List of usage examples for org.eclipse.jface.resource ImageDescriptor createImage
public Image createImage()
From source file:msi.gama.lang.gaml.ui.decorators.GamlImageHelper.java
/** * @see org.eclipse.xtext.ui.IImageHelper#getImage(org.eclipse.jface.resource.ImageDescriptor) *//*from w w w.ja va2 s.c om*/ @Override public Image getImage(final ImageDescriptor d) { ImageDescriptor descriptor = d; if (descriptor == null) { descriptor = ImageDescriptor.getMissingImageDescriptor(); } Image result = registry.get(descriptor); if (result != null) { return result; } result = descriptor.createImage(); if (result != null) { registry.put(descriptor, result); } return result; }
From source file:name.neilbartlett.eclipse.bundlemonitor.views.services.ServiceLabelProvider.java
License:Open Source License
public ServiceLabelProvider() { ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/generic_element.gif"); imgObject = desc.createImage(); }
From source file:name.nirav.evariablesview.ui.view.ViewLabelProvider.java
License:Open Source License
@Override public Image getImage(Object element) { if (element instanceof DebugVariable) { String icoName = "methdef_obj.gif"; DebugVariable var = (DebugVariable) element; ImageDescriptor descriptor; try {//from w w w . j a v a 2 s . co m IJavaModifiers modifiers = var.getModifiers(); if (modifiers != null) { if (modifiers.isFinal()) { if (modifiers.isStatic()) icoName = "constant_co.gif"; else icoName = "final_co.gif"; } else if (modifiers.isPrivate()) { icoName = "private_co.gif"; } else if (modifiers.isStatic()) { icoName = "static_co.gif"; } else if (modifiers.isProtected()) { icoName = "protected_co.gif"; } else if (modifiers.isPublic()) { icoName = "public_co.gif"; } } Image img = cache.get(icoName); if (img != null) return img; descriptor = Activator.getImageDescriptor("icons/" + icoName); Image image = descriptor.createImage(); cache.put(icoName, image); return image; } catch (DebugException e) { Activator.log(e); } } return null; }
From source file:net.bioclipse.biojava.ui.views.SequenceLabelProvider.java
License:Open Source License
public Image getImage(Object element) { if (element instanceof List) { if (sequenceImage == null) { ImageDescriptor descriptor = Activator.getImageDescriptor("icons/sequence4.gif"); sequenceImage = descriptor.createImage(); }//w w w. j av a2 s. com return sequenceImage; } else if (element instanceof ISequence) { if (sequenceImage == null) { ImageDescriptor descriptor = Activator.getImageDescriptor("icons/sequence4.gif"); sequenceImage = descriptor.createImage(); } return sequenceImage; } String imageKey = ISharedImages.IMG_OBJ_ELEMENT; return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); }
From source file:net.bioclipse.core.util.ImageCache.java
License:Open Source License
@SuppressWarnings("unchecked") public Image getImage(ImageDescriptor imageDescriptor) { if (imageDescriptor == null) return null; Image image = (Image) imageMap.get(imageDescriptor); if (image == null) { image = imageDescriptor.createImage(); imageMap.put(imageDescriptor, image); }//from w w w . ja v a 2 s.c o m return image; }
From source file:net.bioclipse.ds.model.AbstractDSTest.java
License:Open Source License
public Image getIcon() { //Create the icon if not already done so if (testErrorMessage != null && testErrorMessage.length() > 1) { if (errorIcon == null) errorIcon = Activator.imageDescriptorFromPlugin(net.bioclipse.ds.Activator.PLUGIN_ID, ERROR_ICON) .createImage();/*from w w w . j ava 2 s . c om*/ return errorIcon; } else if (isExcluded()) { if (excludedIcon == null) excludedIcon = Activator .imageDescriptorFromPlugin(net.bioclipse.ds.Activator.PLUGIN_ID, EXCLUDED_ICON) .createImage(); return excludedIcon; } else if (iconpath == null) icon = Activator.imageDescriptorFromPlugin(net.bioclipse.ds.Activator.PLUGIN_ID, DEFAULT_TEST_ICON) .createImage(); else if (icon == null && pluginID != null && iconpath != null) { ImageDescriptor ide = Activator.imageDescriptorFromPlugin(pluginID, iconpath); if (ide != null) icon = ide.createImage(); } return icon; }
From source file:net.bioclipse.qsar.descriptor.model.BaseEPObject.java
License:Open Source License
public Image getIcon() { if (icon_path == null) { return null; }/*from www .j a va 2s . c om*/ if (icon == null) { ImageDescriptor idesc = Activator.getImageDescriptor(icon_path); if (idesc == null) return null; icon = idesc.createImage(); } return icon; }
From source file:net.bioclipse.usermanager.AccountPropertiesPage.java
License:Open Source License
public AccountPropertiesPage(Composite parent, AccountType accountType, NewAccountWizardPage nawp, UserContainer sandbox) {//www . j av a 2 s . co m this.sandbox = sandbox; int noOfFields = 0, i = 0; mainPage = nawp; Iterator<Property> propertyIter; Property temp; this.accountType = accountType; properties = accountType.getProperties(); // for (propertyIter = properties.iterator(); propertyIter.hasNext(); ) { // if (propertyIter.next().isSecret()) // noOfSecretFields++; // } noOfFields = properties.size();// + noOfSecretFields; accountComposite = new Composite(parent, SWT.NONE); accountComposite.setLayout(new GridLayout(1, false)); GridData txtData = new GridData(SWT.FILL, SWT.NONE, true, true); Composite accountNameComposite = new Composite(accountComposite, SWT.NONE); accountNameComposite.setLayout(new GridLayout(2, false)); accountNameLabel = new Label(accountNameComposite, SWT.NONE); accountNameLabel.setText("Account name: "); accountNameTxt = new Text(accountNameComposite, SWT.BORDER); accountNameTxt.setLayoutData(txtData); accountNameTxt.setText(accountType.getName()); accountNameTxt.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { accountId = accountNameTxt.getText(); mainPage.setPageComplete(isAllRequierdPropertiesFilledIn()); } }); accountPropGroup = new Group(accountComposite, SWT.SHADOW_ETCHED_IN); accountPropGroup.setText("Third-part account properties"); accountLabels = new Label[noOfFields]; accountTxt = new Text[noOfFields]; txtData.widthHint = 220; if (accountType.hasLogo()) { accountPropGroup.setLayout(new GridLayout(2, false)); } else accountPropGroup.setLayout(new GridLayout(1, false)); propComposite = new Composite(accountPropGroup, SWT.NONE); propComposite.setLayout(new GridLayout(2, false)); propertyIter = properties.iterator(); while (propertyIter.hasNext()) { temp = propertyIter.next(); if (temp.isSecret()) { addComponents(i, SWT.BORDER | SWT.PASSWORD, temp.isRequired(), temp.getName(), temp.getDefaultValue()); // i++; // addComponents(i, SWT.BORDER | SWT.PASSWORD, temp.isRequired(), // "Repeat " + temp.getName()); // final int my_i = i; // final ControlDecoration deco = new ControlDecoration( // accountTxt[my_i], SWT.TOP | SWT.RIGHT); // deco.setDescriptionText("The value has to be the same as " + // "the value above"); // deco.setImage(errImage); // deco.setShowOnlyOnFocus(false); // deco.hide(); // accountTxt[i].addKeyListener(new KeyListener() { // // @Override // public void keyReleased(KeyEvent e) { // if (!(accountTxt[my_i-1].getText().equals( // accountTxt[my_i].getText()))) { // deco.show(); // errorFlag = true; // mainPage.setErrorMessage("The value has to be " + // "the same as the value above"); // } else { // deco.hide(); // if (isAllRequierdPropertiesFilledIn()) { // mainPage.setErrorMessage(null); // errorFlag = false; // } else { // errorFlag = true; // createMissingFieldsError(); // } // // } // // } // // @Override // public void keyPressed(KeyEvent e) { // } // }); } else { addComponents(i, SWT.BORDER, temp.isRequired(), temp.getName(), temp.getDefaultValue()); } i++; } if (accountType.hasLogo()) { Label logo = new Label(accountPropGroup, SWT.TOP); ImageDescriptor imDesc = ImageDescriptor.createFromURL(accountType.getLogoPath()); Image im = imDesc.createImage(); logo.setImage(im); } if (createTestConnection()) { // new Label(accountPropGroup, SWT.NONE).setText( "Dummy1" ); if (accountType.hasLogo()) { new Label(accountPropGroup, SWT.NONE); } testLoginButton = new Button(accountPropGroup, SWT.PUSH); testLoginButton.setText("Test log-in"); testLoginButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { testConnection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); } mainPage.setPageComplete(isAllRequierdPropertiesFilledIn()); accountPropGroup.setFocus(); }
From source file:net.bioclipse.usermanager.dialogs.DialogArea.java
License:Open Source License
/** * This method is used when ever a dialog for login in Bioclipse is wanted. * // w w w .j a v a 2 s.com * @param parent The component where it will live * @return A composite with the different SWT-components that are needed. */ public Composite getLoginArea(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayout(new FormLayout()); container.setLayoutData(new GridData(GridData.FILL_BOTH)); usernameLabel = new Label(container, SWT.NONE); final FormData formData = new FormData(); usernameLabel.setLayoutData(formData); usernameLabel.setText("Username:"); passwordLabel = new Label(container, SWT.NONE); final FormData formData_1 = new FormData(); passwordLabel.setLayoutData(formData_1); passwordLabel.setText("Password:"); usernameText = new Text(container, SWT.BORDER); formData.bottom = new FormAttachment(usernameText, 0, SWT.BOTTOM); formData.right = new FormAttachment(usernameText, -5, SWT.LEFT); final FormData formData_2 = new FormData(); formData_2.right = new FormAttachment(usernameText, 0, SWT.RIGHT); formData_2.left = new FormAttachment(usernameText, 0, SWT.LEFT); final FormData formData_3 = new FormData(); formData_3.left = new FormAttachment(0, 140); formData_3.right = new FormAttachment(100, -34); formData_3.top = new FormAttachment(0, 53); usernameText.setLayoutData(formData_3); usernameText.addListener(SWT.CHANGED, this); passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD); formData_1.bottom = new FormAttachment(passwordText, 0, SWT.BOTTOM); formData_1.right = new FormAttachment(passwordText, -5, SWT.LEFT); formData_2.top = new FormAttachment(0, 93); passwordText.setLayoutData(formData_2); passwordText.addListener(SWT.CHANGED, this); if (createNewAccountButton) { Button createNewKeyringButton = new Button(container, SWT.NONE); createNewKeyringButton.addSelectionListener(new SelectionAdapter() { /* * CREATE NEW USER */ public void widgetSelected(SelectionEvent e) { CreateUserDialog createDialog = new CreateUserDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), userContainer); createDialog.open(); if (createDialog.getReturnCode() == Window.OK) { createDialog.close(); EditUserDialog dialog = new EditUserDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), userContainer); dialog.open(); if (dialog.getReturnCode() == Window.OK) { userContainerEdited = true; } } } }); final FormData formData_4 = new FormData(); formData_4.right = new FormAttachment(100, -34); formData_4.top = new FormAttachment(0, 136); createNewKeyringButton.setLayoutData(formData_4); createNewKeyringButton.setText("Create new Account..."); container.setTabList(new Control[] { usernameText, passwordText, passwordLabel, usernameLabel, createNewKeyringButton }); } else { repeatPasswordLabel = new Label(container, SWT.NONE); final FormData formData_4 = new FormData(); repeatPasswordLabel.setLayoutData(formData_2); repeatPasswordLabel.setText("Repeat password:"); repeatPasswordText = new Text(container, SWT.BORDER | SWT.PASSWORD); formData_2.bottom = new FormAttachment(repeatPasswordText, 0, SWT.BOTTOM); formData_2.right = new FormAttachment(repeatPasswordText, -5, SWT.LEFT); formData_4.left = new FormAttachment(repeatPasswordText, -316, SWT.RIGHT); formData_4.right = new FormAttachment(repeatPasswordText, 0, SWT.RIGHT); final FormData formData_5 = new FormData(); formData_5.top = new FormAttachment(0, 107); formData_5.left = new FormAttachment(0, 154); formData_5.right = new FormAttachment(0, 470); repeatPasswordText.setLayoutData(formData_5); repeatPasswordText.addListener(SWT.CHANGED, this); container.setTabList(new Control[] { usernameText, passwordText, repeatPasswordText, usernameLabel, passwordLabel, repeatPasswordLabel }); } Label icon = new Label(container, SWT.NONE); ImageDescriptor imgDesc = ImageDescriptor.createFromFile(this.getClass(), "../../../../../icons/login_16.png"); Image img = imgDesc.createImage(); icon.setImage(img); final FormData formData_6 = new FormData(); formData_6.bottom = new FormAttachment(usernameText, 0, SWT.RIGHT); formData_6.left = new FormAttachment(usernameText, 0, SWT.RIGHT); icon.setLayoutData(formData_6); usernameText.setFocus(); return container; }
From source file:net.cryptea.view.AboutDialog.java
License:Open Source License
private Image createImage() { Bundle bundle = FrameworkUtil.getBundle(AboutDialog.class); URL url = FileLocator.find(bundle, new Path(CrypTeaConstants.Images.CRYPTEA_128), null); ImageDescriptor imageDcr = ImageDescriptor.createFromURL(url); return imageDcr.createImage(); }