List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromImage
public static ImageDescriptor createFromImage(Image img)
From source file:dynamicrefactoring.interfaz.wizard.RefactoringWizard.java
License:Open Source License
/** * Constructor./*ww w.j a v a2 s. c o m*/ * * @param refactoring * refactorizacin que se desea editar o <code>null * @param catalog catlogo de refactorizaciones * </code> si se desea crear una nueva. */ public RefactoringWizard(DynamicRefactoringDefinition refactoring, RefactoringsCatalog catalog) { super(); setNeedsProgressMonitor(true); setDefaultPageImageDescriptor(ImageDescriptor.createFromImage(RefactoringImages.getSIIcon())); setWindowTitle(Messages.RefactoringWizard_WizardTitle); this.refactCatalog = catalog; operation = (refactoring == null) ? CREATE : EDIT; this.refactoring = refactoring; this.originalName = (refactoring != null) ? refactoring.getName() : ""; //$NON-NLS-1$ //generamos el indice para poder realizar bsquedas en tipos de elementos y acciones y predicados try { SearchingFacade.INSTANCE.generateAllIndexes(); } catch (IOException e) { String message = Messages.RefactoringWizard_AllIndexesNotGenerated + ".\n" + e.getMessage(); //$NON-NLS-1$ logger.error(message); } }
From source file:edu.buffalo.cse.green.editor.action.SaveDIAAction.java
License:Open Source License
public ImageDescriptor getImageDescriptor() { Image img = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_SAVEAS_EDIT); return ImageDescriptor.createFromImage(img); }
From source file:edu.buffalo.cse.green.editor.model.MemberModel.java
License:Open Source License
/** * Gets the appropriate icon to represent the given <code>IMember</code>. * /*from ww w.j a v a2s . co m*/ * @param member - The <code>IMember</code> to represent. * @return The icon. */ protected Image getImage(MemberModel<?, ?, E> model) { E member = model.getMember(); ImageDescriptor id = ImageDescriptor.createFromImage(ICON_PROVIDER.getImage(member)); int adornments = 0; IResource memberResource = member.getResource(); if (memberResource != null && member instanceof IMember && member.exists()) { try { IMarker[] errorMarkers = memberResource.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); for (IMarker marker : errorMarkers) { // see if the error/warning is inside this member's scope int errStart = (Integer) marker.getAttribute("charStart"); int errEnd = (Integer) marker.getAttribute("charEnd"); int memStart = member.getSourceRange().getOffset(); int memEnd = memStart + member.getSourceRange().getLength(); if (memStart > errStart || memEnd < errEnd) continue; int severity = marker.getAttribute(IMarker.SEVERITY, SEVERITY_INFO); if (severity == IMarker.SEVERITY_ERROR) { adornments = ERROR; break; } else if (severity == SEVERITY_WARNING) { adornments = WARNING; } } } catch (ResourceException e) { // TODO Issue: when Java editor is open, stack trace // is printed during a refactoring, because we're trying // to access old model, not new model. If Java editor // is not open, we're OK. // RETHROWING THIS EXCEPTION causes a cascade of THROWS clauses being required... // throw e; System.err.println("[GREEN] Resource exception was thrown - probably OK"); } catch (CoreException e) { e.printStackTrace(); } } return new JavaElementImageDescriptor(id, adornments, new Point(id.getImageData().width, id.getImageData().height)).createImage(); }
From source file:eldaEditor.wizards.DSCDiagramCreationPage_ChooseDataBase.java
License:Open Source License
/** * Create a new wizard page instance.//from w ww .j a va 2s . c o m * @param workbench the current workbench * @param selection the current object selection * @see ShapesCreationWizard#init(IWorkbench, IStructuredSelection) */ DSCDiagramCreationPage_ChooseDataBase(IWorkbench workbench, IStructuredSelection selection) { super("dataBasePage"); this.workbench = workbench; this.selection = selection; this.setTitle("Linking events, guards, actions and functions definition file."); setImageDescriptor(ImageDescriptor.createFromImage(OutlineIcons.IMAGE_WIZBAN)); setDescription( "You must select the file containing informations about events, guards, actions and functions\n" + "which would be used in transitions definition.\n" + "They must be into the same project."); }
From source file:eldaEditor.wizards.DSCDiagramCreationPage_ChooseName.java
License:Open Source License
/** * Create a new wizard page instance./*ww w . j a v a 2s . co m*/ * @param workbench the current workbench * @param selection the current object selection * @see ShapesCreationWizard#init(IWorkbench, IStructuredSelection) */ DSCDiagramCreationPage_ChooseName(IWorkbench workbench, IStructuredSelection selection) { super("ChoosePage", selection); this.workbench = workbench; this.selection = selection; setTitle("Create a new " + DEFAULT_EXTENSION + " file"); setDescription("Create a new " + DEFAULT_EXTENSION + " resource."); setImageDescriptor(ImageDescriptor.createFromImage(OutlineIcons.IMAGE_WIZBAN)); }
From source file:eldaEditor.wizards.DSCDiagramCreationPage_Fipa.java
License:Open Source License
/** * Create a new wizard page instance.// w w w. ja va2 s. co m * @param workbench the current workbench * @param selection the current object selection * @see ShapesCreationWizard#init(IWorkbench, IStructuredSelection) */ DSCDiagramCreationPage_Fipa(IWorkbench workbench, IStructuredSelection selection) { // super("fipaPage", selection); super("fipaPage"); this.workbench = workbench; this.selection = selection; this.setTitle("Create a new ADSC diagram"); setImageDescriptor(ImageDescriptor.createFromImage(OutlineIcons.IMAGE_WIZBAN)); this.setDescription("You must only model the Active Distilled Statechart into FIPA template \n"); }
From source file:era.foss.ui.contrib.EraImages.java
License:Open Source License
/** * Gets the image descriptor.//from w w w . j ava 2 s .c o m * * @param imageName the image name * @return the image descriptor */ public static ImageDescriptor getImageDescriptor(String imageName) { return ImageDescriptor.createFromImage(EraImages.getImage(imageName)); }
From source file:es.cv.gvcase.emf.ui.common.utils.ImageUtils.java
License:Open Source License
/** * This method return the ImageDescriptor of the specified Image with the * given name. You can use the static string placed in this class to get the * available Images.//from w w w . j a v a 2s . c om */ public static ImageDescriptor getSharedImageDescriptor(String name) { Image image = getSharedImage(name); if (image != null) { return ImageDescriptor.createFromImage(image); } else { return null; } }
From source file:es.cv.gvcase.mdt.db.navigator.actions.model.MOSKittSqlSubmenuActionProvider.java
License:Open Source License
/** * Generate create actions gen./*from w w w . ja va 2 s.co m*/ * * @param descriptors the descriptors * @param selection the selection * * @return the collection< i action> */ protected Collection<IAction> generateCreateActionsGen(Collection<?> descriptors, ISelection selection) { Collection<IAction> actions = new ArrayList<IAction>(); if (descriptors != null) { for (Object descriptor : descriptors) { if (descriptor instanceof CommandParameter) { CommandParameter cp = (CommandParameter) descriptor; if (filter.isVisible(cp.value) && shouldBeShown((SQLObject) cp.value, selection, isCreateChild())) { // Add the additional attributes if necessary if (cp.value instanceof AuthorizationIdentifier || cp.value instanceof Table) { EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation(); annotation.setSource("AdditionalAttributes"); annotation.getDetails().put("Generated", "false"); ((SQLObject) cp.value).getEAnnotations().add(annotation); if (cp.value instanceof ViewTable) { QueryExpressionDefault qed = SQLExpressionsFactory.eINSTANCE .createQueryExpressionDefault(); qed.setName("queryExpression"); qed.setSQL("SELECT * FROM ..."); ((ViewTable) cp.value).setQueryExpression(qed); } } else if (cp.value instanceof CheckConstraint) { SearchConditionDefault scd = SQLExpressionsFactory.eINSTANCE .createSearchConditionDefault(); scd.setName("searchCondition"); ((CheckConstraint) cp.value).setSearchCondition(scd); } else if (cp.value instanceof Sequence) { IdentitySpecifier is = SQLSchemaFactory.eINSTANCE.createIdentitySpecifier(); is.setName("identitySpecifier"); ((Sequence) cp.value).setIdentity(is); } // Set the name of the element setElementName((SQLObject) cp.value, selection, isCreateChild()); StaticSelectionCommandAction ssca = null; if (isCreateChild()) { ssca = new CreateChildAction(NavigatorUtil.getActiveEditor(), selection, descriptor); } else ssca = new CreateSiblingAction(NavigatorUtil.getActiveEditor(), selection, descriptor); // Now we change the text of the action // This is done so that we can distinguish between // feature and element in the menu item text // This will allow us to separate it in submenus as it's // done in the UML diagrams String valueText = getTypeText(cp.value); String featureText = getFeatureText(cp.feature); ssca.setText(featureText + " | " + valueText); // Set the image of the action String imagePath = ""; try { imagePath = FileLocator .toFileURL(Platform.getBundle("org.eclipse.datatools.modelbase.sql.edit") .getResource("icons/full/obj16")) .getPath(); String className = cp.value.getClass().getSimpleName(); // Remove the "Impl" part of the name className = className.substring(0, className.length() - 4); imagePath += className + ".gif"; Image image = new Image(Display.getCurrent(), imagePath); ImageDescriptor imDesc = ImageDescriptor.createFromImage(image); ssca.setImageDescriptor(imDesc); } catch (IOException e) { return actions; } // Should the action be enabled? if (selection instanceof StructuredSelection) { Object selectedElement = ((StructuredSelection) selection).getFirstElement(); if (!canBeCreated(selectedElement, cp.value)) { ssca.setEnabled(false); } } actions.add(ssca); } } } } return actions; }
From source file:eu.artist.migration.cloudselection.ui.views.GenericView.java
License:Open Source License
private void makeActions() { clear = new Action() { public void run() { clearAll();/*from w w w. ja v a 2 s. c o m*/ } }; clear.setText("Clear"); clear.setToolTipText("Clear current selection"); clear.setImageDescriptor(ImageDescriptor.createFromImage(Utils.createImage("clear.gif"))); ; providerselection = new Action() { public void run() { loadModels(); } }; providerselection.setText("Select providers"); providerselection.setDescription("Select providers"); providerselection.setImageDescriptor(ImageDescriptor.createFromImage(Utils.createImage("add_exc.gif"))); validateProvs = new Action() { public void run() { validate(); } }; validateProvs.setText("Validate and suggest target platform"); validateProvs.setDescription("Get the best target platform solution according to your selection"); validateProvs.setImageDescriptor(ImageDescriptor.createFromImage(Utils.createImage("lrun_obj.gif"))); }