--- a/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Wed Mar 10 15:28:22 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Fri Mar 12 14:58:03 2010 -0600
@@ -12,8 +12,7 @@
org.eclipse.emf.ecore.xmi;bundle-version="2.4.0",
org.eclipse.core.net;bundle-version="1.1.0",
org.eclipse.help;bundle-version="3.4.0",
- com.nokia.cpp.utils.ui,
- org.eclipse.mylyn.commons.ui;bundle-version="3.2.0"
+ com.nokia.cpp.utils.ui
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: com.nokia.carbide.installpackages,
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_arrow1.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_arrow2.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_box.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_fill_box.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_fill_oval.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_fill_rbox.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_free.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_line.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_oval.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/edit_rbox.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_bold1.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_bold2.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_bold4.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_bold8.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_dash.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_dash1d.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_dash2d.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_dot.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/draw16/line_sold.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/blank.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/clearDot.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/collapseall-small.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/collapseall.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/delete.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/expandall-small.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/expandall.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/filter-complete.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/filter-priority.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/refresh-small.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/refresh.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/remove.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/elcl16/warning.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/calendar.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/capture-fit.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/capture-screen-bold.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/capture-screen.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/clear.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/clipboard_obj.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/content-assist-separator.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/copy.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/cut.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/discovery.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/edit-small.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/edit.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/file_obj.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/find-clear-disabled.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/find-clear.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/find.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/go-into.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/go-up.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/grouping.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/link-editor.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/maximize.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/monitor_obj.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/open-browser.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/overlay-repository.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/person-me-narrow.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/person-me-small.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/person-me.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/person-narrow.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/person.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/presentation.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/preview-web.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/redo_edit.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/save.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/schedule-day.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/schedule-week.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/schedule.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/select_rect.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/sort-down-gray.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/sort-down.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/sort-up-gray.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/sort-up.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/toolbar-arrow-down.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/toolbar-arrow-right.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/undo_edit.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/view-filter.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/etool16/web.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/focus-view.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/more.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/notification-close-active.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/notification-close.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-completed.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-conflict.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-has-context.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-has-due.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-incoming-multiple.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-incoming-new.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-incoming.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-outgoing-new.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-outgoing.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-overdue.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-synch-incoming-new.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-synch-incoming.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/overlay-synch-outgoing.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/1.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/2.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/3.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/4.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/5.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/6.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/7.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/progress/8.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/status-conflict.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/status-normal.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/eview16/status-server-context.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/browser-small.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/calendar-small.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/complete.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/file-image.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/file-plain.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/file-small.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/message_info.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/notes-small.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/priority-1.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/priority-2.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/priority-3.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/priority-4.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/priority-5.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj16/question.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj32/priority-critical.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj32/priority-high.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj32/priority-low.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj32/priority-none.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj32/priority-normal.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/obj32/priority-very-low.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/ovr16/overlay-blank.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/ovr16/overlay-complete.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/ovr16/overlay-local-task.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/ovr16/overlay-warning.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/ovr16/solid-white.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/wizban/banner-discovery.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/wizban/banner-export.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/wizban/banner-import.gif has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/wizban/banner-screenshot.png has changed
Binary file connectivity/com.nokia.carbide.remoteConnections/icons/mylyn/wizban/keylock.gif has changed
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/StatusDisplay.java Wed Mar 10 15:28:22 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/StatusDisplay.java Fri Mar 12 14:58:03 2010 -0600
@@ -23,7 +23,6 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotificationPopup;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -39,9 +38,9 @@
import org.eclipse.swt.widgets.Shell;
import com.nokia.carbide.remoteconnections.internal.api.IStatusDisplay;
+import com.nokia.carbide.remoteconnections.internal.ui.mylyn.AbstractNotificationPopup;
import com.nokia.cpp.internal.api.utils.core.Check;
-@SuppressWarnings("restriction")
public class StatusDisplay implements IStatusDisplay {
private final class NotificationPopup extends AbstractNotificationPopup {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/AbstractNotificationPopup.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,606 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 Tasktop Technologies 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:
+ * Benjamin Pasero - intial API and implementation
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.resource.LocalResourceManager;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.carbide.remoteconnections.internal.ui.mylyn.SwtUtil.FadeJob;
+import com.nokia.carbide.remoteconnections.internal.ui.mylyn.SwtUtil.IFadeListener;
+
+/**
+ * @author Benjamin Pasero
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ */
+public abstract class AbstractNotificationPopup extends Window {
+
+ private static final int TITLE_HEIGHT = 24;
+
+ private static final String LABEL_NOTIFICATION = "Notification";
+
+ private static final String LABEL_JOB_CLOSE = "Close Notification Job";
+
+ private static final int MAX_WIDTH = 400;
+
+ private static final int MIN_HEIGHT = 100;
+
+ private static final long DEFAULT_DELAY_CLOSE = 8 * 1000;
+
+ private static final int PADDING_EDGE = 5;
+
+ private long delayClose = DEFAULT_DELAY_CLOSE;
+
+ protected LocalResourceManager resources;
+
+ private NotificationPopupColors color;
+
+ private final Display display;
+
+ private Shell shell;
+
+ private Region lastUsedRegion;
+
+ private Image lastUsedBgImage;
+
+ private final Job closeJob = new Job(LABEL_JOB_CLOSE) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (!display.isDisposed()) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ Shell shell = AbstractNotificationPopup.this.getShell();
+ if (shell == null || shell.isDisposed()) {
+ return;
+ }
+
+ if (isMouseOver(shell)) {
+ scheduleAutoClose();
+ return;
+ }
+
+ AbstractNotificationPopup.this.closeFade();
+ }
+
+ });
+ }
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ private final boolean respectDisplayBounds = true;
+
+ private final boolean respectMonitorBounds = true;
+
+ private FadeJob fadeJob;
+
+ private boolean fadingEnabled;
+
+ public AbstractNotificationPopup(Display display) {
+ this(display, SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ }
+
+ public AbstractNotificationPopup(Display display, int style) {
+ super(new Shell(display));
+ setShellStyle(style);
+
+ this.display = display;
+ resources = new LocalResourceManager(JFaceResources.getResources());
+ initResources();
+
+ closeJob.setSystem(true);
+ }
+
+ public boolean isFadingEnabled() {
+ return fadingEnabled;
+ }
+
+ public void setFadingEnabled(boolean fadingEnabled) {
+ this.fadingEnabled = fadingEnabled;
+ }
+
+ /**
+ * Override to return a customized name. Default is to return the name of the product, specified by the -name (e.g.
+ * "Eclipse SDK") command line parameter that's associated with the product ID (e.g. "org.eclipse.sdk.ide"). Strips
+ * the trailing "SDK" for any name, since this part of the label is considered visual noise.
+ *
+ * @return the name to be used in the title of the popup.
+ */
+ protected String getPopupShellTitle() {
+// String productName = CommonUiUtil.getProductName();
+// if (productName != null) {
+// return productName + " " + LABEL_NOTIFICATION; //$NON-NLS-1$
+// } else {
+ return LABEL_NOTIFICATION;
+// }
+ }
+
+ protected Image getPopupShellImage(int maximumHeight) {
+ // always use the launching workbench window
+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ if (windows != null && windows.length > 0) {
+ IWorkbenchWindow workbenchWindow = windows[0];
+ if (workbenchWindow != null && !workbenchWindow.getShell().isDisposed()) {
+ Image image = getShell().getImage();
+ int diff = Integer.MAX_VALUE;
+ if (image != null && image.getBounds().height <= maximumHeight) {
+ diff = maximumHeight - image.getBounds().height;
+ } else {
+ image = null;
+ }
+
+ Image[] images = getShell().getImages();
+ if (images != null && images.length > 0) {
+ // find the icon that is closest in size, but not larger than maximumHeight
+ for (Image image2 : images) {
+ int newDiff = maximumHeight - image2.getBounds().height;
+ if (newDiff >= 0 && newDiff <= diff) {
+ diff = newDiff;
+ image = image2;
+ }
+ }
+ }
+
+ return image;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Override to populate with notifications.
+ *
+ * @param parent
+ */
+ protected void createContentArea(Composite parent) {
+ // empty by default
+ }
+
+ /**
+ * Override to customize the title bar
+ */
+ protected void createTitleArea(Composite parent) {
+ ((GridData) parent.getLayoutData()).heightHint = TITLE_HEIGHT;
+
+ Label titleImageLabel = new Label(parent, SWT.NONE);
+ titleImageLabel.setImage(getPopupShellImage(TITLE_HEIGHT));
+
+ Label titleTextLabel = new Label(parent, SWT.NONE);
+ titleTextLabel.setText(getPopupShellTitle());
+ titleTextLabel.setFont(CommonFonts.BOLD);
+ titleTextLabel.setForeground(getTitleForeground());
+// titleTextLabel.setForeground(color.getTitleText());
+ titleTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ titleTextLabel.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
+
+ final Label button = new Label(parent, SWT.NONE);
+ button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
+ button.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE_HOVER));
+ }
+
+ @Override
+ public void mouseExit(MouseEvent e) {
+ button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
+ }
+ });
+ button.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ close();
+ setReturnCode(CANCEL);
+ }
+
+ });
+ }
+
+ protected Color getTitleForeground() {
+ return color.getTitleText();
+ }
+
+ private void initResources() {
+ color = new NotificationPopupColors(display, resources);
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+
+ shell = newShell;
+ newShell.setBackground(color.getBorder());
+ }
+
+ @Override
+ public void create() {
+ super.create();
+ addRegion(shell);
+ }
+
+ private void addRegion(Shell shell) {
+ Region region = new Region();
+ Point s = shell.getSize();
+
+ /* Add entire Shell */
+ region.add(0, 0, s.x, s.y);
+
+ /* Subtract Top-Left Corner */
+ region.subtract(0, 0, 5, 1);
+ region.subtract(0, 1, 3, 1);
+ region.subtract(0, 2, 2, 1);
+ region.subtract(0, 3, 1, 1);
+ region.subtract(0, 4, 1, 1);
+
+ /* Subtract Top-Right Corner */
+ region.subtract(s.x - 5, 0, 5, 1);
+ region.subtract(s.x - 3, 1, 3, 1);
+ region.subtract(s.x - 2, 2, 2, 1);
+ region.subtract(s.x - 1, 3, 1, 1);
+ region.subtract(s.x - 1, 4, 1, 1);
+
+ /* Subtract Bottom-Left Corner */
+ region.subtract(0, s.y, 5, 1);
+ region.subtract(0, s.y - 1, 3, 1);
+ region.subtract(0, s.y - 2, 2, 1);
+ region.subtract(0, s.y - 3, 1, 1);
+ region.subtract(0, s.y - 4, 1, 1);
+
+ /* Subtract Bottom-Right Corner */
+ region.subtract(s.x - 5, s.y - 0, 5, 1);
+ region.subtract(s.x - 3, s.y - 1, 3, 1);
+ region.subtract(s.x - 2, s.y - 2, 2, 1);
+ region.subtract(s.x - 1, s.y - 3, 1, 1);
+ region.subtract(s.x - 1, s.y - 4, 1, 1);
+
+ /* Dispose old first */
+ if (shell.getRegion() != null) {
+ shell.getRegion().dispose();
+ }
+
+ /* Apply Region */
+ shell.setRegion(region);
+
+ /* Remember to dispose later */
+ lastUsedRegion = region;
+ }
+
+ private boolean isMouseOver(Shell shell) {
+ if (display.isDisposed()) {
+ return false;
+ }
+ return shell.getBounds().contains(display.getCursorLocation());
+ }
+
+ @Override
+ public int open() {
+ if (shell == null || shell.isDisposed()) {
+ shell = null;
+ create();
+ }
+
+ constrainShellSize();
+ shell.setLocation(fixupDisplayBounds(shell.getSize(), shell.getLocation()));
+
+ if (isFadingEnabled()) {
+ shell.setAlpha(0);
+ }
+ shell.setVisible(true);
+ fadeJob = SwtUtil.fadeIn(shell, new IFadeListener() {
+ public void faded(Shell shell, int alpha) {
+ if (shell.isDisposed()) {
+ return;
+ }
+
+ if (alpha == 255) {
+ scheduleAutoClose();
+ }
+ }
+ });
+
+ return Window.OK;
+ }
+
+ protected void scheduleAutoClose() {
+ if (delayClose > 0) {
+ closeJob.schedule(delayClose);
+ }
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ ((GridLayout) parent.getLayout()).marginWidth = 1;
+ ((GridLayout) parent.getLayout()).marginHeight = 1;
+
+ /* Outer Composite holding the controls */
+ final Composite outerCircle = new Composite(parent, SWT.NO_FOCUS);
+ outerCircle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ outerCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ outerCircle.addControlListener(new ControlAdapter() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ Rectangle clArea = outerCircle.getClientArea();
+ lastUsedBgImage = new Image(outerCircle.getDisplay(), clArea.width, clArea.height);
+ GC gc = new GC(lastUsedBgImage);
+
+ /* Gradient */
+ drawGradient(gc, clArea);
+
+ /* Fix Region Shape */
+ fixRegion(gc, clArea);
+
+ gc.dispose();
+
+ Image oldBGImage = outerCircle.getBackgroundImage();
+ outerCircle.setBackgroundImage(lastUsedBgImage);
+
+ if (oldBGImage != null) {
+ oldBGImage.dispose();
+ }
+ }
+
+ private void drawGradient(GC gc, Rectangle clArea) {
+ gc.setForeground(color.getGradientBegin());
+ gc.setBackground(color.getGradientEnd());
+ gc.fillGradientRectangle(clArea.x, clArea.y, clArea.width, clArea.height, true);
+ }
+
+ private void fixRegion(GC gc, Rectangle clArea) {
+ gc.setForeground(color.getBorder());
+
+ /* Fill Top Left */
+ gc.drawPoint(2, 0);
+ gc.drawPoint(3, 0);
+ gc.drawPoint(1, 1);
+ gc.drawPoint(0, 2);
+ gc.drawPoint(0, 3);
+
+ /* Fill Top Right */
+ gc.drawPoint(clArea.width - 4, 0);
+ gc.drawPoint(clArea.width - 3, 0);
+ gc.drawPoint(clArea.width - 2, 1);
+ gc.drawPoint(clArea.width - 1, 2);
+ gc.drawPoint(clArea.width - 1, 3);
+
+ /* Fill Bottom Left */
+ gc.drawPoint(2, clArea.height - 0);
+ gc.drawPoint(3, clArea.height - 0);
+ gc.drawPoint(1, clArea.height - 1);
+ gc.drawPoint(0, clArea.height - 2);
+ gc.drawPoint(0, clArea.height - 3);
+
+ /* Fill Bottom Right */
+ gc.drawPoint(clArea.width - 4, clArea.height - 0);
+ gc.drawPoint(clArea.width - 3, clArea.height - 0);
+ gc.drawPoint(clArea.width - 2, clArea.height - 1);
+ gc.drawPoint(clArea.width - 1, clArea.height - 2);
+ gc.drawPoint(clArea.width - 1, clArea.height - 3);
+ }
+ });
+
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.verticalSpacing = 0;
+
+ outerCircle.setLayout(layout);
+
+ /* Title area containing label and close button */
+ final Composite titleCircle = new Composite(outerCircle, SWT.NO_FOCUS);
+ titleCircle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ titleCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(4, false);
+ layout.marginWidth = 3;
+ layout.marginHeight = 0;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 3;
+
+ titleCircle.setLayout(layout);
+
+ /* Create Title Area */
+ createTitleArea(titleCircle);
+
+ /* Outer composite to hold content controlls */
+ Composite outerContentCircle = new Composite(outerCircle, SWT.NONE);
+ outerContentCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+
+ outerContentCircle.setLayout(layout);
+ outerContentCircle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ outerContentCircle.setBackground(outerCircle.getBackground());
+
+ /* Middle composite to show a 1px black line around the content controls */
+ Composite middleContentCircle = new Composite(outerContentCircle, SWT.NO_FOCUS);
+ middleContentCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.marginTop = 1;
+
+ middleContentCircle.setLayout(layout);
+ middleContentCircle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ middleContentCircle.setBackground(color.getBorder());
+
+ /* Inner composite containing the content controls */
+ Composite innerContent = new Composite(middleContentCircle, SWT.NO_FOCUS);
+ innerContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ innerContent.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 5;
+ layout.marginLeft = 5;
+ layout.marginRight = 5;
+ innerContent.setLayout(layout);
+
+ innerContent.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+
+ /* 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();
+ Point initialSize = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int height = Math.max(initialSize.y, MIN_HEIGHT);
+ int width = Math.min(initialSize.x, MAX_WIDTH);
+
+ Point size = new Point(width, height);
+ shell.setLocation(clArea.width + clArea.x - size.x - PADDING_EDGE, clArea.height + clArea.y - size.y
+ - PADDING_EDGE);
+ shell.setSize(size);
+ }
+
+ private Rectangle getPrimaryClientArea() {
+ Monitor primaryMonitor = shell.getDisplay().getPrimaryMonitor();
+ return (primaryMonitor != null) ? primaryMonitor.getClientArea() : shell.getDisplay().getClientArea();
+ }
+
+ public void closeFade() {
+ if (fadeJob != null) {
+ fadeJob.cancelAndWait(false);
+ }
+ fadeJob = SwtUtil.fadeOut(getShell(), new IFadeListener() {
+ public void faded(Shell shell, int alpha) {
+ if (!shell.isDisposed()) {
+ if (alpha == 0) {
+ shell.close();
+ } else if (isMouseOver(shell)) {
+ if (fadeJob != null) {
+ fadeJob.cancelAndWait(false);
+ }
+ fadeJob = SwtUtil.fastFadeIn(shell, new IFadeListener() {
+ public void faded(Shell shell, int alpha) {
+ if (shell.isDisposed()) {
+ return;
+ }
+
+ if (alpha == 255) {
+ scheduleAutoClose();
+ }
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean close() {
+ resources.dispose();
+ if (lastUsedRegion != null) {
+ lastUsedRegion.dispose();
+ }
+ if (lastUsedBgImage != null && !lastUsedBgImage.isDisposed()) {
+ lastUsedBgImage.dispose();
+ }
+ return super.close();
+ }
+
+ public long getDelayClose() {
+ return delayClose;
+ }
+
+ public void setDelayClose(long delayClose) {
+ this.delayClose = delayClose;
+ }
+
+ private Point fixupDisplayBounds(Point tipSize, Point location) {
+ if (respectDisplayBounds) {
+ Rectangle bounds;
+ Point rightBounds = new Point(tipSize.x + location.x, tipSize.y + location.y);
+
+ if (respectMonitorBounds) {
+ bounds = shell.getDisplay().getPrimaryMonitor().getBounds();
+ } else {
+ bounds = getPrimaryClientArea();
+ }
+
+ if (!(bounds.contains(location) && bounds.contains(rightBounds))) {
+ if (rightBounds.x > bounds.x + bounds.width) {
+ location.x -= rightBounds.x - (bounds.x + bounds.width);
+ }
+
+ if (rightBounds.y > bounds.y + bounds.height) {
+ location.y -= rightBounds.y - (bounds.y + bounds.height);
+ }
+
+ if (location.x < bounds.x) {
+ location.x = bounds.x;
+ }
+
+ if (location.y < bounds.y) {
+ location.y = bounds.y;
+ }
+ }
+ }
+
+ return location;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/CommonFonts.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.jface.resource.FontRegistry;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author Mik Kersten
+ * @since 3.0
+ */
+public class CommonFonts {
+
+ public static Font BOLD;
+
+ public static Font ITALIC;
+
+ public static Font BOLD_ITALIC;
+
+ public static Font STRIKETHROUGH = null;
+
+ public static boolean HAS_STRIKETHROUGH;
+
+ static {
+ if (Display.getCurrent() != null) {
+ init();
+ } else {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ init();
+ }
+ });
+ }
+ }
+
+ private static void init() {
+ BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
+ ITALIC = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
+ BOLD_ITALIC = new Font(Display.getCurrent(), getModifiedFontData(ITALIC.getFontData(), SWT.BOLD | SWT.ITALIC));
+
+ Font defaultFont = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
+ FontData[] defaultData = defaultFont.getFontData();
+ if (defaultData != null && defaultData.length == 1) {
+ FontData data = new FontData(defaultData[0].getName(), defaultData[0].getHeight(),
+ defaultData[0].getStyle());
+
+ if ("win32".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ // NOTE: Windows only, for: data.data.lfStrikeOut = 1;
+ try {
+ Field dataField = data.getClass().getDeclaredField("data"); //$NON-NLS-1$
+ Object dataObject = dataField.get(data);
+ Class<?> clazz = dataObject.getClass().getSuperclass();
+ Field strikeOutFiled = clazz.getDeclaredField("lfStrikeOut"); //$NON-NLS-1$
+ strikeOutFiled.set(dataObject, (byte) 1);
+ CommonFonts.STRIKETHROUGH = new Font(Display.getCurrent(), data);
+ } catch (Throwable t) {
+ // ignore
+ }
+ }
+ }
+ if (CommonFonts.STRIKETHROUGH == null) {
+ CommonFonts.HAS_STRIKETHROUGH = false;
+ CommonFonts.STRIKETHROUGH = defaultFont;
+ } else {
+ CommonFonts.HAS_STRIKETHROUGH = true;
+ }
+ }
+
+ /**
+ * NOTE: disposal of JFaceResources fonts handled by registry.
+ */
+ public static void dispose() {
+ if (CommonFonts.STRIKETHROUGH != null && !CommonFonts.STRIKETHROUGH.isDisposed()) {
+ CommonFonts.STRIKETHROUGH.dispose();
+ CommonFonts.BOLD_ITALIC.dispose();
+ }
+ }
+
+ /**
+ * Copied from {@link FontRegistry}
+ */
+ private static FontData[] getModifiedFontData(FontData[] baseData, int style) {
+ FontData[] styleData = new FontData[baseData.length];
+ for (int i = 0; i < styleData.length; i++) {
+ FontData base = baseData[i];
+ styleData[i] = new FontData(base.getName(), base.getHeight(), base.getStyle() | style);
+ }
+
+ return styleData;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/CommonImages.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,390 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+
+/**
+ * @author Mik Kersten
+ * @since 3.0
+ */
+public class CommonImages {
+
+ private static final URL baseURL =
+ RemoteConnectionsActivator.getDefault().getBundle().getEntry("/icons/mylyn/"); //$NON-NLS-1$
+
+ private static ImageRegistry imageRegistry;
+
+ private static final String T_ELCL = "elcl16"; //$NON-NLS-1$
+
+ private static final String T_EVIEW = "eview16"; //$NON-NLS-1$
+
+ private static final String T_TOOL = "etool16"; //$NON-NLS-1$
+
+ private static final String T_OBJ = "obj16"; //$NON-NLS-1$
+
+ private static final String T_OBJ_32 = "obj32"; //$NON-NLS-1$
+
+ private static final String T_WIZBAN = "wizban"; //$NON-NLS-1$
+
+ private static final String T_OVR = "ovr16"; //$NON-NLS-1$
+
+ // Priorities
+
+ public static final ImageDescriptor PRIORITY_1 = create(T_OBJ, "priority-1.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_2 = create(T_OBJ, "priority-2.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_3 = create(T_OBJ, "priority-3.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_4 = create(T_OBJ, "priority-4.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_5 = create(T_OBJ, "priority-5.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_1_LARGE = create(T_OBJ_32, "priority-critical.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_2_LARGE = create(T_OBJ_32, "priority-high.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_3_LARGE = create(T_OBJ_32, "priority-normal.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_4_LARGE = create(T_OBJ_32, "priority-low.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRIORITY_5_LARGE = create(T_OBJ_32, "priority-very-low.png"); //$NON-NLS-1$
+
+ // Calendars, people and notifications
+
+ public static final ImageDescriptor CALENDAR = create(T_TOOL, "calendar.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor CALENDAR_SMALL = create(T_OBJ, "calendar-small.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor SCHEDULE = create(T_TOOL, "schedule.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor SCHEDULE_DAY = create(T_TOOL, "schedule-day.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor SCHEDULE_WEEK = create(T_TOOL, "schedule-week.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PERSON = create(T_TOOL, "person.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PERSON_NARROW = create(T_TOOL, "person-narrow.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PERSON_ME = create(T_TOOL, "person-me.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PERSON_ME_SMALL = create(T_TOOL, "person-me-small.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PERSON_ME_NARROW = create(T_TOOL, "person-me-narrow.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor NOTIFICATION_CLOSE = create(T_EVIEW, "notification-close.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor NOTIFICATION_CLOSE_HOVER = create(T_EVIEW, "notification-close-active.gif"); //$NON-NLS-1$
+
+ // Date and synchronization overlays
+
+ public static final ImageDescriptor OVERLAY_DATE_DUE = create(T_EVIEW, "overlay-has-due.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_DATE_OVERDUE = create(T_EVIEW, "overlay-overdue.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_IN_PROGRESS = create(T_EVIEW, "overlay-synchronizing.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_INCOMMING = create(T_EVIEW, "overlay-incoming.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_INCOMMING_NEW = create(T_EVIEW, "overlay-incoming-new.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_OUTGOING = create(T_EVIEW, "overlay-outgoing.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_OUTGOING_NEW = create(T_EVIEW, "overlay-outgoing-new.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_CONFLICT = create(T_EVIEW, "overlay-conflict.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_WARNING = create(T_OVR, "overlay-warning.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_OLD_INCOMMING = create(T_EVIEW, "overlay-synch-incoming.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_OLD_INCOMMING_NEW = create(T_EVIEW,
+ "overlay-synch-incoming-new.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SYNC_OLD_OUTGOING = create(T_EVIEW, "overlay-synch-outgoing.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_CLEAR = create(T_OVR, "overlay-blank.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_WHITE = create(T_OVR, "solid-white.gif"); //$NON-NLS-1$
+
+ // Wizard banners
+
+ public static final ImageDescriptor BANNER_SCREENSHOT = create(T_WIZBAN, "banner-screenshot.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor BANNER_IMPORT = create(T_WIZBAN, "banner-import.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor BANNER_EXPORT = create(T_WIZBAN, "banner-export.gif"); //$NON-NLS-1$
+
+ // Discovery
+
+ public static final ImageDescriptor DISCOVERY = create(T_TOOL, "discovery.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor BANNER_DISOVERY = create(T_WIZBAN, "banner-discovery.png"); //$NON-NLS-1$
+
+ // Miscellaneous
+ // TODO: some of the common images below come from the workbench
+
+ public static final ImageDescriptor COMPLETE = create(T_OBJ, "complete.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor REMOVE = create(T_ELCL, "remove.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DELETE = create(T_ELCL, "delete.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor WARNING = create(T_ELCL, "warning.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FILTER_COMPLETE = create(T_ELCL, "filter-complete.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FILTER_ARCHIVE = create(T_ELCL, "filter-archive.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FILTER_PRIORITY = create(T_ELCL, "filter-priority.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor COLOR_PALETTE = create(T_ELCL, "color-palette.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FILTER = create(T_TOOL, "view-filter.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FIND_CLEAR = create(T_TOOL, "find-clear.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FIND_CLEAR_DISABLED = create(T_TOOL, "find-clear-disabled.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor BROWSER_SMALL = create(T_OBJ, "browser-small.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor BROWSER_OPEN_TASK = create(T_TOOL, "open-browser.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor TOOLBAR_ARROW_RIGHT = create(T_TOOL, "toolbar-arrow-right.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor TOOLBAR_ARROW_DOWN = create(T_TOOL, "toolbar-arrow-down.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor LINK_EDITOR = create(T_TOOL, "link-editor.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor CLEAR = create(T_TOOL, "clear.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor EDIT = create(T_TOOL, "edit.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor EDIT_SMALL = create(T_TOOL, "edit-small.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor CUT = create(T_TOOL, "cut.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor UNDO = create(T_TOOL, "undo_edit.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor REDO = create(T_TOOL, "redo_edit.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor STATUS_NORMAL = create(T_EVIEW, "status-normal.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor STATUS_CONTEXT = create(T_EVIEW, "status-server-context.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PRESENTATION = create(T_TOOL, "presentation.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor GROUPING = create(T_TOOL, "grouping.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor COPY = create(T_TOOL, "copy.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor GO_UP = create(T_TOOL, "go-up.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor GO_INTO = create(T_TOOL, "go-into.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor REFRESH = create(T_ELCL, "refresh.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor REFRESH_SMALL = create(T_ELCL, "refresh-small.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor COLLAPSE_ALL = create(T_ELCL, "collapseall.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor COLLAPSE_ALL_SMALL = create(T_ELCL, "collapseall-small.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor EXPAND_ALL = create(T_ELCL, "expandall.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor EXPAND_ALL_SMALL = create(T_ELCL, "expandall-small.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor BLANK = create(T_ELCL, "blank.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor IMAGE_CAPTURE = create(T_TOOL, "capture-screen.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor IMAGE_FIT = create(T_TOOL, "capture-fit.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor IMAGE_FILE = create(T_OBJ, "file-image.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FILE_PLAIN = create(T_OBJ, "file-plain.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FILE_PLAIN_SMALL = create(T_OBJ, "file-small.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor NOTES_SMALL = create(T_OBJ, "notes-small.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor QUESTION = create(T_OBJ, "question.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor INFORMATION = create(T_OBJ, "message_info.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor SEPARATOR_LIST = create(T_TOOL, "content-assist-separator.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PART_MAXIMIZE = create(T_TOOL, "maximize.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor PREVIEW_WEB = create(T_TOOL, "preview-web.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor WEB = create(T_TOOL, "web.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor FIND = create(T_TOOL, "find.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor SAVE = create(T_TOOL, "save.gif"); //$NON-NLS-1$;
+
+ private static ImageDescriptor create(String prefix, String name) {
+ try {
+ return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
+ } catch (MalformedURLException e) {
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+ }
+
+ /**
+ * Lazily initializes image map.
+ *
+ * @param imageDescriptor
+ * @return Image
+ */
+ public static Image getImage(ImageDescriptor imageDescriptor) {
+ ImageRegistry imageRegistry = getImageRegistry();
+ Image image = imageRegistry.get("" + imageDescriptor.hashCode()); //$NON-NLS-1$
+ if (image == null) {
+ image = imageDescriptor.createImage(true);
+ imageRegistry.put("" + imageDescriptor.hashCode(), image); //$NON-NLS-1$
+ }
+ return image;
+ }
+
+ public static Image getImageWithOverlay(ImageDescriptor icon, ImageDescriptor overlay, boolean top, boolean left) {
+ if (icon == null) {
+ return null;
+ }
+ String key = "" + icon.hashCode(); //$NON-NLS-1$
+ if (overlay != null) {
+ key += overlay.hashCode();
+ }
+ key += new Boolean(top).hashCode();
+ key += new Boolean(left).hashCode();
+
+ Image image = getImageRegistry().get(key);
+
+ if (image == null) {
+ TaskListImageDescriptor imageDescriptor = new TaskListImageDescriptor(icon, overlay, top, left);
+ image = imageDescriptor.createImage(true);
+ getImageRegistry().put(key, image);
+ }
+ return image;
+ }
+
+ /**
+ * Lazily initializes image map.
+ *
+ * @param icon
+ * cannot be null
+ * @param overlayKind
+ * @param wide
+ * @return Image
+ */
+ public static Image getCompositeTaskImage(ImageDescriptor icon, ImageDescriptor overlayKind, boolean wide) {
+ if (icon == null) {
+ return null;
+ }
+ String key = "" + icon.hashCode(); //$NON-NLS-1$
+ if (overlayKind != null) {
+ key += overlayKind.hashCode();
+ }
+ if (wide) {
+ key += ".wide"; //$NON-NLS-1$
+ }
+ Image image = getImageRegistry().get(key);
+
+ if (image == null) {
+ CompositeElementImageDescriptor imageDescriptor = new CompositeElementImageDescriptor(icon, overlayKind,
+ wide);
+ image = imageDescriptor.createImage(true);
+ getImageRegistry().put(key, image);
+ }
+ return image;
+ }
+
+ public static Image getCompositeContainerImage(ImageDescriptor icon, boolean wide) {
+ if (icon == null) {
+ return null;
+ }
+ String key = "" + icon.hashCode(); //$NON-NLS-1$
+ if (wide) {
+ key += ".wide"; //$NON-NLS-1$
+ }
+ Image image = getImageRegistry().get(key);
+ if (image == null) {
+ CompositeContainerImageDescriptor imageDescriptor = new CompositeContainerImageDescriptor(icon,
+ OVERLAY_CLEAR, wide);
+ image = imageDescriptor.createImage(true);
+ getImageRegistry().put(key, image);
+ }
+ return image;
+ }
+
+ public static Image getCompositeSynchImage(ImageDescriptor icon, boolean background) {
+ String key = "" + icon.hashCode(); //$NON-NLS-1$
+ if (background) {
+ key += ".background"; //$NON-NLS-1$
+ }
+
+ Image image = getImageRegistry().get(key);
+ if (image == null) {
+ CompositeSyncImageDescriptor imageDescriptor = new CompositeSyncImageDescriptor(icon, background);
+ image = imageDescriptor.createImage(true);
+ getImageRegistry().put(key, image);
+ }
+ return image;
+ }
+
+ private static ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ imageRegistry = new ImageRegistry();
+ }
+
+ return imageRegistry;
+ }
+
+ private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
+ if (baseURL == null) {
+ throw new MalformedURLException();
+ }
+
+ StringBuffer buffer = new StringBuffer(prefix);
+ buffer.append('/');
+ buffer.append(name);
+ return new URL(baseURL, buffer.toString());
+ }
+
+ private static Image[] progressImages;
+
+ public static Image[] getProgressImages() {
+
+ if (progressImages != null) {
+ return progressImages;
+ }
+
+ progressImages = new Image[8];
+
+ for (int i = 1; i <= 8; i++) {
+ ImageDescriptor imageDescriptor = create(T_EVIEW + "/progress", i + ".png"); //$NON-NLS-1$ //$NON-NLS-2$
+ progressImages[i - 1] = getImage(imageDescriptor);
+ }
+
+ return progressImages;
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/CompositeContainerImageDescriptor.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompositeContainerImageDescriptor extends CompositeImageDescriptor {
+
+ private final ImageData base;
+
+ private ImageData overlay;
+
+ protected Point size;
+
+ public CompositeContainerImageDescriptor(ImageDescriptor icon, ImageDescriptor overlay, boolean wide) {
+ this.base = getImageData(icon);
+ if (overlay != null) {
+ this.overlay = getImageData(overlay);
+ }
+ int width = CompositeElementImageDescriptor.WIDTH_ICON;
+ if (wide) {
+ width += CompositeElementImageDescriptor.OFFSET_DECORATION;
+ }
+ this.size = new Point(width, base.height);
+ }
+
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(base, 0, 0);
+ if (overlay != null) {
+ drawImage(overlay, base.width + 2, 0);
+ }
+ }
+
+ private ImageData getImageData(ImageDescriptor descriptor) {
+ ImageData data = descriptor.getImageData();
+ // see bug 51965: getImageData can return null
+ if (data == null) {
+ data = DEFAULT_IMAGE_DATA;
+ }
+ return data;
+ }
+
+ @Override
+ protected Point getSize() {
+ return new Point(size.x, size.y);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/CompositeElementImageDescriptor.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompositeElementImageDescriptor extends CompositeImageDescriptor {
+
+ private final ImageData base;
+
+ private ImageData kind;
+
+ protected Point size;
+
+ public static final int OFFSET_DECORATION = 6;
+
+ static final int WIDTH_ICON = 16;
+
+ private int offset = 0;
+
+ public CompositeElementImageDescriptor(ImageDescriptor icon, ImageDescriptor overlayKind, boolean wide) {
+ this.base = getImageData(icon);
+ if (overlayKind != null) {
+ this.kind = getImageData(overlayKind);
+ }
+ int width = WIDTH_ICON;
+ if (wide) {
+ width += OFFSET_DECORATION;
+ offset = OFFSET_DECORATION;
+ }
+ this.size = new Point(width, base.height);
+ }
+
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(base, offset, 1);
+ if (kind != null) {
+ drawImage(kind, offset + 5, 6);
+ }
+ }
+
+ private ImageData getImageData(ImageDescriptor descriptor) {
+ ImageData data = descriptor.getImageData();
+ // see bug 51965: getImageData can return null
+ if (data == null) {
+ data = DEFAULT_IMAGE_DATA;
+ }
+ return data;
+ }
+
+ @Override
+ protected Point getSize() {
+ return new Point(size.x, size.y);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/CompositeSyncImageDescriptor.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompositeSyncImageDescriptor extends CompositeImageDescriptor {
+
+ private final ImageData base;
+
+ private final ImageData background;
+
+ private final boolean fillBackground;
+
+ protected Point size;
+
+ static int WIDTH;
+
+ public CompositeSyncImageDescriptor(ImageDescriptor icon, boolean fillBackground) {
+ this.base = getImageData(icon);
+ this.background = getImageData(CommonImages.OVERLAY_WHITE);
+ this.size = new Point(background.width, background.height);
+ this.fillBackground = fillBackground;
+ }
+
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ if (fillBackground) {
+ drawImage(background, 0, 0);
+ }
+ drawImage(base, 3, 2);
+ }
+
+ private ImageData getImageData(ImageDescriptor descriptor) {
+ ImageData data = descriptor.getImageData();
+ // see bug 51965: getImageData can return null
+ if (data == null) {
+ data = DEFAULT_IMAGE_DATA;
+ }
+ return data;
+ }
+
+ @Override
+ protected Point getSize() {
+ return new Point(size.x, size.y);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/NotificationPopupColors.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 Tasktop Technologies 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:
+ * Benjamin Pasero - initial API and implementation
+ * Tasktop Technologies - improvements
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import org.eclipse.jface.resource.DeviceResourceException;
+import org.eclipse.jface.resource.ResourceManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Helper Class to create the colors for the {@link AbstractNotificationPopup}.
+ * <p>
+ * Note: Copied from FormColors of UI Forms.
+ * </p>
+ *
+ * @author Benjamin Pasero (initial contribution from RSSOwl, see bug 177974)
+ * @author Mik Kersten
+ */
+public class NotificationPopupColors {
+
+ private final Display display;
+
+ private Color titleText;
+
+ private Color gradientBegin;
+
+ private Color gradientEnd;
+
+ private Color border;
+
+ private final ResourceManager resourceManager;
+
+ public NotificationPopupColors(Display display, ResourceManager resourceManager) {
+ this.display = display;
+ this.resourceManager = resourceManager;
+
+ createColors();
+ }
+
+ private void createColors() {
+ createBorderColor();
+ createGradientColors();
+ // previously used SWT.COLOR_TITLE_INACTIVE_FOREGROUND, but too light on Windows XP
+ titleText = getColor(resourceManager, getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+ }
+
+ public Color getGradientBegin() {
+ return gradientBegin;
+ }
+
+ public Color getGradientEnd() {
+ return gradientEnd;
+ }
+
+ public Color getBorder() {
+ return border;
+ }
+
+ public Color getTitleText() {
+ return titleText;
+ }
+
+ private void createBorderColor() {
+ RGB tbBorder = getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
+ RGB bg = getImpliedBackground().getRGB();
+
+ // Group 1
+ // Rule: If at least 2 of the RGB values are equal to or between 180 and
+ // 255, then apply specified opacity for Group 1
+ // Examples: Vista, XP Silver, Wn High Con #2
+ // Keyline = TITLE_BACKGROUND @ 70% Opacity over LIST_BACKGROUND
+ if (testTwoPrimaryColors(tbBorder, 179, 256)) {
+ tbBorder = blend(tbBorder, bg, 70);
+ } else if (testTwoPrimaryColors(tbBorder, 120, 180)) {
+ tbBorder = blend(tbBorder, bg, 50);
+ } else {
+ tbBorder = blend(tbBorder, bg, 30);
+ }
+
+ border = getColor(resourceManager, tbBorder);
+ }
+
+ private void createGradientColors() {
+ RGB titleBg = getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
+ Color bgColor = getImpliedBackground();
+ RGB bg = bgColor.getRGB();
+ RGB bottom, top;
+
+ // Group 1
+ // Rule: If at least 2 of the RGB values are equal to or between 180 and
+ // 255, then apply specified opacity for Group 1
+ // Examples: Vista, XP Silver, Wn High Con #2
+ // Gradient Bottom = TITLE_BACKGROUND @ 30% Opacity over LIST_BACKGROUND
+ // Gradient Top = TITLE BACKGROUND @ 0% Opacity over LIST_BACKGROUND
+ if (testTwoPrimaryColors(titleBg, 179, 256)) {
+ bottom = blend(titleBg, bg, 30);
+ top = bg;
+ }
+
+ // Group 2
+ // Rule: If at least 2 of the RGB values are equal to or between 121 and
+ // 179, then apply specified opacity for Group 2
+ // Examples: XP Olive, OSX Graphite, Linux GTK, Wn High Con Black
+ // Gradient Bottom = TITLE_BACKGROUND @ 20% Opacity over LIST_BACKGROUND
+ // Gradient Top = TITLE BACKGROUND @ 0% Opacity over LIST_BACKGROUND
+ else if (testTwoPrimaryColors(titleBg, 120, 180)) {
+ bottom = blend(titleBg, bg, 20);
+ top = bg;
+ }
+
+ // Group 3
+ // Rule: If at least 2 of the RGB values are equal to or between 0 and
+ // 120, then apply specified opacity for Group 3
+ // Examples: XP Default, Wn Classic Standard, Wn Marine, Wn Plum, OSX
+ // Aqua, Wn High Con White, Wn High Con #1
+ // Gradient Bottom = TITLE_BACKGROUND @ 10% Opacity over LIST_BACKGROUND
+ // Gradient Top = TITLE BACKGROUND @ 0% Opacity over LIST_BACKGROUND
+ else {
+ bottom = blend(titleBg, bg, 10);
+ top = bg;
+ }
+
+ gradientBegin = getColor(resourceManager, top);
+ gradientEnd = getColor(resourceManager, bottom);
+ }
+
+ private RGB blend(RGB c1, RGB c2, int ratio) {
+ int r = blend(c1.red, c2.red, ratio);
+ int g = blend(c1.green, c2.green, ratio);
+ int b = blend(c1.blue, c2.blue, ratio);
+ return new RGB(r, g, b);
+ }
+
+ private int blend(int v1, int v2, int ratio) {
+ int b = (ratio * v1 + (100 - ratio) * v2) / 100;
+ return Math.min(255, b);
+ }
+
+ private boolean testTwoPrimaryColors(RGB rgb, int from, int to) {
+ int total = 0;
+ if (testPrimaryColor(rgb.red, from, to)) {
+ total++;
+ }
+ if (testPrimaryColor(rgb.green, from, to)) {
+ total++;
+ }
+ if (testPrimaryColor(rgb.blue, from, to)) {
+ total++;
+ }
+ return total >= 2;
+ }
+
+ private boolean testPrimaryColor(int value, int from, int to) {
+ return value > from && value < to;
+ }
+
+ private RGB getSystemColor(int code) {
+ return getDisplay().getSystemColor(code).getRGB();
+ }
+
+ private Color getImpliedBackground() {
+ return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ }
+
+ private Display getDisplay() {
+ return display;
+ }
+
+ private Color getColor(ResourceManager manager, RGB rgb) {
+ try {
+ return manager.createColor(rgb);
+ } catch (DeviceResourceException e) {
+ return manager.getDevice().getSystemColor(SWT.COLOR_BLACK);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/SwtUtil.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ */
+public class SwtUtil {
+
+ public static final long FADE_RESCHEDULE_DELAY = 80;
+
+ public static final int FADE_IN_INCREMENT = 15;
+
+ public static final int FADE_OUT_INCREMENT = -20;
+
+ public static void collectItemData(TreeItem[] items, Set<Object> allVisible) {
+ for (TreeItem item : items) {
+ allVisible.add(item.getData());
+ collectItemData(item.getItems(), allVisible);
+ }
+ }
+
+ public static FadeJob fastFadeIn(Shell shell, IFadeListener listener) {
+ return new FadeJob(shell, 2 * FADE_IN_INCREMENT, FADE_RESCHEDULE_DELAY, listener);
+ }
+
+ public static FadeJob fadeIn(Shell shell, IFadeListener listener) {
+ return new FadeJob(shell, FADE_IN_INCREMENT, FADE_RESCHEDULE_DELAY, listener);
+ }
+
+ public static FadeJob fadeOut(Shell shell, IFadeListener listener) {
+ return new FadeJob(shell, FADE_OUT_INCREMENT, FADE_RESCHEDULE_DELAY, listener);
+ }
+
+ public static class FadeJob extends Job {
+
+ private final Shell shell;
+
+ private final int increment;
+
+ private volatile boolean stopped;
+
+ private volatile int currentAlpha;
+
+ private final long delay;
+
+ private final IFadeListener fadeListener;
+
+ public FadeJob(Shell shell, int increment, long delay, IFadeListener fadeListener) {
+ super("Fading");
+ if (increment < -255 || increment == 0 || increment > 255) {
+ throw new IllegalArgumentException("-255 <= increment <= 255 && increment != 0"); //$NON-NLS-1$
+ }
+ if (delay < 1) {
+ throw new IllegalArgumentException("delay must be > 0"); //$NON-NLS-1$
+ }
+ this.currentAlpha = shell.getAlpha();
+ this.shell = shell;
+ this.increment = increment;
+ this.delay = delay;
+ this.fadeListener = fadeListener;
+
+ setSystem(true);
+ schedule(delay);
+ }
+
+ @Override
+ protected void canceling() {
+ stopped = true;
+ }
+
+ private void reschedule() {
+ if (stopped) {
+ return;
+ }
+ schedule(delay);
+ }
+
+ public void cancelAndWait(final boolean setAlpha) {
+ if (stopped) {
+ return;
+ }
+ cancel();
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ if (setAlpha) {
+ shell.setAlpha(getLastAlpha());
+ }
+ }
+ });
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (stopped) {
+ return Status.OK_STATUS;
+ }
+
+ currentAlpha += increment;
+ if (currentAlpha <= 0) {
+ currentAlpha = 0;
+ } else if (currentAlpha >= 255) {
+ currentAlpha = 255;
+ }
+
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ if (stopped) {
+ return;
+ }
+
+ if (shell.isDisposed()) {
+ stopped = true;
+ return;
+ }
+
+ shell.setAlpha(currentAlpha);
+
+ if (fadeListener != null) {
+ fadeListener.faded(shell, currentAlpha);
+ }
+ }
+ });
+
+ if (currentAlpha == 0 || currentAlpha == 255) {
+ stopped = true;
+ }
+
+ reschedule();
+ return Status.OK_STATUS;
+ }
+
+ private int getLastAlpha() {
+ return (increment < 0) ? 0 : 255;
+ }
+
+ }
+
+ public static interface IFadeListener {
+
+ public void faded(Shell shell, int alpha);
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/mylyn/TaskListImageDescriptor.java Fri Mar 12 14:58:03 2010 -0600
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.remoteconnections.internal.ui.mylyn;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * @author Mik Kersten
+ */
+public class TaskListImageDescriptor extends CompositeImageDescriptor {
+
+ private final ImageData base;
+
+ private ImageData overlay;
+
+ private boolean top;
+
+ private boolean left;
+
+ protected Point size;
+
+ public TaskListImageDescriptor(ImageDescriptor baseDesc, ImageDescriptor overlayDesc, boolean top, boolean left) {
+ this.base = getImageData(baseDesc);
+ this.top = top;
+ this.left = left;
+ if (overlayDesc != null) {
+ this.overlay = getImageData(overlayDesc);
+ }
+ Point size = new Point(base.width, base.height);
+ setImageSize(size);
+ }
+
+ public TaskListImageDescriptor(ImageDescriptor baseDesc, Point size) {
+ this.base = getImageData(baseDesc);
+ setImageSize(size);
+ }
+
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(base, 0, 0);
+ int x = 0;
+ int y = 0;
+ if (!left) {
+ x = 8;// base.width - overlay.width;
+ }
+ if (!top) {
+ y = 8;// base.height - overlay.height;
+ }
+ if (overlay != null) {
+ drawImage(overlay, x, y);
+ }
+ }
+
+ private ImageData getImageData(ImageDescriptor descriptor) {
+ ImageData data = descriptor.getImageData();
+ // see bug 51965: getImageData can return null
+ if (data == null) {
+ data = DEFAULT_IMAGE_DATA;
+ }
+ return data;
+ }
+
+ public void setImageSize(Point size) {
+ this.size = size;
+ }
+
+ @Override
+ protected Point getSize() {
+ return new Point(size.x, size.y);
+ }
+}