1 11 package org.eclipse.ui.internal.part.services; 12 13 import java.io.File ; 14 import java.net.URL ; 15 16 import org.eclipse.core.runtime.Path; 17 import org.eclipse.core.runtime.Platform; 18 import org.eclipse.jface.resource.ImageDescriptor; 19 import org.eclipse.ui.internal.part.components.services.IPluginResources; 20 import org.osgi.framework.Bundle; 21 22 25 public class PluginResources implements IPluginResources { 26 27 private Bundle bundle; 28 29 public PluginResources(Bundle pluginBundle) { 30 bundle = pluginBundle; 31 } 32 33 36 public ImageDescriptor getImage(String path) { 37 return ImageDescriptor.createFromURL(getPluginURL(path)); 38 } 39 40 43 public URL getPluginURL(String path) { 44 return Platform.find(bundle, new Path(path)); 45 } 46 47 50 public File getStateFile(String path) { 51 return Platform.getStateLocation(bundle).append(path).toFile(); 52 } 53 54 } 55 | Popular Tags |