com.intellij.ide.ui.customization.CustomizationUtil Java Examples
The following examples show how to use
com.intellij.ide.ui.customization.CustomizationUtil.
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: GlobalConfigsToolWindowPanel.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
private void addTreeMouseListeners() { EditSourceOnDoubleClickHandler.install(getTree(), new Runnable() { @Override public void run() { TreePath path = getTree().getSelectionPath(); if (path == null) return; DefaultMutableTreeNode selectedElement = (DefaultMutableTreeNode)path.getLastPathComponent(); if (selectedElement == null) return; GlobalConfigsTreeStructure.GlobalConfigNode configNode = (GlobalConfigsTreeStructure.GlobalConfigNode)selectedElement.getUserObject(); if (configNode == null) return; PsiElement element = configNode.getXmlTag(); if (element == null) return; OpenSourceUtil.navigate((Navigatable)element); } }); CustomizationUtil.installPopupHandler(getTree(), IdeActions.GROUP_STRUCTURE_VIEW_POPUP, ActionPlaces.STRUCTURE_VIEW_POPUP); }
Example #2
Source File: ArrangementRuleAliasesPanel.java From consulo with Apache License 2.0 | 5 votes |
public ArrangementRuleAliasesPanel(@Nonnull ArrangementStandardSettingsManager settingsManager, @Nonnull ArrangementColorsProvider colorsProvider) { super(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5)); JBScrollPane scrollPane = new JBScrollPane(); final JViewport viewport = scrollPane.getViewport(); ArrangementMatchingRulesControl.RepresentationCallback callback = new ArrangementMatchingRulesControl.RepresentationCallback() { @Override public void ensureVisible(@Nonnull Rectangle r) { Rectangle visibleRect = viewport.getViewRect(); if (r.y <= visibleRect.y) { return; } int excessiveHeight = r.y + r.height - (visibleRect.y + visibleRect.height); if (excessiveHeight <= 0) { return; } int verticalShift = Math.min(r.y - visibleRect.y, excessiveHeight); if (verticalShift > 0) { viewport.setViewPosition(new Point(visibleRect.x, visibleRect.y + verticalShift)); } } }; myControl = new ArrangementRuleAliasControl(settingsManager, colorsProvider, callback); scrollPane.setViewportView(myControl); CustomizationUtil.installPopupHandler( myControl, ArrangementConstants.ALIAS_RULE_CONTEXT_MENU, ArrangementConstants.ALIAS_RULE_CONTROL_PLACE ); TitleWithToolbar top = new TitleWithToolbar( ApplicationBundle.message("arrangement.settings.section.rule.sequence"), ArrangementConstants.ALIAS_RULE_CONTROL_TOOLBAR, ArrangementConstants.ALIAS_RULE_CONTROL_TOOLBAR_PLACE, myControl ); add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1)); add(scrollPane, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0)); }
Example #3
Source File: AbstractProjectViewPSIPane.java From consulo with Apache License 2.0 | 5 votes |
private void initTree() { myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); UIUtil.setLineStyleAngled(myTree); myTree.setRootVisible(false); myTree.setShowsRootHandles(true); myTree.expandPath(new TreePath(myTree.getModel().getRoot())); EditSourceOnDoubleClickHandler.install(myTree); ToolTipManager.sharedInstance().registerComponent(myTree); TreeUtil.installActions(myTree); new MySpeedSearch(myTree); myTree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (KeyEvent.VK_ENTER == e.getKeyCode()) { TreePath path = getSelectedPath(); if (path != null && !myTree.getModel().isLeaf(path.getLastPathComponent())) { return; } DataContext dataContext = DataManager.getInstance().getDataContext(myTree); OpenSourceUtil.openSourcesFrom(dataContext, ScreenReader.isActive()); } else if (KeyEvent.VK_ESCAPE == e.getKeyCode()) { if (e.isConsumed()) return; PsiCopyPasteManager copyPasteManager = PsiCopyPasteManager.getInstance(); boolean[] isCopied = new boolean[1]; if (copyPasteManager.getElements(isCopied) != null && !isCopied[0]) { copyPasteManager.clear(); e.consume(); } } } }); CustomizationUtil.installPopupHandler(myTree, IdeActions.GROUP_PROJECT_VIEW_POPUP, ActionPlaces.PROJECT_VIEW_POPUP); }
Example #4
Source File: ScopeTreeViewPanel.java From consulo with Apache License 2.0 | 5 votes |
private void initTree() { myTree.setCellRenderer(new MyTreeCellRenderer()); myTree.setRootVisible(false); myTree.setShowsRootHandles(true); UIUtil.setLineStyleAngled(myTree); TreeUtil.installActions(myTree); EditSourceOnDoubleClickHandler.install(myTree); new TreeSpeedSearch(myTree); myCopyPasteDelegator = new CopyPasteDelegator(myProject, this) { @Override @Nonnull protected PsiElement[] getSelectedElements() { return getSelectedPsiElements(); } }; myTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myTree, myProject); final ScopeTreeStructureExpander[] extensions = Extensions.getExtensions(ScopeTreeStructureExpander.EP_NAME, myProject); for (ScopeTreeStructureExpander expander : extensions) { myTree.addTreeWillExpandListener(expander); } if (extensions.length == 0) { myTree.addTreeWillExpandListener(new SortingExpandListener()); } myTree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (KeyEvent.VK_ENTER == e.getKeyCode()) { final Object component = myTree.getLastSelectedPathComponent(); if (component instanceof DefaultMutableTreeNode) { final DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)component; if (selectedNode.isLeaf()) { OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(myTree), false); } } } } }); CustomizationUtil.installPopupHandler(myTree, IdeActions.GROUP_PROJECT_VIEW_POPUP, ActionPlaces.PROJECT_VIEW_POPUP); }
Example #5
Source File: ArrangementMatchingRulesPanel.java From consulo with Apache License 2.0 | 4 votes |
public ArrangementMatchingRulesPanel(@Nonnull Language language, @Nonnull ArrangementStandardSettingsManager settingsManager, @Nonnull ArrangementColorsProvider colorsProvider) { super(new GridBagLayout()); JBScrollPane scrollPane = new JBScrollPane(); final JViewport viewport = scrollPane.getViewport(); ArrangementSectionRulesControl.RepresentationCallback callback = new ArrangementSectionRulesControl.RepresentationCallback() { @Override public void ensureVisible(@Nonnull Rectangle r) { Rectangle visibleRect = viewport.getViewRect(); if (r.y <= visibleRect.y) { return; } int excessiveHeight = r.y + r.height - (visibleRect.y + visibleRect.height); if (excessiveHeight <= 0) { return; } int verticalShift = Math.min(r.y - visibleRect.y, excessiveHeight); if (verticalShift > 0) { viewport.setViewPosition(new Point(visibleRect.x, visibleRect.y + verticalShift)); } } }; myControl = createRulesControl(language, settingsManager, colorsProvider, callback); scrollPane.setViewportView(myControl); CustomizationUtil.installPopupHandler( myControl, ArrangementConstants.ACTION_GROUP_MATCHING_RULES_CONTEXT_MENU, ArrangementConstants.MATCHING_RULES_CONTROL_PLACE ); TitleWithToolbar top = new TitleWithToolbar( ApplicationBundle.message("arrangement.settings.section.match"), ArrangementConstants.ACTION_GROUP_MATCHING_RULES_CONTROL_TOOLBAR, ArrangementConstants.MATCHING_RULES_CONTROL_TOOLBAR_PLACE, myControl ); add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1)); add(scrollPane, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0)); }
Example #6
Source File: StructureViewComponent.java From consulo with Apache License 2.0 | 4 votes |
private void addTreeMouseListeners() { EditSourceOnDoubleClickHandler.install(getTree()); CustomizationUtil.installPopupHandler(getTree(), IdeActions.GROUP_STRUCTURE_VIEW_POPUP, ActionPlaces.STRUCTURE_VIEW_POPUP); }