use of org.eclipse.jface.resource.ImageRegistry in project polymap4-core by Polymap4.
the class CatalogPlugin method imageForName.
public Image imageForName(String resName) {
ImageRegistry images = getImageRegistry();
Image image = images.get(resName);
if (image == null || image.isDisposed()) {
URL res = getBundle().getResource(resName);
assert res != null : "Image resource not found: " + resName;
images.put(resName, ImageDescriptor.createFromURL(res));
image = images.get(resName);
}
return image;
}
use of org.eclipse.jface.resource.ImageRegistry in project polymap4-core by Polymap4.
the class CatalogPlugin method imageForDescriptor.
public Image imageForDescriptor(ImageDescriptor imageDescriptor, String key) {
ImageRegistry images = getImageRegistry();
Image image = images.get(key);
if (image == null || image.isDisposed()) {
images.put(key, imageDescriptor);
image = images.get(key);
}
return image;
}
use of org.eclipse.jface.resource.ImageRegistry in project statecharts by Yakindu.
the class DomainWizardPage method createControl.
public void createControl(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
GridLayoutFactory.fillDefaults().applyTo(composite);
final Group domainSelectionGroup = new Group(composite, SWT.NONE);
domainSelectionGroup.setText("Select the statechart domain:");
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(domainSelectionGroup);
GridDataFactory.fillDefaults().grab(true, true).applyTo(domainSelectionGroup);
Label spacer = new Label(domainSelectionGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer);
image = new Label(domainSelectionGroup, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, false).applyTo(image);
domainCombo = new ComboViewer(domainSelectionGroup, SWT.READ_ONLY);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
domainCombo.setContentProvider(new ArrayContentProvider());
domainCombo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((IDomain) element).getName();
}
});
domainCombo.setInput(domainDescriptors);
description = new Label(domainSelectionGroup, SWT.WRAP);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(description);
setControl(composite);
domainCombo.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IDomain domain = unwrap(event.getSelection());
description.setText(domain.getDescription());
image.setImage(asImage(domain));
domainSelectionGroup.layout();
}
private Image asImage(IDomain domain) {
ImageRegistry imageRegistry = DiagramActivator.getDefault().getImageRegistry();
Image image = imageRegistry.get(domain.getImagePath().toString());
if (image == null)
imageRegistry.put(domain.getImagePath().toString(), ImageDescriptor.createFromURL(domain.getImagePath()).createImage());
return imageRegistry.get(domain.getImagePath().toString());
}
});
trySelectDefaultDomain();
IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.yakindu.sct.ui.wizard.create.contribution");
if (configurationElements.length > 0) {
Label spacer2 = new Label(domainSelectionGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer2);
for (IConfigurationElement iConfigurationElement : configurationElements) {
try {
CreationWizardContribution contribution = (CreationWizardContribution) iConfigurationElement.createExecutableExtension("class");
contribution.toDomainWizardPage(composite);
} catch (CoreException e) {
e.printStackTrace();
}
}
}
}
use of org.eclipse.jface.resource.ImageRegistry in project tdq-studio-se by Talend.
the class ImageLib method initialize.
/**
* initialize the fieds.
*/
static void initialize() {
if (imageRegistry == null) {
imageRegistry = new ImageRegistry(PlatformUI.getWorkbench().getDisplay());
iconURL = getIconLocation();
}
}
use of org.eclipse.jface.resource.ImageRegistry in project portfolio by buchen.
the class StartupAddon method replaceDefaultDialogImages.
@PostConstruct
public void replaceDefaultDialogImages() {
ImageRegistry registry = JFaceResources.getImageRegistry();
registry.put(Dialog.DLG_IMG_MESSAGE_ERROR, Images.ERROR.descriptor());
registry.put(Dialog.DLG_IMG_MESSAGE_WARNING, Images.WARNING.descriptor());
registry.put(Dialog.DLG_IMG_MESSAGE_INFO, Images.INFO.descriptor());
}
Aggregations