Java Code Examples for com.intellij.util.ui.UIUtil#removeMnemonic()
The following examples show how to use
com.intellij.util.ui.UIUtil#removeMnemonic() .
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: LiveTemplateSettingsEditor.java From consulo with Apache License 2.0 | 6 votes |
private void addContextNode(MultiMap<TemplateContextType, TemplateContextType> hierarchy, CheckedTreeNode parent, TemplateContextType type) { final Collection<TemplateContextType> children = hierarchy.get(type); final String name = UIUtil.removeMnemonic(type.getPresentableName()); final CheckedTreeNode node = new CheckedTreeNode(Pair.create(children.isEmpty() ? type : null, name)); parent.add(node); if (children.isEmpty()) { node.setChecked(myContext.get(type)); } else { for (TemplateContextType child : children) { addContextNode(hierarchy, node, child); } final CheckedTreeNode other = new CheckedTreeNode(Pair.create(type, "Other")); other.setChecked(myContext.get(type)); node.add(other); } }
Example 2
Source File: RollbackChangesDialog.java From consulo with Apache License 2.0 | 4 votes |
private static void showNoChangesDialog(Project project) { String operationName = UIUtil.removeMnemonic(RollbackUtil.getRollbackOperationName(project)); Messages.showWarningDialog(project, VcsBundle.message("commit.dialog.no.changes.detected.text"), VcsBundle.message("changes.action.rollback.nothing", operationName)); }
Example 3
Source File: RollbackChangesDialog.java From consulo with Apache License 2.0 | 4 votes |
public RollbackChangesDialog(final Project project, final List<LocalChangeList> changeLists, final List<Change> changes, final boolean refreshSynchronously, final Runnable afterVcsRefreshInAwt) { super(project, true); myProject = project; myRefreshSynchronously = refreshSynchronously; myAfterVcsRefreshInAwt = afterVcsRefreshInAwt; myInvokedFromModalContext = LaterInvocator.isInModalContext(); myInfoCalculator = new ChangeInfoCalculator(); myCommitLegendPanel = new CommitLegendPanel(myInfoCalculator); myListChangeListener = new Runnable() { @Override public void run() { if (myBrowser != null) { // We could not utilize "myBrowser.getViewer().getChanges()" here (to get all changes) as currently it is not recursive. List<Change> allChanges = getAllChanges(changeLists); Collection<Change> includedChanges = myBrowser.getViewer().getIncludedChanges(); myInfoCalculator.update(allChanges, ContainerUtil.newArrayList(includedChanges)); myCommitLegendPanel.update(); boolean hasNewFiles = ContainerUtil.exists(includedChanges, new Condition<Change>() { @Override public boolean value(Change change) { return change.getType() == Change.Type.NEW; } }); myDeleteLocallyAddedFiles.setEnabled(hasNewFiles); } } }; myBrowser = new ChangesBrowser(project, changeLists, changes, null, true, true, myListChangeListener, ChangesBrowser.MyUseCase.LOCAL_CHANGES, null) { @Nonnull @Override protected DefaultTreeModel buildTreeModel(List<Change> changes, ChangeNodeDecorator changeNodeDecorator, boolean showFlatten) { TreeModelBuilder builder = new TreeModelBuilder(myProject, showFlatten); // Currently we do not explicitly utilize passed "changeNodeDecorator" instance (which is defined by // "ChangesBrowser.MyUseCase.LOCAL_CHANGES" parameter passed to "ChangesBrowser"). But correct node decorator will still be set // in "TreeModelBuilder.setChangeLists()". return builder.setChangeLists(changeLists).build(); } }; Disposer.register(getDisposable(), myBrowser); myOperationName = operationNameByChanges(project, getAllChanges(changeLists)); setOKButtonText(myOperationName); myOperationName = UIUtil.removeMnemonic(myOperationName); setTitle(VcsBundle.message("changes.action.rollback.custom.title", myOperationName)); setCancelButtonText(CommonBundle.getCloseButtonText()); myBrowser.setToggleActionTitle("&Include in " + myOperationName.toLowerCase()); myDeleteLocallyAddedFiles = new JCheckBox(VcsBundle.message("changes.checkbox.delete.locally.added.files")); myDeleteLocallyAddedFiles.setSelected(PropertiesComponent.getInstance().isTrueValue(DELETE_LOCALLY_ADDED_FILES_KEY)); myDeleteLocallyAddedFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PropertiesComponent.getInstance().setValue(DELETE_LOCALLY_ADDED_FILES_KEY, myDeleteLocallyAddedFiles.isSelected()); } }); init(); myListChangeListener.run(); }
Example 4
Source File: LiveTemplateSettingsEditor.java From consulo with Apache License 2.0 | 4 votes |
private JPanel createShortContextPanel(final boolean allowNoContexts) { JPanel panel = new JPanel(new BorderLayout()); final JLabel ctxLabel = new JLabel(); final JLabel change = new JLabel(); change.setForeground(JBColor.BLUE); change.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); panel.add(ctxLabel, BorderLayout.CENTER); panel.add(change, BorderLayout.EAST); final Runnable updateLabel = new Runnable() { @Override public void run() { StringBuilder sb = new StringBuilder(); String oldPrefix = ""; for (TemplateContextType type : getApplicableContexts()) { final TemplateContextType base = type.getBaseContextType(); String ownName = UIUtil.removeMnemonic(type.getPresentableName()); String prefix = ""; if (base != null && !(base instanceof EverywhereContextType)) { prefix = UIUtil.removeMnemonic(base.getPresentableName()) + ": "; ownName = StringUtil.decapitalize(ownName); } if (type instanceof EverywhereContextType) { ownName = "Other"; } if (sb.length() > 0) { sb.append(oldPrefix.equals(prefix) ? ", " : "; "); } if (!oldPrefix.equals(prefix)) { sb.append(prefix); oldPrefix = prefix; } sb.append(ownName); } final boolean noContexts = sb.length() == 0; ctxLabel.setText((noContexts ? "No applicable contexts" + (allowNoContexts ? "" : " yet") : "Applicable in " + sb.toString()) + ". "); ctxLabel.setForeground(noContexts ? allowNoContexts ? JBColor.GRAY : JBColor.RED : UIUtil.getLabelForeground()); change.setText(noContexts ? "Define" : "Change"); } }; new ClickListener() { @Override public boolean onClick(MouseEvent e, int clickCount) { if (disposeContextPopup()) return false; final JPanel content = createPopupContextPanel(updateLabel); Dimension prefSize = content.getPreferredSize(); if (myLastSize != null && (myLastSize.width > prefSize.width || myLastSize.height > prefSize.height)) { content.setPreferredSize(new Dimension(Math.max(prefSize.width, myLastSize.width), Math.max(prefSize.height, myLastSize.height))); } myContextPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null).setResizable(true).createPopup(); myContextPopup.show(new RelativePoint(change, new Point(change.getWidth() , -content.getPreferredSize().height - 10))); myContextPopup.addListener(new JBPopupAdapter() { @Override public void onClosed(LightweightWindowEvent event) { myLastSize = content.getSize(); } }); return true; } }.installOn(change); updateLabel.run(); return panel; }
Example 5
Source File: DirectoryChooser.java From consulo with Apache License 2.0 | 4 votes |
public FilterExistentAction() { super(RefactoringBundle.message("directory.chooser.hide.non.existent.checkBox.text"), UIUtil.removeMnemonic(RefactoringBundle.message("directory.chooser.hide.non.existent.checkBox.text")), AllIcons.General.Filter); }