Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-10-11 03:57:38 -0400
committerUwe Stieber2013-10-11 03:57:38 -0400
commite0d8bd9d64857a6efbcc07d66171c9523ffc6245 (patch)
tree4480084305c09791db9536b46b55cf0725b876e9
parentcbd614b69cea6c3cfb54e6480e6554f681f81fc5 (diff)
downloadorg.eclipse.tcf-e0d8bd9d64857a6efbcc07d66171c9523ffc6245.tar.gz
org.eclipse.tcf-e0d8bd9d64857a6efbcc07d66171c9523ffc6245.tar.xz
org.eclipse.tcf-e0d8bd9d64857a6efbcc07d66171c9523ffc6245.zip
Target Explorer: Complete notification popups and tests
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/build.properties35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/icons/peer.gifbin0 -> 567 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/ImageConsts.java64
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/UIPlugin.java164
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/NotificationsTestCase.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate2.java117
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/delegates/DefaultFormTextFactoryDelegate.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/DefaultFormTextFactoryDelegate.java)57
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/FactoryDelegateManager.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/AbstractNotificationPopup.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/NotificationPopup.java13
13 files changed, 420 insertions, 115 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.tests/build.properties
index 40180a444..8fb3dcb2d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/build.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/build.properties
@@ -1,17 +1,18 @@
-###############################################################################
-# Copyright (c) 2012 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
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- plugin.xml,\
- data/,\
- about.html
+###############################################################################
+# Copyright (c) 2012 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
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ data/,\
+ about.html,\
+ icons/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/icons/peer.gif b/target_explorer/plugins/org.eclipse.tcf.te.tests/icons/peer.gif
new file mode 100644
index 000000000..e9df7b871
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/icons/peer.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
index ed11a79bd..529ec3e6a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
@@ -218,5 +218,9 @@
class="org.eclipse.tcf.te.tests.notifications.TestFormTextFactoryDelegate"
id="org.eclipse.tcf.te.tests.delegates.TestFormTextFactoryDelegate">
</delegate>
+ <delegate
+ class="org.eclipse.tcf.te.tests.notifications.TestFormTextFactoryDelegate2"
+ id="org.eclipse.tcf.te.tests.delegates.TestFormTextFactoryDelegate2">
+ </delegate>
</extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/ImageConsts.java
new file mode 100644
index 000000000..834ebb185
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/ImageConsts.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tests.activator;
+
+/**
+ * Image registry constants.
+ */
+public interface ImageConsts {
+
+ // ***** The directory structure constants *****
+
+ /**
+ * The root directory where to load the images from, relative to
+ * the bundle directory.
+ */
+ public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load disabled local toolbar images from,
+ * relative to the image root directory.
+ */
+ public final static String IMAGE_DIR_DLCL = "dlcl16/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load enabled local toolbar images from,
+ * relative to the image root directory.
+ */
+ public final static String IMAGE_DIR_ELCL = "elcl16/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load view related images from, relative to
+ * the image root directory.
+ */
+ public final static String IMAGE_DIR_EVIEW = "eview16/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load wizard banner images from,
+ * relative to the image root directory.
+ */
+ public final static String IMAGE_DIR_WIZBAN = "wizban/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load object overlay images from,
+ * relative to the image root directory.
+ */
+ public final static String IMAGE_DIR_OVR = "ovr16/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load model object images from, relative to the image root directory.
+ */
+ public final static String IMAGE_DIR_OBJ = "obj16/"; //$NON-NLS-1$
+
+ // ***** The image constants *****
+
+ public static final String PEER = "Peer"; //$NON-NLS-1$
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/UIPlugin.java
index 1b3e9929e..c06c2f9cf 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/activator/UIPlugin.java
@@ -1,64 +1,100 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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.tests.activator;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class UIPlugin extends AbstractUIPlugin {
- // The shared instance
- private static UIPlugin plugin;
-
- /**
- * The constructor
- */
- public UIPlugin() {
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static UIPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() != null && getDefault().getBundle() != null) {
- return getDefault().getBundle().getSymbolicName();
- }
- return "org.eclipse.tcf.te.tests"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.tests.activator;
+
+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.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIPlugin extends AbstractUIPlugin {
+ // The shared instance
+ private static UIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public UIPlugin() {
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() != null && getDefault().getBundle() != null) {
+ return getDefault().getBundle().getSymbolicName();
+ }
+ return "org.eclipse.tcf.te.tests"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = 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 + "peer.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.PEER, 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);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/NotificationsTestCase.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/NotificationsTestCase.java
index 66bb4ca01..03e2737d3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/NotificationsTestCase.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/NotificationsTestCase.java
@@ -18,6 +18,7 @@ import org.eclipse.tcf.te.runtime.events.NotifyEvent;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.tests.CoreTestCase;
+import org.eclipse.tcf.te.tests.activator.ImageConsts;
/**
* Notification test cases.
@@ -44,8 +45,11 @@ public class NotificationsTestCase extends CoreTestCase {
public void testNotifications() {
IPropertiesContainer properties = new PropertiesContainer();
- properties.setProperty(NotifyEvent.PROP_TITLE_TEXT, "VxWorks Simulator"); //$NON-NLS-1$
- properties.setProperty(NotifyEvent.PROP_DESCRIPTION_TEXT, "Test notification issued by the unit test framework."); //$NON-NLS-1$
+ assertNotNull("Failed to create properties container.", properties); //$NON-NLS-1$
+
+ // First test is using the default form text factory delegate
+ properties.setProperty(NotifyEvent.PROP_TITLE_TEXT, "Notification Test"); //$NON-NLS-1$
+ properties.setProperty(NotifyEvent.PROP_DESCRIPTION_TEXT, "Test notification with a simple title and description."); //$NON-NLS-1$
NotifyEvent notification = new NotifyEvent(NotificationsTestCase.this, properties);
assertNotNull("Failed to create test notification event.", notification); //$NON-NLS-1$
@@ -53,6 +57,46 @@ public class NotificationsTestCase extends CoreTestCase {
EventManager.getInstance().fireEvent(notification);
ExecutorsUtil.waitAndExecute(20000, null);
+
+ // Second test is using a custom form text factory delegate to set an icon
+ properties.clearProperties();
+ properties.setProperty(NotifyEvent.PROP_TITLE_TEXT, "Simulator Target"); //$NON-NLS-1$
+ properties.setProperty(NotifyEvent.PROP_TITLE_IMAGE_ID, ImageConsts.PEER);
+ properties.setProperty(NotifyEvent.PROP_DESCRIPTION_TEXT, "Test notification issued by the unit test framework."); //$NON-NLS-1$
+
+ notification = new NotifyEvent(NotificationsTestCase.this, "org.eclipse.tcf.te.tests.delegates.TestFormTextFactoryDelegate", properties); //$NON-NLS-1$
+ assertNotNull("Failed to create test notification event.", notification); //$NON-NLS-1$
+
+ EventManager.getInstance().fireEvent(notification);
+
+ ExecutorsUtil.waitAndExecute(20000, null);
+
+ // Third and forth test is using a custom form text factory delegate to simulate a more complex rendering
+ properties.clearProperties();
+ properties.setProperty(NotifyEvent.PROP_TITLE_TEXT, "Simulator Target"); //$NON-NLS-1$
+ properties.setProperty(NotifyEvent.PROP_TITLE_IMAGE_ID, ImageConsts.PEER);
+ properties.setProperty("moduleName", "cobble.out"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.setProperty("success", true); //$NON-NLS-1$
+
+ notification = new NotifyEvent(NotificationsTestCase.this, "org.eclipse.tcf.te.tests.delegates.TestFormTextFactoryDelegate2", properties); //$NON-NLS-1$
+ assertNotNull("Failed to create test notification event.", notification); //$NON-NLS-1$
+
+ EventManager.getInstance().fireEvent(notification);
+
+ ExecutorsUtil.waitAndExecute(20000, null);
+
+ properties.clearProperties();
+ properties.setProperty(NotifyEvent.PROP_TITLE_TEXT, "Simulator Target"); //$NON-NLS-1$
+ properties.setProperty(NotifyEvent.PROP_TITLE_IMAGE_ID, ImageConsts.PEER);
+ properties.setProperty("moduleName", "cobble.out"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.setProperty("success", false); //$NON-NLS-1$
+
+ notification = new NotifyEvent(NotificationsTestCase.this, "org.eclipse.tcf.te.tests.delegates.TestFormTextFactoryDelegate2", properties); //$NON-NLS-1$
+ assertNotNull("Failed to create test notification event.", notification); //$NON-NLS-1$
+
+ EventManager.getInstance().fireEvent(notification);
+
+ ExecutorsUtil.waitAndExecute(20000, null);
}
//***** END SECTION: Single test methods *****
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate.java
index cefc4add7..d4cfd40c1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate.java
@@ -10,23 +10,21 @@
package org.eclipse.tcf.te.tests.notifications;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.events.NotifyEvent;
-import org.eclipse.tcf.te.ui.notifications.interfaces.IFormTextFactoryDelegate;
-import org.eclipse.ui.forms.widgets.FormText;
-import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tests.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.notifications.delegates.DefaultFormTextFactoryDelegate;
/**
* Test notification form text factory delegate implementation.
*/
-public class TestFormTextFactoryDelegate implements IFormTextFactoryDelegate {
+public class TestFormTextFactoryDelegate extends DefaultFormTextFactoryDelegate {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.notifications.interfaces.IFormTextFactoryDelegate#populateFormText(org.eclipse.ui.forms.widgets.FormToolkit, org.eclipse.ui.forms.widgets.FormText, org.eclipse.tcf.te.runtime.events.NotifyEvent)
+ * @see org.eclipse.tcf.te.ui.notifications.delegates.DefaultFormTextFactoryDelegate#getImage(java.lang.String)
*/
@Override
- public void populateFormText(FormToolkit toolkit, FormText widget, NotifyEvent event) {
- Assert.isNotNull(toolkit);
- Assert.isNotNull(widget);
- Assert.isNotNull(event);
+ protected Image getImage(String key) {
+ Assert.isNotNull(key);
+ return UIPlugin.getImage(key);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate2.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate2.java
new file mode 100644
index 000000000..3a9370136
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate2.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tests.notifications;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.runtime.events.NotifyEvent;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * Test notification form text factory delegate implementation.
+ */
+public class TestFormTextFactoryDelegate2 extends TestFormTextFactoryDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.notifications.delegates.DefaultFormTextFactoryDelegate#populateFormText(org.eclipse.ui.forms.widgets.FormToolkit, org.eclipse.ui.forms.widgets.FormText, org.eclipse.tcf.te.runtime.events.NotifyEvent)
+ */
+ @Override
+ public void populateFormText(FormToolkit toolkit, FormText widget, NotifyEvent event) {
+ Assert.isNotNull(toolkit);
+ Assert.isNotNull(widget);
+ Assert.isNotNull(event);
+
+ // Get properties
+ String titleText = event.getProperties().getStringProperty(NotifyEvent.PROP_TITLE_TEXT);
+ String titleImageId = event.getProperties().getStringProperty(NotifyEvent.PROP_TITLE_IMAGE_ID);
+ String moduleName = event.getProperties().getStringProperty("moduleName"); //$NON-NLS-1$
+ boolean success = event.getProperties().getBooleanProperty("success"); //$NON-NLS-1$
+
+ if (titleText != null && moduleName != null) {
+ StringBuilder buffer = new StringBuilder();
+
+ buffer.append("<form>"); //$NON-NLS-1$
+
+ // The title paragraph
+ buffer.append("<p>"); //$NON-NLS-1$
+
+ // If the title image id is set, try to load the image
+ if (titleImageId != null) {
+ Image image = getImage(titleImageId);
+ if (image != null) {
+ buffer.append("<img href=\"titleImage\"/> "); //$NON-NLS-1$
+ widget.setImage("titleImage", image); //$NON-NLS-1$
+ }
+ }
+
+ // Set the title using the default header font
+ buffer.append("<span color=\"header\" font=\"header\">"); //$NON-NLS-1$
+ buffer.append(titleText);
+ buffer.append("</span>"); //$NON-NLS-1$
+
+ buffer.append("</p>"); //$NON-NLS-1$
+
+ if (success) {
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append("<span color=\"green\" font=\"text\">"); //$NON-NLS-1$
+ buffer.append("Successfully"); //$NON-NLS-1$
+ buffer.append("</span>"); //$NON-NLS-1$
+ buffer.append(" "); //$NON-NLS-1$
+ buffer.append("<span font=\"text\">"); //$NON-NLS-1$
+ buffer.append("loaded module " + moduleName + "."); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("</span>"); //$NON-NLS-1$
+ buffer.append("</p>"); //$NON-NLS-1$
+
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append("<a href=\"showModule\" nowrap=\"true\">Show Module</a>"); //$NON-NLS-1$
+ buffer.append("</p>"); //$NON-NLS-1$
+ } else {
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append("<span color=\"red\" font=\"text\">"); //$NON-NLS-1$
+ buffer.append("Failed"); //$NON-NLS-1$
+ buffer.append("</span>"); //$NON-NLS-1$
+ buffer.append(" "); //$NON-NLS-1$
+ buffer.append("<span font=\"text\">"); //$NON-NLS-1$
+ buffer.append("to load module " + moduleName + "."); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("</span>"); //$NON-NLS-1$
+ buffer.append("</p>"); //$NON-NLS-1$
+
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append("<a href=\"showError\" nowrap=\"true\">Show Error</a>"); //$NON-NLS-1$
+ buffer.append("</p>"); //$NON-NLS-1$
+ }
+
+ buffer.append("</form>"); //$NON-NLS-1$
+
+ // Set colors
+ setFormTextColors(toolkit, widget);
+ // Set fonts
+ setFormTextFonts(toolkit, widget);
+
+ // Set the form text to the widget
+ widget.setText(buffer.toString(), true, false);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.notifications.delegates.DefaultFormTextFactoryDelegate#setFormTextColors(org.eclipse.ui.forms.widgets.FormToolkit, org.eclipse.ui.forms.widgets.FormText)
+ */
+ @Override
+ protected void setFormTextColors(FormToolkit toolkit, FormText widget) {
+ super.setFormTextColors(toolkit, widget);
+
+ widget.setColor("green", PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN)); //$NON-NLS-1$
+ widget.setColor("red", PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_RED)); //$NON-NLS-1$
+ }
+}
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 aedd3aa08..20218a8ec 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
@@ -14,6 +14,7 @@ Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Bundle-Localization: plugin
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,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/DefaultFormTextFactoryDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/delegates/DefaultFormTextFactoryDelegate.java
index f80c6c8b5..6a629cb6e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/DefaultFormTextFactoryDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/delegates/DefaultFormTextFactoryDelegate.java
@@ -7,7 +7,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.ui.notifications.internal.factory;
+package org.eclipse.tcf.te.ui.notifications.delegates;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.JFaceResources;
@@ -44,11 +44,14 @@ public class DefaultFormTextFactoryDelegate implements IFormTextFactoryDelegate
buffer.append("<form>"); //$NON-NLS-1$
+ // The title paragraph
+ buffer.append("<p>"); //$NON-NLS-1$
+
// If the title image id is set, try to load the image
if (titleImageId != null) {
- Image image = UIPlugin.getImage(titleImageId);
+ Image image = getImage(titleImageId);
if (image != null) {
- buffer.append("<img href=\"titleImage\"> "); //$NON-NLS-1$
+ buffer.append("<img href=\"titleImage\"/> "); //$NON-NLS-1$
widget.setImage("titleImage", image); //$NON-NLS-1$
}
}
@@ -58,17 +61,61 @@ public class DefaultFormTextFactoryDelegate implements IFormTextFactoryDelegate
buffer.append(titleText);
buffer.append("</span>"); //$NON-NLS-1$
+ buffer.append("</p>"); //$NON-NLS-1$
+
// Add the description
buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append("<span font=\"text\">"); //$NON-NLS-1$
buffer.append(description);
+ buffer.append("</span>"); //$NON-NLS-1$
buffer.append("</p>"); //$NON-NLS-1$
buffer.append("</form>"); //$NON-NLS-1$
- widget.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE)); //$NON-NLS-1$
- widget.setFont("header", JFaceResources.getHeaderFont()); //$NON-NLS-1$
+ // Set colors
+ setFormTextColors(toolkit, widget);
+ // Set fonts
+ setFormTextFonts(toolkit, widget);
+ // Set the form text to the widget
widget.setText(buffer.toString(), true, false);
}
}
+
+ /**
+ * Set the colors used by the form.
+ *
+ * @param toolkit The form toolkit. Must not be <code>null</code>.
+ * @param widget The form text widget. Must not be <code>null</code>.
+ */
+ protected void setFormTextColors(FormToolkit toolkit, FormText widget) {
+ Assert.isNotNull(toolkit);
+ Assert.isNotNull(widget);
+
+ widget.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE)); //$NON-NLS-1$
+ }
+
+ /**
+ * Set the fonts used by the form.
+ *
+ * @param toolkit The form toolkit. Must not be <code>null</code>.
+ * @param widget The form text widget. Must not be <code>null</code>.
+ */
+ protected void setFormTextFonts(FormToolkit toolkit, FormText widget) {
+ Assert.isNotNull(toolkit);
+ Assert.isNotNull(widget);
+
+ widget.setFont("header", JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); //$NON-NLS-1$
+ widget.setFont("text", JFaceResources.getTextFont()); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the image for the given image key.
+ *
+ * @param key The image key. Must not be <code>null</code>.
+ * @return The image or <code>null</code>.
+ */
+ protected Image getImage(String key) {
+ return UIPlugin.getImage(key);
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/FactoryDelegateManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/FactoryDelegateManager.java
index fc832f2a1..1d81a8656 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/FactoryDelegateManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/factory/FactoryDelegateManager.java
@@ -14,6 +14,7 @@ import java.util.Collection;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+import org.eclipse.tcf.te.ui.notifications.delegates.DefaultFormTextFactoryDelegate;
import org.eclipse.tcf.te.ui.notifications.interfaces.IFormTextFactoryDelegate;
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 1c3596a64..10feee51c 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
@@ -453,7 +453,7 @@ public abstract class AbstractNotificationPopup extends Window {
/* Create Title Area */
createTitleArea(titleCircle);
- /* Outer composite to hold content controlls */
+ /* Outer composite to hold content controls */
Composite outerContentCircle = new Composite(outerCircle, SWT.NONE);
outerContentCircle.setBackgroundMode(SWT.INHERIT_FORCE);
@@ -495,20 +495,9 @@ public abstract class AbstractNotificationPopup extends Window {
/* Content Area */
createContentArea(innerContent);
- setNullBackground(outerCircle);
-
return outerCircle;
}
- private void setNullBackground(final Composite outerCircle) {
- for (Control c : outerCircle.getChildren()) {
- c.setBackground(null);
- if (c instanceof Composite) {
- setNullBackground((Composite) c);
- }
- }
- }
-
@Override
protected void initializeBounds() {
Rectangle clArea = getPrimaryClientArea();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/NotificationPopup.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/NotificationPopup.java
index 3145dfc43..83b5edb24 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/NotificationPopup.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.notifications/src/org/eclipse/tcf/te/ui/notifications/internal/popup/NotificationPopup.java
@@ -16,12 +16,12 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
@@ -78,9 +78,8 @@ public class NotificationPopup extends AbstractNotificationPopup {
int count = 0;
for (final NotifyEvent notification : notifications) {
Composite notificationComposite = new Composite(parent, SWT.NO_FOCUS);
- GridLayout gridLayout = new GridLayout(1, false);
- GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(notificationComposite);
- notificationComposite.setLayout(gridLayout);
+ notificationComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ notificationComposite.setLayout(new GridLayout(1, false));
notificationComposite.setBackground(parent.getBackground());
if (count < NUM_NOTIFICATIONS_TO_DISPLAY) {
@@ -98,7 +97,11 @@ public class NotificationPopup extends AbstractNotificationPopup {
// Create the form text widget.
FormText widget = toolkit.createFormText(notificationComposite, true);
- widget.setBackground(parent.getBackground());
+ GridData layoutData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ layoutData.widthHint = 300;
+ widget.setLayoutData(layoutData);
+ widget.setBackground(notificationComposite.getBackground());
+ widget.setWhitespaceNormalized(false);
// Populate the widget content based on the current notification event
delegate.populateFormText(toolkit, widget, notification);

Back to the top