diff options
Diffstat (limited to 'bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java')
-rw-r--r-- | bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java index 8345362fb..b8eef4087 100644 --- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java +++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java @@ -29,95 +29,95 @@ import org.osgi.framework.BundleContext; import org.osgi.util.tracker.ServiceTracker; public class JSchUIPlugin extends AbstractUIPlugin{ - public static final String ID="org.eclipse.jsch.ui"; //$NON-NLS-1$ - public static final String DECORATOR_ID="org.eclipse.jsch.ui.decorator"; //$NON-NLS-1$ - - private static Hashtable<String, ImageDescriptor> imageDescriptors = new Hashtable<>(20); - /** - * The singleton plug-in instance - */ - private static JSchUIPlugin plugin; - private ServiceTracker<?, ?> tracker; - - public JSchUIPlugin(){ - super(); - plugin=this; - } - - /** - * Returns the singleton plug-in instance. - * - * @return the plugin instance - */ - public static JSchUIPlugin getPlugin(){ - return plugin; - } - - /** - * Returns the image descriptor for the given image ID. - * Returns null if there is no such image. - * @param id the id of the image descriptor - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String id){ - return imageDescriptors.get(id); - } - - /** - * Creates an image and places it in the image registry. - */ - protected void createImageDescriptor(String id){ - URL url=FileLocator.find(JSchUIPlugin.getPlugin().getBundle(), new Path( - IUIConstants.ICON_PATH+id), null); - ImageDescriptor desc=ImageDescriptor.createFromURL(url); - imageDescriptors.put(id, desc); - } - - /** - * Convenience method to get an image descriptor for an extension - * - * @param extension the extension declaring the image - * @param subdirectoryAndFilename the path to the image - * @return the image - */ - public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) { - URL fullPathString = FileLocator.find(Platform.getBundle(extension.getNamespaceIdentifier()), new Path(subdirectoryAndFilename), null); - return ImageDescriptor.createFromURL(fullPathString); - } - - /** - * Initializes the table of images used in this plugin. - */ - private void initializeImages() { - createImageDescriptor(IUIConstants.IMG_KEY_LOCK); - } - - @Override + public static final String ID="org.eclipse.jsch.ui"; //$NON-NLS-1$ + public static final String DECORATOR_ID="org.eclipse.jsch.ui.decorator"; //$NON-NLS-1$ + + private static Hashtable<String, ImageDescriptor> imageDescriptors = new Hashtable<>(20); + /** + * The singleton plug-in instance + */ + private static JSchUIPlugin plugin; + private ServiceTracker<?, ?> tracker; + + public JSchUIPlugin(){ + super(); + plugin=this; + } + + /** + * Returns the singleton plug-in instance. + * + * @return the plugin instance + */ + public static JSchUIPlugin getPlugin(){ + return plugin; + } + + /** + * Returns the image descriptor for the given image ID. + * Returns null if there is no such image. + * @param id the id of the image descriptor + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String id){ + return imageDescriptors.get(id); + } + + /** + * Creates an image and places it in the image registry. + */ + protected void createImageDescriptor(String id){ + URL url=FileLocator.find(JSchUIPlugin.getPlugin().getBundle(), new Path( + IUIConstants.ICON_PATH+id), null); + ImageDescriptor desc=ImageDescriptor.createFromURL(url); + imageDescriptors.put(id, desc); + } + + /** + * Convenience method to get an image descriptor for an extension + * + * @param extension the extension declaring the image + * @param subdirectoryAndFilename the path to the image + * @return the image + */ + public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) { + URL fullPathString = FileLocator.find(Platform.getBundle(extension.getNamespaceIdentifier()), new Path(subdirectoryAndFilename), null); + return ImageDescriptor.createFromURL(fullPathString); + } + + /** + * Initializes the table of images used in this plugin. + */ + private void initializeImages() { + createImageDescriptor(IUIConstants.IMG_KEY_LOCK); + } + + @Override public void start(BundleContext context) throws Exception { - super.start(context); + super.start(context); - initializeImages(); + initializeImages(); - IPreferenceStore store = getPreferenceStore(); - if (store.getBoolean(IUIConstants.PREF_FIRST_STARTUP)) { - store.setValue(IUIConstants.PREF_FIRST_STARTUP, false); - } + IPreferenceStore store = getPreferenceStore(); + if (store.getBoolean(IUIConstants.PREF_FIRST_STARTUP)) { + store.setValue(IUIConstants.PREF_FIRST_STARTUP, false); + } - tracker = new ServiceTracker(getBundle().getBundleContext(),IJSchService.class.getName(), null); - tracker.open(); - } + tracker = new ServiceTracker(getBundle().getBundleContext(),IJSchService.class.getName(), null); + tracker.open(); + } - @Override + @Override public void stop(BundleContext context) throws Exception{ - super.stop(context); - tracker.close(); - } + super.stop(context); + tracker.close(); + } - public IJSchService getJSchService() { - return (IJSchService)tracker.getService(); - } + public IJSchService getJSchService() { + return (IJSchService)tracker.getService(); + } - public URL getImageUrl(String relative){ - return FileLocator.find(Platform.getBundle(ID), new Path(IUIConstants.ICON_PATH + relative), null); - } + public URL getImageUrl(String relative){ + return FileLocator.find(Platform.getBundle(ID), new Path(IUIConstants.ICON_PATH + relative), null); + } } |