myModel.addPropertyChangeListener(EOModel.STORED_PROCEDURES, myStoredProceduresChangeListener);
  public void init(IEditorSite _site, IEditorInput _editorInput) throws PartInitException {    try {      IWorkbench workbench = Activator.getDefault().getWorkbench();      IWorkbenchPage workbenchPage = workbench.getActiveWorkbenchWindow().getActivePage();      int result = switchMode;      if (workbenchPage != null && !EOModelerPerspectiveFactory.EOMODELER_PERSPECTIVE_ID.equals(workbenchPage.getPerspective().getId()) && result < 2) {        // FIXME AK: this sucks, as we only keep this pref for the session, but I'm totally tired of this dialog        MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), Messages.getString("EOModelEditor.switchPerspectivesTitle"), null, Messages.getString("EOModelEditor.switchPerspectivesMessage"), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, Messages.getString("EOModelEditor.switchPerspectivesAlways"), Messages.getString("EOModelEditor.switchPerspectivesNever") }, 0); // yes is the default        result = dialog.open();        if (result > 1) {          switchMode = result;        }      }      if (result == 0 || result == 2) {        workbench.showPerspective(EOModelerPerspectiveFactory.EOMODELER_PERSPECTIVE_ID, workbench.getActiveWorkbenchWindow());      }    }    catch (WorkbenchException e) {      e.printStackTrace();    }    try {      IFileEditorInput fileEditorInput;      if (_editorInput instanceof IFileEditorInput) {        fileEditorInput = (IFileEditorInput) _editorInput;      }      else {        throw new PartInitException("Unknown editor input: " + _editorInput + ".");      }      if (myModel != null) {        myModel.removePropertyChangeListener(EOModel.DIRTY, myDirtyModelListener);        myModel.removePropertyChangeListener(EOModel.ENTITIES, myEntitiesChangeListener);      }      IFile file = fileEditorInput.getFile();      String openingEntityName = null;      if ("plist".equalsIgnoreCase(file.getFileExtension())) {        String name = file.getName();        openingEntityName = name.substring(0, name.indexOf('.'));        fileEditorInput = new FileEditorInput(file.getParent().getFile(new Path("index.eomodeld")));      }      myLoadFailures = new HashSet();      myModel = EclipseEOModelGroupFactory.createModel(fileEditorInput.getFile().getParent(), myLoadFailures);      if (openingEntityName != null) {        myOpeningEntity = myModel.getEntityNamed(openingEntityName);      }      handleModelErrors(myLoadFailures);      myModel.addPropertyChangeListener(EOModel.DIRTY, myDirtyModelListener);      myModel.addPropertyChangeListener(EOModel.ENTITIES, myEntitiesChangeListener);      super.init(_site, fileEditorInput);      updatePartName();      _site.setSelectionProvider(this);    }    catch (Exception e) {      throw new PartInitException("Failed to create EOModelEditorInput for " + _editorInput + ".", e);    }  }