private void configureActions() { createExecuteDocumentAction(); actionGroup.addSeparator(); createVersionSwitcherAction(); actionGroup.addSeparator(); createOpenDocumentAction(); actionGroup.addSeparator(); createRefreshRepositoryAction(); toolBar.updateActionsImmediately(); // Context menu with the plugin actions. getRepositoryTree().addMouseListener(new PopupHandler() { @Override public void invokePopup(final Component comp, final int x, final int y) { ActionPopupMenu actionPopupMenu = ActionManager.getInstance().createActionPopupMenu("LivingDoc.RepositoryViewToolbar", actionGroup); actionPopupMenu.getComponent().show(comp, x, y); } }); }
@Override protected void createTrees(@NotNull final Map<String, JTree> type2TreeMap) { ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP); final JTree tree1 = createTree(false); PopupHandler.installPopupHandler(tree1, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); final BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction(); baseOnThisMethodAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree1); type2TreeMap.put(CALLEE_TYPE, tree1); final JTree tree2 = createTree(false); PopupHandler.installPopupHandler(tree2, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisMethodAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree2); type2TreeMap.put(CALLER_TYPE, tree2); }
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(); }
protected void createTreeAndSetupCommonActions(@NotNull Map<String, JTree> trees, ActionGroup group) { final BaseOnThisTypeAction baseOnThisTypeAction = createBaseOnThisAction(); final JTree tree1 = createTree(true); PopupHandler.installPopupHandler(tree1, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree1); trees.put(TYPE_HIERARCHY_TYPE, tree1); final JTree tree2 = createTree(true); PopupHandler.installPopupHandler(tree2, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree2); trees.put(SUPERTYPES_HIERARCHY_TYPE, tree2); final JTree tree3 = createTree(true); PopupHandler.installPopupHandler(tree3, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree3); trees.put(SUBTYPES_HIERARCHY_TYPE, tree3); }
private JComponent createToolbar() { MqRefreshAction mqRefreshAction = new MqRefreshAction(); EmptyAction.setupAction(mqRefreshAction, "hg4idea.QRefresh", this); MqDeleteAction mqDeleteAction = new MqDeleteAction(); EmptyAction.setupAction(mqDeleteAction, "hg4idea.QDelete", this); PopupHandler.installPopupHandler(myPatchTable, POPUP_ACTION_GROUP, ActionPlaces.PROJECT_VIEW_POPUP); ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup toolbarGroup = new DefaultActionGroup(); toolbarGroup.add(mqRefreshAction); toolbarGroup.add(actionManager.getAction("Hg.MQ.Unapplied")); toolbarGroup.add(mqDeleteAction); ActionToolbar toolbar = actionManager.createActionToolbar(TOOLBAR_ACTION_GROUP, toolbarGroup, false); toolbar.setTargetComponent(this); return toolbar.getComponent(); }
public BrowserPanel(CvsRootConfiguration configuration, Project project, Consumer<VcsException> errorCallback) { super(new BorderLayout(2, 0)); setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); myProject = project; myCvsRootConfiguration = configuration; myTree = new CvsTree(project, false, TreeSelectionModel.SINGLE_TREE_SELECTION, true, true, errorCallback); add(myTree, BorderLayout.CENTER); myTree.init(); myTree.setCvsRootConfiguration(configuration); myCheckoutHelper = new CheckoutHelper(configuration, this); TreeUIHelper uiHelper = TreeUIHelper.getInstance(); uiHelper.installEditSourceOnDoubleClick(myTree.getTree()); TreeUtil.installActions(myTree.getTree()); ActionGroup group = getActionGroup(); PopupHandler.installPopupHandler(myTree.getTree(), group, ActionPlaces.CHECKOUT_POPUP, ActionManager.getInstance()); }
public TestRunResultsView(Project project) { this.model = new ListTreeTableModelOnColumns(null, COLUMNS.toArray(new ColumnInfo[COLUMNS.size()])); this.tree = new TreeTable(this.model); this.tree.getColumnModel().getColumn(0).setMinWidth(TestMeasureColumnInfo.MeasureProperty.GROUP.width * 2); for (TestMeasureColumnInfo.MeasureProperty prop : TestMeasureColumnInfo.MeasureProperty.values()) { //first column is name column which is not included in MeasureProperties, that's why we add 1. this.tree.getColumnModel().getColumn(prop.ordinal() + 1).setMinWidth(prop.width); } this.panel = JBUI.Panels.simplePanel().addToCenter(ScrollPaneFactory.createScrollPane(this.tree)); //set text when no tests were fetched yet this.setEmptyText(Messages.getMessage("execution.result.ui.loading")); //add rightclick dialog DefaultActionGroup dag = new DefaultActionGroup(); dag.add(new OpenInEditorAction(() -> { TestResultNode node = this.getSelectedNode(); if (node != null) { return node.getResult(); } return null; }, project)); PopupHandler.installUnknownPopupHandler(this.tree, dag, ActionManager.getInstance()); }
private void registerThreadsPopupMenu(final JList framesList) { final PopupHandler popupHandler = new PopupHandler() { public void invokePopup(Component comp, int x, int y) { DefaultActionGroup group = (DefaultActionGroup)ActionManager.getInstance().getAction(DebuggerActions.THREADS_PANEL_POPUP); ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(DebuggerActions.THREADS_PANEL_POPUP, group); popupMenu.getComponent().show(comp, x, y); } }; framesList.addMouseListener(popupHandler); registerDisposable(new Disposable() { public void dispose() { myThreadsCombo.removeItemListener(myThreadsListener); framesList.removeMouseListener(popupHandler); } }); }
protected void createTrees(@NotNull Map<String, JTree> trees) { ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_TYPE_HIERARCHY_POPUP); final BaseOnThisTypeAction baseOnThisTypeAction = new BaseOnThisTypeAction(); final JTree tree1 = createTree(true); PopupHandler.installPopupHandler(tree1, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree1); trees.put(TYPE_HIERARCHY_TYPE, tree1); final JTree tree2 = createTree(true); PopupHandler.installPopupHandler(tree2, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree2); trees.put(SUPERTYPES_HIERARCHY_TYPE, tree2); final JTree tree3 = createTree(true); PopupHandler.installPopupHandler(tree3, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree3); trees.put(SUBTYPES_HIERARCHY_TYPE, tree3); }
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); }
protected void createTreeAndSetupCommonActions(@Nonnull Map<String, JTree> trees, ActionGroup group) { final BaseOnThisTypeAction baseOnThisTypeAction = createBaseOnThisAction(); final JTree tree1 = createTree(true); PopupHandler.installPopupHandler(tree1, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree1); trees.put(TYPE_HIERARCHY_TYPE, tree1); final JTree tree2 = createTree(true); PopupHandler.installPopupHandler(tree2, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree2); trees.put(SUPERTYPES_HIERARCHY_TYPE, tree2); final JTree tree3 = createTree(true); PopupHandler.installPopupHandler(tree3, group, ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); baseOnThisTypeAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_TYPE_HIERARCHY).getShortcutSet(), tree3); trees.put(SUBTYPES_HIERARCHY_TYPE, tree3); }
private void initTree(final MyTree tree) { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setCellRenderer(new MyTreeCellRenderer(tree == myLeftTree)); tree.setRootVisible(false); tree.setShowsRootHandles(true); UIUtil.setLineStyleAngled(tree); TreeUtil.installActions(tree); SmartExpander.installOn(tree); EditSourceOnDoubleClickHandler.install(tree); new TreeSpeedSearch(tree); PopupHandler.installUnknownPopupHandler(tree, createTreePopupActions(), ActionManager.getInstance()); }
public InspectDebuggerTree(Project project) { super(project); final PopupHandler popupHandler = new PopupHandler() { public void invokePopup(Component comp, int x, int y) { ActionPopupMenu popupMenu = createPopupMenu(); if (popupMenu != null) { myTipManager.registerPopup(popupMenu.getComponent()).show(comp, x, y); } } }; addMouseListener(popupHandler); new ValueNodeDnD(this, project); }
public DebuggerTreePanel(Project project, DebuggerStateManager stateManager) { super(project, stateManager); myTree = createTreeView(); final PopupHandler popupHandler = new PopupHandler() { @Override public void invokePopup(Component comp, int x, int y) { ActionPopupMenu popupMenu = createPopupMenu(); if (popupMenu != null) { myTree.myTipManager.registerPopup(popupMenu.getComponent()).show(comp, x, y); } } }; myTree.addMouseListener(popupHandler); setFocusTraversalPolicy(new IdeFocusTraversalPolicy() { @Override public Component getDefaultComponentImpl(Container focusCycleRoot) { return myTree; } }); registerDisposable(new Disposable() { @Override public void dispose() { myTree.removeMouseListener(popupHandler); } }); final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark"); final CustomShortcutSet shortcutSet = shortcuts.length > 0? new CustomShortcutSet(shortcuts) : new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0)); overrideShortcut(myTree, XDebuggerActions.MARK_OBJECT, shortcutSet); }
public ConfigurationArgumentsHelpArea() { super(new BorderLayout()); add(myPanel); setBorder(IdeBorderFactory.createEmptyBorder(10, 0, 0, 0)); final DefaultActionGroup group = new DefaultActionGroup(); group.add(new MyCopyAction()); myHelpArea.addMouseListener( new PopupHandler(){ @Override public void invokePopup(final Component comp,final int x,final int y){ ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group).getComponent().show(comp, x, y); } } ); FixedSizeButton copyButton = new FixedSizeButton(22); copyButton.setIcon(PlatformIcons.COPY_ICON); copyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final StringSelection contents = new StringSelection(myHelpArea.getText().trim()); CopyPasteManager.getInstance().setContents(contents); } }); myToolbarPanel.add(copyButton, BorderLayout.NORTH); myToolbarPanel.setVisible(false); }
protected void createTrees(@NotNull Map<String, JTree> trees) { final JTree tree = createTree(false); ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_METHOD_HIERARCHY_POPUP); PopupHandler.installPopupHandler(tree, group, ActionPlaces.METHOD_HIERARCHY_VIEW_POPUP, ActionManager.getInstance()); final BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction(); baseOnThisMethodAction .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_METHOD_HIERARCHY).getShortcutSet(), tree); trees.put(METHOD_TYPE, tree); }
public SourceItemsTree(ArtifactEditorContext editorContext, ArtifactEditorImpl artifactsEditor) { myArtifactsEditor = artifactsEditor; myBuilder = new SimpleTreeBuilder(this, this.getBuilderModel(), new SourceItemsTreeStructure(editorContext, artifactsEditor), new WeightBasedComparator(true)); setRootVisible(false); setShowsRootHandles(true); Disposer.register(this, myBuilder); PopupHandler.installPopupHandler(this, createPopupGroup(), ActionPlaces.UNKNOWN, ActionManager.getInstance()); installDnD(); }
public StatisticsPanel(final Project project, final TestFrameworkRunningModel model) { myProject = project; myTableModel = new StatisticsTableModel(); myStatisticsTableView.setModelAndUpdateColumns(myTableModel); myFrameworkRunningModel = model; final Runnable gotoSuiteOrParentAction = createGotoSuiteOrParentAction(); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { gotoSuiteOrParentAction.run(); return true; } }.installOn(myStatisticsTableView); // Fire selection changed and move focus on SHIFT+ENTER final KeyStroke shiftEnterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK); SMRunnerUtil.registerAsAction(shiftEnterKey, "select-test-proxy-in-test-view", new Runnable() { public void run() { showSelectedProxyInTestsTree(); } }, myStatisticsTableView); // Expand selected or go to parent on ENTER final KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); SMRunnerUtil.registerAsAction(enterKey, "go-to-selected-suite-or-parent", gotoSuiteOrParentAction, myStatisticsTableView); // Contex menu in Table PopupHandler.installPopupHandler(myStatisticsTableView, IdeActions.GROUP_TESTTREE_POPUP, ActionPlaces.TESTTREE_VIEW_POPUP); // set this statistic tab as dataprovider for test's table view DataManager.registerDataProvider(myStatisticsTableView, this); }
public static MouseListener installPopupHandler(JComponent component, @NotNull final String groupId, final String place) { if (ApplicationManager.getApplication() == null) return new MouseAdapter(){}; PopupHandler popupHandler = new PopupHandler() { @Override public void invokePopup(Component comp, int x, int y) { ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(groupId); final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(place, group); popupMenu.getComponent().show(comp, x, y); } }; component.addMouseListener(popupHandler); return popupHandler; }
protected void init() { final DefaultActionGroup fileSystemActionGroup = createFileSystemActionGroup(); myFileSystemToolBar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, fileSystemActionGroup, true); final JTree tree = myFileSystemTree.getTree(); tree.getSelectionModel().addTreeSelectionListener(myTreeSelectionListener); tree.setCellRenderer(new NodeRenderer()); tree.addMouseListener(new PopupHandler() { public void invokePopup(Component comp, int x, int y) { final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UPDATE_POPUP, fileSystemActionGroup); popupMenu.getComponent().show(comp, x, y); } }); tree.addSelectionPath(tree.getPathForRow(0)); new FileDrop(tree, new FileDrop.Target() { public FileChooserDescriptor getDescriptor() { return myChooserDescriptor; } public boolean isHiddenShown() { return myFileSystemTree.areHiddensShown(); } public void dropFiles(final List<VirtualFile> files) { if (files.size() > 0) { selectInTree(files.toArray(new VirtualFile[files.size()])); } } }); super.init(); }
public void init() { setLayout(new BorderLayout()); myTable = new JBTable(); myTextArea = new JTextArea(0, 0); myTextArea.setEditable(false); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); mySplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, scrollPane, ScrollPaneFactory.createScrollPane(myTextArea)); add(mySplitPane, BorderLayout.CENTER); add(createToolbar(), BorderLayout.WEST); final DefaultTableModel model = new DefaultTableModel(createTableModel(new HashMap<String, String>()), new Object[]{"Name", "Value"}) { public boolean isCellEditable(final int row, final int column) { return false; } }; myTable.setModel(model); myTable.setShowVerticalLines(true); myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int index = myTable.getSelectedRow(); if (index >= 0) { Object value = myTable.getValueAt(index, 1); if (value instanceof String) { myTextArea.setText(((String) value)); } else { myTextArea.setText(""); } } else { myTextArea.setText(""); } } }); myPopupActionGroup = createPopup(); PopupHandler.installPopupHandler(myTable, myPopupActionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance()); PopupHandler.installPopupHandler(scrollPane, myPopupActionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance()); final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_CLOSE_ACTIVE_TAB); myCloseAction.registerCustomShortcutSet(new CustomShortcutSet(shortcuts), this); myRefreshAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), this); }
private void createUI() { myMainPanel = new JPanel(new BorderLayout()); myBrowser = new RepositoryBrowserComponent(SvnVcs.getInstance(myProject)); final DefaultActionGroup group = new DefaultActionGroup(); group.add(new RepositoryBrowserDialog.MkDirAction(myBrowser) { @Override public void update(AnActionEvent e) { super.update(e); e.getPresentation().setText("New Remote Folder..."); } }); group.add(new RepositoryBrowserDialog.DeleteAction(myBrowser)); group.add(new RepositoryBrowserDialog.RefreshAction(myBrowser)); final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu("", group); final JPopupMenu component = popupMenu.getComponent(); myBrowser.getRepositoryTree().addMouseListener(new PopupHandler() { @Override public void invokePopup(Component comp, int x, int y) { component.show(comp, x, y); } }); final Splitter splitter = new Splitter(true); splitter.setProportion(0.7f); final JPanel wrapper = createBrowserPartWrapper(); splitter.setFirstComponent(wrapper); final JPanel commitMessageWrapper = createCommitMessageWrapper(); splitter.setSecondComponent(commitMessageWrapper); myMainPanel.add(splitter, BorderLayout.CENTER); final JPanel recentMessagesWrapper = new JPanel(new BorderLayout()); recentMessagesWrapper.add(new JLabel("Recent Messages:"), BorderLayout.NORTH); myMessagesBox = new JComboBox(); recentMessagesWrapper.add(myMessagesBox, BorderLayout.SOUTH); recentMessagesWrapper.setBorder(BorderFactory.createEmptyBorder(4,0,0,0)); myMainPanel.add(recentMessagesWrapper, BorderLayout.SOUTH); }
private void tunePopupActionGroup() { final DefaultActionGroup propertiesPopupGroup = new DefaultActionGroup(); propertiesPopupGroup.copyFromGroup((DefaultActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_STRUCTURE_VIEW_POPUP)); propertiesPopupGroup.add(Separator.getInstance(), Constraints.FIRST); propertiesPopupGroup.add(new IgnoreIncompletePropertyPropertiesFilesAction(), Constraints.FIRST); propertiesPopupGroup.add(new NewPropertyAction(true), Constraints.FIRST); PopupHandler.installPopupHandler(getTree(), propertiesPopupGroup, IdeActions.GROUP_STRUCTURE_VIEW_POPUP, ActionManager.getInstance()); }
public StructureTree(GeneratedStructureModel model) { super(model); setCellRenderer(new GeneratedStructureRenderer()); setRootVisible(false); setShowsRootHandles(true); final DefaultActionGroup structureContextActions = new DefaultActionGroup("StructureContext", true); structureContextActions.add(NavigateAction.getInstance()); structureContextActions.add(new CopyValueAction(this)); PopupHandler.installFollowingSelectionTreePopup(this, structureContextActions, "XSLT.Debugger.GeneratedStructure", ActionManager.getInstance()); }
public TfsTreeForm() { DataManager.registerDataProvider(tree, this); new TreeSpeedSearch(tree); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { selectedItem = doGetSelectedItem(); pathField.setText(selectedItem != null ? selectedItem.path : null); eventDispatcher.getMulticaster().selectionChanged(); } }); PopupHandler.installPopupHandler(tree, POPUP_ACTION_GROUP, ActionPlaces.REMOTE_HOST_DIALOG_POPUP); setMessage(null, false); }
public LabelWithCopy() { addMouseListener(new PopupHandler() { @Override public void invokePopup(Component comp, int x, int y) { ActionManager actMgr = ActionManager.getInstance(); ActionGroup group = (ActionGroup) ActionManager.getInstance() .getAction("railways.CopyMenu"); ActionPopupMenu popupMenu = actMgr.createActionPopupMenu(ActionPlaces.UNKNOWN, group); popupMenu.getComponent().show(comp, x, y); } }); }
public DebuggerTreePanel(Project project, DebuggerStateManager stateManager) { super(project, stateManager); myTree = createTreeView(); final PopupHandler popupHandler = new PopupHandler() { public void invokePopup(Component comp, int x, int y) { ActionPopupMenu popupMenu = createPopupMenu(); if (popupMenu != null) { myTree.myTipManager.registerPopup(popupMenu.getComponent()).show(comp, x, y); } } }; myTree.addMouseListener(popupHandler); setFocusTraversalPolicy(new IdeFocusTraversalPolicy() { public Component getDefaultComponentImpl(Container focusCycleRoot) { return myTree; } }); registerDisposable(new Disposable() { public void dispose() { myTree.removeMouseListener(popupHandler); } }); final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark"); final CustomShortcutSet shortcutSet = shortcuts.length > 0? new CustomShortcutSet(shortcuts) : new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0)); overrideShortcut(myTree, XDebuggerActions.MARK_OBJECT, shortcutSet); }
public ConfigurationArgumentsHelpArea() { super(new BorderLayout()); add(myPanel); setBorder(IdeBorderFactory.createEmptyBorder(10, 0, 0, 0)); final DefaultActionGroup group = new DefaultActionGroup(); group.add(new MyCopyAction()); myHelpArea.addMouseListener( new PopupHandler(){ public void invokePopup(final Component comp,final int x,final int y){ createPopupMenu(group).getComponent().show(comp,x,y); } } ); FixedSizeButton copyButton = new FixedSizeButton(22); copyButton.setIcon(PlatformIcons.COPY_ICON); copyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final StringSelection contents = new StringSelection(myHelpArea.getText().trim()); CopyPasteManager.getInstance().setContents(contents); } }); myToolbarPanel.add(copyButton, BorderLayout.NORTH); myToolbarPanel.setVisible(false); }
@Override public void setErrorPanelPopupHandler(@NotNull PopupHandler handler) { ApplicationManager.getApplication().assertIsDispatchThread(); MyErrorPanel errorPanel = getErrorPanel(); if (errorPanel != null) { errorPanel.setPopupHandler(handler); } }
private void setPopupHandler(@NotNull PopupHandler handler) { if (myHandler != null) { scrollbar.removeMouseListener(myHandler); myErrorStripeButton.removeMouseListener(myHandler); } myHandler = handler; scrollbar.addMouseListener(handler); myErrorStripeButton.addMouseListener(myHandler); }
public static MouseListener installPopupHandler(JComponent component, @NotNull final String groupId, final String place) { if (ApplicationManager.getApplication() == null) return new MouseAdapter(){}; PopupHandler popupHandler = new PopupHandler() { public void invokePopup(Component comp, int x, int y) { ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(groupId); final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(place, group); popupMenu.getComponent().show(comp, x, y); } }; component.addMouseListener(popupHandler); return popupHandler; }