org.eclipse.jface.action.LegacyActionTools Java Examples
The following examples show how to use
org.eclipse.jface.action.LegacyActionTools.
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: SelectAllProjectExplorer_PluginUITest.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Tests that the Top Level Elements */ @Test public void testTopLevelElementsEntryNoDuplicates() { IActionBars actionBars = projectExplorer.getViewSite().getActionBars(); IMenuManager menuManager = actionBars.getMenuManager(); int topLevelElementsEntriesFound = 0; for (IContributionItem item : menuManager.getItems()) { if (item instanceof MenuManager) { String escapedMenuText = LegacyActionTools.removeMnemonics(((MenuManager) item).getMenuText()); if (escapedMenuText.equals("Top Level Elements")) { topLevelElementsEntriesFound++; } } } assertEquals("There was more than one 'Top Level Elements' entry in the navigator action bar.", topLevelElementsEntriesFound, 1); }
Example #2
Source File: SelectAllProjectExplorer_PluginUITest.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Returns the menu contribution titles of the project navigator context menu. * * This only includes {@link ActionContributionItem}s and {@link MenuManager}s. */ private List<String> getContextMenuContributions() { MenuManager menu = new MenuManager(); projectExplorer.getNavigatorActionService().fillContextMenu(menu); return Arrays.asList(menu.getItems()).stream() .map(i -> { if (i instanceof ActionContributionItem) { // use action name return ((ActionContributionItem) i).getAction().getText(); } else if (i instanceof MenuManager) { // use sub-menu title return ((MenuManager) i).getMenuText(); } else { // null for other types of contributions return null; } }) .filter(t -> null != t) // remove mnemonics (e.g. Close &Project -> Close Project)) .map(text -> LegacyActionTools.removeMnemonics(text)) .collect(Collectors.toList()); }
Example #3
Source File: TimeGraphFindDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Stores the button and its mnemonic in {@link #fMnemonicButtonMap}. * * @param button * button whose mnemonic has to be stored */ private void storeButtonWithMnemonicInMap(Button button) { char mnemonic = LegacyActionTools.extractMnemonic(button.getText()); if (mnemonic != LegacyActionTools.MNEMONIC_NONE) { fMnemonicButtonMap.put(new Character(Character.toLowerCase(mnemonic)), button); } }
Example #4
Source File: OptionsConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Constructs a new instance of PreferenceTreeNode according to the parameters. * <p> * The <code>label</code> and the <code>key</code> must not be <code>null</code> if the node * has a corresponding UI control. * </p> * * @param label the label text * @param key the key * @param controlType the type of UI control. * @param showAllChildren tells whether all children should be shown even if just one child * matches the filter. */ public PreferenceTreeNode(String label, Key key, int controlType, boolean showAllChildren) { super(); if (controlType != NONE && (label == null || key == null)) { throw new IllegalArgumentException(); } if (label == null) { label= ""; //$NON-NLS-1$ } fLabel= LegacyActionTools.removeMnemonics(label); fKey= key; fControlType= controlType; fShowAllChildren= showAllChildren; }
Example #5
Source File: Strings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static String removeMnemonicIndicator(String string) { return LegacyActionTools.removeMnemonics(string); }
Example #6
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 3 votes |
/** * Sets the given text and image to the label. * * @param text * the new text or null * @param image * the new image */ private void doRefresh(String text, Image image) { if ( text != null ) { text = LegacyActionTools.escapeMnemonics(text); } label.setText(text); label.setImage(image); }
Example #7
Source File: CompletionProposalCategory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Returns the name of the described extension * without mnemonic hint in order to be displayed * in a message. * * @return Returns the name */ public String getDisplayName() { return LegacyActionTools.removeMnemonics(fName); }