Search in sources :

Example 16 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project tmdm-studio-se by Talend.

the class RepositoryResourceUtilTest method setUp.

@Before
public void setUp() throws Exception {
    ResourceBundle rb = mock(ResourceBundle.class);
    // $NON-NLS-1$
    stub(method(ResourceBundle.class, "getBundle", String.class)).toReturn(rb);
    PowerMockito.mockStatic(JFaceResources.class);
    ImageRegistry registry = mock(ImageRegistry.class);
    when(JFaceResources.getImageRegistry()).thenReturn(registry);
    PowerMockito.mockStatic(DefaultMessagesImpl.class);
    // $NON-NLS-1$
    when(DefaultMessagesImpl.getString(anyString())).thenReturn("anyString()");
    IRepositoryResourceUtilExAdapter mockAdapter = PowerMockito.mock(IRepositoryResourceUtilExAdapter.class);
    PowerMockito.mockStatic(ExAdapterManager.class);
    PowerMockito.when(ExAdapterManager.getAdapter(new RepositoryResourceUtil(), IRepositoryResourceUtilExAdapter.class)).thenReturn(mockAdapter);
    PowerMockito.mockStatic(CoreRuntimePlugin.class);
    CoreRuntimePlugin coreRuntimePlugin = mock(CoreRuntimePlugin.class);
    when(CoreRuntimePlugin.getInstance()).thenReturn(coreRuntimePlugin);
    PowerMockito.mockStatic(RepositoryNodeProviderRegistryReader.class);
    RepositoryNodeProviderRegistryReader reader = mock(RepositoryNodeProviderRegistryReader.class);
    PowerMockito.when(RepositoryNodeProviderRegistryReader.getInstance()).thenReturn(reader);
}
Also used : RepositoryNodeProviderRegistryReader(org.talend.core.model.repository.RepositoryNodeProviderRegistryReader) ImageRegistry(org.eclipse.jface.resource.ImageRegistry) ResourceBundle(java.util.ResourceBundle) CoreRuntimePlugin(org.talend.core.runtime.CoreRuntimePlugin) Before(org.junit.Before)

Example 17 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project liferay-ide by liferay.

the class LiferayServerUI method createImageRegistry.

protected ImageRegistry createImageRegistry() {
    final ImageRegistry registry = new ImageRegistry();
    final String[] pluginTypes = new String[] { "portlet", "hook", "ext", "layouttpl", "theme", "web" };
    for (String type : pluginTypes) {
        registerImage(registry, type, "/icons/e16/" + type + ".png");
    }
    registerImage(registry, IMG_WIZ_RUNTIME, "wizban/liferay_wiz.png");
    registerImage(registry, IMG_NOTIFICATION, "e16/liferay_logo_16.png");
    return registry;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry)

Example 18 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project liferay-ide by liferay.

the class PortalImages method create.

// public static final Image IMG_WORKFLOW_DEFINITION = createImage( "e16/workflow_16x16.png" );
// public static final Image IMG_WORKFLOW_DEFINITION_WIZBAN = createImage( "wizban/workflow_definition_16x16.png" );
// public static final Image IMG_WORKFLOW_DEFINITIONS_FOLDER = createImage( "e16/definitions_16x16.png" );
private static ImageDescriptor create(String key) {
    try {
        ImageDescriptor imageDescriptor = createDescriptor(key);
        ImageRegistry imageRegistry = getImageRegistry();
        if (imageRegistry != null) {
            imageRegistry.put(key, imageDescriptor);
        }
        return imageDescriptor;
    } catch (Exception ex) {
        PortalUI.logError(ex);
        return null;
    }
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Example 19 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project liferay-ide by liferay.

the class PortalImages method createImage.

private static Image createImage(String key) {
    create(key);
    ImageRegistry imageRegistry = getImageRegistry();
    return imageRegistry == null ? null : imageRegistry.get(key);
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry)

Example 20 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project liferay-ide by liferay.

the class Plugin method getImage.

public Image getImage(String key) {
    ImageRegistry imageRegistry = getImageRegistry();
    Image image = imageRegistry.get(key);
    if (image == null || image.isDisposed()) {
        ImageDescriptor descriptor = getImageDescriptor(key);
        if (descriptor != null) {
            image = descriptor.createImage();
            imageRegistry.put(key, image);
        }
    }
    return image;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Image(org.eclipse.swt.graphics.Image)

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