當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageDescriptor類代碼示例

本文整理匯總了Java中org.eclipse.jface.resource.ImageDescriptor的典型用法代碼示例。如果您正苦於以下問題:Java ImageDescriptor類的具體用法?Java ImageDescriptor怎麽用?Java ImageDescriptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImageDescriptor類屬於org.eclipse.jface.resource包,在下文中一共展示了ImageDescriptor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getImageDescriptor

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
/**
 * get icon based on item type (test/suite) and its status (pass/failed/exception/skip/in progress...)
 */
private ImageDescriptor getImageDescriptor(Object element) throws RuntimeException {
	ImageDescriptor descriptor = null;
	if (element instanceof Description == false) {
		String msg = "Unknown type of element in tree of type " + element.getClass().getName();
		Exception e = new RuntimeException(msg);
		N4IDEXpectUIPlugin.logError("cannot obtain image descriptor, fallback to default", e);
		return getImageDescriptor("n4_logo.png");
	}

	Description desc = (Description) element;

	if (desc.isTest()) {
		descriptor = getTestImageDescriptor(executionStatus.getStatus(desc));
	} else if (desc.isSuite()) {
		descriptor = getSuiteImageDescriptor(desc, executionStatus.getStatus(desc));
	} else {
		descriptor = getImageDescriptor("n4_logo.png");
	}
	return descriptor;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:24,代碼來源:XpectLabelProvider.java

示例2: GraphicalPalette

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
public GraphicalPalette(){
	PaletteDrawer tools=new PaletteDrawer("節點列表");
	PanningSelectionToolEntry selectionTool=new PanningSelectionToolEntry();
	tools.add(selectionTool);
	this.setDefaultEntry(selectionTool);
	ImageDescriptor transitionDescriptor=ImageDescriptor.createFromImage(Activator.getImageFromPlugin(Constants.TRANSITION_NODE_ICON_SMALL));
	ConnectionCreationToolEntry connection=new ConnectionCreationToolEntry("Transition","Create a Transition",null,transitionDescriptor,transitionDescriptor);
	tools.add(connection);
	tools.add(this.createToolEntry(StartNode.class,"Start","Create a start node",70,40));
	tools.add(this.createToolEntry(EndNode.class,"End","Create a end node",70,40));
	tools.add(this.createToolEntry(TaskNode.class,"Task","Create a task node",80,40));
	tools.add(this.createToolEntry(ForkNode.class,"Fork","Create a fork node",80,40));
	tools.add(this.createToolEntry(JoinNode.class,"Join","Create a join node",80,40));
	tools.add(this.createToolEntry(ForeachNode.class,"Foreach","Create a foreach node",80,40));
	tools.add(this.createToolEntry(DecisionNode.class,"Decision","Create a decision node",80,40));
	tools.add(this.createToolEntry(SubprocessNode.class,"Subprocess","Create a subprocess node",100,40));
	tools.add(this.createToolEntry(EndCancelNode.class,"End Cancel","Create a end cancel node",100,40));
	tools.add(this.createToolEntry(EndErrorNode.class,"End Error","Create a end error node",100,40));
	tools.add(this.createToolEntry(StateNode.class,"State","Create a state node",80,40));
	tools.add(this.createToolEntry(CustomNode.class,"Custom","Create a custom node",80,40));
	this.add(tools);
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:23,代碼來源:GraphicalPalette.java

示例3: decorate

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
@Override
public void decorate(final Object element, final IDecoration decoration) {
	try {
		if (element instanceof IProject) {
			final URI uri = createPlatformResourceURI(((IProject) element).getName(), true);
			final IN4JSProject project = core.findProject(uri).orNull();
			if (null != project) {
				final ImageRef imageRef = IMAGE_REF_CACHE.get(project.getProjectType());
				if (null != imageRef) {
					final ImageDescriptor descriptor = imageRef.asImageDescriptor().orNull();
					if (null != descriptor) {
						decoration.addOverlay(descriptor);
					}
				}
			}
		}
	} catch (final Exception e) {
		// Exception should not propagate from here, otherwise the lightweight decorator stops working once till
		// next application startup.
		LOGGER.error("Error while trying to get decorator for " + element, e);
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:ProjectTypeLabelDecorator.java

示例4: createToolEntry

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
private CreationToolEntry createToolEntry(final Class<?> nodeClass,final String name,String desc,final int width,final int height){
	SimpleFactory nodeFactory=new SimpleFactory(nodeClass){
		@Override
		public Object getNewObject() {
			AbstractNodeElement node=instanceNode(nodeClass,name,width,height);
			return node;
		}
	};
	String nodeName=instanceNode(nodeClass,name,width,height).nodeName();
	NodeImageConfig config=Activator.getPreference().getNodeImageConfigByName(nodeName);
	if(config==null){
		throw new RuntimeException("當前沒有為名為"+nodeName+"的節點預定義配置信息!");
	}
	ImageDescriptor descriptor=ImageDescriptor.createFromImage(config.getSmallImage());
	return new CombinedTemplateCreationEntry(name,desc,nodeFactory,descriptor,descriptor);
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:17,代碼來源:GraphicalPalette.java

示例5: getImageDescriptor

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
public static ImageDescriptor getImageDescriptor(final String bundleID, final String path) {
  assert bundleID != null : "No bundle defined";
  assert path != null : "No path defined";

  // if the bundle is not ready then there is no image
  final Bundle bundle = Platform.getBundle(bundleID);
  final int bundleState = bundle.getState();
  if (bundleState != Bundle.ACTIVE && bundleState != Bundle.STARTING
      && bundleState != Bundle.RESOLVED) {
    return null;
  }

  // look for the image (this will check both the plugin and fragment
  // folders
  final URL imagePath = FileLocator.find(bundle, new Path(path), null);

  if (imagePath != null) {
    return ImageDescriptor.createFromURL(imagePath);
  }

  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:23,代碼來源:MasterViewLabelProvider.java

示例6: 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;
}
 
開發者ID:de-jcup,項目名稱:eclipse-bash-editor,代碼行數:23,代碼來源:EclipseUtil.java

示例7: getImage

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
/**
 * Get image by path from image registry. If not already registered a new
 * image will be created and registered. If not createable a fallback image
 * is used instead
 * 
 * @param path
 * @param pluginId
 *            - plugin id to identify which plugin image should be loaded
 * @return image
 */
public static Image getImage(String path, String pluginId) {
	ImageRegistry imageRegistry = getImageRegistry();
	if (imageRegistry == null) {
		return null;
	}
	Image image = imageRegistry.get(path);
	if (image == null) {
		ImageDescriptor imageDesc = createImageDescriptor(path, pluginId);
		image = imageDesc.createImage();
		if (image == null) {
			image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
		}
		imageRegistry.put(path, image);
	}
	return image;
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:27,代碼來源:EclipseUtil.java

示例8: updateItem

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
private void updateItem ( final StyledViewerLabel label, final DataItemEntry dataItemEntry )
{
    String itemName = dataItemEntry.getName ();
    if ( itemName == null || itemName.length () == 0 )
    {
        itemName = " ";
    }
    label.setText ( itemName );

    if ( dataItemEntry.getIODirections ().containsAll ( Arrays.asList ( IODirection.INPUT, IODirection.OUTPUT ) ) )
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item_io.gif" ) ) );
    }
    else if ( dataItemEntry.getIODirections ().contains ( IODirection.INPUT ) )
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item_i.gif" ) ) );
    }
    else if ( dataItemEntry.getIODirections ().contains ( IODirection.OUTPUT ) )
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item_o.gif" ) ) );
    }
    else
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item.gif" ) ) );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:27,代碼來源:ConnectionLabelProvider.java

示例9: getImageDescriptor

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
public static ImageDescriptor getImageDescriptor(final String bundleID, final String path) {
  assert(bundleID != null) : "No bundle defined";
  assert(path != null) : "No path defined";

  // if the bundle is not ready then there is no image
  final Bundle bundle = Platform.getBundle(bundleID);
  final int bundleState = bundle.getState();
  if ((bundleState != Bundle.ACTIVE) && (bundleState != Bundle.STARTING)
      && (bundleState != Bundle.RESOLVED)) {
    return null;
  }

  // look for the image (this will check both the plugin and fragment
  // folders
  final URL imagePath = FileLocator.find(bundle, new Path(path), null);

  if (imagePath != null) {
    return ImageDescriptor.createFromURL(imagePath);
  }

  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:23,代碼來源:ContextualViewTreeLabelProvider.java

示例10: testDirectImageDescriptorCaching

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
/**
 * Checks the direct {@link ImageDescriptor image descriptor} caching.
 */
@Test
public void testDirectImageDescriptorCaching() {
	final ImageDescriptor desc1 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
	final ImageDescriptor desc2 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
	assertTrue("Expected exactly same reference of image descriptors.", desc1 == desc2);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:10,代碼來源:GHOLD_170_ImageCaching_PluginUITest.java

示例11: decorate

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
@Override
public void decorate(Object resource, IDecoration decoration) {
  int markers = MarkerFactory.findMarkers((IResource) resource).size();
  if (markers > 0) {
    decoration.addOverlay(ImageDescriptor.createFromFile(FileDecorator.class, ICON),
        IDecoration.TOP_RIGHT);
    decoration.setForegroundColor(color);
  } else {
    decoration.addOverlay(null);
    decoration.setForegroundColor(new Color(null, 0, 0, 0, 0));
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:13,代碼來源:FileDecorator.java

示例12: getSuiteImageDescriptor

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
/** obtain {@link ImageDescriptor} for suite} */
private ImageDescriptor getSuiteImageDescriptor(Description desc, ExecutionStatus st) {
	ImageDescriptor descriptor;
	switch (st) {
	case PENDING:
		descriptor = getImageDescriptor("testsuite.png");
		break;
	case STARTED:
		descriptor = getImageDescriptor("testsuite_running.png");
		break;
	case IGNORED:
		descriptor = getImageDescriptor("testsuite_ignored.png");
		break;
	case PASSED:
		descriptor = getImageDescriptor("testsuite_pass.png");
		Optional<XpectFileContentAccess> fileContentAccess = XpectFileContentsUtil
				.getXpectFileContentAccess(desc);
		if (fileContentAccess.isPresent()) {
			if (fileContentAccess.get().containsFixme()) {
				descriptor = getImageDescriptor("testsuite_fixme.png");
			}
		}
		break;
	case FAILED:
		descriptor = getImageDescriptor("testsuite_fail.png");
		break;
	case ERROR:
		descriptor = getImageDescriptor("testsuite_error.png");
		break;

	default:
		descriptor = getImageDescriptor("n4_logo.png");
		break;
	}
	return descriptor;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:37,代碼來源:XpectLabelProvider.java

示例13: scheduleUpdateEditor

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
@Override
public void scheduleUpdateEditor(ImageDescriptor titleImageDescription) {
	if (editor instanceof N4JSEditor && titleImageDescription != null) {
		titleImageDescription = ((N4JSEditor) editor).applyTitleImageOverlays(titleImageDescription);
	}
	super.scheduleUpdateEditor(titleImageDescription);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:8,代碼來源:N4JSEditorErrorTickUpdater.java

示例14: createEObjectNode

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
/**
 * Returns N4JSEObjectNode instead of simple EObjectNode to allow for attaching additional information such as
 * inheritance state of members.
 */
@Override
public N4JSEObjectNode createEObjectNode(IOutlineNode parentNode, EObject modelElement,
		ImageDescriptor imageDescriptor,
		Object text,
		boolean isLeaf) {
	N4JSEObjectNode eObjectNode = new N4JSEObjectNode(modelElement, parentNode, imageDescriptor, text, isLeaf);
	ICompositeNode parserNode = NodeModelUtils.getNode(modelElement);
	if (parserNode != null)
		eObjectNode.setTextRegion(parserNode.getTextRegion());
	if (isLocalElement(parentNode, modelElement))
		eObjectNode.setShortTextRegion(getLocationInFileProvider().getSignificantTextRegion(modelElement));
	return eObjectNode;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:18,代碼來源:N4JSOutlineNodeFactory.java

示例15: getImageDescriptor

import org.eclipse.jface.resource.ImageDescriptor; //導入依賴的package包/類
@Override
public ImageDescriptor getImageDescriptor() {
	if (getDisplayMode() == DisplayMode.WITH_COLUMNS) {
		return AvroSchemaEditorActivator.getImageDescriptor(AvroSchemaEditorImages.WITH_COLUMNS_DISPLAY_MODE);
	} else {
		return AvroSchemaEditorActivator.getImageDescriptor(AvroSchemaEditorImages.WITHOUT_COLUMNS_DISPLAY_MODE);
	}
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:9,代碼來源:SwitchSchemaViewerDisplayModeAction.java


注:本文中的org.eclipse.jface.resource.ImageDescriptor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。