diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/SharedIcons.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/SharedIcons.java | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/SharedIcons.java b/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/SharedIcons.java deleted file mode 100644 index 677ddda0b4..0000000000 --- a/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/SharedIcons.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - * Victor Roldan Betancort - maintenance - */ -package org.eclipse.emf.cdo.ui.internal.location; - -import org.eclipse.emf.cdo.ui.internal.location.bundle.OM; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * @author Eike Stepper - */ -public class SharedIcons -{ - private static final ImageRegistry REGISTRY = new ImageRegistry(getDisplay()); - - public static final String REPO = "repo.gif"; //$NON-NLS-1$ - - public static final String BRANCH = "branch.png"; //$NON-NLS-1$ - - public static Image getImage(String key) - { - key = mangleKey(key); - Image image = REGISTRY.get(key); - if (image == null) - { - createDescriptor(key); - image = REGISTRY.get(key); - } - - // For some reason, sometimes images get disposed. - // In that case, create and put in registry again. - if (image.isDisposed()) - { - REGISTRY.remove(key); - createDescriptor(key); - image = REGISTRY.get(key); - } - - return image; - } - - public static ImageDescriptor getDescriptor(String key) - { - key = mangleKey(key); - ImageDescriptor descriptor = REGISTRY.getDescriptor(key); - if (descriptor == null) - { - descriptor = createDescriptor(key); - } - - return descriptor; - } - - private static ImageDescriptor createDescriptor(String key) - { - ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(OM.BUNDLE_ID, key); - if (descriptor != null) - { - REGISTRY.put(key, descriptor); - } - - return descriptor; - } - - private static Display getDisplay() - { - Display display = Display.getCurrent(); - if (display == null) - { - display = Display.getDefault(); - } - - if (display == null) - { - throw new IllegalStateException("display == null"); //$NON-NLS-1$ - } - - return display; - } - - private static String mangleKey(String key) - { - return "icons/" + key; //$NON-NLS-1$ - } -} |