EOModelEditor editor = (EOModelEditor) _editorRef.getEditor(true); if (editor != null) { IFileEditorInput existingEditorInput = (IFileEditorInput) editor.getEditorInput();
IEditorPart editorPart = _editorRef.getEditor(true); if (editorPart instanceof EOModelEditor) { EOModelEditor eomodelEditorPart = (EOModelEditor) editorPart; IFileEditorInput existingEditorInput = (IFileEditorInput) eomodelEditorPart.getEditorInput();
  public boolean matches(IEditorReference _editorRef, IEditorInput _input) {    boolean matches = false;    String editorId = _editorRef.getId();    if (editorId == null) {      matches = false;    }    else if (!editorId.equals(EOModelEditor.EOMODEL_EDITOR_ID)) {      matches = false;    }    else if (_input instanceof IFileEditorInput) {      IFile file = ((IFileEditorInput) _input).getFile();      IContainer container = file.getParent();      if ("eomodeld".equals(container.getFileExtension())) {        EOModelEditor editor = (EOModelEditor) _editorRef.getEditor(true);        if (editor != null) {          IFileEditorInput existingEditorInput = (IFileEditorInput) editor.getEditorInput();          IContainer existingEOModelFolder = existingEditorInput.getFile().getParent();          IFileEditorInput possibleEditorInput = (IFileEditorInput) _input;          IFile possibleEditorFile = possibleEditorInput.getFile();          IContainer possibleEOModelFolder = possibleEditorFile.getParent();          matches = existingEOModelFolder.equals(possibleEOModelFolder);          if ("plist".equals(possibleEditorFile.getFileExtension())) {            String entityName = possibleEditorFile.getName();            entityName = entityName.substring(0, entityName.indexOf('.'));            EOModel eoModel = editor.getModel();            EOEntity entity = eoModel.getEntityNamed(entityName);            editor.setSelectedEntity(entity);          }        }      }    }    return matches;  }