本文整理汇总了Java中org.eclipse.jface.resource.ImageDescriptor.createFromURL方法的典型用法代码示例。如果您正苦于以下问题:Java ImageDescriptor.createFromURL方法的具体用法?Java ImageDescriptor.createFromURL怎么用?Java ImageDescriptor.createFromURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.ImageDescriptor
的用法示例。
在下文中一共展示了ImageDescriptor.createFromURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createImageDescriptor
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
public static ImageDescriptor createImageDescriptor(String path, String pluginId) {
if (path == null) {
/* fall back if path null , so avoid NPE in eclipse framework */
return ImageDescriptor.getMissingImageDescriptor();
}
if (pluginId == null) {
/* fall back if pluginId null , so avoid NPE in eclipse framework */
return ImageDescriptor.getMissingImageDescriptor();
}
Bundle bundle = Platform.getBundle(pluginId);
if (bundle == null) {
/*
* fall back if bundle not available, so avoid NPE in eclipse
* framework
*/
return ImageDescriptor.getMissingImageDescriptor();
}
URL url = FileLocator.find(bundle, new Path(path), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
return imageDesc;
}
示例2: createIcons
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private void createIcons() {
icons = new HashMap<String, Image>(7);
final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.generator");
for (IConfigurationElement e : eles) {
final String identity = e.getAttribute("id");
final String icon = e.getAttribute("icon");
if (icon !=null) {
final String cont = e.getContributor().getName();
final Bundle bundle= Platform.getBundle(cont);
final URL entry = bundle.getEntry(icon);
final ImageDescriptor des = ImageDescriptor.createFromURL(entry);
icons.put(identity, des.createImage());
}
}
}
示例3: fillContextMenu
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
@Override
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
ActionContributionItem pasteContribution = getPasteContribution(menu.getItems());
menu.remove(pasteContribution);
IAction pasteAction = new Action(PASTE_ACTION_TEXT) {
@Override
public void run() {
IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
.getService(IHandlerService.class);
try {
JobCopyParticipant.setCopiedFileList(new ArrayList<>());
handlerService.executeCommand(PASTE_COMMAND_ID, null);
} catch (Exception exception) {
logger.warn("Error while pasting job files :: {}",exception.getMessage());
}
}
};
pasteAction.setAccelerator(SWT.MOD1 | 'v');
Bundle bundle = Platform.getBundle(MENU_PLUGIN_NAME);
URL imagePath = BundleUtility.find(bundle,ImagePathConstant.PASTE_IMAGE_PATH.getValue());
ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imagePath);
pasteAction.setImageDescriptor(imageDescriptor);
menu.insertAfter(COPY_ACTION_ID, pasteAction);
}
示例4: getComponentToAddInContainer
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private CombinedTemplateCreationEntry getComponentToAddInContainer(ELTGraphicalEditor eLEtlGraphicalEditor,
Component componentConfig) {
Class<?> clazz = DynamicClassProcessor.INSTANCE.createClass(componentConfig);
CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry(componentConfig.getNameInPalette(),
null, clazz, new SimpleFactory(clazz),
ImageDescriptor.createFromURL(eLEtlGraphicalEditor.prepareIconPathURL(componentConfig
.getPaletteIconPath())), ImageDescriptor.createFromURL(eLEtlGraphicalEditor
.prepareIconPathURL(componentConfig.getPaletteIconPath())));
return component;
}
示例5: createPaletteContainer
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
/**
* Creates the palette container.
*
* @param CategoryName
* the category name
* @return the palette drawer
*/
public PaletteDrawer createPaletteContainer(String CategoryName) {
String name = CategoryName.substring(0, 1).toUpperCase()
+ CategoryName.substring(1).toLowerCase();
PaletteDrawer p = new PaletteDrawer(name, ImageDescriptor.createFromURL(prepareIconPathURL("/icons/"+ name + "_categoryIcon.png")));
p.setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
return p;
}
示例6: createShapesDrawer
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private void createShapesDrawer(PaletteRoot palette) throws RuntimeException, SAXException, IOException {
Map<String, PaletteDrawer> categoryPaletteConatiner = new HashMap<>();
for (CategoryType category : CategoryType.values()) {
if(category.name().equalsIgnoreCase(Constants.UNKNOWN_COMPONENT_CATEGORY)){
continue;
}
PaletteDrawer p = createPaletteContainer(category.name());
addContainerToPalette(palette, p);
categoryPaletteConatiner.put(category.name(), p);
}
List<Component> componentsConfig = XMLConfigUtil.INSTANCE.getComponentConfig();
//To show the components in sorted order in palette
Collections.sort(componentsConfig, new Comparator<Component>() {
public int compare(Component component1, Component component2) {
return component1.getNameInPalette().compareToIgnoreCase(component2.getNameInPalette());
};
});
for (Component componentConfig : componentsConfig) {
Class<?> clazz = DynamicClassProcessor.INSTANCE.createClass(componentConfig);
if(componentConfig.getName().equalsIgnoreCase(Constants.UNKNOWN_COMPONENT)){
continue;
}
CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry(
componentConfig.getNameInPalette(), null, clazz,
new SimpleFactory(clazz),
ImageDescriptor.createFromURL(
prepareIconPathURL(componentConfig.getPaletteIconPath())),
ImageDescriptor.createFromURL(
prepareIconPathURL(componentConfig.getPaletteIconPath())));
categoryPaletteConatiner.get(componentConfig.getCategory().name()).add(component);
}
}
示例7: getImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private Image getImage() {
String path = "icons/ksp.gif";
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
URL url = FileLocator.find(bundle, new Path(path), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
return imageDesc.createImage();
}
示例8: declareRegistryImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private final static void declareRegistryImage(String key, String path) {
ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
Bundle bundle = Platform.getBundle(EditorConfigPlugin.PLUGIN_ID);
URL url = null;
if (bundle != null) {
url = FileLocator.find(bundle, new Path(path), null);
if (url != null) {
desc = ImageDescriptor.createFromURL(url);
}
}
imageRegistry.put(key, desc);
}
示例9: registerImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private Image registerImage(String key) {
try {
IPath path = new Path("images/" + key); //$NON-NLS-1$
URL url = FileLocator.find(this.getBundle(), path, null);
if (url != null) {
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
getImageRegistry().put(key, desc);
return getImageRegistry().get(key);
}
} catch (Exception e) {
// ignored
}
return null;
}
示例10: getImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
/**
* Get image contained in the 'images' folder of the plugin
*/
static Image getImage(String name) {
Bundle bundle = Platform.getBundle(PandionJConstants.PLUGIN_ID);
URL imagePath = FileLocator.find(bundle, new Path(PandionJConstants.IMAGE_FOLDER + "/" + name), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(imagePath);
return imageDesc.createImage();
}
示例11: getImageDescriptor
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
@Override
public ImageDescriptor getImageDescriptor ()
{
return ImageDescriptor.createFromURL ( Activator.getDefault ().getBundle ().getEntry ( "/icons/delete.gif" ) );
}
示例12: createConnectionActions
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private void createConnectionActions() {
connectors.clear();
String lastId = Activator.getDefault().getPreferenceStore().getString(DevicePreferenceConstants.STREAM_ID);
final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.stream");
for (IConfigurationElement e : eles) {
CheckableActionGroup group = new CheckableActionGroup();
try {
final IStreamConnection<ILazyDataset> connection = (IStreamConnection<ILazyDataset>)e.createExecutableExtension("stream");
connectors.add(connection);
connection.setId(e.getAttribute("id"));
connection.setLabel(e.getAttribute("label"));
final String iconPath = e.getAttribute("icon");
ImageDescriptor icon=null;
if (iconPath!=null) {
final String id = e.getContributor().getName();
final Bundle bundle= Platform.getBundle(id);
final URL entry = bundle.getEntry(iconPath);
icon = ImageDescriptor.createFromURL(entry);
}
final MenuAction menu = new MenuAction(connection.getLabel());
final IAction connect = new Action(connection.getLabel(), IAction.AS_CHECK_BOX) {
@Override
public void run() {
connect(connection);
}
};
connect.setImageDescriptor(icon);
connect.setChecked(lastId!=null && lastId.equals(connection.getId()));
group.add(connect);
menu.add(connect);
menu.setSelectedAction(connect);
final IAction configure = new Action("Configure...") {
@Override
public void run() {
configure(connection);
}
};
menu.add(configure);
getViewSite().getActionBars().getToolBarManager().add(menu);
} catch (Exception ne) {
logger.error("Problem creating stream connection for "+e, ne);
}
getViewSite().getActionBars().getToolBarManager().add(new Separator());
}
}
示例13: createImageDescriptor
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private ImageDescriptor createImageDescriptor() {
Bundle bundle = FrameworkUtil.getBundle(ViewLabelProvider.class);
URL url = FileLocator.find(bundle, new Path("icons/folder.png"), null);
return ImageDescriptor.createFromURL(url);
}
示例14: DepcyGraphView
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
public DepcyGraphView() {
projectAction = new ProjectAction(Messages.DepcyGraphView_project, ImageDescriptor.createFromURL(
Activator.getContext().getBundle().getResource(FILE.ICONBALLBLUE)));
remoteAction = new ToggleAction(Messages.DepcyGraphView_remote, ImageDescriptor.createFromURL(
Activator.getContext().getBundle().getResource(FILE.ICONBALLGREEN)));
}
示例15: getCreateImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private void getCreateImage(String path) {
URL url = ModelActivator.getDefault().getBundle().getResource(path);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
icon = imageDesc.createImage();
}