com.intellij.ui.DoubleClickListener Java Examples
The following examples show how to use
com.intellij.ui.DoubleClickListener.
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: LiteralChooser.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Nullable @Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { if (tree.getPathForLocation(e.getX(), e.getY()) != null) { doOKAction(); return true; } return false; } }.installOn(tree); TreeUtil.installActions(tree); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(tree); // scrollPane.setPreferredSize(new Dimension(350, 450)); panel.add(scrollPane, BorderLayout.CENTER); return panel; }
Example #2
Source File: FileTypeChooser.java From consulo with Apache License 2.0 | 6 votes |
@Override protected JComponent createCenterPanel() { myTitleLabel.setText(FileTypesBundle.message("filetype.chooser.prompt", myFileName)); myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myList.setCellRenderer(new FileTypeRenderer()); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { doOKAction(); return true; } }.installOn(myList); myList.getSelectionModel().addListSelectionListener(e -> updateButtonsState()); ScrollingUtil.selectItem(myList, PlainTextFileType.INSTANCE); return myPanel; }
Example #3
Source File: ChooseActionsDialog.java From consulo with Apache License 2.0 | 6 votes |
public ChooseActionsDialog(Component parent, Keymap keymap, QuickList[] quicklists) { super(parent, true); myKeymap = keymap; myQuicklists = quicklists; myActionsTree = new ActionsTree(); myActionsTree.reset(keymap, quicklists); myActionsTree.getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { doOKAction(); return true; } }.installOn(myActionsTree.getTree()); myTreeExpansionMonitor = TreeExpansionMonitor.install(myActionsTree.getTree()); setTitle("Add Actions to Quick List"); init(); }
Example #4
Source File: StatisticsPanel.java From consulo with Apache License 2.0 | 5 votes |
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); }
Example #5
Source File: EditSourceOnDoubleClickHandler.java From consulo with Apache License 2.0 | 5 votes |
public static void install(final TreeTable treeTable) { new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { if (ModalityState.current().dominates(ModalityState.NON_MODAL)) return false; if (treeTable.getTree().getPathForLocation(e.getX(), e.getY()) == null) return false; DataContext dataContext = DataManager.getInstance().getDataContext(treeTable); Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) return false; OpenSourceUtil.openSourcesFrom(dataContext, true); return true; } }.installOn(treeTable); }
Example #6
Source File: EditSourceOnDoubleClickHandler.java From consulo with Apache License 2.0 | 5 votes |
public static void install(final JTable table) { new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { if (ModalityState.current().dominates(ModalityState.NON_MODAL)) return false; if (table.columnAtPoint(e.getPoint()) < 0) return false; if (table.rowAtPoint(e.getPoint()) < 0) return false; DataContext dataContext = DataManager.getInstance().getDataContext(table); Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) return false; OpenSourceUtil.openSourcesFrom(dataContext, true); return true; } }.installOn(table); }
Example #7
Source File: EditSourceOnDoubleClickHandler.java From consulo with Apache License 2.0 | 5 votes |
public static void install(final JList list, final Runnable whenPerformed) { new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { Point point = e.getPoint(); int index = list.locationToIndex(point); if (index == -1) return false; if (!list.getCellBounds(index, index).contains(point)) return false; DataContext dataContext = DataManager.getInstance().getDataContext(list); OpenSourceUtil.openSourcesFrom(dataContext, true); whenPerformed.run(); return true; } }.installOn(list); }
Example #8
Source File: ServersToolWindowContent.java From consulo with Apache License 2.0 | 4 votes |
public ServersToolWindowContent(@Nonnull Project project) { super(new BorderLayout()); myProject = project; myTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode()); myTree = new Tree(myTreeModel); myTree.setRootVisible(false); myTree.setShowsRootHandles(true); myTree.setCellRenderer(new NodeRenderer()); myTree.setLineStyleAngled(); getMainPanel().add(createToolbar(), BorderLayout.WEST); Splitter splitter = new OnePixelSplitter(false, 0.3f); splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree, SideBorder.LEFT)); myPropertiesPanelLayout = new CardLayout(); myPropertiesPanel = new JPanel(myPropertiesPanelLayout); myMessageLabel = new JLabel(EMPTY_SELECTION_MESSAGE, SwingConstants.CENTER); myPropertiesPanel.add(MESSAGE_CARD, new Wrapper(myMessageLabel)); splitter.setSecondComponent(myPropertiesPanel); getMainPanel().add(splitter, BorderLayout.CENTER); setupBuilder(project); for (RemoteServersViewContributor contributor : RemoteServersViewContributor.EP_NAME.getExtensionList()) { contributor.setupTree(myProject, myTree, myBuilder); } myTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { onSelectionChanged(); } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent event) { Set<ServersTreeStructure.RemoteServerNode> nodes = getSelectedRemoteServerNodes(); if (nodes.size() == 1) { RemoteServer<?> server = nodes.iterator().next().getValue(); ServerConnectionManager.getInstance().getOrCreateConnection(server).computeDeployments(EmptyRunnable.INSTANCE); return true; } return false; } }.installOn(myTree); }