List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:com.mercatis.lighthouse3.ui.swimlaneeditor.actions.ReloadInstancesAction.java
License:Apache License
public ReloadInstancesAction(IInstanceView instanceView) { super(null, AS_PUSH_BUTTON); this.setImageDescriptor(ImageDescriptor.createFromURL(this.getClass().getResource("/icons/refresh.gif"))); this.setText("Reload Instances"); this.instanceView = instanceView; }
From source file:com.mercatis.lighthouse3.ui.swimlaneeditor.actions.SwitchToInstanceViewAction.java
License:Apache License
public SwitchToInstanceViewAction(IInstanceView instanceView) { super(null, AS_CHECK_BOX); this.instanceView = instanceView; this.setImageDescriptor(ImageDescriptor.createFromURL(this.getClass().getResource("/icons/dates.gif"))); this.setText("Enable Instance View"); }
From source file:com.mercatis.lighthouse3.ui.swimlaneeditor.gef.ConnectionTool.java
License:Apache License
public ConnectionTool() { super();/*from w w w. j a v a2s . c om*/ setDefaultCursor(new Cursor(null, ImageDescriptor .createFromURL(getClass().getResource("/icons/cursor_connect_ok.png")).getImageData(), 0, 0)); setDisabledCursor(new Cursor(null, ImageDescriptor .createFromURL(getClass().getResource("/icons/cursor_connect_err.png")).getImageData(), 0, 0)); }
From source file:com.mercatis.lighthouse3.ui.swimlaneeditor.gef.DeleteConnectionTool.java
License:Apache License
public DeleteConnectionTool() { super();/*from w w w . j a va 2 s. c o m*/ setDefaultCursor(new Cursor(null, ImageDescriptor.createFromURL(getClass().getResource("/icons/delete.gif")).getImageData(), 8, 7)); }
From source file:com.mercatis.lighthouse3.ui.swimlaneeditor.ProcessTaskSwimlaneEditor.java
License:Apache License
@Override protected PaletteRoot getPaletteRoot() { if (paletteRoot == null) { paletteRoot = new PaletteRoot(); paletteRoot.setLabel("Tools"); PaletteGroup toolsGroup = new PaletteGroup("Tools"); SelectionToolEntry selectionToolEntry = new SelectionToolEntry("Select", "Select"); selectionToolEntry.setToolClass(ExtendedSelectionTool.class); selectionToolEntry//from w w w . ja v a 2s. c o m .setSmallIcon(ImageDescriptor.createFromURL(this.getClass().getResource("/icons/cursor.png"))); toolsGroup.add(selectionToolEntry); connectionDrawer = new PaletteDrawer("Connection"); connectionDrawer .setSmallIcon(ImageDescriptor.createFromURL(this.getClass().getResource("/icons/connect.png"))); toolsGroup.add(connectionDrawer); connectionToolEntry = new ConnectionToolEntry("Create", "Create Connection", null, ImageDescriptor.createFromURL(this.getClass().getResource("/icons/connect.png")), null); connectionDrawer.add(connectionToolEntry); deleteToolEntry = new DeleteToolEntry("Delete", "Delete Connection", ImageDescriptor.createFromURL(this.getClass().getResource("/icons/delete.gif"))); connectionDrawer.add(deleteToolEntry); paletteRoot.setDefaultEntry(selectionToolEntry); paletteRoot.add(toolsGroup); } return paletteRoot; }
From source file:com.mercatis.lighthouse3.ui.swimlaneeditor.ProcessTaskSwimlaneEditor.java
License:Apache License
private void createInstanceViewActions() { instanceViewAction = new SwitchToInstanceViewAction(this); instanceViewAction.setId(TOGGLE_INSTANCE_VIEW_ACTION_ID); instanceViewAction.setEnabled(processInstanceDefinition != null); backAction = new InstanceNavigationAction(this); backAction.setId(BACK_ACTION_ID);/* w ww .ja v a 2 s . c om*/ backAction.setText("Previous Instance"); backAction .setImageDescriptor(ImageDescriptor.createFromURL(this.getClass().getResource("/icons/back.gif"))); backAction.setSortingMode(SortingMode.DESCENDING); backAction.setEnabled(false); forwardAction = new InstanceNavigationAction(this); forwardAction.setId(FORWARD_ACTION_ID); forwardAction.setText("Next Instance"); forwardAction.setImageDescriptor( ImageDescriptor.createFromURL(this.getClass().getResource("/icons/forward.gif"))); forwardAction.setSortingMode(SortingMode.ASCENDING); forwardAction.setEnabled(false); reloadInstancesAction = new ReloadInstancesAction(this); reloadInstancesAction.setId(RELOAD_INSTANCES_ACTION_ID); }
From source file:com.metacase.graphbrowser.views.GraphView.java
License:MIT License
/** * Loads images for action buttons./*from w w w.jav a2 s . c om*/ * @param iconPath * @return loaded image */ public static ImageDescriptor getImageDescriptor(String iconPath) { ImageDescriptor image; URL url = null; try { url = new URL(Platform.getBundle(Activator.PLUGIN_ID).getEntry("/"), iconPath); } catch (MalformedURLException e) { e.printStackTrace(); } image = ImageDescriptor.createFromURL(url); return image; }
From source file:com.mobilesorcery.sdk.testing.TestPlugin.java
License:Open Source License
private void addImage(ImageRegistry reg, String imageKey, String imageLocation) { reg.put(imageKey,//from w ww. ja va2 s . c o m ImageDescriptor.createFromURL(FileLocator.find(getBundle(), new Path(imageLocation), null))); }
From source file:com.motorola.studio.android.wizards.buildingblocks.NewActivityMainPage.java
License:Apache License
/** * add samples control./*from w w w. j av a2 s.co m*/ * * @param composite * The wizard page composite */ @Override protected void createSampleControls(Composite composite, int nColumns) { GridData data = null; Composite linkCompositecomposite = new Composite(composite, SWT.FILL); linkCompositecomposite.setFont(composite.getFont()); GridLayout layout = new GridLayout(nColumns, false); linkCompositecomposite.setLayout(layout); data = new GridData(SWT.FILL, SWT.FILL, true, true, nColumns, 2); linkCompositecomposite.setLayoutData(data); Image image = null; try { ImageDescriptor imageDesc = ImageDescriptor.createFromURL(CodeUtilsActivator.getDefault().getBundle() .getEntry("icons/obj16/new_activity_template_wiz.png")); //$NON-NLS-1$ image = imageDesc.createImage(); } catch (Exception ex) { // do nothing; } CLabel imgLabelLeft = new CLabel(linkCompositecomposite, SWT.CENTER); data = new GridData(SWT.LEFT, SWT.CENTER, false, false); imgLabelLeft.setLayoutData(data); imgLabelLeft.setImage(image); final Link templateLink = new Link(linkCompositecomposite, SWT.NONE); data = new GridData(SWT.LEFT, SWT.CENTER, true, true); templateLink.setLayoutData(data); templateLink.setText("<a>" + CodeUtilsNLS.UI_CreateNewActivityBasedOnTemplateLink //$NON-NLS-1$ + "</a>"); //$NON-NLS-1$ templateLink.addSelectionListener(new SelectionAdapter() { /* (non-Javadoc) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent event) { NewActivityWizard newActivityWizard = (NewActivityWizard) getWizard(); IWizardContainer container = newActivityWizard.getContainer(); container.getShell().setVisible(false); if (container instanceof WizardDialog) { IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry() .findWizard("com.motorola.studio.android.wizards.newActivityBasedOnTemplateWizard"); if (descriptor != null) { NewActivityBasedOnTemplateWizard wizard = null; try { wizard = (NewActivityBasedOnTemplateWizard) descriptor.createWizard(); NewActivityWizard activityWizard = (NewActivityWizard) getWizard(); wizard.init(PlatformUI.getWorkbench(), activityWizard.getSelection()); WizardDialog nextWd = new WizardDialog(getShell(), wizard); nextWd.setTitle(wizard.getWindowTitle()); nextWd.open(); } catch (CoreException e) { StudioLogger.error(NewActivityMainPage.class, "could not open new activity based on template wizard from inside new activity wizard"); } } WizardDialog nextWd = (WizardDialog) container; nextWd.close(); } } }); templateLink.setEnabled(true); }
From source file:com.motorola.studio.android.wizards.buildingblocks.NewActivityWizardListTemplatesPage.java
License:Apache License
private void updateTreeViewAfterSelection(ISelection selection) { String template = selection.toString(); getBuildBlock().setSample(template.substring(1, template.length() - 1)); //condition to enable finish button getBuildBlock().setIsListActivitySelected(true); //category of sample, used to load the correct files getBuildBlock().setSampleCategoty(ActivityBasedOnTemplate.SAMPLE_CATEGORY.LIST_ACTIVITIES_CATEGORY); String strPreview = getBuildBlock().getSamplePreview(); if (strPreview != null) { URL url = null;//from w ww . ja v a 2s . co m try { //loads the selected sample preview image url = FileLocator.toFileURL(CodeUtilsActivator.getDefault().getBundle() .getEntry(ActivityBasedOnTemplate.ACTIVITY_SAMPLES_FOLDER + IPath.SEPARATOR + strPreview)); ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url); Image image = imageDesc.createImage(); Image previousImage = imgLabel.getImage(); if (previousImage != null) { previousImage.dispose(); } imgLabel.setImage(image); } catch (Exception ex) { imgLabel.setImage(null); } } else { imgLabel.setImage(null); } }