/**
   * Find Open Editor for the currently selected ModelExtensionDefinition
   *
   * @param selectedMedFile the mxd file to check
   * @return the currently open editor or <code>null</code> if none open
   */
  private static IEditorPart getOpenEditor(IFile selectedMedFile) {
    final IWorkbenchWindow window = Activator.getDefault().getCurrentWorkbenchWindow();

    if (window != null) {
      final IWorkbenchPage page = window.getActivePage();

      if (page != null) {
        // look through the open editors and see if there is one available for this model file.
        IEditorReference[] editors = page.getEditorReferences();

        for (int i = 0; i < editors.length; ++i) {
          IEditorPart editor = editors[i].getEditor(false);

          if (editor != null) {
            IEditorInput input = editor.getEditorInput();

            if (input instanceof IFileEditorInput) {
              if ((selectedMedFile != null)
                  && selectedMedFile.equals(((IFileEditorInput) input).getFile())) {
                return editor;
              }
            }
          }
        }
      }
    }

    return null;
  }
 private static Shell getShell() {
   return Activator.getDefault().getCurrentWorkbenchWindow().getShell();
 }