Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/activator/UIPlugin.java')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/activator/UIPlugin.java94
1 files changed, 78 insertions, 16 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/activator/UIPlugin.java
index dc5785c3c..3712b8089 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/activator/UIPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013 Wind River Systems, Inc. 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
@@ -9,8 +9,16 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.notifications.activator;
-import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
+import org.eclipse.tcf.te.ui.notifications.interfaces.ImageConsts;
+import org.eclipse.tcf.te.ui.notifications.internal.NotificationModel;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -20,11 +28,14 @@ import org.osgi.framework.BundleContext;
public class UIPlugin extends AbstractUIPlugin {
// The shared instance
private static UIPlugin plugin;
- // The scoped preferences instance
- private static volatile ScopedEclipsePreferences scopedPreferences;
// The trace handler instance
private static volatile TraceHandler traceHandler;
+ private volatile NotificationModel model;
+
+ // The form colors instance
+ private volatile FormColors formColors = null;
+
/**
* The constructor
*/
@@ -51,16 +62,6 @@ public class UIPlugin extends AbstractUIPlugin {
}
/**
- * Return the scoped preferences for this plugin.
- */
- public static ScopedEclipsePreferences getScopedPreferences() {
- if (scopedPreferences == null) {
- scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier());
- }
- return scopedPreferences;
- }
-
- /**
* Returns the bundles trace handler.
*
* @return The bundles trace handler.
@@ -71,6 +72,32 @@ public class UIPlugin extends AbstractUIPlugin {
}
return traceHandler;
}
+
+ /**
+ * Returns the notification model instance.
+ *
+ * @return The notification model.
+ */
+ public NotificationModel getModel() {
+ if (model == null) {
+ model = new NotificationModel();
+ }
+ return model;
+ }
+
+ /**
+ * Returns a form colors instance.
+ *
+ * @return The form colors instance.
+ */
+ public FormColors getFormColors() {
+ if (formColors == null) {
+ formColors = new FormColors(PlatformUI.getWorkbench().getDisplay());
+ formColors.markShared();
+ }
+ return formColors;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@@ -85,11 +112,46 @@ public class UIPlugin extends AbstractUIPlugin {
*/
@Override
public void stop(BundleContext context) throws Exception {
- // Save the tree viewer's state.
+ if (formColors != null) {
+ formColors.dispose();
+ formColors = null;
+ }
plugin = null;
- scopedPreferences = null;
traceHandler = null;
super.stop(context);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
+ */
+ @Override
+ protected void initializeImageRegistry(ImageRegistry registry) {
+ URL url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_EVIEW + "notification-close.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.NOTIFICATION_CLOSE, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_EVIEW + "notification-close-active.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.NOTIFICATION_CLOSE_HOVER, ImageDescriptor.createFromURL(url));
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the <code>Image</code> object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The <code>Image</code> object instance or <code>null</code>.
+ */
+ public static Image getImage(String key) {
+ return getDefault().getImageRegistry().get(key);
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the <code>ImageDescriptor</code> object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The <code>ImageDescriptor</code> object instance or <code>null</code>.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getDefault().getImageRegistry().getDescriptor(key);
+ }
+
}

Back to the top