Search in sources :

Example 56 with ImageRegistry

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;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) Image(org.eclipse.swt.graphics.Image) URL(java.net.URL)

Example 57 with ImageRegistry

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;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) Image(org.eclipse.swt.graphics.Image)

Example 58 with ImageRegistry

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();
            }
        }
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Image(org.eclipse.swt.graphics.Image) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IDomain(org.yakindu.sct.domain.extension.IDomain) ImageRegistry(org.eclipse.jface.resource.ImageRegistry) CoreException(org.eclipse.core.runtime.CoreException) ComboViewer(org.eclipse.jface.viewers.ComboViewer) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 59 with ImageRegistry

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();
    }
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry)

Example 60 with ImageRegistry

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());
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ImageRegistry (org.eclipse.jface.resource.ImageRegistry)63 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)25 Image (org.eclipse.swt.graphics.Image)22 URL (java.net.URL)4 ResourceBundle (java.util.ResourceBundle)4 Before (org.junit.Before)4 CoreRuntimePlugin (org.talend.core.runtime.CoreRuntimePlugin)4 CompositeMultiImageDescriptor (com.archimatetool.editor.ui.components.CompositeMultiImageDescriptor)3 ResourceImageDescriptor (de.jaret.util.ui.ResourceImageDescriptor)3 CompositeImageDescriptor (org.eclipse.jface.resource.CompositeImageDescriptor)3 Label (org.eclipse.swt.widgets.Label)3 RepositoryContext (org.talend.core.context.RepositoryContext)3 Project (org.talend.core.model.general.Project)3 User (org.talend.core.model.properties.User)3 IRepositoryFactory (org.talend.core.repository.model.IRepositoryFactory)3 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)3 XmiResourceManager (org.talend.core.repository.utils.XmiResourceManager)3 IRepositoryNodeConfiguration (org.talend.mdm.repository.core.IRepositoryNodeConfiguration)3 IRepositoryNodeResourceProvider (org.talend.mdm.repository.core.IRepositoryNodeResourceProvider)3 RecycleBinNodeConfiguration (org.talend.mdm.repository.core.impl.recyclebin.RecycleBinNodeConfiguration)3