Program: 148369
Project: 148369
Buggy source:
public static void openDataModel(TreeObject xobject,boolean markdirty) throws Exception {
  IFile pathToTempFile=XSDEditorUtil.createFile(xobject);
  final XSDEditorInput input=new XSDEditorInput(pathToTempFile);
  final IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IEditorDescriptor desc=PlatformUI.getWorkbench().getEditorRegistry().findEditor("String_Node_Str");
  if (activePage.findEditor(input) != null) {
    activePage.openEditor(input,desc.getId());
    return;
  }
  final XSDEditor part=(XSDEditor)activePage.openEditor(input,desc.getId());
  IEditorInput xobjectEditorinput=new XObjectEditorInput(xobject,xobject.getDisplayName());
  final DataModelMainPage dMainPage=new DataModelMainPage(xobject);
  part.addPage(0,dMainPage,xobjectEditorinput);
  part.getSite().setSelectionProvider(dMainPage.getSelectionProvider());
  XSDSelectionListener xsdListener=new XSDSelectionListener(part,dMainPage.getXSDSchema());
  dMainPage.getTypesViewer().addSelectionChangedListener(xsdListener);
  dMainPage.getElementsViewer().addSelectionChangedListener(xsdListener);
  part.setXSDInput(xobjectEditorinput);
  part.setXObject(xobject);
  part.setActiveEditor(dMainPage);
  CTabFolder folder=(CTabFolder)dMainPage.getMainControl().getParent();
  folder.getItem(0).setText(xobject.getDisplayName() + "String_Node_Str" + Util.getRevision(xobject));
  folder.getItem(1).setText("String_Node_Str");
  folder.getItem(2).setText("String_Node_Str");
  if (markdirty)   dMainPage.markDirty();
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(MDMPerspective.VIEWID_PROPERTYVIEW);
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(MDMPerspective.VIEWID_OUTLINE);
}

Fixed version (ground truth):
public static void openDataModel(TreeObject xobject,boolean markdirty) throws Exception {
  IFile pathToTempFile=XSDEditorUtil.createFile(xobject);
  final XSDEditorInput input=new XSDEditorInput(pathToTempFile);
  final IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IEditorDescriptor desc=PlatformUI.getWorkbench().getEditorRegistry().findEditor("String_Node_Str");
  if (activePage.findEditor(input) != null) {
    activePage.openEditor(input,desc.getId());
    return;
  }
  final XSDEditor part=(XSDEditor)activePage.openEditor(input,desc.getId());
  IEditorInput xobjectEditorinput=new XObjectEditorInput(xobject,xobject.getDisplayName());
  final DataModelMainPage dMainPage=new DataModelMainPage(xobject);
  part.addPage(dMainPage,xobjectEditorinput);
  part.getSite().setSelectionProvider(dMainPage.getSelectionProvider());
  XSDSelectionListener xsdListener=new XSDSelectionListener(part,dMainPage.getXSDSchema());
  dMainPage.getTypesViewer().addSelectionChangedListener(xsdListener);
  dMainPage.getElementsViewer().addSelectionChangedListener(xsdListener);
  part.setXSDInput(xobjectEditorinput);
  part.setXObject(xobject);
  part.setActiveEditor(dMainPage);
  CTabFolder folder=(CTabFolder)dMainPage.getMainControl().getParent();
  folder.getItem(2).setText(xobject.getDisplayName() + "String_Node_Str" + Util.getRevision(xobject));
  folder.getItem(0).setText("String_Node_Str");
  folder.getItem(1).setText("String_Node_Str");
  if (markdirty)   dMainPage.markDirty();
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(MDMPerspective.VIEWID_PROPERTYVIEW);
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(MDMPerspective.VIEWID_OUTLINE);
}