List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:eu.artist.postmigration.nfrvt.search.run.ui.AnalysisSettingsTab.java
License:Open Source License
@Override public Image getImage() { URL imgUrl = MigrationExplorerActivator.getDefault().getBundle().getEntry("icons/AnalysisSettingsTab.gif"); if (imgUrl != null) { ImageDescriptor id = null;//from ww w . j ava 2 s .com Image result = MigrationExplorerActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm()); if (result == null) { id = ImageDescriptor.createFromURL(imgUrl); if (id != null) { result = id.createImage(); MigrationExplorerActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result); } } return result; } return null; }
From source file:eu.artist.postmigration.nfrvt.search.run.ui.EvaluationSettingsTab.java
License:Open Source License
@Override public Image getImage() { URL imgUrl = MigrationExplorerActivator.getDefault().getBundle().getEntry("icons/EvaluationSettings.gif"); if (imgUrl != null) { ImageDescriptor id = null;/*from w ww .j a v a2 s . c om*/ Image result = MigrationExplorerActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm()); if (result == null) { id = ImageDescriptor.createFromURL(imgUrl); if (id != null) { result = id.createImage(); MigrationExplorerActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result); } } return result; } return null; }
From source file:eu.artist.postmigration.nfrvt.search.run.ui.PatternSettingsTab.java
License:Open Source License
@Override public Image getImage() { URL imgUrl = MigrationExplorerActivator.getDefault().getBundle().getEntry("icons/PatternSettings.gif"); if (imgUrl != null) { ImageDescriptor id = null;//from w w w . ja va2s . co m Image result = MigrationExplorerActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm()); if (result == null) { id = ImageDescriptor.createFromURL(imgUrl); if (id != null) { result = id.createImage(); MigrationExplorerActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result); } } return result; } return null; }
From source file:eu.artist.postmigration.nfrvt.strategy.fumlsimulation.run.ui.AnalysisSettingsTab.java
License:Open Source License
@Override public Image getImage() { URL imgUrl = FUMLSimulationActivator.getDefault().getBundle().getEntry("icons/AnalysisSettingsTab.gif"); if (imgUrl != null) { ImageDescriptor id = null;//from w w w . j a v a 2 s .c om Image result = FUMLSimulationActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm()); if (result == null) { id = ImageDescriptor.createFromURL(imgUrl); if (id != null) { result = id.createImage(); FUMLSimulationActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result); } } return result; } return null; }
From source file:eu.celar.ui.UIAuthTokenProvider.java
License:Open Source License
/** * Show the new token wizard. If the specified description is not null the wizard will * be started with the wizard page belonging to the specified description. Otherwise it * will be started with the token type page as starting page where the user can choose * the type of the he wants to create./*from ww w .ja v a2 s .co m*/ * * @param tokenWizardId The ID of the token type that should be created or null. * @param forceWizardId * @param description Token description passed to the token specific wizard pages in * order to allow initialisation for a predefined token type. * @return True if the token dialog was closed with status {@link Window#OK}. */ public boolean showNewTokenWizard(final String tokenWizardId, final boolean forceWizardId, final IAuthenticationTokenDescription description) { URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/newtoken_wiz.gif"); //$NON-NLS-1$ Wizard wizard = new Wizard() { @Override public boolean performFinish() { return false; } @Override public void addPages() { List<String> filterList = null; if (tokenWizardId != null) { filterList = new LinkedList<String>(); filterList.add(tokenWizardId); } ExtPointWizardSelectionListPage page = new ExtPointWizardSelectionListPage(WIZARD_PAGE_NAME, Extensions.AUTH_TOKEN_UI_POINT, filterList, forceWizardId, Messages.getString("UIAuthTokenProvider.wizard_first_page_title"), //$NON-NLS-1$ Messages.getString("UIAuthTokenProvider.wizard_first_page_description"), //$NON-NLS-1$ Messages.getString("UIAuthTokenProvider.noTokenCreator")); //$NON-NLS-1$ // page.setPreselectedId( tokenWizardId, true ); page.setInitData(description); page.setCheatSheetManager(cheatSheetManager); addPage(page); } }; wizard.setNeedsProgressMonitor(true); wizard.setForcePreviousAndNextButtons(true); wizard.setWindowTitle(Messages.getString("UIAuthTokenProvider.wizard_title")); //$NON-NLS-1$ wizard.setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl)); WizardDialog dialog = new WizardDialog(this.shell, wizard); return dialog.open() == Window.OK; }
From source file:eu.esdihumboldt.hale.ui.common.function.viewer.FunctionLabelProvider.java
License:Open Source License
/** * @see LabelProvider#getImage(Object)//from w w w . j a v a 2 s. c o m */ @Override public Image getImage(Object element) { if (element instanceof Category) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER); } // get image based on getIconURL in AbstractFunction (and cache them) if (element instanceof AbstractFunction) { URL iconUrl = ((AbstractFunction<?>) element).getIconURL(); String iconString = iconUrl.toString(); Image image = urlImages.get(iconString); if (image == null) { try { image = ImageDescriptor.createFromURL(iconUrl).createImage(); if (image != null) { urlImages.put(iconString, image); } } catch (Throwable e) { // ignore } } return image; } return super.getImage(element); }
From source file:eu.esdihumboldt.hale.ui.function.contribution.internal.AbstractWizardAction.java
License:Open Source License
/** * Constructor/*w w w . j a va 2 s . co m*/ * * @param functionContribution the parent contribution * @param descriptor the function wizard descriptor * @param alignmentService the alignment service */ public AbstractWizardAction(T functionContribution, FunctionWizardDescriptor<?> descriptor, AlignmentService alignmentService) { super(descriptor.getDisplayName(), IAction.AS_PUSH_BUTTON); this.functionContribution = functionContribution; this.descriptor = descriptor; this.alignmentService = alignmentService; setImageDescriptor(ImageDescriptor.createFromURL(descriptor.getIconURL())); // if (selectionService != null) { // selectionService.addSelectionListener(this); // } updateState(); }
From source file:eu.esdihumboldt.hale.ui.function.generic.AbstractGenericFunctionWizard.java
License:Open Source License
/** * @see TitleImageWizard#getTitleImage() *//* ww w .j ava2s .c o m*/ @Override public Image getTitleImage() { if (functionImage == null) { try { functionImage = ImageDescriptor.createFromURL(getFunction().getIconURL()).createImage(); } catch (Exception e) { // ignore } } return functionImage; }
From source file:eu.esdihumboldt.hale.ui.io.action.wizard.ActionUIWizardNode.java
License:Open Source License
/** * Get the wizard image//from w w w. j a v a2 s .c om * * @return the image */ public Image getImage() { if (image == null) { URL iconURL = actionUI.getIconURL(); if (iconURL != null) { image = ImageDescriptor.createFromURL(iconURL).createImage(); } } return image; }
From source file:eu.esdihumboldt.hale.ui.io.ImportSelectSourcePage.java
License:Open Source License
/** * @see HaleWizardPage#createContent(Composite) *//* ww w.j a v a2 s.c o m*/ @Override protected void createContent(Composite page) { // set content types for file field List<IOProviderDescriptor> factories = getWizard().getFactories(); final Set<IContentType> supportedTypes = new HashSet<IContentType>(); for (IOProviderDescriptor factory : factories) { supportedTypes.addAll(factory.getSupportedTypes()); } // get compatible sources List<ImportSourceFactory> availableSources = ImportSourceExtension.getInstance() .getFactories(new FactoryFilter<ImportSource<?>, ImportSourceFactory>() { @Override public boolean acceptFactory(ImportSourceFactory factory) { // check provider factory compatibility boolean providerMatch = factory.getProviderType() .isAssignableFrom(getWizard().getProviderType()); if (!providerMatch) { return false; } // check content type compatibility IContentType ct = factory.getContentType(); if (ct == null) { return true; // any content type supported } else { // stated type must be present return supportedTypes.contains(ct); } } @Override public boolean acceptCollection( ExtensionObjectFactoryCollection<ImportSource<?>, ImportSourceFactory> collection) { return false; } }); if (availableSources == null || availableSources.isEmpty()) { Label label = new Label(page, SWT.NONE); label.setText("No import source available."); } else if (availableSources.size() == 1) { // add source directly createSource(availableSources.iterator().next(), page, supportedTypes); setActiveSource(0); } else { // add tab for each source page.setLayout(new FillLayout()); final TabFolder tabs = new TabFolder(page, SWT.NONE); for (ImportSourceFactory sourceFactory : availableSources) { TabItem item = new TabItem(tabs, SWT.NONE); item.setText(MessageFormat.format("From {0}", sourceFactory.getDisplayName())); // image URL iconURL = sourceFactory.getIconURL(); if (iconURL != null) { Image image = ImageDescriptor.createFromURL(iconURL).createImage(); if (image != null) { images.add(image); // remember for disposal item.setImage(image); } } // tooltip item.setToolTipText(sourceFactory.getDescription()); // content Composite wrapper = new Composite(tabs, SWT.NONE); wrapper.setLayout(GridLayoutFactory.swtDefaults().create()); // for // minimum // margin Composite content = new Composite(wrapper, SWT.NONE); content.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); createSource(sourceFactory, content, supportedTypes); item.setControl(wrapper); } tabs.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setActiveSource(tabs.getSelectionIndex()); } }); setActiveSource(0); } }