コード例 #1
0
  @Override
  protected IEditorPart getCorrespondingEditor(RepositoryNode node) {
    IEditorReference[] eidtors = getActivePage().getEditorReferences();

    for (IEditorReference eidtor : eidtors) {
      try {
        IEditorInput input = eidtor.getEditorInput();
        if (!(input instanceof JobEditorInput)) {
          continue;
        }

        JobEditorInput repositoryInput = (JobEditorInput) input;
        checkUnLoadedNodeForProcess(repositoryInput);
        if (repositoryInput.getItem().equals(node.getObject().getProperty().getItem())) {

          IPath path = repositoryInput.getFile().getLocation();

          return eidtor.getEditor(false);
        }
      } catch (PartInitException e) {
        continue;
      }
    }
    return null;
  }
コード例 #2
0
  private void checkUnLoadedNodeForProcess(JobEditorInput fileEditorInput) {
    if (fileEditorInput == null || fileEditorInput.getLoadedProcess() == null) {
      return;
    }
    IProcess2 loadedProcess = fileEditorInput.getLoadedProcess();
    List<NodeType> unloadedNode = loadedProcess.getUnloadedNode();
    if (unloadedNode != null && !unloadedNode.isEmpty()) {

      String message = "Some Component are not loaded:\n";
      for (int i = 0; i < unloadedNode.size(); i++) {
        message = message + unloadedNode.get(i).getComponentName() + "\n";
      }
      if (!CommonsPlugin.isHeadless() && PlatformUI.isWorkbenchRunning()) {
        Display display = Display.getCurrent();
        if (display == null) {
          display = Display.getDefault();
        }
        if (display != null) {
          final Display tmpDis = display;
          final String tmpMess = message;
          display.syncExec(
              new Runnable() {

                @Override
                public void run() {
                  Shell shell = null;
                  final IWorkbenchWindow activeWorkbenchWindow =
                      PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                  if (activeWorkbenchWindow != null) {
                    shell = activeWorkbenchWindow.getShell();
                  } else {
                    if (tmpDis != null) {
                      shell = tmpDis.getActiveShell();
                    } else {
                      shell = new Shell();
                    }
                  }
                  MessageDialog.openWarning(shell, "Warning", tmpMess);
                }
              });
        }
      }
    }
  }