public static EditorPopupHandler createEditorPopupHandler(final String groupId) { return new EditorPopupHandler() { @Override public void invokePopup(final EditorMouseEvent event) { if (!event.isConsumed() && event.getArea() == EditorMouseEventArea.EDITING_AREA) { ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(groupId); 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 Editor createLogEditor() { Project project = myProjectModel.getProject(); final Editor editor = ConsoleViewUtil.setupConsoleEditor(project, false, false); Disposer.register(myProjectModel, new Disposable() { @Override public void dispose() { EditorFactory.getInstance().releaseEditor(editor); } }); ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true); final ClearLog clearLog = new ClearLog(); clearLog.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.CONSOLE_CLEAR_ALL).getShortcutSet(), editor.getContentComponent()); editor.addEditorMouseListener(new EditorPopupHandler() { public void invokePopup(final EditorMouseEvent event) { final ActionManager actionManager = ActionManager.getInstance(); final ActionPopupMenu menu = actionManager.createActionPopupMenu(ActionPlaces.EDITOR_POPUP, createPopupActions(actionManager, clearLog)); final MouseEvent mouseEvent = event.getMouseEvent(); menu.getComponent().show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY()); } }); return editor; }
@Override public void invokePopup(final EditorMouseEvent event) { if (myEditorPopupActions.isEmpty()) return; ActionGroup group = new DefaultActionGroup(myEditorPopupActions); EditorPopupHandler handler = EditorActionUtil.createEditorPopupHandler(group); handler.invokePopup(event); }
public static EditorPopupHandler createEditorPopupHandler(@NotNull final String groupId) { return new EditorPopupHandler() { @Override public void invokePopup(final EditorMouseEvent event) { if (!event.isConsumed() && event.getArea() == EditorMouseEventArea.EDITING_AREA) { ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(groupId); showEditorPopup(event, group); } } }; }
public static EditorPopupHandler createEditorPopupHandler(@NotNull final ActionGroup group) { return new EditorPopupHandler() { @Override public void invokePopup(final EditorMouseEvent event) { showEditorPopup(event, group); } }; }
public static EditorPopupHandler createEditorPopupHandler(@Nonnull final String groupId) { return new EditorPopupHandler() { @Override public void invokePopup(final EditorMouseEvent event) { if (!event.isConsumed() && event.getArea() == EditorMouseEventArea.EDITING_AREA) { ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(groupId); showEditorPopup(event, group); } } }; }
public static EditorPopupHandler createEditorPopupHandler(@Nonnull final ActionGroup group) { return new EditorPopupHandler() { @Override public void invokePopup(final EditorMouseEvent event) { showEditorPopup(event, group); } }; }