本文整理汇总了Java中org.eclipse.ui.model.IWorkbenchAdapter.getImageDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkbenchAdapter.getImageDescriptor方法的具体用法?Java IWorkbenchAdapter.getImageDescriptor怎么用?Java IWorkbenchAdapter.getImageDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.model.IWorkbenchAdapter
的用法示例。
在下文中一共展示了IWorkbenchAdapter.getImageDescriptor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImage
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
@Override
public Image getImage(Object element) {
//obtain the base image by querying the element
IWorkbenchAdapter adapter = getAdapter(element);
if (adapter == null) {
return null;
}
ImageDescriptor descriptor = adapter.getImageDescriptor(element);
if (descriptor == null) {
return null;
}
//add any annotations to the image descriptor
descriptor = decorateImage(descriptor, element);
try {
return resourceManager.createImage(descriptor);
} catch (Exception e) {
Log.log(e);
return null;
}
}
示例2: getImage
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
@Override
public final Image getImage(final Object inElement) {
// obtain the base image by querying the element
final IWorkbenchAdapter lAdapter = getAdapter(inElement);
if (lAdapter == null) {
return null;
}
ImageDescriptor lDescriptor = lAdapter.getImageDescriptor(inElement);
if (lDescriptor == null) {
return null;
}
// add any annotations to the image descriptor
lDescriptor = decorateImage(lDescriptor, inElement);
return (Image) getResourceManager().get(lDescriptor);
}
示例3: getWorkbenchImageDescriptor
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
/**
* Returns an image descriptor for a IAdaptable. The descriptor includes overlays, if specified (only error ticks apply).
* Returns <code>null</code> if no image could be found.
* @param adaptable the adaptable
* @param flags the image flags
* @return returns the image descriptor
*/
public ImageDescriptor getWorkbenchImageDescriptor(IAdaptable adaptable, int flags) {
IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter) adaptable.getAdapter(IWorkbenchAdapter.class);
if (wbAdapter == null) {
return null;
}
ImageDescriptor descriptor= wbAdapter.getImageDescriptor(adaptable);
if (descriptor == null) {
return null;
}
Point size= useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
return new JavaElementImageDescriptor(descriptor, 0, size);
}
示例4: getImage
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
public final Image getImage(Object element) {
// obtain the base image by querying the element
ImageDescriptor descriptor = null;
if (element instanceof IProject) {
IProject project = (IProject) element;
if (project.isOpen()) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
"net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/prj_open.png");
} else {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
"net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/prj_close.png");
}
} else if (element instanceof IFolder) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin("net.heartsome.cat.common.ui.navigator.resources",
"icons/full/obj16/folder.png");
}
else {
IWorkbenchAdapter adapter = getAdapter(element);
if (adapter == null) {
return null;
}
descriptor = adapter.getImageDescriptor(element);
if (descriptor == null) {
return null;
}
// add any annotations to the image descriptor
descriptor = decorateImage(descriptor, element);
}
return (Image) getResourceManager().get(descriptor);
}
示例5: getImageDescriptor
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
public ImageDescriptor getImageDescriptor(IResource resource) {
IWorkbenchAdapter adapter = super.getAdapter(resource);
if (adapter == null) {
return null;
}
return adapter.getImageDescriptor(resource);
}
示例6: getImage
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
public final Image getImage(Object element) {
// obtain the base image by querying the element
ImageDescriptor descriptor = null;
if (element instanceof IProject) {
IProject project = (IProject) element;
if (project.isOpen()) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
"net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/prj_open.png");
}else {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
"net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/prj_close.png");
}
} else if(element instanceof IFolder){
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
"net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/folder.png");
}
else {
IWorkbenchAdapter adapter = getAdapter(element);
if (adapter == null) {
return null;
}
descriptor = adapter.getImageDescriptor(element);
if (descriptor == null) {
return null;
}
// add any annotations to the image descriptor
descriptor = decorateImage(descriptor, element);
}
return (Image) getResourceManager().get(descriptor);
}
示例7: getWorkbenchImageDescriptor
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
protected ImageDescriptor getWorkbenchImageDescriptor(IAdaptable adaptable) {
IWorkbenchAdapter workbenchAdapter= (IWorkbenchAdapter) adaptable.getAdapter(IWorkbenchAdapter.class);
if (workbenchAdapter == null) {
return null;
}
ImageDescriptor descriptor = workbenchAdapter.getImageDescriptor(adaptable);
return descriptor;
}
示例8: getImageDescriptor
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
/**
* @see IWorkbenchAdapter#getImageDescriptor
*/
public ImageDescriptor getImageDescriptor(Object object) {
IWorkbenchAdapter fileAdapter = (IWorkbenchAdapter)file.getAdapter(IWorkbenchAdapter.class);
return fileAdapter == null ? null : fileAdapter.getImageDescriptor(file);
}
示例9: getAssociatedScaleTimelineMarkerImages
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
/**
* Given the list of edit part objects, this method should return the images
* associated with those edit parts that represent instances of
* ScaleTimelineMarkerHeaderEditPart
*
* During operation, this method also counts how many images of the same
* type are present in the edit part list, and keeps track of the information.
*
* @param editParts
* @return a list of images associated with the edit parts
* @throws CoreException
*/
protected List<Image> getAssociatedScaleTimelineMarkerImages(List<EditPart> editParts)
{
if(imageToCountMap == null)
imageToCountMap = new HashMap<Image, Integer>();
imageToCountMap.clear();
List<Image> images = new ArrayList<Image>();
try
{
for(EditPart editPart : editParts)
{
Object object = editPart.getModel();
if(object instanceof TimelineMarker)
{
TimelineMarker timelineMarker = (TimelineMarker)object;
IMarker marker = getMarker(timelineMarker
, ((ScaleTimelineMarkerEditPart)editPart).getViewer());
String markerPluginId;
markerPluginId = String.valueOf(marker
.getAttribute(MarkerConstants.PLUGIN_ID));
String imageDescriptorPath = null;
Object path = marker.getAttribute(MarkerConstants.IMAGE_DESCRIPTOR_PATH);
if(path != null) {
imageDescriptorPath = String.valueOf(path);
}
ImageDescriptor imageDescriptor = null;
if(imageDescriptorPath != null) {
imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(markerPluginId, imageDescriptorPath);
}
if(imageDescriptor == null) {
IWorkbenchAdapter adapter = (IWorkbenchAdapter) Platform.getAdapterManager().getAdapter(marker, IWorkbenchAdapter.class);
if (adapter != null) {
imageDescriptor = adapter.getImageDescriptor(marker);
}
}
Image image = (Image) getResourceManager().get(imageDescriptor);
Integer integer = imageToCountMap.get(image);
if(integer == null) {
imageToCountMap.put(image, 1);
}
else {
imageToCountMap.put(image, imageToCountMap.get(image) + 1);
}
if(!images.contains(image)) {
images.add(image);
}
}
}
}
catch(CoreException e)
{
Logger.getLogger(ScaleTimelineMarkerTooltip.class).error(
"getting associated scale timeline marker images", e);
images = null;
}
return images;
}
示例10: getImageDescriptor
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
public ImageDescriptor getImageDescriptor(Object object) {
IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter) resource.getAdapter(IWorkbenchAdapter.class);
if (wbAdapter != null)
return wbAdapter.getImageDescriptor(resource);
return null;
}
示例11: getImageDescriptor
import org.eclipse.ui.model.IWorkbenchAdapter; //导入方法依赖的package包/类
public ImageDescriptor getImageDescriptor(Object object) {
IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter)storage.getAdapter(IWorkbenchAdapter.class);
if (wbAdapter != null)
return wbAdapter.getImageDescriptor(storage);
return null;
}