Program: 118140
Project: 118140
Buggy source:
public void okPressed(){
  MultiPageSqlBuilderEditor editor=null;
  CTabFolder folder=getEditorComposite().getTabFolder();
  CTabItem[] a=folder.getItems();
  for (int i=0; i < a.length; i++) {
    CTabItem itm=a[i];
    Object obj=itm.getData("String_Node_Str");
    if (obj instanceof MultiPageSqlBuilderEditor) {
      editor=(MultiPageSqlBuilderEditor)obj;
    }
    if (editor != null) {
      if (itm.getData() instanceof Query) {
        Query q=(Query)itm.getData();
        connParameters.setIfContextButtonCheckedFromBuiltIn(q.isContextMode());
      }
    }
  }
  if (EParameterFieldType.DBTABLE.equals(connParameters.getFieldType())) {
    final IStructuredSelection selection=(IStructuredSelection)structureComposite.getTreeViewer().getSelection();
    final Object firstElement=selection.getFirstElement();
    if (firstElement instanceof RepositoryNode) {
      RepositoryNode node=(RepositoryNode)firstElement;
      boolean is=node.getProperties(EProperties.CONTENT_TYPE).equals(RepositoryNodeType.TABLE);
      if (is) {
        MetadataTableRepositoryObject object=(MetadataTableRepositoryObject)node.getObject();
        connParameters.setSelectDBTable(object.getSourceName());
      }
    }
  }
 else {
    String sql="String_Node_Str";
    sql=editorComposite.getCurrentTabSql();
    connParameters.setQuery(sql);
    if (connParameters.isFromRepository() && !connParameters.isNodeReadOnly()) {
      List<Query> qs=new ArrayList<Query>();
      boolean isInfo=false;
      final CTabFolder tabFolder=getEditorComposite().getTabFolder();
      final CTabItem[] items=tabFolder.getItems();
      for (int i=0; i < items.length; i++) {
        CTabItem item=items[i];
        final String text=item.getText();
        boolean isInfo2=text.length() > 1 && text.substring(0,1).equals("String_Node_Str");
        if (isInfo2) {
          isInfo=true;
        }
      }
      if (isInfo) {
        String title=Messages.getString("String_Node_Str");
        String info=Messages.getString("String_Node_Str");
        boolean openQuestion=MessageDialog.openQuestion(getShell(),title,info);
        if (openQuestion) {
          for (          CTabItem item : items) {
            final String text=item.getText();
            boolean isInfo2=text.length() > 1 && text.substring(0,1).equals("String_Node_Str");
            if (isInfo2) {
              MultiPageSqlBuilderEditor meditor=null;
              Object control=item.getData("String_Node_Str");
              if (control instanceof MultiPageSqlBuilderEditor) {
                meditor=(MultiPageSqlBuilderEditor)control;
              }
              if (meditor != null) {
                RepositoryNode node=null;
                node=meditor.getActivePageRepositoryNode();
                if (text.substring(1).startsWith(AbstractSQLEditorComposite.QUERY_PREFIX)) {
                  if (item.getData() instanceof Query) {
                    Query q=(Query)item.getData();
                    q.setValue(meditor.getActivePageSqlString());
                    q.setContextMode(meditor.getActiveEditors().getContextmode().getContextmodeaction().isChecked());
                    qs.add(q);
                    if (node != null && q != null) {
                      manager.saveQuery(node,q,null);
                    }
                  }
                }
 else {
                  meditor.getActivePageSaveAsSQLAction().run();
                }
              }
            }
          }
        }
      }
      if (connParameters.getQueryObject() != null) {
        RepositoryUpdateManager.updateQuery(connParameters.getQueryObject(),node);
      }
    }
  }
  deleteNoUseTable();
  super.okPressed();
}

Fixed version (ground truth):
@Override public void okPressed(){
  MultiPageSqlBuilderEditor editor=null;
  CTabFolder folder=getEditorComposite().getTabFolder();
  CTabItem[] a=folder.getItems();
  for (  CTabItem itm : a) {
    Object obj=itm.getData("String_Node_Str");
    if (obj instanceof MultiPageSqlBuilderEditor) {
      editor=(MultiPageSqlBuilderEditor)obj;
    }
    if (editor != null) {
      if (itm.getData() instanceof Query) {
        Query q=(Query)itm.getData();
        connParameters.setIfContextButtonCheckedFromBuiltIn(q.isContextMode());
      }
    }
  }
  if (EParameterFieldType.DBTABLE.equals(connParameters.getFieldType())) {
    final IStructuredSelection selection=(IStructuredSelection)structureComposite.getTreeViewer().getSelection();
    final Object firstElement=selection.getFirstElement();
    if (firstElement instanceof RepositoryNode) {
      RepositoryNode node=(RepositoryNode)firstElement;
      boolean is=node.getProperties(EProperties.CONTENT_TYPE).equals(RepositoryNodeType.TABLE);
      if (is) {
        MetadataTableRepositoryObject object=(MetadataTableRepositoryObject)node.getObject();
        connParameters.setSelectDBTable(object.getSourceName());
      }
    }
  }
 else {
    String sql="String_Node_Str";
    sql=editorComposite.getCurrentTabSql();
    connParameters.setQuery(sql);
    if (connParameters.isFromRepository() && !connParameters.isNodeReadOnly()) {
      List<Query> qs=new ArrayList<Query>();
      boolean isInfo=false;
      final CTabFolder tabFolder=getEditorComposite().getTabFolder();
      final CTabItem[] items=tabFolder.getItems();
      for (      CTabItem item : items) {
        final String text=item.getText();
        boolean isInfo2=text.length() > 1 && text.substring(0,1).equals("String_Node_Str");
        if (isInfo2) {
          isInfo=true;
        }
      }
      if (isInfo) {
        String title=Messages.getString("String_Node_Str");
        String info=Messages.getString("String_Node_Str");
        boolean openQuestion=MessageDialog.openQuestion(getShell(),title,info);
        if (openQuestion) {
          for (          CTabItem item : items) {
            final String text=item.getText();
            boolean isInfo2=text.length() > 1 && text.substring(0,1).equals("String_Node_Str");
            if (isInfo2) {
              MultiPageSqlBuilderEditor meditor=null;
              Object control=item.getData("String_Node_Str");
              if (control instanceof MultiPageSqlBuilderEditor) {
                meditor=(MultiPageSqlBuilderEditor)control;
              }
              if (meditor != null) {
                RepositoryNode node=null;
                node=meditor.getActivePageRepositoryNode();
                if (text.substring(1).startsWith(AbstractSQLEditorComposite.QUERY_PREFIX)) {
                  if (item.getData() instanceof Query) {
                    Query q=(Query)item.getData();
                    q.setValue(meditor.getActivePageSqlString());
                    q.setContextMode(meditor.getActiveEditors().getContextmode().getContextmodeaction().isChecked());
                    qs.add(q);
                    if (node != null && q != null) {
                      manager.saveQuery(node,q,null);
                    }
                  }
                }
 else {
                  meditor.getActivePageSaveAsSQLAction().run();
                }
              }
            }
          }
        }
      }
      if (connParameters.getQueryObject() != null) {
        RepositoryUpdateManager.updateQuery(connParameters.getQueryObject(),node);
      }
    }
  }
  deleteNoUseTable();
  super.okPressed();
}