Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-10-11 07:57:38 +0000
committerUwe Stieber2013-10-11 07:57:38 +0000
commite0d8bd9d64857a6efbcc07d66171c9523ffc6245 (patch)
tree4480084305c09791db9536b46b55cf0725b876e9 /target_explorer/plugins/org.eclipse.tcf.te.ui.notifications
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
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.ui.notifications')
-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
5 files changed, 63 insertions, 22 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 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