Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-02-17 11:48:38 -0500
committerUwe Stieber2014-02-17 11:48:38 -0500
commit3edb463a51011d69a60f273e2718cf5b4d48722d (patch)
treecc3a303108e549ff1de1a2024fe36ea7e218b227
parentf37d71a82e5cf633956c23184a03f16df8d55fc8 (diff)
downloadorg.eclipse.tcf-3edb463a51011d69a60f273e2718cf5b4d48722d.tar.gz
org.eclipse.tcf-3edb463a51011d69a60f273e2718cf5b4d48722d.tar.xz
org.eclipse.tcf-3edb463a51011d69a60f273e2718cf5b4d48722d.zip
Target Explorer: Fix fade in animation not enabled by default with Eclipse 4.3.1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/META-INF/MANIFEST.MF3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/plugin.xml5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/activator/UIPlugin.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/interfaces/IPreferenceKeys.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/AbstractNotificationPopup.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/PopupNotificationSink.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/preferences/PreferencesInitializer.java40
7 files changed, 88 insertions, 18 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/META-INF/MANIFEST.MF
index 20218a8ec..c45dbd1e6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/META-INF/MANIFEST.MF
@@ -17,7 +17,8 @@ Export-Package: org.eclipse.tcf.te.ui.notifications.activator;x-internal:=true,
org.eclipse.tcf.te.ui.notifications.delegates,
org.eclipse.tcf.te.ui.notifications.interfaces,
org.eclipse.tcf.te.ui.notifications.internal;x-internal:=true,
- org.eclipse.tcf.te.ui.notifications.internal.events,
+ org.eclipse.tcf.te.ui.notifications.internal.events;x-internal:=true,
org.eclipse.tcf.te.ui.notifications.internal.factory;x-internal:=true,
org.eclipse.tcf.te.ui.notifications.internal.popup;x-internal:=true,
+ org.eclipse.tcf.te.ui.notifications.internal.preferences;x-internal:=true,
org.eclipse.tcf.te.ui.notifications.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/plugin.xml
index bef14a202..745e0f20b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/plugin.xml
@@ -16,4 +16,9 @@
</eventType>
</eventListener>
</extension>
+
+<!-- Preference contributions -->
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.eclipse.tcf.te.ui.notifications.internal.preferences.PreferencesInitializer"/>
+ </extension>
</plugin>
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 256b5b5cb..88f423317 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
@@ -14,6 +14,7 @@ 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.preferences.ScopedEclipsePreferences;
import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
import org.eclipse.tcf.te.ui.notifications.interfaces.ImageConsts;
import org.eclipse.ui.PlatformUI;
@@ -27,6 +28,8 @@ 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;
@@ -59,6 +62,16 @@ 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.
@@ -101,6 +114,7 @@ public class UIPlugin extends AbstractUIPlugin {
formToolkit = null;
}
plugin = null;
+ scopedPreferences = null;
traceHandler = null;
super.stop(context);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/interfaces/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/interfaces/IPreferenceKeys.java
new file mode 100644
index 000000000..fe3a806b7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/interfaces/IPreferenceKeys.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.notifications.interfaces;
+
+
+/**
+ * The bundle's preference key identifiers.
+ */
+public interface IPreferenceKeys {
+
+ /**
+ * Preference key to access the flag controlling if the notification fading animation is enabled.
+ */
+ public static final String PREF_ENABLE_FADING = "notification.enableFading"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/AbstractNotificationPopup.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/AbstractNotificationPopup.java
index beb5ee3c9..cbda4e7a0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/AbstractNotificationPopup.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/AbstractNotificationPopup.java
@@ -41,6 +41,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tcf.te.ui.notifications.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.notifications.interfaces.IPreferenceKeys;
import org.eclipse.tcf.te.ui.notifications.interfaces.ImageConsts;
import org.eclipse.tcf.te.ui.notifications.internal.popup.AnimationUtil.FadeJob;
import org.eclipse.tcf.te.ui.notifications.internal.popup.AnimationUtil.IFadeListener;
@@ -123,7 +124,7 @@ public abstract class AbstractNotificationPopup extends Window {
/* default */ FadeJob fadeJob;
- private boolean fadingEnabled;
+ private final boolean fadingEnabled;
public AbstractNotificationPopup(Display display) {
this(display, SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
@@ -138,14 +139,9 @@ public abstract class AbstractNotificationPopup extends Window {
initResources();
closeJob.setSystem(true);
- }
-
- public boolean isFadingEnabled() {
- return fadingEnabled;
- }
- public void setFadingEnabled(boolean fadingEnabled) {
- this.fadingEnabled = fadingEnabled;
+ // Initialize the fadingEnabled flag
+ fadingEnabled = UIPlugin.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_ENABLE_FADING);
}
/**
@@ -331,7 +327,7 @@ public abstract class AbstractNotificationPopup extends Window {
constrainShellSize();
shell.setLocation(fixupDisplayBounds(shell.getSize(), shell.getLocation()));
- if (isFadingEnabled()) {
+ if (fadingEnabled) {
shell.setAlpha(0);
}
shell.setVisible(true);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/PopupNotificationSink.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/PopupNotificationSink.java
index 20357aa25..ec965ca35 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/PopupNotificationSink.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/PopupNotificationSink.java
@@ -26,12 +26,10 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tcf.te.runtime.events.NotifyEvent;
import org.eclipse.tcf.te.ui.notifications.nls.Messages;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.PlatformUI;
/**
@@ -112,11 +110,6 @@ public class PopupNotificationSink {
}
- public boolean isAnimationsEnabled() {
- IPreferenceStore store = PlatformUI.getPreferenceStore();
- return store.getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
- }
-
/**
* Notify the given notification events.
*
@@ -144,7 +137,6 @@ public class PopupNotificationSink {
Shell shell = new Shell(PlatformUI.getWorkbench().getDisplay());
popup = new NotificationPopup(shell);
- popup.setFadingEnabled(isAnimationsEnabled());
List<NotifyEvent> toDisplay = new ArrayList<NotifyEvent>(currentlyNotifying);
Collections.sort(toDisplay);
popup.setContents(toDisplay);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/preferences/PreferencesInitializer.java
new file mode 100644
index 000000000..20cae9bd1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/preferences/PreferencesInitializer.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.notifications.internal.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
+import org.eclipse.tcf.te.ui.notifications.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.notifications.interfaces.IPreferenceKeys;
+
+
+/**
+ * The bundle's preference initializer implementation.
+ */
+public class PreferencesInitializer extends AbstractPreferenceInitializer implements IPreferenceKeys {
+
+ /**
+ * Constructor.
+ */
+ public PreferencesInitializer() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ ScopedEclipsePreferences store = UIPlugin.getScopedPreferences();
+
+ // Notification fading animation: default on
+ store.putDefaultBoolean(IPreferenceKeys.PREF_ENABLE_FADING, true);
+ }
+}

Back to the top