Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Fedorov2019-07-18 07:35:18 +0000
committerAlexander Fedorov2019-07-18 07:35:18 +0000
commit47770c4052845dd93da22a50c254eece94b04c45 (patch)
tree38d8ba1772a78e7d703f358a7b56816ec2524030 /org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples
parent9a92492875f68e70d213a7e319b14b83a19652d8 (diff)
downloadeclipse.platform.text-47770c4052845dd93da22a50c254eece94b04c45.tar.gz
eclipse.platform.text-47770c4052845dd93da22a50c254eece94b04c45.tar.xz
eclipse.platform.text-47770c4052845dd93da22a50c254eece94b04c45.zip
Bug 548799 - Replace usage of AbstractUIPlugin#imageDescriptorFromPluginY20190718-0905
Use ResourceLocator#imageDescriptorFromBundle Change-Id: Ia98ce7df28405d4691ea33ea9d3a03b97b9ec827 Signed-off-by: Alexander Fedorov <alexander.fedorov@arsysop.ru>
Diffstat (limited to 'org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples')
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java7
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java8
2 files changed, 8 insertions, 7 deletions
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java
index 79f567c28..e33b5de12 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Alexander Fedorov <alexander.fedorov@arsysop.ru> - Bug 548799
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
@@ -25,13 +26,13 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.ResourceLocator;
import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.ui.examples.javaeditor.JavaEditorExamplePlugin;
import org.eclipse.ui.examples.templateeditor.template.XMLContextType;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
@@ -102,7 +103,7 @@ public class TemplateEditorUI {
}
public static ImageDescriptor imageDescriptorFromPlugin(String string, String default_image) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(string, default_image);
+ return ResourceLocator.imageDescriptorFromBundle(string, default_image).orElse(null);
}
public IPreferenceStore getPreferenceStore() {
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java
index 44b95349e..d2eacbcf8 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,13 +10,14 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Alexander Fedorov <alexander.fedorov@arsysop.ru> - Bug 548799
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.template;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.ResourceLocator;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -114,8 +115,7 @@ public class XMLCompletionProcessor extends TemplateCompletionProcessor {
ImageRegistry registry= TemplateEditorUI.getDefault().getImageRegistry();
Image image= registry.get(DEFAULT_IMAGE);
if (image == null) {
- ImageDescriptor desc= TemplateEditorUI.imageDescriptorFromPlugin("org.eclipse.ui.examples.javaeditor", DEFAULT_IMAGE); //$NON-NLS-1$
- registry.put(DEFAULT_IMAGE, desc);
+ ResourceLocator.imageDescriptorFromBundle(getClass(), DEFAULT_IMAGE).ifPresent(d -> registry.put(DEFAULT_IMAGE, d));
image= registry.get(DEFAULT_IMAGE);
}
return image;

Back to the top