Skip to content

Commit

Permalink
[all] Replace the calls to the deprecated function AbstractUIPlugin#i…
Browse files Browse the repository at this point in the history
…mageDescriptorFromPlugin.

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Sep 22, 2019
1 parent d3d62a7 commit 3d29e46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceLocator;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;

Expand Down Expand Up @@ -104,7 +105,7 @@ public Image getImage(String imagePath) {
public ImageDescriptor getImageDescriptor(String imagePath) {
ImageDescriptor descriptor = getImageRegistry().getDescriptor(imagePath);
if (descriptor == null) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, imagePath);
descriptor = ResourceLocator.imageDescriptorFromBundle(PLUGIN_ID, imagePath).orElse(null);
if (descriptor != null) {
getImageRegistry().put(imagePath, descriptor);
}
Expand Down
Expand Up @@ -38,6 +38,7 @@
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceLocator;
import org.eclipse.osgi.internal.debug.Debug;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
Expand Down Expand Up @@ -130,7 +131,7 @@ public Image getImage(String imagePath) {
public ImageDescriptor getImageDescriptor(String imagePath) {
ImageDescriptor descriptor = getImageRegistry().getDescriptor(imagePath);
if (descriptor == null) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SARLEclipsePlugin.PLUGIN_ID, imagePath);
descriptor = ResourceLocator.imageDescriptorFromBundle(SARLEclipsePlugin.PLUGIN_ID, imagePath).orElse(null);
if (descriptor != null) {
getImageRegistry().put(imagePath, descriptor);
}
Expand Down
Expand Up @@ -36,6 +36,7 @@
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.swt.SWT;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.events.FocusAdapter;
Expand All @@ -58,7 +59,6 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.xtext.builder.EclipseOutputConfigurationProvider;
import org.eclipse.xtext.builder.preferences.BuilderPreferenceAccess;
import org.eclipse.xtext.generator.OutputConfiguration;
Expand Down Expand Up @@ -398,7 +398,7 @@ protected ImageDescriptor getImageDescriptor(String imagePath) {
final ImageRegistry registry = activator.getImageRegistry();
ImageDescriptor descriptor = registry.getDescriptor(imagePath);
if (descriptor == null) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(activator.getBundle().getSymbolicName(), imagePath);
descriptor = ResourceLocator.imageDescriptorFromBundle(activator.getBundle().getSymbolicName(), imagePath).orElse(null);
if (descriptor != null) {
registry.put(imagePath, descriptor);
}
Expand Down

0 comments on commit 3d29e46

Please sign in to comment.