Skip to content

Commit 7b1ad9f

Browse files
committed
Remove explicit disabled icons from org.eclipse.ui.workbench.texteditor
Use on-the-fly-generated disabled version of SVG-rasterized icons instead.
1 parent af592e8 commit 7b1ad9f

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

bundles/org.eclipse.ui.workbench.texteditor/plugin.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -521,27 +521,22 @@
521521
</image>
522522
<image
523523
commandId="org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters"
524-
disabledIcon="$nl$/icons/full/dtool16/show_whitespace_chars.png"
525524
icon="$nl$/icons/full/etool16/show_whitespace_chars.svg">
526525
</image>
527526
<image
528527
commandId="org.eclipse.ui.edit.text.toggleWordWrap"
529-
disabledIcon="$nl$/icons/full/dtool16/wordwrap.png"
530528
icon="$nl$/icons/full/etool16/wordwrap.svg">
531529
</image>
532530
<image
533531
commandId="org.eclipse.ui.edit.text.toggleBlockSelectionMode"
534-
disabledIcon="$nl$/icons/full/dtool16/block_selection_mode.png"
535532
icon="$nl$/icons/full/etool16/block_selection_mode.svg">
536533
</image>
537534
<image
538535
commandId="org.eclipse.ui.edit.text.upperCase"
539-
disabledIcon="icons/full/dtool16/toUpper.png"
540536
icon="icons/full/etool16/toUpper.svg">
541537
</image>
542538
<image
543539
commandId="org.eclipse.ui.edit.text.lowerCase"
544-
disabledIcon="icons/full/dtool16/toLower.png"
545540
icon="icons/full/etool16/toLower.svg">
546541
</image>
547542
</extension>
@@ -1294,7 +1289,6 @@
12941289
toolbarPath="Normal/Presentation"
12951290
id="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"
12961291
definitionId="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"
1297-
disabledIcon="$nl$/icons/full/dtool16/segment_edit.png"
12981292
icon="$nl$/icons/full/etool16/segment_edit.svg"
12991293
helpContextId="org.eclipse.ui.only_show_selected_element_action_context"
13001294
label="%onlyShowSelectedElement.label"
@@ -1304,7 +1298,6 @@
13041298
<action
13051299
allowLabelUpdate="true"
13061300
definitionId="org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters"
1307-
disabledIcon="$nl$/icons/full/dtool16/show_whitespace_chars.png"
13081301
helpContextId="org.eclipse.ui.show_whitespace_characters_action_context"
13091302
icon="$nl$/icons/full/etool16/show_whitespace_chars.svg"
13101303
id="org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters"
@@ -1317,7 +1310,6 @@
13171310
<action
13181311
allowLabelUpdate="true"
13191312
definitionId="org.eclipse.ui.edit.text.toggleBlockSelectionMode"
1320-
disabledIcon="$nl$/icons/full/dtool16/block_selection_mode.png"
13211313
helpContextId="org.eclipse.ui.block_selection_mode_action_context"
13221314
icon="$nl$/icons/full/etool16/block_selection_mode.svg"
13231315
id="org.eclipse.ui.edit.text.toggleBlockSelectionMode"
@@ -1330,7 +1322,6 @@
13301322
<action
13311323
allowLabelUpdate="true"
13321324
definitionId="org.eclipse.ui.edit.text.toggleWordWrap"
1333-
disabledIcon="$nl$/icons/full/dtool16/wordwrap.png"
13341325
helpContextId="org.eclipse.ui.word_wrap_toggle_action_context"
13351326
icon="$nl$/icons/full/etool16/wordwrap.svg"
13361327
id="org.eclipse.ui.edit.text.toggleWordWrap"

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,10 @@ public void run() {
892892
removeTemplates();
893893
}
894894
};
895-
fRemoveAction.setImageDescriptor(TemplatesPageImages
896-
.getDescriptor(TemplatesPageImages.IMG_DLCL_TEMPLATE_DELETE));
897895
fRemoveAction.setImageDescriptor(TemplatesPageImages
898896
.getDescriptor(TemplatesPageImages.IMG_ELCL_TEMPLATE_DELETE));
897+
fRemoveAction.setDisabledImageDescriptor(TemplatesPageImages
898+
.getDescriptor(TemplatesPageImages.IMG_DLCL_TEMPLATE_DELETE));
899899
fRemoveAction.setToolTipText(TemplatesMessages.TemplatesPage_remove_tooltip);
900900

901901
fLinkWithEditorAction= new Action(TemplatesMessages.TemplatesPage_link_to_editor,

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesPageImages.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import org.osgi.framework.Bundle;
1919

20+
import org.eclipse.swt.SWT;
2021
import org.eclipse.swt.graphics.Image;
2122

2223
import org.eclipse.core.runtime.FileLocator;
@@ -54,11 +55,11 @@ class TemplatesPageImages {
5455

5556
public static final String IMG_ELCL_TEMPLATE_COLLAPSE_ALL = PREFIX_ELCL + "collapseall.svg"; //$NON-NLS-1$
5657

57-
public static final String IMG_DLCL_TEMPLATE_DELETE= PREFIX_DLCL + "delete_template.png"; //$NON-NLS-1$
58+
public static final String IMG_DLCL_TEMPLATE_DELETE = PREFIX_DLCL + "delete_template.svg"; //$NON-NLS-1$
5859

59-
public static final String IMG_DLCL_TEMPLATE_EDIT= PREFIX_DLCL + "edit_template.png"; //$NON-NLS-1$
60+
public static final String IMG_DLCL_TEMPLATE_EDIT = PREFIX_DLCL + "edit_template.svg"; //$NON-NLS-1$
6061

61-
public static final String IMG_DLCL_TEMPLATE_INSERT= PREFIX_DLCL + "insert_template.png"; //$NON-NLS-1$
62+
public static final String IMG_DLCL_TEMPLATE_INSERT = PREFIX_DLCL + "insert_template.svg"; //$NON-NLS-1$
6263

6364
public static final String IMG_OBJ_PREVIEW = PREFIX_OBJ + "preview.svg"; //$NON-NLS-1$
6465

@@ -77,8 +78,6 @@ class TemplatesPageImages {
7778
// slashes correct
7879
private final static String ELCL= ICONS_PATH + "elcl16/"; //$NON-NLS-1$
7980

80-
private final static String DLCL= ICONS_PATH + "dlcl16/"; //$NON-NLS-1$
81-
8281
private final static String OBJ= ICONS_PATH + "obj16/"; //$NON-NLS-1$
8382

8483
/**
@@ -87,12 +86,9 @@ class TemplatesPageImages {
8786
private static void declareImages() {
8887
// Ant Editor images
8988
declareRegistryImage(IMG_ELCL_TEMPLATE_NEW, ELCL + "new_template.svg"); //$NON-NLS-1$
90-
declareRegistryImage(IMG_ELCL_TEMPLATE_INSERT, ELCL + "insert_template.svg"); //$NON-NLS-1$
91-
declareRegistryImage(IMG_DLCL_TEMPLATE_INSERT, DLCL + "insert_template.png"); //$NON-NLS-1$
92-
declareRegistryImage(IMG_ELCL_TEMPLATE_DELETE, ELCL + "delete_template.svg"); //$NON-NLS-1$
93-
declareRegistryImage(IMG_DLCL_TEMPLATE_DELETE, DLCL + "delete_template.png"); //$NON-NLS-1$
94-
declareRegistryImage(IMG_ELCL_TEMPLATE_EDIT, ELCL + "edit_template.svg"); //$NON-NLS-1$
95-
declareRegistryImage(IMG_DLCL_TEMPLATE_EDIT, DLCL + "edit_template.png"); //$NON-NLS-1$
89+
declareRegistryImage(IMG_ELCL_TEMPLATE_INSERT, IMG_DLCL_TEMPLATE_INSERT, ELCL + "insert_template.svg"); //$NON-NLS-1$
90+
declareRegistryImage(IMG_ELCL_TEMPLATE_DELETE, IMG_DLCL_TEMPLATE_DELETE, ELCL + "delete_template.svg"); //$NON-NLS-1$
91+
declareRegistryImage(IMG_ELCL_TEMPLATE_EDIT, IMG_DLCL_TEMPLATE_EDIT, ELCL + "edit_template.svg"); //$NON-NLS-1$
9692
declareRegistryImage(IMG_ELCL_TEMPLATE_LINK, ELCL + "link_to_editor.svg"); //$NON-NLS-1$
9793
declareRegistryImage(IMG_ELCL_TEMPLATE_COLLAPSE_ALL, ELCL + "collapseall.svg"); //$NON-NLS-1$
9894

@@ -109,6 +105,10 @@ private static void declareImages() {
109105
* class is found (i.e. typically the packages directory)
110106
*/
111107
private final static void declareRegistryImage(String key, String path) {
108+
declareRegistryImage(key, null, path);
109+
}
110+
111+
private final static void declareRegistryImage(String key, String disabledKey, String path) {
112112
ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
113113
Bundle bundle= Platform.getBundle(TextEditorPlugin.PLUGIN_ID);
114114
URL url= null;
@@ -117,6 +117,10 @@ private final static void declareRegistryImage(String key, String path) {
117117
desc= ImageDescriptor.createFromURL(url);
118118
}
119119
fgImageRegistry.put(key, desc);
120+
if (disabledKey != null) {
121+
ImageDescriptor disabledDescriptor = ImageDescriptor.createWithFlags(desc, SWT.IMAGE_DISABLE);
122+
fgImageRegistry.put(disabledKey, disabledDescriptor);
123+
}
120124
}
121125

122126
/**

0 commit comments

Comments
 (0)