Esempio n. 1
0
  @Override
  public void actionPerformed() {
    if (compilationUnit != null) {
      EditorPartPresenter editorPartPresenter =
          editorAgent.getOpenedEditor(Path.valueOf(compilationUnit.getPath()));
      if (editorPartPresenter != null) {
        editorAgent.activateEditor(editorPartPresenter);
        fileOpened(editorPartPresenter);
        return;
      }

      projectExplorer
          .getNodeByPath(new HasStorablePath.StorablePath(compilationUnit.getPath()))
          .then(selectNode())
          .then(openNode());
    } else if (classFile != null) {
      String className = classFile.getElementName();

      JarEntry jarEntry = dtoFactory.createDto(JarEntry.class);
      jarEntry.setName(className);
      jarEntry.setType(JarEntry.JarEntryType.CLASS_FILE);
      jarEntry.setPath(classFile.getPath());

      JarFileNode jarFileNode =
          javaNodeManager
              .getJavaNodeFactory()
              .newJarFileNode(
                  jarEntry,
                  null,
                  appContext.getCurrentProject().getProjectConfig(),
                  javaNodeManager.getJavaSettingsProvider().getSettings());
      openFile(jarFileNode);
    }
  }