Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2018-04-19 20:02:30 +0000
committerMickael Istria2018-04-19 20:11:07 +0000
commitda86552b33ff5d3dbf392c1bcec8545208d7cd2c (patch)
treedc7fb2a97d5c1833ddce2e8117c4eca287045fd3
parentd353d2648d4e1313a0c76cbd2333ead791caa3bb (diff)
downloadeclipse.platform.text-da86552b33ff5d3dbf392c1bcec8545208d7cd2c.tar.gz
eclipse.platform.text-da86552b33ff5d3dbf392c1bcec8545208d7cd2c.tar.xz
eclipse.platform.text-da86552b33ff5d3dbf392c1bcec8545208d7cd2c.zip
Bug 533729 - Cut/Copy/Paste on textual editors context menu miss iconsI20180420-2000I20180419-2000
Change-Id: I4198436202aea56d89f34cdded601f0fc2bb4d0f Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
index ac9dd61766a..1a01cdbd642 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -206,6 +206,7 @@ import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.actions.CommandNotMappedException;
import org.eclipse.ui.actions.ContributedAction;
+import org.eclipse.ui.commands.ICommandImageService;
import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.dnd.IDragAndDropService;
import org.eclipse.ui.internal.texteditor.EditPosition;
@@ -5692,23 +5693,27 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Cut.", this, ITextOperationTarget.CUT); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
+ updateImages(action, IWorkbenchCommandConstants.EDIT_CUT);
setAction(ITextEditorActionConstants.CUT, action);
setAction(IWorkbenchCommandConstants.EDIT_COPY, null);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Copy.", this, ITextOperationTarget.COPY, true); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
+ updateImages(action, IWorkbenchCommandConstants.EDIT_COPY);
setAction(ITextEditorActionConstants.COPY, action);
setAction(IWorkbenchCommandConstants.EDIT_PASTE, null);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Paste.", this, ITextOperationTarget.PASTE); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
+ updateImages(action, IWorkbenchCommandConstants.EDIT_PASTE);
setAction(ITextEditorActionConstants.PASTE, action);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Delete.", this, ITextOperationTarget.DELETE); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
+ updateImages(action, IWorkbenchCommandConstants.EDIT_DELETE);
setAction(ITextEditorActionConstants.DELETE, action);
action= new DeleteLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.DeleteLine.", this, DeleteLineAction.WHOLE, false); //$NON-NLS-1$
@@ -5787,11 +5792,13 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Print.", this, ITextOperationTarget.PRINT, true); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.PRINT_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PRINT);
+ updateImages(action, IWorkbenchCommandConstants.FILE_PRINT);
setAction(ITextEditorActionConstants.PRINT, action);
action= new FindReplaceAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindReplace.", this); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
+ updateImages(action, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
setAction(ITextEditorActionConstants.FIND, action);
action= new FindNextAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindNext.", this, true); //$NON-NLS-1$
@@ -5820,6 +5827,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
action= new RevertToSavedAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Revert.", this); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.REVERT_TO_SAVED_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REVERT);
+ updateImages(action, IWorkbenchCommandConstants.FILE_REVERT);
setAction(ITextEditorActionConstants.REVERT_TO_SAVED, action);
action= new GotoLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.GotoLine.", this); //$NON-NLS-1$
@@ -5977,6 +5985,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
});
openProperties.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);
+ updateImages(openProperties, IWorkbenchCommandConstants.FILE_PROPERTIES);
setAction(ITextEditorActionConstants.PROPERTIES, openProperties);
markAsContentDependentAction(ITextEditorActionConstants.UNDO, true);
@@ -6023,6 +6032,19 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
setActionActivationCode(ITextEditorActionConstants.SHIFT_LEFT, '\t', -1, SWT.SHIFT);
}
+ private void updateImages(IAction action, String commandId) {
+ if (action.getImageDescriptor() != null) {
+ return;
+ }
+ ICommandImageService imgService = getSite().getService(ICommandImageService.class);
+ if (imgService == null) {
+ return;
+ }
+ action.setImageDescriptor(imgService.getImageDescriptor(commandId));
+ action.setDisabledImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_DISABLED));
+ action.setHoverImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_HOVER));
+ }
+
/**
* Convenience method to add the action installed under the given action id to the given menu.
* @param menu the menu to add the action to

Back to the top