List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromImage
public static ImageDescriptor createFromImage(Image img)
From source file:se.aceone.mediatek.linkit.ui.NewLinkit20ProjectWizard.java
License:Open Source License
@Override /**/*from w w w . j av a 2 s .c om*/ * adds pages to the wizard. We are using the standard project wizard of Eclipse */ public void addPages() { // // We assume everything is OK as it is tested in the handler // create each page and fill in the title and description // first page to fill in the project name // mWizardPage = new WizardNewProjectCreationPage("New LinkIt SDK 2.0 Tool Chain Project"); mWizardPage.setDescription("Create a new LinkItIt SDK 2.0 Tool Chain Project."); mWizardPage.setTitle("New LinkItIt SDK 2.0 Tool Chain Project"); AbstractUIPlugin plugin = Activator.getDefault(); ImageRegistry imageRegistry = plugin.getImageRegistry(); Image myImage = imageRegistry.get(Activator.CPU_64PX); ImageDescriptor image = ImageDescriptor.createFromImage(myImage); mWizardPage.setImageDescriptor(image); // // / addPage(mWizardPage); }
From source file:sernet.verinice.iso27k.rcp.action.AddElement.java
License:Open Source License
@SuppressWarnings("unchecked") public void selectionChanged(IAction action, ISelection selection) { action.setEnabled(checkRights());/*from ww w . ja v a 2 s . c o m*/ if (selection instanceof IStructuredSelection) { Object sel = ((IStructuredSelection) selection).getFirstElement(); boolean allowed = false; boolean enabled = false; if (sel instanceof CnATreeElement) { allowed = CnAElementHome.getInstance().isNewChildAllowed((CnATreeElement) sel); } if (sel instanceof Audit) { enabled = false; action.setText(Messages.getString("AddElement.20")); } else if (sel instanceof IISO27kGroup) { enabled = true; IISO27kGroup group = (IISO27kGroup) sel; // TODO - getChildTypes()[0] might be a problem for more than one type String childType = group.getChildTypes()[0]; if (group instanceof Asset) { childType = Control.TYPE_ID; } action.setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(childType))); action.setText(TITLE_FOR_TYPE.get(group.getTypeId()) != null ? TITLE_FOR_TYPE.get(group.getTypeId()) : Messages.getString("AddElement.20")); //$NON-NLS-1$ } // Only change state when it is enabled, since we do not want to // trash the enablement settings of plugin.xml if (action.isEnabled()) { action.setEnabled(allowed && enabled); } } }
From source file:sernet.verinice.iso27k.rcp.action.AddElementHandler.java
License:Open Source License
@Override public void updateElement(UIElement menu, Map arg1) { ISelection selection = getSelection(); if (selection instanceof IStructuredSelection) { Object sel = ((IStructuredSelection) selection).getFirstElement(); boolean allowed = false; boolean enabled = false; if (sel instanceof CnATreeElement) { allowed = CnAElementHome.getInstance().isNewChildAllowed((CnATreeElement) sel); }/*from w w w. j a v a 2s. c o m*/ if (sel instanceof Audit) { enabled = false; menu.setText(Messages.getString("AddElement.20")); } else if (sel instanceof IISO27kGroup) { enabled = true; IISO27kGroup group = (IISO27kGroup) sel; // TODO - getChildTypes()[0] might be a problem for more than one type String childType = group.getChildTypes()[0]; if (group instanceof Asset) { childType = Control.TYPE_ID; } menu.setIcon( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(childType))); menu.setText(TITLE_FOR_TYPE.get(group.getTypeId()) != null ? TITLE_FOR_TYPE.get(group.getTypeId()) : Messages.getString("AddElement.20")); //$NON-NLS-1$ } // Only change state when it is enabled, since we do not want to // trash the enablement settings of plugin.xml if (this.isEnabled()) { this.setEnabled(allowed && enabled); } } }
From source file:sernet.verinice.iso27k.rcp.action.AddGroup.java
License:Open Source License
public AddGroup(IISO27kGroup element, String typeId, String childTypeId) { super();/*from w w w. j a v a 2 s. c o m*/ this.parent = element; this.typeId = typeId; this.setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(childTypeId))); this.setText(TITLE_FOR_TYPE.get(typeId) != null ? TITLE_FOR_TYPE.get(typeId) : Messages.getString("AddGroup.19")); //$NON-NLS-1$ }
From source file:sernet.verinice.iso27k.rcp.action.AddGroup.java
License:Open Source License
@SuppressWarnings("unchecked") public void selectionChanged(IAction action, ISelection selection) { action.setEnabled(checkRights());//from w w w . j ava 2s . c om if (selection instanceof IStructuredSelection) { Object sel = ((IStructuredSelection) selection).getFirstElement(); boolean allowed = false; boolean enabled = false; if (sel instanceof CnATreeElement) { allowed = CnAElementHome.getInstance().isNewChildAllowed((CnATreeElement) sel); } if (sel instanceof Audit) { enabled = false; action.setText(Messages.getString("AddGroup.19")); } else if (sel instanceof IISO27kGroup) { enabled = true; IISO27kGroup group = (IISO27kGroup) sel; String typeId0 = group.getChildTypes()[0]; if (group instanceof Asset) { typeId0 = Control.TYPE_ID; } action.setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(typeId0))); action.setText(TITLE_FOR_TYPE.get(group.getTypeId()) != null ? TITLE_FOR_TYPE.get(group.getTypeId()) : Messages.getString("AddGroup.19")); //$NON-NLS-1$ } // Only change state when it is enabled, since we do not want to // trash the enablement settings of plugin.xml if (action.isEnabled()) { action.setEnabled(allowed && enabled); } } }
From source file:sernet.verinice.iso27k.rcp.action.AddGroupHandler.java
License:Open Source License
@Override public void updateElement(UIElement menu, Map arg1) { ISelection selection = getSelection(); if (selection instanceof IStructuredSelection) { Object sel = ((IStructuredSelection) selection).getFirstElement(); boolean allowed = false; boolean enabled = false; if (sel instanceof CnATreeElement) { allowed = CnAElementHome.getInstance().isNewChildAllowed((CnATreeElement) sel); }/* w w w . ja v a 2 s .co m*/ if (sel instanceof Audit) { enabled = false; menu.setText(Messages.getString("AddGroup.19")); } else if (sel instanceof IISO27kGroup) { enabled = true; IISO27kGroup group = (IISO27kGroup) sel; String typeId0 = group.getChildTypes()[0]; if (group instanceof Asset) { typeId0 = Control.TYPE_ID; } menu.setIcon(ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(typeId0))); menu.setText(TITLE_FOR_TYPE.get(group.getTypeId()) != null ? TITLE_FOR_TYPE.get(group.getTypeId()) : Messages.getString("AddGroup.19")); //$NON-NLS-1$ } // Only change state when it is enabled, since we do not want to // trash the enablement settings of plugin.xml if (this.isEnabled()) { this.setEnabled(allowed && enabled); } } }
From source file:sernet.verinice.iso27k.rcp.action.AddIsaControl.java
License:Open Source License
@SuppressWarnings("unchecked") public void selectionChanged(IAction action, ISelection selection) { action.setEnabled(checkRights());/* w w w.j ava 2 s .c o m*/ if (selection instanceof IStructuredSelection) { Object sel = ((IStructuredSelection) selection).getFirstElement(); boolean allowed = false; boolean enabled = false; if (sel instanceof CnATreeElement) { allowed = CnAElementHome.getInstance().isNewChildAllowed((CnATreeElement) sel); } if (sel instanceof Audit) { enabled = false; action.setText(Messages.getString("AddElement.20")); } else if (sel instanceof IISO27kGroup) { enabled = true; IISO27kGroup group = (IISO27kGroup) sel; // TODO - getChildTypes()[0] might be a problem for more than one type String childType = group.getChildTypes()[1]; if (group instanceof Asset) { childType = SamtTopic.TYPE_ID; } action.setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(childType))); action.setText(TITLE_FOR_TYPE.get(group.getTypeId()) != null ? TITLE_FOR_TYPE.get(group.getTypeId()) : Messages.getString("AddElement.20")); //$NON-NLS-1$ } // Only change state when it is enabled, since we do not want to // trash the enablement settings of plugin.xml if (action.isEnabled()) { action.setEnabled(allowed && enabled); } } }
From source file:sernet.verinice.samt.audit.rcp.AddAction.java
License:Open Source License
/** * Creates an action to set the typeId of an groupView * /*from w ww .j a v a2 s.c om*/ * @param groupView * the view the type is displyed * @param typeId * {@link CnATreeElement} type * @param title * @param groupView */ public AddAction(String typeId, String title, GenericElementView groupView) { this.objectTypeId = typeId; String title_0 = title; if (title_0 == null) { title_0 = AddGroup.TITLE_FOR_TYPE.get(typeId); } setText(title_0); setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(objectTypeId))); this.groupView = groupView; }
From source file:sernet.verinice.samt.audit.rcp.AddMenuCreater.java
License:Open Source License
@Override public void init(IViewPart view) { if (view instanceof ElementView) { this.groupView = (GenericElementView) view; final String typeId = groupView.getCommandFactory().getElementTypeId(); final String groupId = groupView.getCommandFactory().getGroupTypeId(); // this is not a typo: "groupId" String title = AddElement.TITLE_FOR_TYPE.get(groupId); addElementAction = new AddAction(typeId, title, groupView); addElementAction.setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(typeId))); title = AddGroup.TITLE_FOR_TYPE.get(groupId); addGroupAction = new AddAction(groupId, title, groupView); addGroupAction.setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(groupId))); view.getSite().getPage().addPostSelectionListener(this); }/*from www . j av a2 s . c o m*/ }
From source file:sernet.verinice.samt.audit.rcp.SwitchElementAction.java
License:Open Source License
/** * Creates an action to set the typeId of an groupView * /*from ww w .ja v a 2 s .co m*/ * @param groupView the view the type is displyed * @param typeId {@link CnATreeElement} type */ public SwitchElementAction(GenericElementView groupView, String typeId) { this.groupView = groupView; this.objectTypeId = typeId; String title = HitroUtil.getInstance().getTypeFactory().getMessage(typeId); setText(title); setImageDescriptor( ImageDescriptor.createFromImage(ImageCache.getInstance().getISO27kTypeImage(objectTypeId))); }