Exemplo n.º 1
0
  @Override
  protected void processMouseEvent(MouseEvent e) {
    switch (e.getID()) {
      case MouseEvent.MOUSE_PRESSED:
      case MouseEvent.MOUSE_RELEASED:
      case MouseEvent.MOUSE_CLICKED:
        if (isInFoldingArea(e)) {
          mousePressedInFoldingArea(e);
        } else if (isInTextArea(e)) {
          mousePressedInTextArea(e);
        } else {
          mousePressedInIconsArea(e);
        }
        if (!e.isConsumed()
            && e.getButton() == MouseEvent.BUTTON3
            && e.getID() == MouseEvent.MOUSE_PRESSED) {
          DefaultActionGroup actionGroup =
              ActionUtils.getDefaultGroup(MPSActions.EDITOR_LEFTPANEL_GROUP);
          if (actionGroup != null) {
            ActionPopupMenu popupMenu =
                ActionManager.getInstance()
                    .createActionPopupMenu(ActionPlaces.EDITOR_POPUP, actionGroup);
            popupMenu.getComponent().show(e.getComponent(), e.getX(), e.getY());
            e.consume();
          }
        }
    }

    // suppressing future event processig in case event was consumed by one of LeftHighlighter
    // elements
    if (!e.isConsumed()) {
      super.processMouseEvent(e);
    }
  }
Exemplo n.º 2
0
 public void showGroupPopupMenu(final Component comp, final int x, final int y) {
   ActionGroup group = myGroup.getPopupActionGroup();
   if (group != null) {
     ActionPopupMenu popupMenu =
         ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
     popupMenu.getComponent().show(comp, x, y);
   }
 }
Exemplo n.º 3
0
 private void popupInvoked(Component component, int x, int y) {
   final TreePath path = myTree.getLeadSelectionPath();
   if (path == null) return;
   if (!(path.getLastPathComponent() instanceof MessageNode)) return;
   if (getData(DataConstants.NAVIGATABLE_ARRAY) == null) return;
   DefaultActionGroup group = new DefaultActionGroup();
   group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
   ActionPopupMenu menu =
       ActionManager.getInstance().createActionPopupMenu(ActionPlaces.ANT_MESSAGES_POPUP, group);
   menu.getComponent().show(component, x, y);
 }
Exemplo n.º 4
0
 @Override
 public void invokePopup(Component comp, int x, int y) {
   // Single right click
   ActionManager actionManager = ActionManager.getInstance();
   ActionGroup actionGroup =
       (ActionGroup) actionManager.getAction(ImageEditorActions.GROUP_POPUP);
   ActionPopupMenu menu =
       actionManager.createActionPopupMenu(ImageEditorActions.ACTION_PLACE, actionGroup);
   JPopupMenu popupMenu = menu.getComponent();
   popupMenu.pack();
   popupMenu.show(comp, x, y);
 }
 @Override
 public void invokePopup(final EditorMouseEvent event) {
   if (!event.isConsumed() && event.getArea() == EditorMouseEventArea.EDITING_AREA) {
     ActionGroup group =
         (ActionGroup)
             CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_EDITOR_POPUP);
     ActionPopupMenu popupMenu =
         ActionManager.getInstance().createActionPopupMenu(ActionPlaces.EDITOR_POPUP, group);
     MouseEvent e = event.getMouseEvent();
     final Component c = e.getComponent();
     if (c != null && c.isShowing()) {
       popupMenu.getComponent().show(c, e.getX(), e.getY());
     }
     e.consume();
   }
 }
  private void popupInvoked(Component component, int x, int y) {
    final TreePath path = myTree.getLeadSelectionPath();

    if (path == null) return;

    final DefaultActionGroup actions = new DefaultActionGroup();
    final ActionManager actionManager = ActionManager.getInstance();
    actions.add(actionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
    actions.add(actionManager.getAction(IdeActions.ACTION_FIND_USAGES));

    actions.add(myIncludeAction);
    actions.add(myExcludeAction);

    actions.addSeparator();

    final InspectionToolWrapper toolWrapper = myTree.getSelectedToolWrapper();
    if (toolWrapper != null) {
      final QuickFixAction[] quickFixes = myProvider.getQuickFixes(toolWrapper, myTree);
      if (quickFixes != null) {
        for (QuickFixAction quickFixe : quickFixes) {
          actions.add(quickFixe);
        }
      }
      final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName());
      if (key == null) return; // e.g. DummyEntryPointsTool

      // options
      actions.addSeparator();
      actions.add(new EditSettingsAction());
      final List<AnAction> options = new InspectionsOptionsToolbarAction(this).createActions();
      for (AnAction action : options) {
        actions.add(action);
      }
    }

    actions.addSeparator();
    actions.add(actionManager.getAction(IdeActions.GROUP_VERSION_CONTROLS));

    final ActionPopupMenu menu =
        actionManager.createActionPopupMenu(ActionPlaces.CODE_INSPECTION, actions);
    menu.getComponent().show(component, x, y);
  }