當前位置: 首頁>>代碼示例>>Java>>正文


Java EditorPartPresenter類代碼示例

本文整理匯總了Java中org.eclipse.che.ide.api.editor.EditorPartPresenter的典型用法代碼示例。如果您正苦於以下問題:Java EditorPartPresenter類的具體用法?Java EditorPartPresenter怎麽用?Java EditorPartPresenter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EditorPartPresenter類屬於org.eclipse.che.ide.api.editor包,在下文中一共展示了EditorPartPresenter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PartStackPresenter

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
@Inject
public PartStackPresenter(
    final EventBus eventBus,
    final PartMenu partMenu,
    PartStackEventHandler partStackEventHandler,
    TabItemFactory tabItemFactory,
    PartsComparator partsComparator,
    @Assisted final PartStackView view,
    @Assisted @NotNull WorkBenchPartController workBenchPartController) {
  this.view = view;
  this.view.setDelegate(this);

  this.eventBus = eventBus;
  this.partMenu = partMenu;
  this.partStackHandler = partStackEventHandler;
  this.workBenchPartController = workBenchPartController;
  this.tabItemFactory = tabItemFactory;
  this.partsComparator = partsComparator;

  this.parts = new HashMap<>();
  this.constraints = new LinkedHashMap<>();

  this.propertyListener =
      new PropertyListener() {
        @Override
        public void propertyChanged(PartPresenter source, int propId) {
          if (PartPresenter.TITLE_PROPERTY == propId) {
            updatePartTab(source);
          } else if (EditorPartPresenter.PROP_DIRTY == propId) {
            eventBus.fireEvent(new EditorDirtyStateChangedEvent((EditorPartPresenter) source));
          }
        }
      };

  if (workBenchPartController != null) {
    this.workBenchPartController.setSize(DEFAULT_PART_SIZE);
  }

  currentSize = DEFAULT_PART_SIZE;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:41,代碼來源:PartStackPresenter.java

示例2: trackEditor

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
/**
 * Begins to track given editor to sync its content with opened files with the same {@link Path}.
 *
 * @param editor editor to sync content
 */
@Override
public void trackEditor(EditorPartPresenter editor) {
  Path path = editor.getEditorInput().getFile().getLocation();
  if (editorGroups.containsKey(path)) {
    editorGroups.get(path).addEditor(editor);
  } else {
    EditorGroupSynchronization group = editorGroupSyncProvider.get();
    editorGroups.put(path, group);
    group.addEditor(editor);
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:EditorContentSynchronizerImpl.java

示例3: isResourceOpened

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
private boolean isResourceOpened(final Resource resource) {
  if (!resource.isFile()) {
    return false;
  }

  File file = (File) resource;

  for (EditorPartPresenter editor : editorAgent.getOpenedEditors()) {
    Path editorPath = editor.getEditorInput().getFile().getLocation();
    if (editorPath.equals(file.getLocation())) {
      return true;
    }
  }

  return false;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:ResourceManager.java

示例4: updateInPerspective

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
  EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
  if (Objects.nonNull(activeEditor) && activeEditor instanceof TextEditor) {
    TextEditorConfiguration configuration = ((TextEditor) activeEditor).getConfiguration();
    if (configuration instanceof LanguageServerEditorConfiguration) {
      ServerCapabilities capabilities =
          ((LanguageServerEditorConfiguration) configuration).getServerCapabilities();
      event
          .getPresentation()
          .setEnabledAndVisible(
              capabilities.getDocumentSymbolProvider() != null
                  && capabilities.getDocumentSymbolProvider());
      return;
    }
  }
  event.getPresentation().setEnabledAndVisible(false);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:19,代碼來源:GoToSymbolAction.java

示例5: setCursorAndActivateEditor

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
private void setCursorAndActivateEditor(final EditorPartPresenter editor, final int offset) {

    /*
    For some undefined reason we need to wrap cursor and focus setting into timer with 1ms.
    When editors are switching, they don't have enough time to redraw and set focus. Need
    to investigate this problem more deeply. But at this moment this trick works as well.
    */

    new DelayedTask() {
      @Override
      public void onExecute() {
        if (editor instanceof TextEditor) {
          ((TextEditor) editor)
              .getDocument()
              .setSelectedRange(LinearRange.createWithStart(offset).andLength(0), true);
          editor.activate(); // force set focus to the editor
        }
      }
    }.delay(1);
  }
 
開發者ID:eclipse,項目名稱:che,代碼行數:21,代碼來源:OpenDeclarationFinder.java

示例6: changeBreakpointState

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
@Override
public void changeBreakpointState(final int lineNumber) {
  EditorPartPresenter editor = editorAgent.getActiveEditor();
  if (editor == null) {
    return;
  }

  final VirtualFile activeFile = editor.getEditorInput().getFile();
  Optional<Breakpoint> existedBreakpoint =
      breakpointStorage.get(activeFile.getLocation().toString(), lineNumber + 1);

  if (existedBreakpoint.isPresent()) {
    delete(existedBreakpoint.get());
  } else {
    if (activeFile instanceof HasLocation) {
      addBreakpoint(
          activeFile, new BreakpointImpl(((HasLocation) activeFile).toLocation(lineNumber + 1)));
    } else {
      LOG.warning("Impossible to figure debug location for: " + activeFile.getLocation());
      return;
    }
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:24,代碼來源:BreakpointManagerImpl.java

示例7: onOpenEditor

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
/** The new file has been opened in the editor. Method reads breakpoints. */
private void onOpenEditor(String filePath, EditorPartPresenter editor) {
  final BreakpointRenderer renderer = getBreakpointRendererForEditor(editor);
  if (renderer != null) {
    breakpointStorage
        .getByPath(filePath)
        .forEach(
            breakpoint ->
                renderer.setBreakpointMark(
                    breakpoint,
                    activeBreakpoints.contains(breakpoint),
                    BreakpointManagerImpl.this::onLineChange));

    if (suspendedLocation != null && suspendedLocation.getTarget().equals(filePath)) {
      renderer.setLineActive(suspendedLocation.getLineNumber() - 1, true);
    }
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:19,代碼來源:BreakpointManagerImpl.java

示例8: restore

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
private List<Promise<Void>> restore(
    JsonObject files,
    EditorPartStack editorPartStack,
    Map<EditorPartPresenter, EditorPartStack> activeEditors) {

  if (files.hasKey("FILES")) {
    // plain
    JsonArray filesArray = files.getArray("FILES");
    List<Promise<Void>> promises = new ArrayList<>();
    for (int i = 0; i < filesArray.length(); i++) {
      JsonObject file = filesArray.getObject(i);
      Promise<Void> openFile = openFile(file, editorPartStack, activeEditors);
      promises.add(openFile);
    }
    return promises;
  } else {
    // split
    return restoreSplit(files, editorPartStack, activeEditors);
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:21,代碼來源:EditorAgentImpl.java

示例9: updateInPerspective

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
  EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
  if (activeEditor instanceof TextEditor) {
    TextEditorConfiguration configuration = ((TextEditor) activeEditor).getConfiguration();
    if (configuration instanceof LanguageServerEditorConfiguration) {
      ServerCapabilities capabilities =
          ((LanguageServerEditorConfiguration) configuration).getServerCapabilities();
      event
          .getPresentation()
          .setEnabledAndVisible(
              capabilities.getReferencesProvider() != null
                  && capabilities.getReferencesProvider());
      return;
    }
  }
  event.getPresentation().setEnabledAndVisible(false);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:19,代碼來源:FindReferencesAction.java

示例10: storeEditors

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
private JsonArray storeEditors(EditorPartStack partStack) {
  JsonArray result = Json.createArray();
  int i = 0;
  List<EditorPartPresenter> parts = partStack.getParts();
  for (EditorPartPresenter part : parts) {
    JsonObject file = Json.createObject();
    file.put("PATH", part.getEditorInput().getFile().getLocation().toString());
    file.put("EDITOR_PROVIDER", openedEditorsToProviders.get(part));
    if (part instanceof TextEditor) {
      file.put("CURSOR_OFFSET", ((TextEditor) part).getCursorOffset());
      file.put("TOP_VISIBLE_LINE", ((TextEditor) part).getTopVisibleLine());
    }
    if (partStack.getActivePart().equals(part)) {
      file.put("ACTIVE", true);
    }
    result.set(i++, file);
  }
  return result;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:20,代碼來源:EditorAgentImpl.java

示例11: EditorTabContextMenu

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
@Inject
public EditorTabContextMenu(
    @Assisted EditorTab editorTab,
    @Assisted EditorPartPresenter editorPart,
    @Assisted EditorPartStack editorPartStack,
    ActionManager actionManager,
    KeyBindingAgent keyBindingAgent,
    Provider<PerspectiveManager> managerProvider) {
  super(actionManager, keyBindingAgent, managerProvider);

  this.editorTab = editorTab;
  this.editorPart = editorPart;
  this.editorPartStack = editorPartStack;
  this.actionManager = actionManager;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:16,代碼來源:EditorTabContextMenu.java

示例12: updateListClosedParts

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
private void updateListClosedParts(VirtualFile file) {
  if (closedParts.isEmpty()) {
    return;
  }

  for (EditorPartPresenter closedEditorPart : closedParts) {
    Path path = closedEditorPart.getEditorInput().getFile().getLocation();
    if (path.equals(file.getLocation())) {
      closedParts.remove(closedEditorPart);
      return;
    }
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:14,代碼來源:EditorPartStackPresenter.java

示例13: editorOpened

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
public void editorOpened(final EditorPartPresenter editor) {
  final PropertyListener propertyListener =
      new PropertyListener() {
        @Override
        public void propertyChanged(PartPresenter source, int propId) {
          if (propId == EditorPartPresenter.PROP_DIRTY) {
            if (!editor.isDirty()) {
              reparseAllOpenedFiles();
              // remove just saved editor
              editor2reconcile.remove(editor);
            }
          }
        }
      };
  editor.addPropertyListener(propertyListener);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:FileWatcher.java

示例14: actionPerformed

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
  ContributePartPresenter contributePartPresenter = contributePartPresenterProvider.get();
  PartPresenter activePart = workspaceAgent.getActivePart();
  if (activePart != null && activePart instanceof ContributePartPresenter) {
    workspaceAgent.hidePart(contributePartPresenter);

    EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
    if (activeEditor != null) {
      workspaceAgent.setActivePart(activeEditor);
    }
    return;
  }

  workspaceAgent.openPart(contributePartPresenter, TOOLING);
  workspaceAgent.setActivePart(contributePartPresenter);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:18,代碼來源:ContributePartDisplayingModeAction.java

示例15: actionPerformed

import org.eclipse.che.ide.api.editor.EditorPartPresenter; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
  Debugger debugger = debuggerManager.getActiveDebugger();
  if (debugger != null) {
    EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
    if (activeEditor instanceof TextEditor) {
      int lineNumber = ((TextEditor) activeEditor).getCursorPosition().getLine() + 1;

      VirtualFile file = activeEditor.getEditorInput().getFile();
      if (file instanceof HasLocation) {
        Location location = ((HasLocation) file).toLocation(lineNumber);
        debugger.runToLocation(location);
      }
    }
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:RunToCursorAction.java


注:本文中的org.eclipse.che.ide.api.editor.EditorPartPresenter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。