Java Code Examples for org.eclipse.jface.action.IAction#setDisabledImageDescriptor()
The following examples show how to use
org.eclipse.jface.action.IAction#setDisabledImageDescriptor() .
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: XFilteredTree.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Create the button that clears the text. * * @param parent parent <code>Composite</code> of toolbar button */ private void createClearTextOld(Composite parent) { // only create the button if the text widget doesn't support one // natively if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) { filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL); filterToolBar.createControl(parent); IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$ /** * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { clearText(); } }; clearTextAction.setToolTipText(XViewerText.get("button.clear")); //$NON-NLS-1$ clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON)); clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON)); filterToolBar.add(clearTextAction); } }
Example 2
Source File: FilteredTreeComposite.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Create the button that clears the text. * * @param parent parent <code>Composite</code> of toolbar button */ private void createClearText(Composite parent) { // only create the button if the text widget doesn't support one // natively if ((filterText.getStyle() & SWT.CANCEL) == 0) { filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL); filterToolBar.createControl(parent); IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$ @Override public void run() { clearText(); } }; clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip); clearTextAction.setImageDescriptor(XViewerImageCache.getImageDescriptor("clear.gif")); //$NON-NLS-1$ clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON)); filterToolBar.add(clearTextAction); } }
Example 3
Source File: MenuProvider.java From olca-app with Mozilla Public License 2.0 | 6 votes |
/** Undo, Redo, and Delete */ private void addEditActions(final IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); IAction undoAction = registry.getAction(ActionFactory.UNDO.getId()); undoAction.setImageDescriptor(Icon.UNDO.descriptor()); undoAction.setDisabledImageDescriptor(Icon.UNDO_DISABLED.descriptor()); IAction redoAction = registry.getAction(ActionFactory.REDO.getId()); redoAction.setImageDescriptor(Icon.REDO.descriptor()); redoAction.setDisabledImageDescriptor(Icon.REDO_DISABLED.descriptor()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, undoAction); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, redoAction); IAction deleteAction = registry.getAction(ActionFactory.DELETE.getId()); deleteAction.setText(M.Delete); deleteAction.setImageDescriptor(Icon.DELETE.descriptor()); deleteAction.setDisabledImageDescriptor(Icon.DELETE_DISABLED.descriptor()); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, deleteAction); }
Example 4
Source File: ShowWhitespaceCharactersActionContributor.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void contributeActions(XtextEditor editor) { IToolBarManager toolBarManager = editor.getEditorSite().getActionBars().getToolBarManager(); IAction action = editor.getAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS); action.setImageDescriptor(imageHelper .getImageDescriptor("full/etool16/show_whitespace_chars.gif")); action.setDisabledImageDescriptor(imageHelper .getImageDescriptor("full/dtool16/show_whitespace_chars.gif")); if(toolBarManager.find(action.getId())==null) { toolBarManager.add(new ActionContributionItemExtension(action)); // toolBarManager.add(action); } }
Example 5
Source File: JavaPluginImages.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static void setImageDescriptors(IAction action, String type, String relPath) { ImageDescriptor id= create("d" + type, relPath, false); //$NON-NLS-1$ if (id != null) action.setDisabledImageDescriptor(id); /* * id= create("c" + type, relPath, false); //$NON-NLS-1$ * if (id != null) * action.setHoverImageDescriptor(id); */ ImageDescriptor descriptor= create("e" + type, relPath, true); //$NON-NLS-1$ action.setHoverImageDescriptor(descriptor); action.setImageDescriptor(descriptor); }
Example 6
Source File: JavaCompareUtilities.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
static void initAction(IAction a, ResourceBundle bundle, String prefix) { String labelKey= "label"; //$NON-NLS-1$ String tooltipKey= "tooltip"; //$NON-NLS-1$ String imageKey= "image"; //$NON-NLS-1$ String descriptionKey= "description"; //$NON-NLS-1$ if (prefix != null && prefix.length() > 0) { labelKey= prefix + labelKey; tooltipKey= prefix + tooltipKey; imageKey= prefix + imageKey; descriptionKey= prefix + descriptionKey; } a.setText(getString(bundle, labelKey, labelKey)); a.setToolTipText(getString(bundle, tooltipKey, null)); a.setDescription(getString(bundle, descriptionKey, null)); String relPath= getString(bundle, imageKey, null); if (relPath != null && relPath.trim().length() > 0) { String dPath; String ePath; if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$ String path= relPath.substring(1); dPath= 'd' + path; ePath= 'e' + path; } else { dPath= "dlcl16/" + relPath; //$NON-NLS-1$ ePath= "elcl16/" + relPath; //$NON-NLS-1$ } ImageDescriptor id= JavaCompareUtilities.getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87) if (id != null) a.setDisabledImageDescriptor(id); id= JavaCompareUtilities.getImageDescriptor(ePath); if (id != null) { a.setImageDescriptor(id); a.setHoverImageDescriptor(id); } } }