Program: 122584
Project: 122584
Buggy source:
/** 
 * DOC amaumont Comment method "createExpressionFilter".
 * @param defaultValue TODO
 */
protected void createExpressionFilter(final String defaultText){
  if (mapperManager.isAdvancedMap() && getDataMapTable() instanceof AbstractInOutTable) {
    final AbstractInOutTable table=(AbstractInOutTable)getDataMapTable();
    IPreferenceStore preferenceStore=CorePlugin.getDefault().getPreferenceStore();
    expressionFilterText=new UnnotifiableColorStyledText(getCenterComposite(),SWT.BORDER | SWT.V_SCROLL,preferenceStore,LanguageManager.getCurrentLanguage().getName());
    openExpressionBuilder=new Button(getCenterComposite(),SWT.PUSH);
    openExpressionBuilder.setImage(ImageProvider.getImage(EImage.THREE_DOTS_ICON));
    openExpressionBuilder.setVisible(table.isActivateExpressionFilter());
    openExpressionBuilder.addSelectionListener(new SelectionListener(){
      IService expressionBuilderDialogService=GlobalServiceRegister.getDefault().getService(IExpressionBuilderDialogService.class);
      IExpressionBuilderDialogController dialogForTable=((IExpressionBuilderDialogService)expressionBuilderDialogService).getExpressionBuilderInstance(DataMapTableView.this.getCenterComposite(),null,mapperManager.getAbstractMapComponent());
      public void widgetDefaultSelected(      SelectionEvent e){
      }
      public void widgetSelected(      SelectionEvent e){
        if (dialogForTable instanceof TrayDialog) {
          TrayDialog parentDialog=(TrayDialog)dialogForTable;
          dialogForTable.setDefaultExpression(expressionFilterText.getText());
          if (Window.OK == parentDialog.open()) {
            String expressionForTable=dialogForTable.getExpressionForTable();
            ControlUtils.setText(expressionFilterText,expressionForTable);
            if (isFilterEqualsToDefault(expressionForTable)) {
              table.getExpressionFilter().setExpression(null);
            }
 else {
              table.getExpressionFilter().setExpression(expressionForTable);
            }
            checkProblemsForExpressionFilter(false,true);
            ITableEntry currentExpressionFilterEntry=null;
            StyledTextHandler textTarget=mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler();
            if (textTarget.getCurrentEntry() != null) {
              currentExpressionFilterEntry=textTarget.getCurrentEntry();
            }
 else {
              currentExpressionFilterEntry=table.getExpressionFilter();
            }
            mapperManager.getUiManager().parseNewExpression(textTarget.getStyledText().getText(),currentExpressionFilterEntry,false);
          }
        }
      }
    }
);
    GridData gridData1=new GridData();
    gridData1.exclude=!table.isActivateExpressionFilter();
    openExpressionBuilder.setLayoutData(gridData1);
    GridData gridData=new GridData(GridData.FILL_HORIZONTAL);
    gridData.minimumHeight=10;
    gridData.heightHint=32;
    gridData.minimumWidth=25;
    gridData.widthHint=50;
    expressionFilterText.setLayoutData(gridData);
    String expressionFilter=table.getExpressionFilter().getExpression();
    if (expressionFilter != null && !"String_Node_Str".equals(expressionFilter.trim())) {
      expressionFilterText.setText(expressionFilter);
    }
 else {
      expressionFilterText.setText(defaultText);
    }
    new DragNDrop(mapperManager,expressionFilterText,false,true);
    expressionFilterText.setVisible(table.isActivateExpressionFilter());
    gridData.exclude=!table.isActivateExpressionFilter();
    expressionFilterText.addFocusListener(new FocusListener(){
      public void focusGained(      FocusEvent e){
        redrawExpressionFilter();
        Control text=(Control)e.getSource();
        if (defaultText.equals(ControlUtils.getText(text))) {
          ControlUtils.setText(text,"String_Node_Str");
        }
        ExpressionFilterEntry currentExpressionFilterEntry=table.getExpressionFilter();
        mapperManager.getUiManager().selectLinks(DataMapTableView.this,Arrays.<ITableEntry>asList(currentExpressionFilterEntry),true,false);
        expressionFilterText.setBackground(null);
        expressionFilterText.setForeground(null);
        StyledTextHandler styledTextHandler=mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler();
        styledTextHandler.setCurrentEntry(currentExpressionFilterEntry);
        previousTextForExpressionFilter=currentExpressionFilterEntry.getExpression() == null ? "String_Node_Str" : currentExpressionFilterEntry.getExpression();
        styledTextHandler.getStyledText().setText(previousTextForExpressionFilter);
        expressionFilterText.setToolTipText(null);
        styledTextHandler.getStyledText().setEnabled(true);
        styledTextHandler.getStyledText().setEditable(true);
        expressionProposalStyledText=styledTextHandler.getContentProposalAdapter();
        expressionProposalProviderForExpressionFilter.init(table,getValidZonesForExpressionFilterField(),table.getExpressionFilter());
        if (expressionProposalStyledText != null) {
          expressionProposalStyledText.setContentProposalProvider(expressionProposalProviderForExpressionFilter);
        }
        mapperManager.getUiManager().selectLinks(DataMapTableView.this,Arrays.<ITableEntry>asList(currentExpressionFilterEntry),true,false);
        colorExpressionFilterFromProblems(table,false);
      }
      public void focusLost(      FocusEvent e){
        Control text=(Control)e.getSource();
        if ("String_Node_Str".equals(ControlUtils.getText(text).trim())) {
          ControlUtils.setText(text,defaultText);
        }
        setExpressionFilterFromStyledText(table,text);
        checkProblemsForExpressionFilter(false,true);
      }
    }
);
    Listener showTooltipErrorListener=new Listener(){
      public void handleEvent(      Event event){
switch (event.type) {
case SWT.MouseMove:
          if (table.getExpressionFilter().getProblems() != null && !expressionFilterText.isFocusControl()) {
            String tooltip=createErrorContentForTooltip(table.getExpressionFilter().getProblems());
            expressionFilterText.setToolTipText(tooltip);
          }
 else {
            expressionFilterText.setToolTipText(null);
          }
        break;
default :
    }
  }
}
;
expressionFilterText.addListener(SWT.MouseMove,showTooltipErrorListener);
if (executionLimiterForExpressionFilterSetText == null) {
  executionLimiterForExpressionFilterSetText=new ExecutionLimiterImproved(50,true){
    @Override public void execute(    boolean isFinalExecution,    Object data){
      if (isFinalExecution) {
        expressionFilterText.getDisplay().syncExec(new Runnable(){
          public void run(){
            if (expressionFilterText.isDisposed()) {
              return;
            }
            if (expressionFilterText.getText() != null) {
              expressionFilterText.setText(expressionFilterText.getText());
            }
          }
        }
);
      }
    }
  }
;
}
expressionFilterText.addControlListener(new ControlListener(){
  public void controlMoved(  ControlEvent e){
    redrawExpressionFilter();
  }
  public void controlResized(  ControlEvent e){
    redrawExpressionFilter();
  }
}
);
ControlListener listenerForCorrectWrapBug=new ControlListener(){
  public void controlMoved(  ControlEvent e){
    redrawExpressionFilter();
  }
  public void controlResized(  ControlEvent e){
    correctAsynchStyledTextWrapBug();
  }
}
;
ScrolledComposite scrolledCompositeView=null;
if (getZone() == Zone.INPUTS) {
  scrolledCompositeView=getMapperManager().getUiManager().getScrolledCompositeViewInputs();
}
 else if (getZone() == Zone.OUTPUTS) {
  scrolledCompositeView=getMapperManager().getUiManager().getScrolledCompositeViewOutputs();
}
scrolledCompositeView.addControlListener(listenerForCorrectWrapBug);
SelectionListener selectionListenerToCorrectWrapBug=new SelectionListener(){
  public void widgetDefaultSelected(  SelectionEvent e){
  }
  public void widgetSelected(  SelectionEvent e){
    redrawExpressionFilter();
  }
}
;
scrolledCompositeView.getVerticalBar().addSelectionListener(selectionListenerToCorrectWrapBug);
expressionFilterText.getVerticalBar().addSelectionListener(selectionListenerToCorrectWrapBug);
ExpressionEditorToMapperStyledTextKeyListener keyAndModifyListener=new ExpressionEditorToMapperStyledTextKeyListener(expressionFilterText,mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler());
expressionFilterText.addExtendedModifyListener(keyAndModifyListener);
expressionFilterText.addKeyListener(keyAndModifyListener);
}
}

Fixed version (ground truth):
/** 
 * DOC amaumont Comment method "createExpressionFilter".
 * @param defaultValue TODO
 */
protected void createExpressionFilter(final String defaultText){
  if (mapperManager.isAdvancedMap() && getDataMapTable() instanceof AbstractInOutTable) {
    final AbstractInOutTable table=(AbstractInOutTable)getDataMapTable();
    IPreferenceStore preferenceStore=CorePlugin.getDefault().getPreferenceStore();
    expressionFilterText=new UnnotifiableColorStyledText(getCenterComposite(),SWT.BORDER | SWT.V_SCROLL,preferenceStore,LanguageManager.getCurrentLanguage().getName());
    openExpressionBuilder=new Button(getCenterComposite(),SWT.PUSH);
    openExpressionBuilder.setImage(ImageProvider.getImage(EImage.THREE_DOTS_ICON));
    openExpressionBuilder.setVisible(table.isActivateExpressionFilter());
    openExpressionBuilder.addSelectionListener(new SelectionListener(){
      IService expressionBuilderDialogService=GlobalServiceRegister.getDefault().getService(IExpressionBuilderDialogService.class);
      IExpressionBuilderDialogController dialogForTable=((IExpressionBuilderDialogService)expressionBuilderDialogService).getExpressionBuilderInstance(DataMapTableView.this.getCenterComposite(),null,mapperManager.getAbstractMapComponent());
      public void widgetDefaultSelected(      SelectionEvent e){
      }
      public void widgetSelected(      SelectionEvent e){
        if (dialogForTable instanceof TrayDialog) {
          TrayDialog parentDialog=(TrayDialog)dialogForTable;
          dialogForTable.setDefaultExpression(expressionFilterText.getText());
          if (Window.OK == parentDialog.open()) {
            String expressionForTable=dialogForTable.getExpressionForTable();
            ControlUtils.setText(expressionFilterText,expressionForTable);
            if (isFilterEqualsToDefault(expressionForTable)) {
              table.getExpressionFilter().setExpression(null);
            }
 else {
              table.getExpressionFilter().setExpression(expressionForTable);
            }
            checkProblemsForExpressionFilter(false,true);
            ITableEntry currentExpressionFilterEntry=null;
            StyledTextHandler textTarget=mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler();
            if (textTarget.getCurrentEntry() != null) {
              currentExpressionFilterEntry=textTarget.getCurrentEntry();
            }
 else {
              currentExpressionFilterEntry=table.getExpressionFilter();
            }
            mapperManager.getUiManager().parseNewExpression(textTarget.getStyledText().getText(),currentExpressionFilterEntry,false);
          }
        }
      }
    }
);
    if (mapperManager.componentIsReadOnly()) {
      expressionFilterText.setEditable(false);
      openExpressionBuilder.setEnabled(false);
    }
    GridData gridData1=new GridData();
    gridData1.exclude=!table.isActivateExpressionFilter();
    openExpressionBuilder.setLayoutData(gridData1);
    GridData gridData=new GridData(GridData.FILL_HORIZONTAL);
    gridData.minimumHeight=10;
    gridData.heightHint=32;
    gridData.minimumWidth=25;
    gridData.widthHint=50;
    expressionFilterText.setLayoutData(gridData);
    String expressionFilter=table.getExpressionFilter().getExpression();
    if (expressionFilter != null && !"String_Node_Str".equals(expressionFilter.trim())) {
      expressionFilterText.setText(expressionFilter);
    }
 else {
      expressionFilterText.setText(defaultText);
    }
    new DragNDrop(mapperManager,expressionFilterText,false,true);
    expressionFilterText.setVisible(table.isActivateExpressionFilter());
    gridData.exclude=!table.isActivateExpressionFilter();
    expressionFilterText.addFocusListener(new FocusListener(){
      public void focusGained(      FocusEvent e){
        redrawExpressionFilter();
        Control text=(Control)e.getSource();
        if (defaultText.equals(ControlUtils.getText(text))) {
          ControlUtils.setText(text,"String_Node_Str");
        }
        ExpressionFilterEntry currentExpressionFilterEntry=table.getExpressionFilter();
        mapperManager.getUiManager().selectLinks(DataMapTableView.this,Arrays.<ITableEntry>asList(currentExpressionFilterEntry),true,false);
        expressionFilterText.setBackground(null);
        expressionFilterText.setForeground(null);
        StyledTextHandler styledTextHandler=mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler();
        styledTextHandler.setCurrentEntry(currentExpressionFilterEntry);
        previousTextForExpressionFilter=currentExpressionFilterEntry.getExpression() == null ? "String_Node_Str" : currentExpressionFilterEntry.getExpression();
        styledTextHandler.getStyledText().setText(previousTextForExpressionFilter);
        expressionFilterText.setToolTipText(null);
        styledTextHandler.getStyledText().setEnabled(true);
        styledTextHandler.getStyledText().setEditable(true);
        expressionProposalStyledText=styledTextHandler.getContentProposalAdapter();
        expressionProposalProviderForExpressionFilter.init(table,getValidZonesForExpressionFilterField(),table.getExpressionFilter());
        if (expressionProposalStyledText != null) {
          expressionProposalStyledText.setContentProposalProvider(expressionProposalProviderForExpressionFilter);
        }
        mapperManager.getUiManager().selectLinks(DataMapTableView.this,Arrays.<ITableEntry>asList(currentExpressionFilterEntry),true,false);
        colorExpressionFilterFromProblems(table,false);
      }
      public void focusLost(      FocusEvent e){
        Control text=(Control)e.getSource();
        if ("String_Node_Str".equals(ControlUtils.getText(text).trim())) {
          ControlUtils.setText(text,defaultText);
        }
        setExpressionFilterFromStyledText(table,text);
        checkProblemsForExpressionFilter(false,true);
      }
    }
);
    Listener showTooltipErrorListener=new Listener(){
      public void handleEvent(      Event event){
switch (event.type) {
case SWT.MouseMove:
          if (table.getExpressionFilter().getProblems() != null && !expressionFilterText.isFocusControl()) {
            String tooltip=createErrorContentForTooltip(table.getExpressionFilter().getProblems());
            expressionFilterText.setToolTipText(tooltip);
          }
 else {
            expressionFilterText.setToolTipText(null);
          }
        break;
default :
    }
  }
}
;
expressionFilterText.addListener(SWT.MouseMove,showTooltipErrorListener);
if (executionLimiterForExpressionFilterSetText == null) {
  executionLimiterForExpressionFilterSetText=new ExecutionLimiterImproved(50,true){
    @Override public void execute(    boolean isFinalExecution,    Object data){
      if (isFinalExecution) {
        expressionFilterText.getDisplay().syncExec(new Runnable(){
          public void run(){
            if (expressionFilterText.isDisposed()) {
              return;
            }
            if (expressionFilterText.getText() != null) {
              expressionFilterText.setText(expressionFilterText.getText());
            }
          }
        }
);
      }
    }
  }
;
}
expressionFilterText.addControlListener(new ControlListener(){
  public void controlMoved(  ControlEvent e){
    redrawExpressionFilter();
  }
  public void controlResized(  ControlEvent e){
    redrawExpressionFilter();
  }
}
);
ControlListener listenerForCorrectWrapBug=new ControlListener(){
  public void controlMoved(  ControlEvent e){
    redrawExpressionFilter();
  }
  public void controlResized(  ControlEvent e){
    correctAsynchStyledTextWrapBug();
  }
}
;
ScrolledComposite scrolledCompositeView=null;
if (getZone() == Zone.INPUTS) {
  scrolledCompositeView=getMapperManager().getUiManager().getScrolledCompositeViewInputs();
}
 else if (getZone() == Zone.OUTPUTS) {
  scrolledCompositeView=getMapperManager().getUiManager().getScrolledCompositeViewOutputs();
}
scrolledCompositeView.addControlListener(listenerForCorrectWrapBug);
SelectionListener selectionListenerToCorrectWrapBug=new SelectionListener(){
  public void widgetDefaultSelected(  SelectionEvent e){
  }
  public void widgetSelected(  SelectionEvent e){
    redrawExpressionFilter();
  }
}
;
scrolledCompositeView.getVerticalBar().addSelectionListener(selectionListenerToCorrectWrapBug);
expressionFilterText.getVerticalBar().addSelectionListener(selectionListenerToCorrectWrapBug);
ExpressionEditorToMapperStyledTextKeyListener keyAndModifyListener=new ExpressionEditorToMapperStyledTextKeyListener(expressionFilterText,mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler());
expressionFilterText.addExtendedModifyListener(keyAndModifyListener);
expressionFilterText.addKeyListener(keyAndModifyListener);
}
}