当前位置: 首页>>代码示例>>Java>>正文


Java IWorkbenchAdapter.getImageDescriptor方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:23,代码来源:CopiedWorkbenchLabelProvider.java

示例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);
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:18,代码来源:WorkbenchLabelProvider.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaElementImageProvider.java

示例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);
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:33,代码来源:WorkbenchLabelProvider.java

示例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);

}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:9,代码来源:ResourceUIHelper.java

示例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);
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:33,代码来源:WorkbenchLabelProvider.java

示例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;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:10,代码来源:LangNavigatorLabelProvider.java

示例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);
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:8,代码来源:RemoteFileEditorInput.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:81,代码来源:GroupScaleTimelineMarkerTooltip.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:PropertyKeyHyperlink.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:7,代码来源:PropertyKeyHyperlink.java


注:本文中的org.eclipse.ui.model.IWorkbenchAdapter.getImageDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。