Program: 24473
Project: 24473
Buggy source:
private void setUpEditorViews(IModel canvas){
  this.selectionRecord=new SelectionRecord(viewModel);
  this.feedbackModel=new FeedbackModel(selectionRecord);
  this.shapePane=new ShapePane();
  this.shapePane.addLayer(new DomainModelLayer(viewModel));
  this.shapePane.addLayer(new SelectionLayer(selectionRecord));
  this.shapePane.addLayer(new FeedbackLayer(feedbackModel));
  Envelope canvasBounds=this.viewModel.getCanvasBounds();
  this.shapePane.setPaneBounds(canvasBounds);
  scrollPane=new JScrollPane((ShapePane)this.shapePane,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.getVerticalScrollBar().setUnitIncrement(16);
  scrollPane.setFocusable(true);
  scrollPane.setWheelScrollingEnabled(true);
  this.editBehaviourController=new MouseBehaviourController(shapePane,new OperationFactory(this.shapePane,this.feedbackModel,this.selectionRecord,viewModel,this.commandStack));
  INotationSubsystem notationSubsystem=canvas.getNotationSubsystem();
  this.palettePane=new PalettePanel(notationSubsystem,editBehaviourController);
  this.add(palettePane,BorderLayout.LINE_START);
  this.add(scrollPane,BorderLayout.CENTER);
  this.selectionChangeListener=new ISelectionChangeListener(){
    @Override public void selectionChanged(    ISelectionChangeEvent event){
      EnvelopeBuilder builder=null;
      Iterator<ISelection> oldIter=event.oldSelectionIter();
      while (oldIter.hasNext()) {
        ISelection seln=oldIter.next();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + seln.getPrimitiveController().getDrawnBounds());
        }
        Envelope bounds=seln.getPrimitiveController().getDrawnBounds();
        if (builder == null) {
          builder=new EnvelopeBuilder(bounds);
        }
 else {
          builder.union(bounds);
        }
      }
      if (builder != null) {
        builder.expand(REFRESH_EXPANSION_X,REFRESH_EXPANSION_Y);
        Envelope refreshBounds=builder.getEnvelope();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + refreshBounds);
        }
        shapePane.updateView(refreshBounds);
      }
 else {
        logger.debug("String_Node_Str");
      }
      builder=null;
      Iterator<ISelection> newIter=event.newSelectionIter();
      while (newIter.hasNext()) {
        ISelection seln=newIter.next();
        Envelope bounds=seln.getPrimitiveController().getDrawnBounds();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + seln.getPrimitiveController().getDrawnBounds());
        }
        if (builder == null) {
          builder=new EnvelopeBuilder(bounds);
        }
 else {
          builder.union(bounds);
        }
      }
      if (builder != null) {
        builder.expand(REFRESH_EXPANSION_X,REFRESH_EXPANSION_Y);
        Envelope refreshBounds=builder.getEnvelope();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + refreshBounds);
        }
        shapePane.updateView(refreshBounds);
      }
 else {
        logger.debug("String_Node_Str");
      }
    }
  }
;
  this.revalidate();
  this.initialise();
}

Fixed version (ground truth):
private void setUpEditorViews(IModel canvas){
  this.selectionRecord=new SelectionRecord(viewModel);
  this.feedbackModel=new FeedbackModel(selectionRecord);
  this.shapePane=new ShapePane();
  this.shapePane.addLayer(new DomainModelLayer(viewModel));
  this.shapePane.addLayer(new SelectionLayer(selectionRecord));
  this.shapePane.addLayer(new FeedbackLayer(feedbackModel));
  Envelope canvasBounds=this.viewModel.getCanvasBounds();
  this.shapePane.setPaneBounds(canvasBounds);
  scrollPane=new JScrollPane((ShapePane)this.shapePane,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.getVerticalScrollBar().setUnitIncrement(16);
  scrollPane.setFocusable(true);
  scrollPane.setWheelScrollingEnabled(true);
  this.editBehaviourController=new ViewBehaviourController(shapePane,new OperationFactory(this.shapePane,this.feedbackModel,this.selectionRecord,viewModel,this.commandStack));
  INotationSubsystem notationSubsystem=canvas.getNotationSubsystem();
  this.palettePane=new PalettePanel(notationSubsystem,editBehaviourController);
  this.add(palettePane,BorderLayout.LINE_START);
  this.add(scrollPane,BorderLayout.CENTER);
  this.selectionChangeListener=new ISelectionChangeListener(){
    @Override public void selectionChanged(    ISelectionChangeEvent event){
      EnvelopeBuilder builder=null;
      Iterator<ISelection> oldIter=event.oldSelectionIter();
      while (oldIter.hasNext()) {
        ISelection seln=oldIter.next();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + seln.getPrimitiveController().getDrawnBounds());
        }
        Envelope bounds=seln.getPrimitiveController().getDrawnBounds();
        if (builder == null) {
          builder=new EnvelopeBuilder(bounds);
        }
 else {
          builder.union(bounds);
        }
      }
      if (builder != null) {
        builder.expand(REFRESH_EXPANSION_X,REFRESH_EXPANSION_Y);
        Envelope refreshBounds=builder.getEnvelope();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + refreshBounds);
        }
        shapePane.updateView(refreshBounds);
      }
 else {
        logger.debug("String_Node_Str");
      }
      builder=null;
      Iterator<ISelection> newIter=event.newSelectionIter();
      while (newIter.hasNext()) {
        ISelection seln=newIter.next();
        Envelope bounds=seln.getPrimitiveController().getDrawnBounds();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + seln.getPrimitiveController().getDrawnBounds());
        }
        if (builder == null) {
          builder=new EnvelopeBuilder(bounds);
        }
 else {
          builder.union(bounds);
        }
      }
      if (builder != null) {
        builder.expand(REFRESH_EXPANSION_X,REFRESH_EXPANSION_Y);
        Envelope refreshBounds=builder.getEnvelope();
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + refreshBounds);
        }
        shapePane.updateView(refreshBounds);
      }
 else {
        logger.debug("String_Node_Str");
      }
    }
  }
;
  this.revalidate();
  this.initialise();
}