@Override public boolean matches(IEditorReference editorRef, IEditorInput input) { IQ7Element inputElement = getElement(input); if (inputElement != null && editorRef.getId().startsWith("org.eclipse.rcptt.ui.editors")) { IWorkbenchPart part = editorRef.getPart(false); if (part instanceof EclEditor) { IQ7NamedElement model = ((EclEditor) part).getModel(); if (model != null) { return inputElement.equals(model); } } else if (part instanceof NamedElementEditor) { IQ7NamedElement model = ((NamedElementEditor) part).getModel(); if (model != null) { return inputElement.equals(model); } } // try figure out using ref editor input IEditorInput editRefInput; try { editRefInput = editorRef.getEditorInput(); if (editRefInput != null) { IQ7Element refElement = getElement(editRefInput); return inputElement.equals(refElement); } } catch (PartInitException e) { RcpttPlugin.log(e.getMessage(), e); } } return false; }
private String calculateDependenciesHash(IQ7NamedElement element) { StringBuilder bb = new StringBuilder(); for (IContext context : getReferencedContexts(element)) { try { bb.append("_").append(context.getID()); } catch (ModelException e) { RcpttPlugin.log(e); } } if (element != null && element.isWorkingCopy() && element instanceof ITestCase) { String[] ctxs; try { ctxs = ((ITestCase) element).getContexts(); if (ctxs != null) { for (String ctx : ctxs) { bb.append("_").append(ctx); } } } catch (ModelException e) { RcpttPlugin.log(e); } } return bb.toString(); }