Java Code Examples for com.intellij.ui.PopupHandler#installUnknownPopupHandler()

The following examples show how to use com.intellij.ui.PopupHandler#installUnknownPopupHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommentsTree.java    From Crucible4IDEA with MIT License 6 votes vote down vote up
protected CommentsTree(@NotNull final Project project, @NotNull final Review review, @NotNull DefaultTreeModel model,
                       @Nullable final Editor editor, @Nullable final FilePath filePath) {
  super(model);
  myReview = review;
  setExpandableItemsEnabled(false);
  setRowHeight(0);
  final CommentNodeRenderer renderer = new CommentNodeRenderer(this, review, project);
  setCellRenderer(renderer);
  getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

  final DefaultActionGroup group = new DefaultActionGroup();
  final AddCommentAction replyToComment = new AddCommentAction(review, editor, filePath,
                                                               CrucibleBundle.message("crucible.add.reply"), true);
  replyToComment.setContextComponent(this);
  group.add(replyToComment);
  PopupHandler.installUnknownPopupHandler(this, group, ActionManager.getInstance());
  TreeUtil.expandAll(this);

  new MyLinkMouseListener(renderer, project, review).installOn(this);
}
 
Example 2
Source File: IdeRootPane.java    From consulo with Apache License 2.0 6 votes vote down vote up
private JComponent createToolbar() {
  ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_MAIN_TOOLBAR);
  final ActionToolbar toolBar= myActionManager.createActionToolbar(
          ActionPlaces.MAIN_TOOLBAR,
          group,
          true
  );
  toolBar.setLayoutPolicy(ActionToolbar.WRAP_LAYOUT_POLICY);

  DefaultActionGroup menuGroup = new DefaultActionGroup();
  menuGroup.add(new ViewToolbarAction());
  menuGroup.add(new CustomizeUIAction());
  PopupHandler.installUnknownPopupHandler(toolBar.getComponent(), menuGroup, myActionManager);

  return toolBar.getComponent();
}
 
Example 3
Source File: DiffPanelImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void onContentChangedIn(EditorSource source) {
  myDiffUpdater.contentRemoved(source);
  final EditorEx editor = source.getEditor();
  if (myIsHorizontal && source.getSide() == FragmentSide.SIDE1 && editor != null) {
    editor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
  }
  DiffSideView viewSide = getSideView(source.getSide());
  viewSide.setEditorSource(getProject(), source);
  Disposer.dispose(myScrollSupport);
  if (editor == null) {
    if (!myDisposed) {
      rediff();
    }
    return;
  }

  final MouseListener mouseListener = PopupHandler.installUnknownPopupHandler(editor.getContentComponent(), new MergeActionGroup(this, source.getSide()), ActionManager.getInstance());
  myDiffUpdater.contentAdded(source);
  editor.getSettings().setLineNumbersShown(true);
  editor.getSettings().setFoldingOutlineShown(false);
  editor.getFoldingModel().setFoldingEnabled(false);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);

  Editor editor1 = getEditor(FragmentSide.SIDE1);
  Editor editor2 = getEditor(FragmentSide.SIDE2);
  if (editor1 != null && editor2 != null && myIsSyncScroll) {
    myScrollSupport.install(new EditingSides[]{this});
  }

  final VisibleAreaListener visibleAreaListener = mySplitter.getVisibleAreaListener();
  final ScrollingModel scrollingModel = editor.getScrollingModel();
  if (visibleAreaListener != null) {
    scrollingModel.addVisibleAreaListener(visibleAreaListener);
    scrollingModel.addVisibleAreaListener(myVisibleAreaListener);
  }
  myFontSizeSynchronizer.synchronize(editor);
  source.addDisposable(new Disposable() {
    public void dispose() {
      myFontSizeSynchronizer.stopSynchronize(editor);
    }
  });
  source.addDisposable(new Disposable() {
    public void dispose() {
      if (visibleAreaListener != null) {
        scrollingModel.removeVisibleAreaListener(visibleAreaListener);
        scrollingModel.removeVisibleAreaListener(myVisibleAreaListener);
      }
      editor.getContentComponent().removeMouseListener(mouseListener);
    }
  });
}