Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-10-10 11:47:32 +0000
committerUwe Stieber2013-10-10 11:47:32 +0000
commitcbd614b69cea6c3cfb54e6480e6554f681f81fc5 (patch)
tree48f7f67d7e338db77d76b9a9d02a9fb9ab57936b /target_explorer/plugins/org.eclipse.tcf.te.tests
parent73fcbe5fb3c44f09409c6fa4afa8e16cb3e79bc7 (diff)
downloadorg.eclipse.tcf-cbd614b69cea6c3cfb54e6480e6554f681f81fc5.tar.gz
org.eclipse.tcf-cbd614b69cea6c3cfb54e6480e6554f681f81fc5.tar.xz
org.eclipse.tcf-cbd614b69cea6c3cfb54e6480e6554f681f81fc5.zip
Target Explorer: Simplify desktop popup notifications
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tests')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/META-INF/MANIFEST.MF2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/icons/notifications-category.gifbin937 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/NotificationsTestCase.java24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestNotification.java98
6 files changed, 49 insertions, 128 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tests/META-INF/MANIFEST.MF
index 102bbbef4..dec616d91 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.tcf.te.runtime;bundle-version="1.2.0",
org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.2.0",
org.eclipse.tcf.te.runtime.model;bundle-version="1.2.0",
- org.eclipse.tcf.te.runtime.notifications;bundle-version="1.2.0",
org.eclipse.tcf.te.runtime.services;bundle-version="1.2.0",
org.eclipse.tcf.te.runtime.statushandler;bundle-version="1.2.0",
org.eclipse.tcf.te.runtime.stepper;bundle-version="1.2.0",
@@ -31,6 +30,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.tcf.te.ui.notifications;bundle-version="1.2.0",
org.eclipse.tcf.te.ui.views;bundle-version="1.2.0",
org.eclipse.ui;bundle-version="3.8.0",
+ org.eclipse.ui.forms;bundle-version="3.5.200",
org.junit;bundle-version="4.10.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/icons/notifications-category.gif b/target_explorer/plugins/org.eclipse.tcf.te.tests/icons/notifications-category.gif
deleted file mode 100644
index 7928be603..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/icons/notifications-category.gif
+++ /dev/null
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 4bcd81bf6..ed11a79bd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
@@ -213,19 +213,10 @@
</extension>
<!-- Test notifications contributions -->
- <extension point="org.eclipse.tcf.te.ui.notifications.notifications">
- <category
- icon="icons/notifications-category.gif"
- id="org.eclipse.tcf.te.tests.category1"
- label="Test Notifications">
- </category>
- <event
- categoryId="org.eclipse.tcf.te.tests.category1"
- id="org.eclipse.tcf.te.tests.event1"
- label="Test Event">
- <defaultHandler
- sinkId="org.eclipse.tcf.te.ui.notifications.sink.popup">
- </defaultHandler>
- </event>
- </extension>
+ <extension point="org.eclipse.tcf.te.ui.notifications.factoryDelegates">
+ <delegate
+ class="org.eclipse.tcf.te.tests.notifications.TestFormTextFactoryDelegate"
+ id="org.eclipse.tcf.te.tests.delegates.TestFormTextFactoryDelegate">
+ </delegate>
+ </extension>
</plugin>
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 fd795e74c..66bb4ca01 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
@@ -13,8 +13,10 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
-import org.eclipse.tcf.te.runtime.notifications.interfaces.INotificationService;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+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;
/**
@@ -41,20 +43,14 @@ public class NotificationsTestCase extends CoreTestCase {
// start with 'test'!
public void testNotifications() {
- // Get the service
- INotificationService service = ServiceManager.getInstance().getService(INotificationService.class);
- assertNotNull("Failed to get notification service instance.", service); //$NON-NLS-1$
+ 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$
- TestNotification notification = new TestNotification("org.eclipse.tcf.te.tests.event1"); //$NON-NLS-1$
- assertNotNull("Failed to create test notification.", notification); //$NON-NLS-1$
+ NotifyEvent notification = new NotifyEvent(NotificationsTestCase.this, properties);
+ assertNotNull("Failed to create test notification event.", notification); //$NON-NLS-1$
- notification.setLabel("Test Notification Label"); //$NON-NLS-1$
- assertEquals("Notification label setter / getter does not match.", "Test Notification Label", notification.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
-
- notification.setDescription("Test Notification Description"); //$NON-NLS-1$
- assertEquals("Notification description setter / getter does not match.", "Test Notification Description", notification.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
-
- service.notify(notification);
+ EventManager.getInstance().fireEvent(notification);
ExecutorsUtil.waitAndExecute(20000, null);
}
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
new file mode 100644
index 000000000..cefc4add7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestFormTextFactoryDelegate.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.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;
+
+/**
+ * Test notification form text factory delegate implementation.
+ */
+public class TestFormTextFactoryDelegate implements IFormTextFactoryDelegate {
+
+ /* (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)
+ */
+ @Override
+ public void populateFormText(FormToolkit toolkit, FormText widget, NotifyEvent event) {
+ Assert.isNotNull(toolkit);
+ Assert.isNotNull(widget);
+ Assert.isNotNull(event);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestNotification.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestNotification.java
deleted file mode 100644
index 49466d1b8..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/notifications/TestNotification.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * 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 java.util.Date;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.ui.notifications.popup.AbstractUiNotification;
-
-/**
- * Test notification implementation.
- */
-public class TestNotification extends AbstractUiNotification {
- private String description;
- private String label;
-
- /**
- * Constructor
- *
- * @param eventId
- */
- public TestNotification(String eventId) {
- super(eventId);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.notifications.popup.AbstractUiNotification#getNotificationImage()
- */
- @Override
- public Image getNotificationImage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.notifications.popup.AbstractUiNotification#getNotificationKindImage()
- */
- @Override
- public Image getNotificationKindImage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.notifications.popup.AbstractUiNotification#open()
- */
- @Override
- public void open() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.notifications.AbstractNotification#getDate()
- */
- @Override
- public Date getDate() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.notifications.AbstractNotification#getDescription()
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.notifications.AbstractNotification#getLabel()
- */
- @Override
- public String getLabel() {
- return label;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
-}

Back to the top