本文整理汇总了Java中org.eclipse.jface.resource.ImageDescriptor.createFromImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageDescriptor.createFromImage方法的具体用法?Java ImageDescriptor.createFromImage怎么用?Java ImageDescriptor.createFromImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.ImageDescriptor
的用法示例。
在下文中一共展示了ImageDescriptor.createFromImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: testIndirectImageDescriptorCaching
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
/**
* Checks the indirect {@link ImageDescriptor image descriptor} caching.
*/
@Test
public void testIndirectImageDescriptorCaching() {
final Image img1 = ImageRef.LIB_PATH.asImage().orNull();
final Image img2 = ImageRef.LIB_PATH.asImage().orNull();
final ImageDescriptor desc1 = ImageDescriptor.createFromImage(img1);
final ImageDescriptor desc2 = ImageDescriptor.createFromImage(img2);
assertTrue("Expected different reference of image descriptors.", desc1 != desc2);
}
示例4: getImageDescriptor
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
@Override
default ImageDescriptor getImageDescriptor(final Object object) {
final Image image = getImage();
return null == image ? null : ImageDescriptor.createFromImage(image);
}
示例5: dbModelsViewDidShowMenu
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
@Override
public void dbModelsViewDidShowMenu(IMenuManager menuManager) {
if (dbModelsView.getTableViewer().getStructuredSelection().getFirstElement() == null) {
return;
}
DBController selectedController = (DBController) dbModelsView.getTableViewer().getStructuredSelection().getFirstElement();
if (selectedController.isConnected()) {
Action disconnectAction = new Action(Images.DISCONNECT_DATABASE.getDescription(resourceBundle),
ImageDescriptor.createFromImage(ImageUtils.getImage(Images.DISCONNECT_DATABASE))) {
@Override
public void run() {
disconnectSelectedDatabase();
}
};
menuManager.add(disconnectAction);
} else {
Action connectAction = new Action(Images.CONNECT_DATABASE.getDescription(resourceBundle),
ImageDescriptor.createFromImage(ImageUtils.getImage(Images.CONNECT_DATABASE))) {
@Override
public void run() {
connectToSelectedDatabase();
}
};
menuManager.add(connectAction);
Action editAction = new Action(Images.EDIT_DATABASE.getDescription(resourceBundle),
ImageDescriptor.createFromImage(ImageUtils.getImage(Images.EDIT_DATABASE))) {
@Override
public void run() {
openEditSelectedDatabaseDialog();
}
};
menuManager.add(editAction);
}
Action updateProcessesAction = new Action(Images.UPDATE.getDescription(resourceBundle),
ImageDescriptor.createFromImage(ImageUtils.getImage(Images.UPDATE))) {
@Override
public void run() {
updateProcessesInSelectedDatabase();
}
};
menuManager.add(updateProcessesAction);
}