/** * Tests if a CU is currently shown in an editor * * @return the IEditorPart if shown, null if element is not open in an editor */ public static IEditorPart isOpenInEditor(final Object inputElement) { final Collection<IEditorPart> allErlangEditors = EditorUtility.getAllErlangEditors(); for (final IEditorPart editorPart : allErlangEditors) { if (inputElement instanceof IErlElement) { final IErlElement element = (IErlElement) inputElement; final IErlModule module = ErlangEngine.getInstance().getModelUtilService().getModule(element); final AbstractErlangEditor editor = (AbstractErlangEditor) editorPart; if (module.equals(editor.getModule())) { return editorPart; } } } final IEditorInput input = getEditorInput(inputElement); if (input != null) { for (final IEditorPart editorPart : allErlangEditors) { if (editorPart.getEditorInput().equals(input)) { return editorPart; } } } return null; }