Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-12-03 22:01:11 +0000
committerSteffen Pingel2011-12-03 22:01:11 +0000
commit51f69a0d966888bda697d03f1dfcd5f3c4f94b36 (patch)
tree30e210791b46846eb92eaf4c9203689e8f6d799c /org.eclipse.mylyn.commons.ui
parent71d317f128271fa11827435e9a8096e9b9e5aa85 (diff)
downloadorg.eclipse.mylyn.commons-51f69a0d966888bda697d03f1dfcd5f3c4f94b36.tar.gz
org.eclipse.mylyn.commons-51f69a0d966888bda697d03f1dfcd5f3c4f94b36.tar.xz
org.eclipse.mylyn.commons-51f69a0d966888bda697d03f1dfcd5f3c4f94b36.zip
NEW - bug 360301: [api] make provisional packages API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=360301 Change-Id: I8bf991f79dcc7c13f66d636dbe493ba6e5d54568
Diffstat (limited to 'org.eclipse.mylyn.commons.ui')
-rw-r--r--org.eclipse.mylyn.commons.ui/.settings/.api_filters12
-rw-r--r--org.eclipse.mylyn.commons.ui/META-INF/MANIFEST.MF15
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSorter.java129
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSupport.java434
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ClipboardCopier.java105
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonImages.java431
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonUiUtil.java209
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListItem.java275
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListViewer.java501
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientCanvas.java351
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientColors.java186
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientToolTip.java87
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/PlatformUiUtil.java197
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ProgressContainer.java257
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/SelectionProviderAdapter.java79
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableSorter.java38
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableViewerSupport.java132
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeSorter.java39
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeViewerSupport.java130
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/CollapseAllAction.java42
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/ExpandAllAction.java42
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonColors.java40
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonFonts.java112
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonThemes.java64
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractInPlaceDialog.java311
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractNotificationPopup.java584
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/EnhancedWizardDialog.java123
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IInPlaceDialogListener.java24
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IValidatable.java26
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/InPlaceDialogEvent.java39
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/ValidatableWizardDialog.java126
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/wizard/ScreenshotCreationPage.java76
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/AnimationUtil.java155
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorCanvas.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorSelectionWindow.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiConstants.java21
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiPlugin.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CompositeSyncImageDescriptor.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListItem.java8
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListViewer.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/Messages.java20
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/NotificationPopupColors.java10
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SectionComposite.java6
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SwtUtil.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/TaskBarManager.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/WindowUtil.java9
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/messages.properties13
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSorter.java6
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotification.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java20
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ClipboardCopier.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonColors.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFonts.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImageManger.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonPropertyTester.java6
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonTextSupport.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonThemes.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePicker.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePickerPanel.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DateSelectionDialog.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DecoratingPatternStyledCellLabelProvider.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DelayedRefreshJob.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientCanvas.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientToolTip.java9
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/IFilteredTreeListener.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScalingHyperlink.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SearchHistoryPopUpDialog.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectionProviderAdapter.java6
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SubstringPatternFilter.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableSorter.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java5
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableViewerSupport.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeSorter.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/CollapseAllAction.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractDeleteLineHandler.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractTextViewerHandler.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineHandler.java4
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToBeginningHandler.java4
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToEndHandler.java4
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineHandler.java4
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToBeginningHandler.java4
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToEndHandler.java4
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/AbstractInPlaceDialog.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceCheckBoxTreeDialog.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDateSelectionDialog.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDialogEvent.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java3
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/EditorBusyIndicator.java2
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/IBusyEditor.java2
114 files changed, 5614 insertions, 60 deletions
diff --git a/org.eclipse.mylyn.commons.ui/.settings/.api_filters b/org.eclipse.mylyn.commons.ui/.settings/.api_filters
deleted file mode 100644
index c98c4122..00000000
--- a/org.eclipse.mylyn.commons.ui/.settings/.api_filters
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.mylyn.commons.ui" version="2">
- <resource path="src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java" type="org.eclipse.mylyn.internal.provisional.commons.ui.EnhancedFilteredTree">
- <filter comment="Needed to remove the key listener added by filtered tree" id="640712815">
- <message_arguments>
- <message_argument value="TypedListener"/>
- <message_argument value="EnhancedFilteredTree"/>
- <message_argument value="getEventListener()"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/org.eclipse.mylyn.commons.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.commons.ui/META-INF/MANIFEST.MF
index 1a914ff7..7bd08d50 100644
--- a/org.eclipse.mylyn.commons.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.commons.ui/META-INF/MANIFEST.MF
@@ -5,16 +5,26 @@ Bundle-SymbolicName: org.eclipse.mylyn.commons.ui;singleton:=true
Bundle-Version: 3.7.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.expressions,
+ org.eclipse.swt,
+ org.eclipse.jface,
org.eclipse.jface.text,
org.eclipse.ui,
+ org.eclipse.ui.browser,
org.eclipse.ui.editors,
org.eclipse.ui.forms,
- org.eclipse.ui.browser,
+ org.eclipse.ui.workbench,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.mylyn.commons.core;bundle-version="3.7.0",
org.eclipse.mylyn.commons.screenshots;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Activator: org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin
-Export-Package: org.eclipse.mylyn.internal.commons.ui;x-internal:=true,
+Export-Package: org.eclipse.mylyn.commons.ui,
+ org.eclipse.mylyn.commons.ui.actions,
+ org.eclipse.mylyn.commons.ui.compatibility,
+ org.eclipse.mylyn.commons.ui.dialogs,
+ org.eclipse.mylyn.commons.ui.wizard,
+ org.eclipse.mylyn.internal.commons.ui;x-internal:=true,
org.eclipse.mylyn.internal.provisional.commons.ui;x-internal:=true,
org.eclipse.mylyn.internal.provisional.commons.ui.actions;x-internal:=true,
org.eclipse.mylyn.internal.provisional.commons.ui.commands;x-internal:=true,
@@ -22,3 +32,4 @@ Export-Package: org.eclipse.mylyn.internal.commons.ui;x-internal:=true,
org.eclipse.mylyn.internal.provisional.commons.ui.editor;x-internal:=true
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
+
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSorter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSorter.java
new file mode 100644
index 00000000..f0d50349
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSorter.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ContentViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Item;
+
+/**
+ * Provides sorting support for column-based viewers such as tables and tree-tables.
+ *
+ * @author Shawn Minto
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public abstract class AbstractColumnViewerSorter<V extends ColumnViewer, I extends Item> extends ViewerSorter {
+
+ /**
+ * Returns the current sort column.
+ *
+ * @return the column that is being sorted; <code>null</code>, if no column is sorted
+ */
+ abstract I getSortColumn(V viewer);
+
+ /**
+ * Returns the current sort order.
+ *
+ * @return {@link SWT#DOWN}, if sorting descending; 0, if no sort order is specified; {@link SWT#UP}, if sorting
+ * ascending
+ */
+ abstract int getSortDirection(V viewer);
+
+ /**
+ * Returns the index of <code>I</code>.
+ */
+ abstract int getColumnIndex(V viewer, I column);
+
+ /**
+ * Compares <code>e1</code> and <code>e2</code> according to the current sort column and order. Delegates to
+ * {@link #compareDefault(ColumnViewer, Object, Object)} if no sort column is selected.
+ *
+ * @see #getSortColumn(ColumnViewer)
+ * @see #getSortDirection(ColumnViewer)
+ * @see #compareDefault(ColumnViewer, Object, Object)
+ */
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ Assert.isLegal(viewer instanceof ColumnViewer);
+ @SuppressWarnings("unchecked")
+ V columnViewer = (V) viewer;
+ I column = getSortColumn(columnViewer);
+ if (column != null) {
+ int index = getColumnIndex(columnViewer, column);
+ int result = compare(columnViewer, e1, e2, index);
+ if (getSortDirection(columnViewer) == SWT.UP) {
+ return -result;
+ }
+ return result;
+ }
+ return compareDefault(columnViewer, e1, e2);
+ }
+
+ /**
+ * Compares <code>e1</code> and <code>e2</code> following the contract of
+ * {@link ViewerComparator#compare(Viewer, Object, Object)}. Subclasses may override.
+ *
+ * @see ViewerComparator#compare(Viewer, Object, Object)
+ */
+ protected int compareDefault(V viewer, Object e1, Object e2) {
+ return super.compare(viewer, e1, e2);
+ }
+
+ /**
+ * Compares <code>e1</code> and <code>e2</code> according based on their category and column specific label.
+ */
+ @SuppressWarnings("unchecked")
+ public int compare(V viewer, Object e1, Object e2, int columnIndex) {
+ int cat1 = category(e1);
+ int cat2 = category(e2);
+
+ if (cat1 != cat2) {
+ return cat1 - cat2;
+ }
+
+ String name1;
+ String name2;
+
+ if (viewer == null || !(viewer instanceof ContentViewer)) {
+ name1 = e1.toString();
+ name2 = e2.toString();
+ } else {
+ CellLabelProvider prov = viewer.getLabelProvider(columnIndex);
+ if (prov instanceof ILabelProvider) {
+ ILabelProvider lprov = (ILabelProvider) prov;
+ name1 = lprov.getText(e1);
+ name2 = lprov.getText(e2);
+ } else {
+ name1 = e1.toString();
+ name2 = e2.toString();
+ }
+ }
+ if (name1 == null) {
+ name1 = "";//$NON-NLS-1$
+ }
+ if (name2 == null) {
+ name2 = "";//$NON-NLS-1$
+ }
+
+ // use the comparator to compare the strings
+ return getComparator().compare(name1, name2);
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSupport.java
new file mode 100644
index 00000000..27f962d1
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/AbstractColumnViewerSupport.java
@@ -0,0 +1,434 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.layout.AbstractColumnLayout;
+import org.eclipse.jface.util.Policy;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.mylyn.commons.core.XmlMemento;
+import org.eclipse.mylyn.internal.commons.ui.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * Provides an abstract implementation for persisting the column and sorting state of a {@link ColumnViewer}.
+ *
+ * @author Shawn Minto
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public abstract class AbstractColumnViewerSupport<T extends Item> {
+
+ private static class ColumnState {
+ // this represents the width of the column or the weight if it was weight data
+ int width;
+ }
+
+ public static final String KEY_COLUMN_CAN_HIDE = "org.eclipse.mylyn.column.viewer.support.column.can.hide"; //$NON-NLS-1$
+
+ // from AbstractColumnLayout
+ private static final String KEY_LAYOUT_DATA = Policy.JFACE + ".LAYOUT_DATA"; //$NON-NLS-1$
+
+ public static final String KEY_SUPPORTS_SORTING = "org.eclipse.mylyn.column.viewer.support.sorting"; //$NON-NLS-1$
+
+ private Menu contextMenu;
+
+ private final Control control;
+
+ private int[] defaultOrder;
+
+ private ColumnState[] defaults;
+
+ private int defaultSortColumnIndex;
+
+ private int defaultSortDirection;
+
+ private final boolean[] defaultVisibilities;
+
+ private final Menu headerMenu;
+
+ private ColumnState[] lastStates;
+
+ private final File stateFile;
+
+ private boolean supportsSorting;
+
+ private final ColumnViewer viewer;
+
+ public AbstractColumnViewerSupport(ColumnViewer viewer, File stateFile) {
+ this(viewer, stateFile, new boolean[0]);
+ }
+
+ public AbstractColumnViewerSupport(ColumnViewer viewer, File stateFile, boolean[] defaultVisibilities) {
+ Assert.isNotNull(viewer);
+ Assert.isNotNull(stateFile);
+ Assert.isNotNull(defaultVisibilities);
+ Object supportSort = viewer.getControl().getData(KEY_SUPPORTS_SORTING);
+ if (supportSort instanceof Boolean) {
+ supportsSorting = (Boolean) supportSort;
+ } else {
+ supportsSorting = true;
+ }
+ this.defaultVisibilities = defaultVisibilities;
+ this.viewer = viewer;
+ this.stateFile = stateFile;
+
+ control = viewer.getControl();
+
+ Composite parent = viewer.getControl().getParent();
+ headerMenu = new Menu(parent);
+ }
+
+ abstract void addColumnSelectionListener(T column, SelectionListener selectionListener);
+
+ private MenuItem createMenuItem(Menu parent, final T column, final int i) {
+ final MenuItem item = new MenuItem(parent, SWT.CHECK);
+ item.setText(column.getText());
+ item.setSelection(getWidth(column) > 0);
+ item.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ int lastWidth = getWidth(column);
+ if (lastWidth != 0) {
+ lastStates[i].width = lastWidth;
+ }
+ if (lastStates[i].width == 0) {
+ // if the user shrunk it to 0, use the default
+ lastStates[i].width = defaults[i].width;
+ }
+ if (lastStates[i].width == 0) {
+ // if the default and the last width was 0, then set to 150 pixels
+ lastStates[i].width = 150;
+ }
+ if (item.getSelection()) {
+ setWidth(column, lastStates[i].width);
+ } else {
+ setWidth(column, 0);
+ }
+ }
+ });
+ return item;
+ }
+
+ private void createRestoreDefaults(Menu parent) {
+
+ new MenuItem(parent, SWT.SEPARATOR);
+
+ final MenuItem restoreDefaults = new MenuItem(parent, SWT.PUSH);
+ restoreDefaults.setText(Messages.AbstractColumnViewerSupport_Restore_defaults);
+ restoreDefaults.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ restoreDefaults();
+ }
+ });
+ }
+
+ abstract Rectangle getClientArea();
+
+ abstract T getColumn(int index);
+
+ abstract int getColumnIndexOf(T column);
+
+ abstract AbstractColumnLayout getColumnLayout();
+
+ private ColumnLayoutData getColumnLayoutData(Item column) {
+ Object data = column.getData(KEY_LAYOUT_DATA);
+ if (data instanceof ColumnLayoutData) {
+ return (ColumnLayoutData) data;
+ } else {
+ return null;
+ }
+ }
+
+ abstract int[] getColumnOrder();
+
+ abstract T[] getColumns();
+
+ abstract int getColumnWidth(T column);
+
+ abstract int getHeaderHeight();
+
+ abstract T getSortColumn();
+
+ abstract int getSortDirection();
+
+ private int getWidth(T column) {
+ ColumnLayoutData data = getColumnLayoutData(column);
+ AbstractColumnLayout columnLayout = getColumnLayout();
+ if (data != null && columnLayout != null) {
+ if (data instanceof ColumnWeightData) {
+ return ((ColumnWeightData) data).weight;
+ } else if (data instanceof ColumnPixelData) {
+ // turn this into a weighted width
+ int width = ((ColumnPixelData) data).width;
+ int totalWidth = control.getSize().x;
+ if (totalWidth == 0) {
+ return width;
+ } else {
+ return (width * 100) / totalWidth;
+ }
+ } else {
+ // we dont know
+ return getColumnWidth(column);
+ }
+ } else {
+ // if has column data, use that (pixel or weight)
+ return getColumnWidth(column);
+ }
+ }
+
+ private void initialize() {
+ T[] columns = getColumns();
+ defaults = new ColumnState[columns.length];
+ defaultSortColumnIndex = -1;
+ for (int i = 0; i < columns.length; i++) {
+ final T column = columns[i];
+
+ if (supportsSorting) {
+ addColumnSelectionListener(column, new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int direction = getSortDirection();
+ if (getSortColumn() == column && direction != SWT.NONE) {
+ direction = (direction == SWT.DOWN) ? SWT.UP : SWT.NONE;
+ } else {
+ direction = SWT.DOWN;
+ }
+
+ setSortDirection(direction);
+ if (direction == SWT.NONE) {
+ setSortColumn(null);
+ } else {
+ setSortColumn(column);
+ }
+ viewer.refresh();
+ }
+ });
+ if (column == getSortColumn()) {
+ defaultSortColumnIndex = i;
+ }
+ }
+
+ MenuItem item = createMenuItem(headerMenu, column, i);
+ item.setEnabled(canHide(column));
+
+ defaults[i] = new ColumnState();
+ defaults[i].width = getWidth(column);
+
+ }
+
+ createRestoreDefaults(headerMenu);
+
+ defaultOrder = getColumnOrder();
+ defaultSortDirection = getSortDirection();
+
+ control.addListener(SWT.MenuDetect, new Listener() {
+ public void handleEvent(Event event) {
+ Menu menu = control.getMenu();
+ if (menu != null && menu != headerMenu) {
+ contextMenu = menu;
+ }
+
+ Display display = control.getDisplay();
+ Point pt = display.map(null, control, new Point(event.x, event.y));
+ Rectangle clientArea = getClientArea();
+ boolean header = clientArea.y <= pt.y && pt.y < (clientArea.y + getHeaderHeight());
+
+ control.setMenu(header ? headerMenu : contextMenu);
+ }
+ });
+
+ control.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ save();
+ }
+ });
+ }
+
+ private boolean canHide(T column) {
+ Object canHide = column.getData(KEY_COLUMN_CAN_HIDE);
+ return !(canHide instanceof Boolean) || ((Boolean) canHide).booleanValue();
+ }
+
+ void initializeViewerSupport() {
+ initialize();
+ restore();
+
+ T[] columns = getColumns();
+ lastStates = new ColumnState[columns.length];
+ for (int i = 0; i < columns.length; i++) {
+ final T column = columns[i];
+ lastStates[i] = new ColumnState();
+ lastStates[i].width = getWidth(column);
+ }
+ }
+
+ private void restore() {
+ if (stateFile.exists()) {
+ try {
+ FileReader reader = new FileReader(stateFile);
+ try {
+ XmlMemento memento = XmlMemento.createReadRoot(reader);
+
+ XmlMemento[] children = memento.getChildren("Column"); //$NON-NLS-1$
+ int[] order = new int[children.length];
+ for (int i = 0; i < children.length; i++) {
+ T column = getColumn(i);
+ Integer widthInteger = children[i].getInteger("width"); //$NON-NLS-1$
+ if (widthInteger != null) {
+ int width = widthInteger;
+ // ensure that columns that may not be hidden have a non zero width
+ if (width >= 0 && (width > 0 || canHide(column))) {
+ setWidth(column, width);
+ }
+ }
+ headerMenu.getItem(i).setSelection(getWidth(column) > 0);
+ Integer orderInteger = children[i].getInteger("order"); //$NON-NLS-1$
+ order[i] = (orderInteger != null) ? orderInteger.intValue() : 0;
+ }
+ try {
+ setColumnOrder(order);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+
+ XmlMemento child = memento.getChild("Sort"); //$NON-NLS-1$
+ if (child != null) {
+ int columnIndex = child.getInteger("column"); //$NON-NLS-1$
+ T column = getColumn(columnIndex);
+ setSortColumn(column);
+ setSortDirection(child.getInteger("direction")); //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+ // ignore
+ } finally {
+ reader.close();
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+
+ viewer.refresh();
+ } else {
+ T[] columns = getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ T column = columns[i];
+ if (i < defaultVisibilities.length && !defaultVisibilities[i]) {
+ setWidth(column, 0);
+ headerMenu.getItem(i).setSelection(false);
+ }
+ }
+ }
+ }
+
+ private void restoreDefaults() {
+ for (int index = 0; index < defaults.length; index++) {
+ T column = getColumn(index);
+ if (index < defaultVisibilities.length && !defaultVisibilities[index]) {
+ setWidth(column, 0);
+ } else {
+ setWidth(column, defaults[index].width);
+ }
+ // update the menu
+ headerMenu.getItem(index).setSelection(getWidth(column) > 0);
+ }
+ setColumnOrder(defaultOrder);
+ if (defaultSortColumnIndex != -1) {
+ setSortColumn(getColumn(defaultSortColumnIndex));
+ setSortDirection(defaultSortDirection);
+ } else {
+ setSortColumn(null);
+ }
+ viewer.refresh();
+ }
+
+ private void save() {
+ XmlMemento memento = XmlMemento.createWriteRoot("Viewer"); //$NON-NLS-1$
+
+ int[] order = getColumnOrder();
+ T[] columns = getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ T column = columns[i];
+ XmlMemento child = memento.createChild("Column"); //$NON-NLS-1$
+ child.putInteger("width", getWidth(column)); //$NON-NLS-1$
+ child.putInteger("order", order[i]); //$NON-NLS-1$
+ }
+
+ T sortColumn = getSortColumn();
+ if (sortColumn != null) {
+ XmlMemento child = memento.createChild("Sort"); //$NON-NLS-1$
+ child.putInteger("column", getColumnIndexOf(sortColumn)); //$NON-NLS-1$
+ child.putInteger("direction", getSortDirection()); //$NON-NLS-1$
+ }
+
+ try {
+ FileWriter writer = new FileWriter(stateFile);
+ try {
+ memento.save(writer);
+ } finally {
+ writer.close();
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ abstract void setColumnOrder(int[] order);
+
+ abstract void setColumnResizable(T column, boolean resizable);
+
+ abstract void setColumnWidth(T column, int width);
+
+ abstract void setSortColumn(T column);
+
+ abstract void setSortDirection(int direction);
+
+ private void setWidth(T column, int width) {
+ // if has column data, set that (pixel or weight)
+ ColumnLayoutData data = getColumnLayoutData(column);
+ AbstractColumnLayout columnLayout = getColumnLayout();
+ if (data != null && columnLayout != null) {
+ if (width == 0) {
+ columnLayout.setColumnData(column, new ColumnPixelData(width, data.resizable));
+ } else {
+ columnLayout.setColumnData(column, new ColumnWeightData(width, data.resizable));
+ }
+ control.getParent().layout();
+ } else {
+ setColumnWidth(column, width);
+ }
+ setColumnResizable(column, width > 0);
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ClipboardCopier.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ClipboardCopier.java
new file mode 100644
index 00000000..d6043a6d
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ClipboardCopier.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.commons.ui;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * A helper class for copying text to the clipboard.
+ *
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class ClipboardCopier {
+
+ /**
+ * Provides a textual representation when copying objects to the clipboard.
+ */
+ public interface TextProvider {
+
+ public abstract String getTextForElement(Object element);
+
+ }
+
+ private static ClipboardCopier instance = new ClipboardCopier();
+
+ public static String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * Returns the default instance.
+ */
+ public static ClipboardCopier getDefault() {
+ return instance;
+ }
+
+ private Clipboard clipboard;
+
+ /**
+ * Constructs a new instance. Instances must be disposed by invoking {@link #dispose()} when they are no longer
+ * needed.
+ */
+ public ClipboardCopier() {
+ }
+
+ public void copy(IStructuredSelection selection, TextProvider provider) {
+ copy(selection.toList(), provider);
+ }
+
+ public void copy(List<?> selection, TextProvider provider) {
+ if (!selection.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (Object item : selection) {
+ String textForElement = provider.getTextForElement(item);
+ if (textForElement != null) {
+ if (sb.length() > 0) {
+ sb.append(LINE_SEPARATOR);
+ sb.append(LINE_SEPARATOR);
+ }
+ sb.append(textForElement);
+ }
+ }
+ if (sb.length() > 0) {
+ copy(sb.toString());
+ }
+ }
+ }
+
+ public void copy(String text) {
+ Assert.isNotNull(text);
+ Assert.isTrue(text.length() > 0);
+
+ if (clipboard == null) {
+ clipboard = new Clipboard(Display.getDefault());
+ }
+
+ TextTransfer textTransfer = TextTransfer.getInstance();
+ clipboard.setContents(new Object[] { text }, new Transfer[] { textTransfer });
+ }
+
+ /**
+ * Frees resources.
+ */
+ public void dispose() {
+ if (clipboard != null) {
+ clipboard.dispose();
+ clipboard = null;
+ }
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonImages.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonImages.java
new file mode 100644
index 00000000..e46190ee
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonImages.java
@@ -0,0 +1,431 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 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 org.eclipse.mylyn.commons.ui;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.mylyn.internal.commons.ui.CommonsUiConstants;
+import org.eclipse.mylyn.internal.commons.ui.CompositeContainerImageDescriptor;
+import org.eclipse.mylyn.internal.commons.ui.CompositeElementImageDescriptor;
+import org.eclipse.mylyn.internal.commons.ui.CompositeSyncImageDescriptor;
+import org.eclipse.mylyn.internal.commons.ui.TaskListImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Mik Kersten
+ * @since 3.7
+ */
+public class CommonImages {
+
+ private static final URL baseURL = Platform.getBundle(CommonsUiConstants.ID_PLUGIN).getEntry("/icons/"); //$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_OBJ48 = "obj48"; //$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$
+
+ public static final ImageDescriptor NOTIFICATION_PREFERENCES_HOVER = create(T_EVIEW,
+ "notification-preferences-active.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor NOTIFICATION_PREFERENCES = create(T_EVIEW,
+ "notification-preferences-inactive.png"); //$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-sync-warning.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_WARNING = create(T_OVR, "warning_ovr.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_SUCCESS = create(T_OVR, "success_ovr.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_ERROR = create(T_OVR, "error_ovr.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OVERLAY_FAILED = create(T_OVR, "failed_ovr.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 CHECKED = create(T_OBJ, "checked.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 = create(T_ELCL, "expand.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$;
+
+ public static final ImageDescriptor VALIDATE = create(T_OBJ, "resource_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor NOTIFICATION_CONFIGURE = create(T_TOOL, "notification-configure.gif"); //$NON-NLS-1$;
+
+ public static final ImageDescriptor NOTIFICATION_CONFIGURE_HOVER = create(T_TOOL,
+ "notification-configure-active.gif"); //$NON-NLS-1$;
+
+ public static final ImageDescriptor CHECKBOX_CLEARED = create(T_ELCL, "checkboxcleared.gif"); //$NON-NLS-1$;
+
+ public static final ImageDescriptor CHECKBOX_SELECTED = create(T_ELCL, "checkboxselected.gif"); //$NON-NLS-1$;
+
+ public static final ImageDescriptor CHECKBOX_UNSELECTED = create(T_ELCL, "checkboxunselected.gif"); //$NON-NLS-1$;
+
+ public static final ImageDescriptor CHECKBOX_DISABLED = create(T_ELCL, "checkboxgreyed.gif"); //$NON-NLS-1$;
+
+ public static final ImageDescriptor PERSON_LARGE = create(T_OBJ48, "person.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;
+ }
+
+ @Deprecated
+ 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;
+ }
+
+ @Deprecated
+ 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;
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonUiUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonUiUtil.java
new file mode 100644
index 00000000..369bb1e1
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/CommonUiUtil.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.commons.ui;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.LegacyActionTools;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.mylyn.commons.core.ICoreRunnable;
+import org.eclipse.mylyn.internal.commons.ui.CommonsUiConstants;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class CommonUiUtil {
+
+ private static final String KEY_ENABLED = "org.eclipse.mylyn.commons.ui.enabled"; //$NON-NLS-1$
+
+ public static void run(IRunnableContext context, final ICoreRunnable runnable) throws CoreException {
+ try {
+ IRunnableWithProgress runner = new IRunnableWithProgress() {
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ runnable.run(monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } catch (OperationCanceledException e) {
+ throw new InterruptedException();
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ context.run(true, true, runner);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() instanceof CoreException) {
+ throw (CoreException) e.getCause();
+ } else {
+ Platform.getLog(Platform.getBundle(CommonsUiConstants.ID_PLUGIN)).log(
+ new Status(IStatus.ERROR, CommonsUiConstants.ID_PLUGIN, "Unexpected exception", e)); //$NON-NLS-1$
+ }
+ } catch (InterruptedException e) {
+ throw new OperationCanceledException();
+ }
+ }
+
+ public static void setMessage(DialogPage page, IStatus status) {
+ String message = status.getMessage();
+ switch (status.getSeverity()) {
+ case IStatus.OK:
+ page.setMessage(null, IMessageProvider.NONE);
+ break;
+ case IStatus.INFO:
+ page.setMessage(message, IMessageProvider.INFORMATION);
+ break;
+ case IStatus.WARNING:
+ page.setMessage(message, IMessageProvider.WARNING);
+ break;
+ default:
+ page.setMessage(message, IMessageProvider.ERROR);
+ break;
+ }
+ }
+
+ /**
+ * Recursively sets the menu of all children of <code>composite</code>.
+ */
+ public static void setMenu(Composite composite, Menu menu) {
+ if (!composite.isDisposed()) {
+ composite.setMenu(menu);
+ for (Control child : composite.getChildren()) {
+ child.setMenu(menu);
+ if (child instanceof Composite) {
+ setMenu((Composite) child, menu);
+ }
+ }
+ }
+ }
+
+ public static void setEnabled(Composite composite, boolean restore) {
+ if (restore) {
+ restoreState(composite);
+ } else {
+ saveStateAndDisable(composite);
+ }
+ }
+
+ private static void saveStateAndDisable(Composite composite) {
+ if (!composite.isDisposed()) {
+ Object data = composite.getData(KEY_ENABLED);
+ if (data == null) {
+ if (!composite.getEnabled()) {
+ composite.setData(KEY_ENABLED, Boolean.FALSE);
+ } else {
+ composite.setData(KEY_ENABLED, Boolean.TRUE);
+ composite.setEnabled(false);
+ }
+ }
+ for (Control control : composite.getChildren()) {
+ if (control instanceof Composite) {
+ saveStateAndDisable((Composite) control);
+ } else {
+ data = control.getData(KEY_ENABLED);
+ if (data == null) {
+ if (!control.getEnabled()) {
+ control.setData(KEY_ENABLED, Boolean.FALSE);
+ } else {
+ control.setData(KEY_ENABLED, Boolean.TRUE);
+ control.setEnabled(false);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static void restoreState(Composite composite) {
+ if (!composite.isDisposed()) {
+ Object data = composite.getData(KEY_ENABLED);
+ if (data != null) {
+ if (data == Boolean.TRUE) {
+ composite.setEnabled(data == Boolean.TRUE);
+ }
+ composite.setData(KEY_ENABLED, null);
+ }
+ for (Control control : composite.getChildren()) {
+ if (control instanceof Composite) {
+ restoreState((Composite) control);
+ } else {
+ data = control.getData(KEY_ENABLED);
+ if (data != null) {
+ if (data == Boolean.TRUE) {
+ control.setEnabled(true);
+ }
+ control.setData(KEY_ENABLED, null);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns text masking the &amp;-character from decoration as an accelerator in SWT labels.
+ *
+ * @deprecated use {@link LegacyActionTools#extractMnemonic(String)} instead
+ */
+ @Deprecated
+ public static String toLabel(String text) {
+ return (text != null) ? text.replaceAll("&", "&&") : null; // mask & from SWT //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Returns text for use as the label of an action to ensure that it is displayed properly.
+ *
+ * @return the cleaned text
+ */
+ public static String toMenuLabel(String label) {
+ // a tab at the end of the text will make sure that the @ will not create a weird space in the action text
+ // bug 287347: @ at start of task name cause a weird space in activation history menu
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=287347
+ if (label.contains("@")) { //$NON-NLS-1$
+ label += "\t"; //$NON-NLS-1$
+ }
+ return LegacyActionTools.escapeMnemonics(label);
+ }
+
+ public static String getProductName() {
+ return getProductName(null);
+ }
+
+ public static String getProductName(String defaultName) {
+ IProduct product = Platform.getProduct();
+ if (product != null) {
+ String productName = product.getName();
+ if (productName != null) {
+ String LABEL_SDK = "SDK"; //$NON-NLS-1$
+ if (productName.endsWith(LABEL_SDK)) {
+ productName = productName.substring(0, productName.length() - LABEL_SDK.length()).trim();
+ }
+ return productName;
+ }
+ }
+ return defaultName;
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListItem.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListItem.java
new file mode 100644
index 00000000..0cbc42dd
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListItem.java
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+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.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Based on <code>org.eclipse.ui.internal.progress.ProgressInfoItem</code>.
+ *
+ * @author Steffen Pingel
+ */
+public abstract class ControlListItem extends Composite {
+
+ static String DARK_COLOR_KEY = "org.eclipse.mylyn.commons.ui.ControlListItem.DARK_COLOR"; //$NON-NLS-1$
+
+ interface IndexListener {
+
+ /**
+ * Select the item previous to the receiver.
+ */
+ public void selectPrevious();
+
+ /**
+ * Select the next previous to the receiver.
+ */
+ public void selectNext();
+
+ /**
+ * Select the receiver.
+ */
+ public void select();
+
+ public void open();
+
+ }
+
+ IndexListener indexListener;
+
+ private int currentIndex;
+
+ private boolean selected;
+
+ private final MouseAdapter mouseListener;
+
+ private boolean isShowing = true;
+
+ private final MouseTrackAdapter mouseTrackListener;
+
+ private boolean hot;
+
+ static {
+ // Mac has different Gamma value
+ int shift = "carbon".equals(SWT.getPlatform()) ? -25 : -10;//$NON-NLS-1$
+
+ Color lightColor = Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+
+ // Determine a dark color by shifting the list color
+ RGB darkRGB = new RGB(Math.max(0, lightColor.getRed() + shift), Math.max(0, lightColor.getGreen() + shift),
+ Math.max(0, lightColor.getBlue() + shift));
+ JFaceResources.getColorRegistry().put(DARK_COLOR_KEY, darkRGB);
+ }
+
+ /**
+ * Create a new instance of the receiver with the specified parent, style and info object/
+ *
+ * @param parent
+ * @param style
+ * @param progressInfo
+ */
+ public ControlListItem(Composite parent, int style, Object element) {
+ super(parent, style | SWT.NO_FOCUS);
+ setData(element);
+ setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ mouseListener = doCreateMouseListener();
+ mouseTrackListener = doCreateMouseTrackListener();
+ createContent();
+ registerChild(this);
+ Control[] children = getChildren();
+ for (Control child : children) {
+ registerChild(child);
+ }
+ setHot(false);
+ refresh();
+ }
+
+ private MouseTrackAdapter doCreateMouseTrackListener() {
+ return new MouseTrackAdapter() {
+ private int enterCount;
+
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ enterCount++;
+ updateHotState();
+ }
+
+ @Override
+ public void mouseExit(MouseEvent e) {
+ enterCount--;
+ getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (!isDisposed()) {
+ updateHotState();
+ }
+ }
+ });
+ }
+
+ private void updateHotState() {
+ if (enterCount == 0) {
+ if (isHot()) {
+ setHot(false);
+ }
+ } else {
+ if (!isHot()) {
+ setHot(true);
+ }
+ }
+ }
+ };
+ }
+
+ private MouseAdapter doCreateMouseListener() {
+ return new MouseAdapter() {
+ @Override
+ public void mouseDown(MouseEvent e) {
+ if (indexListener != null) {
+ if (e.count == 2) {
+ indexListener.open();
+ } else {
+ indexListener.select();
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * Create the child widgets of the receiver.
+ */
+ protected abstract void createContent();
+
+ public boolean isHot() {
+ return hot;
+ }
+
+ public void setHot(boolean hot) {
+ this.hot = hot;
+ }
+
+ protected void registerChild(Control child) {
+ child.addMouseListener(mouseListener);
+ child.addMouseTrackListener(mouseTrackListener);
+
+ }
+
+ /**
+ * Refresh the contents of the receiver.
+ */
+ protected abstract void refresh();
+
+ /**
+ * Set the color base on the index
+ *
+ * @param index
+ */
+ public void updateColors(int index) {
+ currentIndex = index;
+
+ if (selected) {
+ setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
+ setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
+ } else {
+ if (index % 2 == 0) {
+ setBackground(JFaceResources.getColorRegistry().get(DARK_COLOR_KEY));
+ } else {
+ setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ }
+ setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
+ }
+ }
+
+ @Override
+ public void setForeground(Color color) {
+ super.setForeground(color);
+ Control[] children = getChildren();
+ for (Control child : children) {
+ child.setForeground(color);
+ }
+ }
+
+ @Override
+ public void setBackground(Color color) {
+ super.setBackground(color);
+ Control[] children = getChildren();
+ for (Control child : children) {
+ child.setBackground(color);
+ }
+ }
+
+ /**
+ * Set the selection colors.
+ *
+ * @param select
+ * boolean that indicates whether or not to show selection.
+ */
+ public void setSelected(boolean select) {
+ selected = select;
+ updateColors(currentIndex);
+ }
+
+ /**
+ * Set the listener for index changes.
+ *
+ * @param indexListener
+ */
+ void setIndexListener(IndexListener indexListener) {
+ this.indexListener = indexListener;
+ }
+
+ /**
+ * Return whether or not the receiver is selected.
+ *
+ * @return boolean
+ */
+ public boolean isSelected() {
+ return selected;
+ }
+
+ /**
+ * Set whether or not the receiver is being displayed based on the top and bottom of the currently visible area.
+ *
+ * @param top
+ * @param bottom
+ */
+ void setDisplayed(int top, int bottom) {
+ int itemTop = getLocation().y;
+ int itemBottom = itemTop + getBounds().height;
+ setDisplayed(itemTop <= bottom && itemBottom > top);
+
+ }
+
+ /**
+ * Set whether or not the receiver is being displayed
+ *
+ * @param displayed
+ */
+ private void setDisplayed(boolean displayed) {
+ // See if this element has been turned off
+ boolean refresh = !isShowing && displayed;
+ isShowing = displayed;
+ if (refresh) {
+ refresh();
+ }
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListViewer.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListViewer.java
new file mode 100644
index 00000000..7ca81ddd
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ControlListViewer.java
@@ -0,0 +1,501 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * Based on {@link org.eclipse.ui.internal.progress.DetailedProgressViewer}.
+ *
+ * @author Steffen Pingel
+ */
+@SuppressWarnings("restriction")
+public abstract class ControlListViewer extends StructuredViewer {
+
+ Composite control;
+
+ private final ScrolledComposite scrolled;
+
+ private final Composite noEntryArea;
+
+ protected boolean hasFocus;
+
+ /**
+ * Create a new instance of the receiver with a control that is a child of parent with style style.
+ *
+ * @param parent
+ * @param style
+ */
+ public ControlListViewer(Composite parent, int style) {
+ scrolled = new ScrolledComposite(parent, style);
+ int height = JFaceResources.getDefaultFont().getFontData()[0].getHeight();
+ scrolled.getVerticalBar().setIncrement(height * 2);
+ scrolled.setExpandHorizontal(true);
+ scrolled.setExpandVertical(true);
+
+ control = new Composite(scrolled, SWT.NONE) {
+ @Override
+ public boolean setFocus() {
+ forceFocus();
+ return true;
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ updateSize(control);
+ }
+ }
+ };
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 1;
+ control.setLayout(layout);
+ control.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+
+ control.addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+ updateVisibleItems();
+
+ }
+
+ public void controlResized(ControlEvent e) {
+ updateVisibleItems();
+ }
+ });
+
+ scrolled.setContent(control);
+ hookControl(control);
+
+ noEntryArea = new Composite(scrolled, SWT.NONE);
+ doCreateNoEntryArea(noEntryArea);
+
+ scrolled.setExpandHorizontal(true);
+ scrolled.setExpandVertical(true);
+ scrolled.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ updateSize(scrolled.getContent());
+ }
+ });
+ control.addTraverseListener(new TraverseListener() {
+ private boolean handleEvent = true;
+
+ public void keyTraversed(TraverseEvent event) {
+ if (!handleEvent) {
+ return;
+ }
+ switch (event.detail) {
+ case SWT.TRAVERSE_ARROW_PREVIOUS: {
+ Control[] children = control.getChildren();
+ if (children.length > 0) {
+ boolean selected = false;
+ for (int i = 0; i < children.length; i++) {
+ ControlListItem item = (ControlListItem) children[i];
+ if (item.isSelected()) {
+ selected = true;
+ if (i > 0) {
+ setSelection(new StructuredSelection(children[i - 1].getData()), true);
+ }
+ break;
+ }
+ }
+ if (!selected) {
+ setSelection(new StructuredSelection(children[children.length - 1].getData()), true);
+ }
+ }
+ break;
+ }
+ case SWT.TRAVERSE_ARROW_NEXT: {
+ Control[] children = control.getChildren();
+ if (children.length > 0) {
+ boolean selected = false;
+ for (int i = 0; i < children.length; i++) {
+ ControlListItem item = (ControlListItem) children[i];
+ if (item.isSelected()) {
+ selected = true;
+ if (i < children.length - 1) {
+ setSelection(new StructuredSelection(children[i + 1].getData()), true);
+ }
+ break;
+ }
+ }
+ if (!selected) {
+ setSelection(new StructuredSelection(children[0].getData()), true);
+ }
+ }
+ break;
+ }
+ default:
+ handleEvent = false;
+ event.doit = true;
+ Control control = ControlListViewer.this.control;
+ Shell shell = control.getShell();
+ while (control != null) {
+ if (control.traverse(event.detail)) {
+ break;
+ }
+ if (!event.doit || control == shell) {
+ break;
+ }
+ control = control.getParent();
+ }
+ handleEvent = true;
+ break;
+ }
+ }
+ });
+ }
+
+ protected void doCreateNoEntryArea(Composite parent) {
+ }
+
+ public void add(Object[] elements) {
+ ViewerComparator sorter = getComparator();
+
+ // Use a Set in case we are getting something added that exists
+ Set<Object> newItems = new HashSet<Object>(elements.length);
+
+ Control[] existingChildren = control.getChildren();
+ for (Control element : existingChildren) {
+ if (element.getData() != null) {
+ newItems.add(element.getData());
+ }
+ }
+
+ for (Object element : elements) {
+ if (element != null) {
+ newItems.add(element);
+ }
+ }
+
+ Object[] infos = new Object[newItems.size()];
+ newItems.toArray(infos);
+
+ if (sorter != null) {
+ sorter.sort(this, infos);
+ }
+
+ // Update with the new elements to prevent flash
+ for (Control element : existingChildren) {
+ ((ControlListItem) element).dispose();
+ }
+
+ for (int i = 0; i < infos.length; i++) {
+ ControlListItem item = createNewItem(infos[i]);
+ item.updateColors(i);
+ }
+
+ control.layout(true);
+ doUpdateContent();
+ }
+
+ private void updateSize(Control control) {
+ if (control == null) {
+ return;
+ }
+ // XXX need a small offset in case the list has a scroll bar
+ Point size = control.computeSize(scrolled.getClientArea().width - 20, SWT.DEFAULT, true);
+ control.setSize(size);
+ scrolled.setMinSize(size);
+ }
+
+ protected void doUpdateContent() {
+ if (control.getChildren().length > 0) {
+ updateSize(control);
+ scrolled.setContent(control);
+ } else {
+ updateSize(noEntryArea);
+ scrolled.setContent(noEntryArea);
+ }
+ }
+
+ /**
+ * Create a new item for info.
+ *
+ * @param element
+ * @return ControlListItem
+ */
+ private ControlListItem createNewItem(Object element) {
+ final ControlListItem item = doCreateItem(control, element);
+// item.getChildren()[0].addPaintListener(new PaintListener() {
+// public void paintControl(PaintEvent e) {
+// if (hasFocus && item.isSelected()) {
+// Point size = item.getSize();
+// e.gc.setForeground(e.gc.getDevice().getSystemColor(SWT.COLOR_DARK_GRAY));
+// e.gc.setLineDash(new int[] { 1, 2 });
+// e.gc.drawRoundRectangle(0, 0, size.x - 1, size.y - 1, 5, 5);
+// }
+// }
+// });
+ item.setIndexListener(new ControlListItem.IndexListener() {
+ public void selectNext() {
+ Control[] children = control.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ if (item == children[i]) {
+ if (i < children.length - 1) {
+ setSelection(new StructuredSelection(children[i + 1].getData()));
+ }
+ break;
+ }
+ }
+ }
+
+ public void selectPrevious() {
+ Control[] children = control.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ if (item == children[i]) {
+ if (i > 0) {
+ setSelection(new StructuredSelection(children[i - 1].getData()));
+ }
+ break;
+ }
+ }
+ }
+
+ public void select() {
+ setSelection(new StructuredSelection(item.getData()));
+ setFocus();
+ }
+
+ public void open() {
+ handleOpen();
+ }
+ });
+
+ // Refresh to populate with the current tasks
+ item.refresh();
+ return item;
+ }
+
+ protected abstract ControlListItem doCreateItem(Composite parent, Object element);
+
+ @Override
+ protected ControlListItem doFindInputItem(Object element) {
+ return null;
+ }
+
+ @Override
+ protected ControlListItem doFindItem(Object element) {
+ Control[] children = control.getChildren();
+ for (Control child : children) {
+ if (child.isDisposed() || child.getData() == null) {
+ continue;
+ }
+ if (child.getData().equals(element)) {
+ return (ControlListItem) child;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
+ if (usingElementMap()) {
+ unmapElement(item);
+ }
+ item.dispose();
+ add(new Object[] { element });
+ }
+
+ @Override
+ public ScrolledComposite getControl() {
+ return scrolled;
+ }
+
+ @Override
+ protected List<?> getSelectionFromWidget() {
+ Control[] children = control.getChildren();
+ ArrayList<Object> selection = new ArrayList<Object>(children.length);
+ for (Control child : children) {
+ ControlListItem item = (ControlListItem) child;
+ if (item.isSelected() && item.getData() != null) {
+ selection.add(item.getData());
+ }
+ }
+ return selection;
+ }
+
+ protected void handleOpen() {
+ Control control = getControl();
+ if (control != null && !control.isDisposed()) {
+ ISelection selection = getSelection();
+ fireOpen(new OpenEvent(this, selection));
+ }
+ }
+
+ @Override
+ protected void inputChanged(Object input, Object oldInput) {
+ super.inputChanged(input, oldInput);
+ refreshAll();
+ doUpdateContent();
+ }
+
+ @Override
+ protected void internalRefresh(Object element) {
+ if (element == null) {
+ return;
+ }
+
+ if (element.equals(getRoot())) {
+ refreshAll();
+ return;
+ }
+ Widget widget = findItem(element);
+ if (widget == null) {
+ add(new Object[] { element });
+ return;
+ }
+ ((ControlListItem) widget).refresh();
+
+ updateSize(control);
+ }
+
+ public void remove(Object[] elements) {
+ for (Object element : elements) {
+ Widget item = doFindItem(element);
+ if (item != null) {
+ unmapElement(element);
+ item.dispose();
+ }
+ }
+
+ Control[] existingChildren = control.getChildren();
+ for (int i = 0; i < existingChildren.length; i++) {
+ ControlListItem item = (ControlListItem) existingChildren[i];
+ item.updateColors(i);
+ }
+ control.layout(true);
+ doUpdateContent();
+ }
+
+ @Override
+ public void reveal(Object element) {
+ Control control = doFindItem(element);
+ if (control != null) {
+ revealControl(control);
+ }
+ }
+
+ private void revealControl(Control control) {
+ Rectangle clientArea = scrolled.getClientArea();
+ Point origin = scrolled.getOrigin();
+ Point location = control.getLocation();
+ Point size = control.getSize();
+ if (location.y + size.y > origin.y + clientArea.height) {
+ scrolled.setOrigin(origin.x, location.y + size.y - clientArea.height);
+ }
+ if (location.y < origin.y) {
+ scrolled.setOrigin(origin.x, location.y);
+ }
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ protected void setSelectionToWidget(List list, boolean reveal) {
+ HashSet<Object> elements = new HashSet<Object>(list);
+ Control[] children = control.getChildren();
+ for (Control control : children) {
+ ControlListItem child = (ControlListItem) control;
+ boolean selected = elements.contains(child.getData());
+ if (selected != child.isSelected()) {
+ child.setSelected(selected);
+ }
+ if (reveal && selected) {
+ revealControl(child);
+ reveal = false;
+ }
+ }
+ }
+
+ /**
+ * Set focus on the current selection.
+ */
+ public void setFocus() {
+ Control[] children = control.getChildren();
+ if (children.length > 0) {
+ // causes the item's tool bar to get focus when clicked which is undesirable
+// for (Control element : children) {
+// ControlListItem item = (ControlListItem) element;
+// if (item.isSelected()) {
+// if (item.setFocus()) {
+// return;
+// }
+// }
+// }
+ control.forceFocus();
+ } else {
+ noEntryArea.setFocus();
+ }
+ }
+
+ /**
+ * Refresh everything as the root is being refreshed.
+ */
+ private void refreshAll() {
+ Object[] infos = getSortedChildren(getRoot());
+ Control[] existingChildren = control.getChildren();
+
+ for (Control element : existingChildren) {
+ element.dispose();
+ }
+
+ for (int i = 0; i < infos.length; i++) {
+ ControlListItem item = createNewItem(infos[i]);
+ item.updateColors(i);
+ }
+
+ control.layout(true);
+ doUpdateContent();
+ }
+
+ /**
+ * Set the virtual items to be visible or not depending on the displayed area.
+ */
+ private void updateVisibleItems() {
+ Control[] children = control.getChildren();
+ int top = scrolled.getOrigin().y;
+ int bottom = top + scrolled.getParent().getBounds().height;
+ for (Control element : children) {
+ ControlListItem item = (ControlListItem) element;
+ item.setDisplayed(top, bottom);
+ }
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientCanvas.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientCanvas.java
new file mode 100644
index 00000000..afc5dc1d
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientCanvas.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ * Tasktop Technologies - extracted FormHeading implementation for Mylyn
+ *******************************************************************************/
+package org.eclipse.mylyn.commons.ui;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * Based on {@link org.eclipse.ui.internal.forms.widgets.FormHeading}.
+ *
+ * @since 3.7
+ */
+@SuppressWarnings("restriction")
+public class GradientCanvas extends Canvas {
+
+ private static final int SEPARATOR = 1 << 1;
+
+ private static final int BOTTOM_SEPARATOR = 1 << 2;
+
+ private static final int BACKGROUND_IMAGE_TILED = 1 << 3;
+
+ public static final String COLOR_BASE_BG = "baseBg"; //$NON-NLS-1$
+
+ static String PREFIX = "org.eclipse.ui.forms."; //$NON-NLS-1$
+
+ static String H_PREFIX = PREFIX + "H_"; //$NON-NLS-1$
+
+ public static String H_BOTTOM_KEYLINE1 = H_PREFIX + "BOTTOM_KEYLINE1"; //$NON-NLS-1$
+
+ /**
+ * Key for the form header bottom keyline 2 color.
+ */
+ public static String H_BOTTOM_KEYLINE2 = H_PREFIX + "BOTTOM_KEYLINE2"; //$NON-NLS-1$
+
+ private Image backgroundImage;
+
+ private Image gradientImage;
+
+ Map<String, Color> colors = new Hashtable<String, Color>();
+
+ private int flags;
+
+ private GradientInfo gradientInfo;
+
+ private class GradientInfo {
+ Color[] gradientColors;
+
+ int[] percents;
+
+ boolean vertical;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#forceFocus()
+ */
+ @Override
+ public boolean forceFocus() {
+ return false;
+ }
+
+ /**
+ * Creates the form content control as a child of the provided parent.
+ *
+ * @param parent
+ * the parent widget
+ */
+ public GradientCanvas(Composite parent, int style) {
+ super(parent, style);
+ setBackgroundMode(SWT.INHERIT_DEFAULT);
+ setSeparatorAlignment(SWT.BOTTOM);
+ addListener(SWT.Paint, new Listener() {
+ public void handleEvent(Event e) {
+ onPaint(e.gc);
+ }
+ });
+ addListener(SWT.Dispose, new Listener() {
+ public void handleEvent(Event e) {
+ if (gradientImage != null) {
+ // XXX FormImages.getInstance().markFinished(gradientImage);
+ gradientImage.dispose();
+ gradientImage = null;
+ }
+ }
+ });
+ addListener(SWT.Resize, new Listener() {
+ public void handleEvent(Event e) {
+ if (gradientInfo != null || (backgroundImage != null && !isBackgroundImageTiled())) {
+ updateGradientImage();
+ }
+ }
+ });
+ }
+
+ /**
+ * Sets the background color of the header.
+ */
+ @Override
+ public void setBackground(Color bg) {
+ super.setBackground(bg);
+ internalSetBackground(bg);
+ }
+
+ private void internalSetBackground(Color bg) {
+ putColor(COLOR_BASE_BG, bg);
+ }
+
+ public void setBackgroundGradient(Color[] gradientColors, int[] percents, boolean vertical) {
+ if (gradientColors != null) {
+ gradientInfo = new GradientInfo();
+ gradientInfo.gradientColors = gradientColors;
+ gradientInfo.percents = percents;
+ gradientInfo.vertical = vertical;
+ setBackground(null);
+ updateGradientImage();
+ } else {
+ // reset
+ gradientInfo = null;
+ if (gradientImage != null) {
+ // XXX FormImages.getInstance().markFinished(gradientImage);
+ gradientImage.dispose();
+ gradientImage = null;
+ setBackgroundImage(null);
+ }
+ }
+ }
+
+ public void setHeadingBackgroundImage(Image image) {
+ this.backgroundImage = image;
+ if (image != null) {
+ setBackground(null);
+ }
+ if (isBackgroundImageTiled()) {
+ setBackgroundImage(image);
+ } else {
+ updateGradientImage();
+ }
+ }
+
+ public Image getHeadingBackgroundImage() {
+ return backgroundImage;
+ }
+
+ public void setBackgroundImageTiled(boolean tiled) {
+ if (tiled) {
+ flags |= BACKGROUND_IMAGE_TILED;
+ } else {
+ flags &= ~BACKGROUND_IMAGE_TILED;
+ }
+ setHeadingBackgroundImage(this.backgroundImage);
+ }
+
+ public boolean isBackgroundImageTiled() {
+ return (flags & BACKGROUND_IMAGE_TILED) != 0;
+ }
+
+ @Override
+ public void setBackgroundImage(Image image) {
+ super.setBackgroundImage(image);
+ if (image != null) {
+ internalSetBackground(null);
+ }
+ }
+
+ private void onPaint(GC gc) {
+ if (!isSeparatorVisible() && getBackgroundImage() == null) {
+ return;
+ }
+ Rectangle carea = getClientArea();
+ Image buffer = new Image(getDisplay(), carea.width, carea.height);
+ buffer.setBackground(getBackground());
+ GC igc = new GC(buffer);
+ igc.setBackground(getBackground());
+ igc.fillRectangle(0, 0, carea.width, carea.height);
+ if (getBackgroundImage() != null) {
+ if (gradientInfo != null) {
+ drawBackground(igc, carea.x, carea.y, carea.width, carea.height);
+ } else {
+ Image bgImage = getBackgroundImage();
+ Rectangle ibounds = bgImage.getBounds();
+ drawBackground(igc, carea.x, carea.y, ibounds.width, ibounds.height);
+ }
+ }
+
+ if (isSeparatorVisible()) {
+ drawSeparator(carea, igc);
+ }
+ igc.dispose();
+ gc.drawImage(buffer, carea.x, carea.y);
+ buffer.dispose();
+ }
+
+ private void drawSeparator(Rectangle carea, GC igc) {
+ // bg separator
+ if (hasColor(H_BOTTOM_KEYLINE1)) {
+ igc.setForeground(getColor(H_BOTTOM_KEYLINE1));
+ } else {
+ igc.setForeground(getBackground());
+ }
+ if (getSeparatorAlignment() == SWT.BOTTOM) {
+ igc.drawLine(carea.x, carea.height - 2, carea.x + carea.width - 1, carea.height - 2);
+ } else {
+ igc.drawLine(carea.x, 1, carea.x + carea.width - 1, 1);
+ }
+ if (hasColor(H_BOTTOM_KEYLINE2)) {
+ igc.setForeground(getColor(H_BOTTOM_KEYLINE2));
+ } else {
+ igc.setForeground(getForeground());
+ }
+ if (getSeparatorAlignment() == SWT.BOTTOM) {
+ igc.drawLine(carea.x, carea.height - 1, carea.x + carea.width - 1, carea.height - 1);
+ } else {
+ igc.drawLine(carea.x, 0, carea.x + carea.width - 1, 0);
+ }
+ }
+
+ private void updateGradientImage() {
+ Rectangle rect = getBounds();
+ if (gradientImage != null) {
+ // XXX FormImages.getInstance().markFinished(gradientImage);
+ gradientImage.dispose();
+ gradientImage = null;
+ }
+ if (gradientInfo != null) {
+ // XXX use FormImages
+// gradientImage = FormImages.getInstance().getGradient(gradientInfo.gradientColors, gradientInfo.percents,
+// gradientInfo.vertical ? rect.height : rect.width, gradientInfo.vertical, getColor(COLOR_BASE_BG));
+ boolean vertical = gradientInfo.vertical;
+ int width = vertical ? 1 : rect.width;
+ int height = vertical ? rect.height : 1;
+ gradientImage = new Image(getDisplay(), Math.max(width, 1), Math.max(height, 1));
+ GC gc = new GC(gradientImage);
+ drawTextGradient(gc, width, height);
+ gc.dispose();
+ } else if (backgroundImage != null && !isBackgroundImageTiled()) {
+ gradientImage = new Image(getDisplay(), Math.max(rect.width, 1), Math.max(rect.height, 1));
+ gradientImage.setBackground(getBackground());
+ GC gc = new GC(gradientImage);
+ gc.drawImage(backgroundImage, 0, 0);
+ gc.dispose();
+ }
+ setBackgroundImage(gradientImage);
+ }
+
+ // XXX remove, use FormImages
+ private void drawTextGradient(GC gc, int width, int height) {
+ final Color oldBackground = gc.getBackground();
+ if (gradientInfo.gradientColors.length == 1) {
+ if (gradientInfo.gradientColors[0] != null) {
+ gc.setBackground(gradientInfo.gradientColors[0]);
+ }
+ gc.fillRectangle(0, 0, width, height);
+ } else {
+ final Color oldForeground = gc.getForeground();
+ Color lastColor = gradientInfo.gradientColors[0];
+ if (lastColor == null) {
+ lastColor = oldBackground;
+ }
+ int pos = 0;
+ for (int i = 0; i < gradientInfo.percents.length; ++i) {
+ gc.setForeground(lastColor);
+ lastColor = gradientInfo.gradientColors[i + 1];
+ if (lastColor == null) {
+ lastColor = oldBackground;
+ }
+ gc.setBackground(lastColor);
+ if (gradientInfo.vertical) {
+ final int gradientHeight = (gradientInfo.percents[i] * height / 100) - pos;
+ gc.fillGradientRectangle(0, pos, width, gradientHeight, true);
+ pos += gradientHeight;
+ } else {
+ final int gradientWidth = (gradientInfo.percents[i] * width / 100) - pos;
+ gc.fillGradientRectangle(pos, 0, gradientWidth, height, false);
+ pos += gradientWidth;
+ }
+ }
+ if (gradientInfo.vertical && pos < height) {
+ gc.setBackground(getColor(COLOR_BASE_BG));
+ gc.fillRectangle(0, pos, width, height - pos);
+ }
+ if (!gradientInfo.vertical && pos < width) {
+ gc.setBackground(getColor(COLOR_BASE_BG));
+ gc.fillRectangle(pos, 0, width - pos, height);
+ }
+
+ if (isSeparatorVisible()) {
+ drawSeparator(getClientArea(), gc);
+ }
+ gc.setForeground(oldForeground);
+ }
+ }
+
+ public boolean isSeparatorVisible() {
+ return (flags & SEPARATOR) != 0;
+ }
+
+ public void setSeparatorVisible(boolean addSeparator) {
+ if (addSeparator) {
+ flags |= SEPARATOR;
+ } else {
+ flags &= ~SEPARATOR;
+ }
+ }
+
+ public void setSeparatorAlignment(int alignment) {
+ if (alignment == SWT.BOTTOM) {
+ flags |= BOTTOM_SEPARATOR;
+ } else {
+ flags &= ~BOTTOM_SEPARATOR;
+ }
+ }
+
+ public int getSeparatorAlignment() {
+ return (flags & BOTTOM_SEPARATOR) != 0 ? SWT.BOTTOM : SWT.TOP;
+ }
+
+ public void putColor(String key, Color color) {
+ if (color == null) {
+ colors.remove(key);
+ } else {
+ colors.put(key, color);
+ }
+ }
+
+ public Color getColor(String key) {
+ return colors.get(key);
+ }
+
+ public boolean hasColor(String key) {
+ return colors.containsKey(key);
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientColors.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientColors.java
new file mode 100644
index 00000000..977fdf83
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientColors.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.commons.ui;
+
+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;
+
+/**
+ * Based on FormColors of UI Forms.
+ *
+ * @author Benjamin Pasero (initial contribution from RSSOwl, see bug 177974)
+ * @author Mik Kersten
+ */
+public class GradientColors {
+
+ private final Display display;
+
+ private Color titleText;
+
+ private Color gradientBegin;
+
+ private Color gradientEnd;
+
+ private Color border;
+
+ private final ResourceManager resourceManager;
+
+ public GradientColors(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);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientToolTip.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientToolTip.java
new file mode 100644
index 00000000..1d7c6b9e
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/GradientToolTip.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.commons.ui;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.resource.LocalResourceManager;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+
+/**
+ * A Custom JFace ToolTip that applies a gradient to the contents
+ *
+ * @author Shawn Minto
+ * @since 3.7
+ */
+public abstract class GradientToolTip extends ToolTip {
+
+ private GradientColors colors;
+
+ private LocalResourceManager resourceManager;
+
+ public GradientToolTip(Control control, int style, boolean manualActivation) {
+ super(control, style, manualActivation);
+ initResources(control);
+ }
+
+ public GradientToolTip(Control control) {
+ super(control);
+ initResources(control);
+ }
+
+ private void initResources(Control control) {
+ resourceManager = new LocalResourceManager(JFaceResources.getResources());
+ colors = new GradientColors(control.getDisplay(), resourceManager);
+ }
+
+ @Override
+ protected final Composite createToolTipContentArea(Event event, final Composite parent) {
+ GradientCanvas gradient = new GradientCanvas(parent, SWT.NONE);
+ gradient.setSeparatorVisible(false);
+ GridLayout headLayout = new GridLayout();
+ headLayout.marginHeight = 0;
+ headLayout.marginWidth = 0;
+ headLayout.horizontalSpacing = 0;
+ headLayout.verticalSpacing = 0;
+ headLayout.numColumns = 1;
+ gradient.setLayout(headLayout);
+
+ gradient.setBackgroundGradient(new Color[] { colors.getGradientBegin(), colors.getGradientEnd() },
+ new int[] { 100 }, true);
+
+ createToolTipArea(event, gradient);
+
+ // force a null background so that the gradient shines through
+ for (Control c : gradient.getChildren()) {
+ setNullBackground(c);
+ }
+
+ return gradient;
+ }
+
+ private void setNullBackground(final Control outerCircle) {
+ outerCircle.setBackground(null);
+ if (outerCircle instanceof Composite) {
+ ((Composite) outerCircle).setBackgroundMode(SWT.INHERIT_FORCE);
+ for (Control c : ((Composite) outerCircle).getChildren()) {
+ setNullBackground(c);
+ }
+ }
+ }
+
+ protected abstract Composite createToolTipArea(Event event, Composite parent);
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/PlatformUiUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/PlatformUiUtil.java
new file mode 100644
index 00000000..20c9cf3a
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/PlatformUiUtil.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 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
+ * David Green - fix for bug 247182
+ * Frank Becker - fixes for bug 259877
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Display;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class PlatformUiUtil {
+
+ private static Boolean internalBrowserAvailable;
+
+ private static class Eclipse36Checker {
+ public static final boolean result;
+ static {
+ boolean methodAvailable = false;
+ try {
+ StyledText.class.getMethod("setTabStops", int[].class); //$NON-NLS-1$
+ methodAvailable = true;
+ } catch (NoSuchMethodException e) {
+ }
+ result = methodAvailable;
+ }
+ }
+
+ /**
+ * bug 247182: file import dialog doesn't work on Mac OS X if the file extension has more than one dot.
+ */
+ public static String[] getFilterExtensions(String... extensions) {
+ for (int i = 0; i < extensions.length; i++) {
+ String extension = extensions[i];
+ if (Platform.OS_MACOSX.equals(Platform.getOS())) {
+ int j = extension.lastIndexOf('.');
+ if (j != -1) {
+ extension = extension.substring(j);
+ }
+ }
+ extensions[i] = "*" + extension; //$NON-NLS-1$
+ }
+ return extensions;
+ }
+
+ public static int getToolTipXShift() {
+ if ("gtk".equals(SWT.getPlatform()) || "carbon".equals(SWT.getPlatform()) || "cocoa".equals(SWT.getPlatform())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return -26;
+ } else {
+ return -23;
+ }
+ }
+
+ public static int getTreeImageOffset() {
+ if ("carbon".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ return 16;
+ } else if ("cocoa".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ return 13;
+ } else {
+ return 20;
+ }
+ }
+
+ public static int getIncomingImageOffset() {
+ if ("carbon".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ return 5;
+ } else if ("cocoa".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ return 2;
+ } else {
+ return 6;
+ }
+ }
+
+ public static int getTreeItemSquish() {
+ if ("gtk".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ return 8;
+ } else if (isMac()) {
+ return 3;
+ } else {
+ return 0;
+ }
+ }
+
+ private static boolean isMac() {
+ return "carbon".equals(SWT.getPlatform()) || "cocoa".equals(SWT.getPlatform()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // TODO e3.5: remove, platform has been fixed, see bug 272046
+ public static boolean isPaintItemClippingRequired() {
+ return "gtk".equals(SWT.getPlatform()); //$NON-NLS-1$
+ }
+
+ public static boolean spinnerHasNativeBorder() {
+ return isMac() && !isEclipse36orLater();
+ }
+
+ private static boolean isEclipse36orLater() {
+ return Eclipse36Checker.result;
+ }
+
+ public static boolean hasNarrowToolBar() {
+ return Platform.WS_WIN32.equals(SWT.getPlatform());
+ }
+
+ /**
+ * If a a section does not use a toolbar as its text client the spacing between the section header and client will
+ * be different from other sections. This method returns the value to set as the vertical spacing on those sections
+ * to align the vertical position of section clients.
+ *
+ * @return value for {@link org.eclipse.ui.forms.widgets.Section#clientVerticalSpacing}
+ */
+ public static int getToolbarSectionClientVerticalSpacing() {
+ if (Platform.WS_WIN32.equals(SWT.getPlatform())) {
+ return 5;
+ }
+ return 7;
+ }
+
+ /**
+ * Returns the width of the view menu drop-down button.
+ */
+ public static int getViewMenuWidth() {
+ return 32;
+ }
+
+ /**
+ * Because of bug# 322293 (NPE when select Hyperlink from MultipleHyperlinkPresenter List) for MacOS we enable this
+ * only if running on Eclipse >= "3.7.0.v201101192000"
+ */
+ public static boolean supportsMultipleHyperlinkPresenter() {
+ if (isMac()) {
+ Bundle bundle = Platform.getBundle("org.eclipse.platform"); //$NON-NLS-1$
+ if (bundle != null) {
+ String versionString = (String) bundle.getHeaders().get("Bundle-Version"); //$NON-NLS-1$
+ Version version = new Version(versionString);
+ return version.compareTo(new Version("3.7.0.v201101192000")) >= 0; //$NON-NLS-1$
+ } else {
+ bundle = Platform.getBundle("org.eclipse.swt"); //$NON-NLS-1$
+ if (bundle != null) {
+ String versionString = (String) bundle.getHeaders().get("Bundle-Version"); //$NON-NLS-1$
+ Version version = new Version(versionString);
+ return version.compareTo(new Version("3.7.0.v3721")) >= 0; //$NON-NLS-1$
+ } else {
+ //TODO e3.7 change this to true when eclipse 3.6 reach end of live!
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Because of bug#175655: [context] provide an on-hover affordance to supplement Alt+click navigation Tooltips will
+ * show everyone on Linux unless they are balloons.
+ */
+ public static int getSwtTooltipStyle() {
+ if ("gtk".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ return SWT.BALLOON;
+ }
+ return SWT.NONE;
+ }
+
+ public static boolean usesMouseWheelEventsForScrolling() {
+ return "cocoa".equals(SWT.getPlatform()); //$NON-NLS-1$
+ }
+
+ public static boolean hasInternalBrowser() {
+ if (internalBrowserAvailable == null) {
+ try {
+ Browser browser = new Browser(Display.getCurrent().getActiveShell(), SWT.NONE);
+ browser.dispose();
+ internalBrowserAvailable = Boolean.TRUE;
+ } catch (SWTError er) {
+ internalBrowserAvailable = Boolean.FALSE;
+ }
+ }
+ return internalBrowserAvailable.booleanValue();
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ProgressContainer.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ProgressContainer.java
new file mode 100644
index 00000000..31c7e3e5
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/ProgressContainer.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ * Chris Gross (schtoo@schtoo.com) - patch for bug 16179
+ * Tasktop Technologies - extracted code for Mylyn
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ProgressMonitorWrapper;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A helper class for running operations in dialogs. Based on {@link WizardDialog}.
+ *
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class ProgressContainer implements IRunnableContext {
+
+ private static final String FOCUS_CONTROL = "focusControl"; //$NON-NLS-1$
+
+ // The number of long running operation executed from the dialog.
+ private long activeRunningOperations = 0;
+
+ private Cursor arrowCursor;
+
+ private Button cancelButton;
+
+ private boolean lockedUI = false;
+
+ // The progress monitor
+ private final ProgressMonitorPart progressMonitorPart;
+
+ private final Shell shell;
+
+ private Cursor waitCursor;
+
+ private boolean useWaitCursor;
+
+ public ProgressContainer(Shell shell, ProgressMonitorPart progressMonitorPart) {
+ Assert.isNotNull(shell);
+ Assert.isNotNull(progressMonitorPart);
+ this.shell = shell;
+ this.progressMonitorPart = progressMonitorPart;
+ init();
+ }
+
+ private void init() {
+ this.shell.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ progressMonitorPart.setCanceled(true);
+ }
+ });
+ }
+
+ public boolean useWaitCursor() {
+ return useWaitCursor;
+ }
+
+ public void setUseWaitCursor(boolean useWaitCursor) {
+ this.useWaitCursor = useWaitCursor;
+ }
+
+ /**
+ * About to start a long running operation triggered through the wizard. Shows the progress monitor and disables the
+ * wizard's buttons and controls.
+ *
+ * @param enableCancelButton
+ * <code>true</code> if the Cancel button should be enabled, and <code>false</code> if it should be
+ * disabled
+ * @return the saved UI state
+ */
+ private Object aboutToStart(boolean enableCancelButton) {
+ Map<Object, Object> savedState = null;
+ if (getShell() != null) {
+ // Save focus control
+ Control focusControl = getShell().getDisplay().getFocusControl();
+ if (focusControl != null && focusControl.getShell() != getShell()) {
+ focusControl = null;
+ }
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ if (useWaitCursor()) {
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ setDisplayCursor(waitCursor);
+ // Set the arrow cursor to the cancel component.
+ arrowCursor = new Cursor(d, SWT.CURSOR_ARROW);
+ if (cancelButton != null) {
+ cancelButton.setCursor(arrowCursor);
+ }
+ }
+ // Deactivate shell
+ savedState = new HashMap<Object, Object>(10);
+ saveUiState(savedState);
+ if (focusControl != null) {
+ savedState.put(FOCUS_CONTROL, focusControl);
+ }
+ // Attach the progress monitor part to the cancel button
+ if (cancelButton != null) {
+ progressMonitorPart.attachToCancelComponent(cancelButton);
+ }
+ progressMonitorPart.setVisible(true);
+ }
+ return savedState;
+ }
+
+ public Button getCancelButton() {
+ return cancelButton;
+ }
+
+ private IProgressMonitor getProgressMonitor() {
+ return new ProgressMonitorWrapper(progressMonitorPart) {
+ @Override
+ public void internalWorked(double work) {
+ if (progressMonitorPart.isDisposed()) {
+ this.setCanceled(true);
+ return;
+ }
+ super.internalWorked(work);
+ }
+ };
+ }
+
+ public Shell getShell() {
+ return shell;
+ }
+
+ public boolean isActive() {
+ return activeRunningOperations > 0;
+ }
+
+ public boolean isLockedUI() {
+ return lockedUI;
+ }
+
+ protected void restoreUiState(Map<Object, Object> state) {
+ // ignore
+
+ }
+
+ /**
+ * This implementation of IRunnableContext#run(boolean, boolean, IRunnableWithProgress) blocks until the runnable
+ * has been run, regardless of the value of <code>fork</code>. It is recommended that <code>fork</code> is set to
+ * true in most cases. If <code>fork</code> is set to <code>false</code>, the runnable will run in the UI thread and
+ * it is the runnable's responsibility to call <code>Display.readAndDispatch()</code> to ensure UI responsiveness.
+ * UI state is saved prior to executing the long-running operation and is restored after the long-running operation
+ * completes executing. Any attempt to change the UI state of the wizard in the long-running operation will be
+ * nullified when original UI state is restored.
+ */
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+ // The operation can only be canceled if it is executed in a separate
+ // thread.
+ // Otherwise the UI is blocked anyway.
+ Object state = null;
+ if (activeRunningOperations == 0) {
+ state = aboutToStart(fork && cancelable);
+ }
+ activeRunningOperations++;
+ try {
+ if (!fork) {
+ lockedUI = true;
+ }
+ ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
+ lockedUI = false;
+ } finally {
+ activeRunningOperations--;
+ // Stop if this is the last one
+ if (state != null) {
+ stopped(state);
+ }
+ }
+ }
+
+ protected void saveUiState(Map<Object, Object> savedState) {
+ // ignore
+
+ }
+
+ public void setCancelButton(Button cancelButton) {
+ this.cancelButton = cancelButton;
+ }
+
+ /**
+ * Sets the given cursor for all shells currently active for this window's display.
+ *
+ * @param c
+ * the cursor
+ */
+ private void setDisplayCursor(Cursor c) {
+ Shell[] shells = getShell().getDisplay().getShells();
+ for (Shell shell2 : shells) {
+ shell2.setCursor(c);
+ }
+ }
+
+ /**
+ * A long running operation triggered through the wizard was stopped either by user input or by normal end. Hides
+ * the progress monitor and restores the enable state wizard's buttons and controls.
+ *
+ * @param savedState
+ * the saved UI state as returned by <code>aboutToStart</code>
+ * @see #aboutToStart
+ */
+ @SuppressWarnings("unchecked")
+ private void stopped(Object savedState) {
+ if (getShell() != null && !getShell().isDisposed()) {
+ progressMonitorPart.setVisible(false);
+ if (cancelButton != null) {
+ progressMonitorPart.removeFromCancelComponent(cancelButton);
+ }
+
+ Map<Object, Object> state = (Map<Object, Object>) savedState;
+ restoreUiState(state);
+ if (waitCursor != null) {
+ setDisplayCursor(null);
+ if (cancelButton != null) {
+ cancelButton.setCursor(null);
+ }
+ waitCursor.dispose();
+ waitCursor = null;
+ arrowCursor.dispose();
+ arrowCursor = null;
+ }
+ Control focusControl = (Control) state.get(FOCUS_CONTROL);
+ if (focusControl != null && !focusControl.isDisposed()) {
+ focusControl.setFocus();
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/SelectionProviderAdapter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/SelectionProviderAdapter.java
new file mode 100644
index 00000000..9d76f514
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/SelectionProviderAdapter.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.commons.ui;
+
+import org.eclipse.core.commands.common.EventManager;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+
+/**
+ * Provides an simple implementation of {@link ISelectionProvider} that propagates selection events to registered
+ * listeners.
+ *
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class SelectionProviderAdapter extends EventManager implements ISelectionProvider, ISelectionChangedListener {
+
+ private ISelection selection;
+
+ /**
+ * Constructs a <code>SelectionProviderAdapter</code> and initializes the selection to <code>selection</code>.
+ *
+ * @param selection
+ * the initial selection
+ * @see #setSelection(ISelection)
+ */
+ public SelectionProviderAdapter(ISelection selection) {
+ setSelection(selection);
+ }
+
+ /**
+ * Constructs a <code>SelectionProviderAdapter</code> with a <code>null</code> selection.
+ */
+ public SelectionProviderAdapter() {
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ addListenerObject(listener);
+ }
+
+ public ISelection getSelection() {
+ return selection;
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ removeListenerObject(listener);
+ }
+
+ public void selectionChanged(final SelectionChangedEvent event) {
+ this.selection = event.getSelection();
+ Object[] listeners = getListeners();
+ for (Object listener2 : listeners) {
+ final ISelectionChangedListener listener = (ISelectionChangedListener) listener2;
+ SafeRunner.run(new SafeRunnable() {
+ public void run() {
+ listener.selectionChanged(event);
+ }
+ });
+ }
+ }
+
+ public void setSelection(ISelection selection) {
+ selectionChanged(new SelectionChangedEvent(this, selection));
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableSorter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableSorter.java
new file mode 100644
index 00000000..eb02fe5d
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableSorter.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public abstract class TableSorter extends AbstractColumnViewerSorter<TableViewer, TableColumn> {
+
+ @Override
+ int getColumnIndex(TableViewer viewer, TableColumn column) {
+ return viewer.getTable().indexOf(column);
+ }
+
+ @Override
+ TableColumn getSortColumn(TableViewer viewer) {
+ return viewer.getTable().getSortColumn();
+ }
+
+ @Override
+ int getSortDirection(TableViewer viewer) {
+ return viewer.getTable().getSortDirection();
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableViewerSupport.java
new file mode 100644
index 00000000..0668a4f8
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TableViewerSupport.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Frank Becker 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:
+ * Frank Becker - initial API and implementation
+ * Tasktop Technologies - improvements
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui;
+
+import java.io.File;
+
+import org.eclipse.jface.layout.AbstractColumnLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * @author Frank Becker
+ * @author Steffen Pingel
+ * @author Shawn Minto
+ * @since 3.7
+ */
+public class TableViewerSupport extends AbstractColumnViewerSupport<TableColumn> {
+
+ private final Table table;
+
+ public TableViewerSupport(TableViewer viewer, File stateFile) {
+ super(viewer, stateFile);
+ this.table = viewer.getTable();
+ initializeViewerSupport();
+ }
+
+ public TableViewerSupport(TableViewer viewer, File stateFile, boolean[] defaultVisibilities) {
+ super(viewer, stateFile, defaultVisibilities);
+ this.table = viewer.getTable();
+ initializeViewerSupport();
+ }
+
+ @Override
+ void addColumnSelectionListener(TableColumn column, SelectionListener selectionListener) {
+ column.addSelectionListener(selectionListener);
+ }
+
+ @Override
+ Rectangle getClientArea() {
+ return table.getClientArea();
+ }
+
+ @Override
+ TableColumn getColumn(int index) {
+ return table.getColumn(index);
+ }
+
+ @Override
+ int getColumnIndexOf(TableColumn column) {
+ return table.indexOf(column);
+ }
+
+ @Override
+ AbstractColumnLayout getColumnLayout() {
+ if (table.getLayout() instanceof AbstractColumnLayout) {
+ return (AbstractColumnLayout) table.getLayout();
+ } else if (table.getParent().getLayout() instanceof AbstractColumnLayout) {
+ return (AbstractColumnLayout) table.getParent().getLayout();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ int[] getColumnOrder() {
+ return table.getColumnOrder();
+ }
+
+ @Override
+ TableColumn[] getColumns() {
+ return table.getColumns();
+ }
+
+ @Override
+ int getColumnWidth(TableColumn column) {
+ return column.getWidth();
+ }
+
+ @Override
+ int getHeaderHeight() {
+ return table.getHeaderHeight();
+ }
+
+ @Override
+ TableColumn getSortColumn() {
+ return table.getSortColumn();
+ }
+
+ @Override
+ int getSortDirection() {
+ return table.getSortDirection();
+ }
+
+ @Override
+ void setColumnOrder(int[] order) {
+ table.setColumnOrder(order);
+ }
+
+ @Override
+ void setColumnResizable(TableColumn column, boolean resizable) {
+ column.setResizable(resizable);
+ }
+
+ @Override
+ void setColumnWidth(TableColumn column, int width) {
+ column.setWidth(width);
+ }
+
+ @Override
+ void setSortColumn(TableColumn column) {
+ table.setSortColumn(column);
+ }
+
+ @Override
+ void setSortDirection(int direction) {
+ table.setSortDirection(direction);
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeSorter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeSorter.java
new file mode 100644
index 00000000..98e82bac
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeSorter.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * @author Shawn Minto
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public abstract class TreeSorter extends AbstractColumnViewerSorter<TreeViewer, TreeColumn> {
+
+ @Override
+ int getColumnIndex(TreeViewer viewer, TreeColumn column) {
+ return viewer.getTree().indexOf(column);
+ }
+
+ @Override
+ TreeColumn getSortColumn(TreeViewer viewer) {
+ return viewer.getTree().getSortColumn();
+ }
+
+ @Override
+ protected int getSortDirection(TreeViewer viewer) {
+ return viewer.getTree().getSortDirection();
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeViewerSupport.java
new file mode 100644
index 00000000..aaa83c18
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/TreeViewerSupport.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui;
+
+import java.io.File;
+
+import org.eclipse.jface.layout.AbstractColumnLayout;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * @author Shawn Minto
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class TreeViewerSupport extends AbstractColumnViewerSupport<TreeColumn> {
+
+ private final Tree tree;
+
+ public TreeViewerSupport(TreeViewer viewer, File stateFile) {
+ super(viewer, stateFile);
+ this.tree = viewer.getTree();
+ initializeViewerSupport();
+ }
+
+ public TreeViewerSupport(TreeViewer viewer, File stateFile, boolean[] defaultVisibilities) {
+ super(viewer, stateFile, defaultVisibilities);
+ this.tree = viewer.getTree();
+ initializeViewerSupport();
+ }
+
+ @Override
+ void addColumnSelectionListener(TreeColumn column, SelectionListener selectionListener) {
+ column.addSelectionListener(selectionListener);
+ }
+
+ @Override
+ Rectangle getClientArea() {
+ return tree.getClientArea();
+ }
+
+ @Override
+ TreeColumn getColumn(int index) {
+ return tree.getColumn(index);
+ }
+
+ @Override
+ int getColumnIndexOf(TreeColumn column) {
+ return tree.indexOf(column);
+ }
+
+ @Override
+ AbstractColumnLayout getColumnLayout() {
+ if (tree.getLayout() instanceof AbstractColumnLayout) {
+ return (AbstractColumnLayout) tree.getLayout();
+ } else if (tree.getParent().getLayout() instanceof AbstractColumnLayout) {
+ return (AbstractColumnLayout) tree.getParent().getLayout();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ int[] getColumnOrder() {
+ return tree.getColumnOrder();
+ }
+
+ @Override
+ TreeColumn[] getColumns() {
+ return tree.getColumns();
+ }
+
+ @Override
+ int getColumnWidth(TreeColumn column) {
+ return column.getWidth();
+ }
+
+ @Override
+ int getHeaderHeight() {
+ return tree.getHeaderHeight();
+ }
+
+ @Override
+ TreeColumn getSortColumn() {
+ return tree.getSortColumn();
+ }
+
+ @Override
+ int getSortDirection() {
+ return tree.getSortDirection();
+ }
+
+ @Override
+ void setColumnOrder(int[] order) {
+ tree.setColumnOrder(order);
+ }
+
+ @Override
+ void setColumnResizable(TreeColumn column, boolean resizable) {
+ column.setResizable(resizable);
+ }
+
+ @Override
+ void setColumnWidth(TreeColumn column, int width) {
+ column.setWidth(width);
+ }
+
+ @Override
+ void setSortColumn(TreeColumn column) {
+ tree.setSortColumn(column);
+ }
+
+ @Override
+ void setSortDirection(int direction) {
+ tree.setSortDirection(direction);
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/CollapseAllAction.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/CollapseAllAction.java
new file mode 100644
index 00000000..33ccad87
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/CollapseAllAction.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui.actions;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.mylyn.commons.ui.CommonImages;
+import org.eclipse.mylyn.internal.commons.ui.Messages;
+
+/**
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class CollapseAllAction extends Action {
+
+ private final AbstractTreeViewer viewer;
+
+ public CollapseAllAction(AbstractTreeViewer viewer) {
+ Assert.isNotNull(viewer);
+ this.viewer = viewer;
+ setText(Messages.CollapseAllAction_Label);
+ setToolTipText(Messages.CollapseAllAction_ToolTip);
+ setImageDescriptor(CommonImages.COLLAPSE_ALL);
+ }
+
+ @Override
+ public void run() {
+ viewer.collapseAll();
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/ExpandAllAction.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/ExpandAllAction.java
new file mode 100644
index 00000000..bde9a57f
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/actions/ExpandAllAction.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui.actions;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.mylyn.commons.ui.CommonImages;
+import org.eclipse.mylyn.internal.commons.ui.Messages;
+
+/**
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public class ExpandAllAction extends Action {
+
+ private final AbstractTreeViewer viewer;
+
+ public ExpandAllAction(AbstractTreeViewer viewer) {
+ Assert.isNotNull(viewer);
+ this.viewer = viewer;
+ setText(Messages.ExpandAllAction_Label);
+ setToolTipText(Messages.ExpandAllAction_ToolTip);
+ setImageDescriptor(CommonImages.EXPAND_ALL);
+ }
+
+ @Override
+ public void run() {
+ viewer.expandAll();
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonColors.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonColors.java
new file mode 100644
index 00000000..5d2de943
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonColors.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 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 org.eclipse.mylyn.commons.ui.compatibility;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Provides common colors. Class must be referenced from the SWT UI thread only.
+ * <p>
+ * NOTE: Use of this class is discouraged. Colors are not theme dependent.
+ * </p>
+ *
+ * @author Mik Kersten
+ * @since 3.7
+ */
+public class CommonColors {
+
+ public static final Color HYPERLINK_WIDGET = new Color(Display.getDefault(), 12, 81, 172);
+
+ public static final Color TEXT_QUOTED = new Color(Display.getDefault(), 38, 86, 145);
+
+ /**
+ * NOTE: disposal of JFaceResources fonts handled by registry.
+ */
+ public static void dispose() {
+ HYPERLINK_WIDGET.dispose();
+ TEXT_QUOTED.dispose();
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonFonts.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonFonts.java
new file mode 100644
index 00000000..b069d7f3
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonFonts.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.commons.ui.compatibility;
+
+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;
+
+/**
+ * Provides commons fonts. Fields may by <code>null</code> until initialization is completed.
+ * <p>
+ * NOTE: Use of this class is discouraged. Fonts are static and not updated when system or theme settings change.
+ * </p>
+ *
+ * @author Mik Kersten
+ * @since 3.7
+ */
+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;
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonThemes.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonThemes.java
new file mode 100644
index 00000000..d71889bf
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/compatibility/CommonThemes.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 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 org.eclipse.mylyn.commons.ui.compatibility;
+
+/**
+ * Provides common theme constants.
+ * <p>
+ * NOTE: Use of this class is discouraged. The specified theme settings depend on components in Mylyn Tasks and may not
+ * be available.
+ * </p>
+ *
+ * @author Mik Kersten
+ * @since 3.7
+ */
+public class CommonThemes {
+
+ public static final String COLOR_INCOMING_BACKGROUND = "org.eclipse.mylyn.tasks.ui.colors.incoming.background"; //$NON-NLS-1$
+
+ public static final String COLOR_SCHEDULED_PAST = "org.eclipse.mylyn.tasks.ui.colors.foreground.past.scheduled"; //$NON-NLS-1$
+
+ public static final String COLOR_OVERDUE = "org.eclipse.mylyn.tasks.ui.colors.foreground.past.due"; //$NON-NLS-1$
+
+ public static final String COLOR_SCHEDULED_THIS_WEEK = "org.eclipse.mylyn.tasks.ui.colors.foreground.thisweek.scheduled"; //$NON-NLS-1$
+
+ public static final String COLOR_COMPLETED = "org.eclipse.mylyn.tasks.ui.colors.foreground.completed"; //$NON-NLS-1$
+
+ public static final String COLOR_SCHEDULED_TODAY = "org.eclipse.mylyn.tasks.ui.colors.foreground.today.scheduled"; //$NON-NLS-1$
+
+ public static final String COLOR_COMPLETED_TODAY = "org.eclipse.mylyn.tasks.ui.colors.foreground.today.completed"; //$NON-NLS-1$
+
+ public static final String COLOR_OVERDUE_FOR_OTHERS = "org.eclipse.mylyn.tasks.ui.colors.foreground.overdue.for.others"; //$NON-NLS-1$
+
+ public static final String COLOR_CATEGORY_GRADIENT_START = "org.eclipse.mylyn.tasks.ui.colors.category.gradient.start"; //$NON-NLS-1$
+
+ public static final String COLOR_CATEGORY_GRADIENT_END = "org.eclipse.mylyn.tasks.ui.colors.category.gradient.end"; //$NON-NLS-1$
+
+ public static final String COLOR_CATEGORY = COLOR_CATEGORY_GRADIENT_END;
+
+ public static final String FONT_EDITOR_COMMENT = "org.eclipse.mylyn.tasks.ui.fonts.task.editor.comment"; //$NON-NLS-1$
+
+ public static final String COLOR_TASK_ACTIVE = "org.eclipse.mylyn.tasks.ui.colors.foreground.task.active"; //$NON-NLS-1$
+
+ public static boolean isCommonTheme(String property) {
+ if (property == null) {
+ return false;
+ } else {
+ return property.equals(COLOR_CATEGORY) || property.equals(COLOR_OVERDUE)
+ || property.equals(COLOR_SCHEDULED_PAST) || property.equals(COLOR_COMPLETED_TODAY)
+ || property.equals(COLOR_SCHEDULED_TODAY) || property.equals(COLOR_SCHEDULED_THIS_WEEK)
+ || property.equals(COLOR_INCOMING_BACKGROUND) || property.equals(COLOR_CATEGORY_GRADIENT_START)
+ || property.equals(COLOR_CATEGORY_GRADIENT_END) || property.equals(COLOR_TASK_ACTIVE);
+ }
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractInPlaceDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractInPlaceDialog.java
new file mode 100644
index 00000000..f51612f6
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractInPlaceDialog.java
@@ -0,0 +1,311 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.commons.ui.dialogs;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.window.Window;
+import org.eclipse.mylyn.internal.commons.ui.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Abstract class for an in-place popup dialog that has a cancel button and sends and ok event when the dialog is closed
+ *
+ * @author Shawn Minto
+ * @since 3.7
+ */
+public abstract class AbstractInPlaceDialog extends PopupDialog {
+
+ public static final int ID_CLEAR = IDialogConstants.CLIENT_ID + 1;
+
+ protected static final int MARGIN_SIZE = 3;
+
+ private final int side;
+
+ private final Rectangle controlBounds;
+
+ private Control control;
+
+ private final Set<IInPlaceDialogListener> listeners = new HashSet<IInPlaceDialogListener>();
+
+ private final Control openControl;
+
+ DisposeListener disposeListener = new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ }
+ };
+
+ public AbstractInPlaceDialog(Shell parent, int side, Control openControl) {
+ super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE, false, false, false, false, false, null, null);
+ this.side = side;
+ this.openControl = openControl;
+
+ Rectangle bounds;
+ if (openControl == null || openControl.isDisposed()) {
+ bounds = new Rectangle(0, 0, 0, 0);
+ } else {
+ bounds = openControl.getBounds();
+ Point absPosition = openControl.toDisplay(openControl.getLocation());
+ bounds.x = absPosition.x - bounds.x;
+ bounds.y = absPosition.y - bounds.y;
+ }
+ this.controlBounds = bounds;
+ if (openControl != null) {
+ openControl.addDisposeListener(disposeListener);
+ }
+
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ return createDialogArea(parent);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ gl.horizontalSpacing = 0;
+ gl.verticalSpacing = 0;
+ gl.numColumns = 1;
+ composite.setLayout(gl);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+
+ this.control = createControl(composite);
+
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ gl = new GridLayout();
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ gl.marginBottom = MARGIN_SIZE;
+ gl.marginRight = MARGIN_SIZE;
+ gl.horizontalSpacing = 10;
+ gl.verticalSpacing = 0;
+ gl.numColumns = 1;
+ gl.makeColumnsEqualWidth = false;
+ buttonComposite.setLayout(gl);
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.CENTER).applyTo(buttonComposite);
+ createButtons(buttonComposite);
+ Dialog.applyDialogFont(parent);
+
+ parent.pack();
+
+ setBackgroundColor(parent);
+
+ return parent;
+ }
+
+ private void setBackgroundColor(Composite parent) {
+ parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ for (Control control : parent.getChildren()) {
+ if (control instanceof Composite) {
+ setBackgroundColor((Composite) control);
+ } else {
+ control.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ }
+ }
+ }
+
+ protected abstract Control createControl(Composite composite);
+
+ protected void createButtons(Composite composite) {
+ createButton(composite, ID_CLEAR, Messages.DateSelectionDialog_Clear, true);
+ }
+
+ protected void dispose() {
+ setReturnCode(Window.CANCEL);
+ close();
+ }
+
+ protected Control createButton(Composite composite, final int returnCode, String text, final boolean shouldClose) {
+ Button button = new Button(composite, SWT.NONE);
+ button.setText(text);
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ setReturnCode(returnCode);
+ if (shouldClose) {
+ close();
+ } else {
+ notifyButtonPressed(false);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ if (composite.getLayout() instanceof GridLayout) {
+ ((GridLayout) composite.getLayout()).numColumns = composite.getChildren().length;
+ }
+ GridDataFactory.fillDefaults().applyTo(button);
+ return button;
+ }
+
+ @Override
+ public int open() {
+ int result = super.open();
+ getControl().setFocus();
+ setReturnCode(-1);
+ return result;
+ }
+
+ @Override
+ public boolean close() {
+ if (getReturnCode() == -1) {
+ setReturnCode(Window.OK);
+ }
+ notifyButtonPressed(true);
+ if (openControl != null && !openControl.isDisposed()) {
+ openControl.removeDisposeListener(disposeListener);
+ }
+ return super.close();
+ }
+
+ public void addEventListener(IInPlaceDialogListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeCloseListener(IInPlaceDialogListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyButtonPressed(boolean isClosing) {
+ final InPlaceDialogEvent event = new InPlaceDialogEvent(getReturnCode(), isClosing);
+ for (final IInPlaceDialogListener listener : listeners) {
+ SafeRunnable.run(new ISafeRunnable() {
+ public void run() throws Exception {
+ listener.buttonPressed(event);
+ }
+
+ public void handleException(Throwable exception) {
+ // ignore
+ }
+ });
+ }
+ }
+
+ @Override
+ protected void initializeBounds() {
+// Rectangle monitorBounds = PlatformUI.getWorkbench()
+// .getActiveWorkbenchWindow()
+// .getShell()
+// .getMonitor()
+// .getClientArea();
+ Rectangle monitorBounds = getShell().getMonitor().getClientArea();
+ Rectangle bounds = getShell().getBounds();
+ int x = 0;
+ int y = 0;
+
+ switch (side) {
+ case SWT.TOP:
+ x = controlBounds.x;
+ y = controlBounds.y + controlBounds.height;
+ if (x + bounds.width > monitorBounds.x + monitorBounds.width) {
+ x = (controlBounds.x + controlBounds.width) - bounds.width;
+ }
+ break;
+ case SWT.BOTTOM:
+ x = controlBounds.x;
+ y = controlBounds.y - bounds.height;
+ if (x + bounds.width > monitorBounds.x + monitorBounds.width) {
+ x = (controlBounds.x + controlBounds.width) - bounds.width;
+ }
+ break;
+ case SWT.RIGHT:
+ x = (controlBounds.x + controlBounds.width) - bounds.width;
+ y = controlBounds.y + controlBounds.height;
+ break;
+ case SWT.LEFT:
+ x = controlBounds.x;
+ y = controlBounds.y + controlBounds.height;
+ break;
+ }
+ getShell().setBounds(x, y, bounds.width, bounds.height);
+ }
+
+ @Override
+ protected void adjustBounds() {
+ Point tipSize = getShell().getSize();
+ Point location = getShell().getLocation();
+
+ Rectangle bounds;
+ Point rightBounds = new Point(tipSize.x + location.x, tipSize.y + location.y);
+
+ Monitor[] ms = getShell().getDisplay().getMonitors();
+
+ if (ms.length > 1) {
+ bounds = controlBounds;
+ Point p = new Point(location.x, location.y);
+
+ Rectangle tmp;
+ for (Monitor element : ms) {
+ tmp = element.getBounds();
+ if (tmp.contains(p)) {
+ bounds = tmp;
+ break;
+ }
+ }
+
+ } else {
+ bounds = getControl().getDisplay().getBounds();
+ }
+
+ 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;
+ }
+ }
+
+ getShell().setLocation(location);
+ }
+
+ public Control getControl() {
+ return control;
+ }
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractNotificationPopup.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractNotificationPopup.java
new file mode 100644
index 00000000..3c3427b9
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/AbstractNotificationPopup.java
@@ -0,0 +1,584 @@
+/*******************************************************************************
+ * 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 - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui.dialogs;
+
+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.mylyn.commons.ui.CommonImages;
+import org.eclipse.mylyn.commons.ui.CommonUiUtil;
+import org.eclipse.mylyn.commons.ui.GradientColors;
+import org.eclipse.mylyn.commons.ui.compatibility.CommonFonts;
+import org.eclipse.mylyn.internal.commons.ui.AnimationUtil;
+import org.eclipse.mylyn.internal.commons.ui.AnimationUtil.FadeJob;
+import org.eclipse.mylyn.internal.commons.ui.AnimationUtil.IFadeListener;
+import org.eclipse.mylyn.internal.commons.ui.Messages;
+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;
+
+/**
+ * A popup window with a title bar and message area for displaying notifications.
+ *
+ * @author Benjamin Pasero
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public abstract class AbstractNotificationPopup extends Window {
+
+ private static final int TITLE_HEIGHT = 24;
+
+ private static final String LABEL_NOTIFICATION = Messages.AbstractNotificationPopup_Notification;
+
+ private static final String LABEL_JOB_CLOSE = Messages.AbstractNotificationPopup_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 GradientColors 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) {
+ 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 GradientColors(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 = AnimationUtil.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 = AnimationUtil.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 = AnimationUtil.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;
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/EnhancedWizardDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/EnhancedWizardDialog.java
new file mode 100644
index 00000000..fedd5a99
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/EnhancedWizardDialog.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Frank Becker 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:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui.dialogs;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Wizard dialog for displaying additional button in the button bar. Based on ValidatableWizardDialog from Helen
+ * Bershadskaya
+ *
+ * @author Helen Bershadskaya
+ * @author Frank Becker
+ * @since 3.7
+ */
+public abstract class EnhancedWizardDialog extends WizardDialog {
+
+ public EnhancedWizardDialog(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ }
+
+ abstract protected void createExtraButtons(Composite composite);
+
+ abstract protected void updateExtraButtons();
+
+ abstract protected boolean handleExtraButtonPressed(int buttonId);
+
+ abstract protected HashMap<String, Boolean> saveAndSetEnabledStateMylyn();
+
+ abstract protected void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState);
+
+ /**
+ * Overridden so we can add a validate button to the wizard button bar, if a repository settings page requires it.
+ * Validate button is added left justified at button bar bottom (next to help image).
+ */
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 0; // create
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // create help control if needed
+ if (isHelpAvailable()) {
+ createHelpControl(composite);
+ }
+
+ createExtraButtons(composite);
+ Label filler = new Label(composite, SWT.NONE);
+ filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ ((GridLayout) composite.getLayout()).numColumns++;
+
+ super.createButtonsForButtonBar(composite);
+
+ return composite;
+ }
+
+ /**
+ * Overridden so we can react to the validate button being pressed. This could have been done with a straight
+ * selection listener in the creation method above, but this is more consistent with how the other buttons work in
+ * the wizard dialog.
+ *
+ * @since 3.1
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (!handleExtraButtonPressed(buttonId)) {
+ super.buttonPressed(buttonId);
+ }
+ }
+
+ @Override
+ public void updateButtons() {
+ updateExtraButtons();
+ super.updateButtons();
+ }
+
+ /**
+ * Overridden to be able to set proper state for our validate button
+ */
+ @Override
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+
+ HashMap<String, Boolean> savedEnabledState = null;
+ try {
+ savedEnabledState = saveAndSetEnabledStateMylyn();
+ super.run(fork, cancelable, runnable);
+ } finally {
+ if (savedEnabledState != null) {
+ restoreEnabledStateMylyn(savedEnabledState);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IInPlaceDialogListener.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IInPlaceDialogListener.java
new file mode 100644
index 00000000..624ac8e4
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IInPlaceDialogListener.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 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 org.eclipse.mylyn.commons.ui.dialogs;
+
+/**
+ * Listener interface for close events from an {@link AbstractInPlaceDialog}
+ *
+ * @author Shawn Minto
+ * @since 3.7
+ */
+public interface IInPlaceDialogListener {
+
+ public void buttonPressed(InPlaceDialogEvent event);
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IValidatable.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IValidatable.java
new file mode 100644
index 00000000..a0a28d2a
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/IValidatable.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 org.eclipse.mylyn.commons.ui.dialogs;
+
+/**
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public interface IValidatable {
+
+ public boolean canValidate();
+
+ public boolean needsValidation();
+
+ public void validate();
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/InPlaceDialogEvent.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/InPlaceDialogEvent.java
new file mode 100644
index 00000000..1e6ec238
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/InPlaceDialogEvent.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 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 org.eclipse.mylyn.commons.ui.dialogs;
+
+/**
+ * Event sent with an {@link IInPlaceDialogListener} that contains information about the close event that occurred
+ *
+ * @author Shawn Minto
+ * @since 3.7
+ */
+public class InPlaceDialogEvent {
+
+ private final int returnCode;
+
+ private final boolean isClosing;
+
+ public InPlaceDialogEvent(int returnCode, boolean isClosing) {
+ this.returnCode = returnCode;
+ this.isClosing = isClosing;
+ }
+
+ public boolean isClosing() {
+ return isClosing;
+ }
+
+ public int getReturnCode() {
+ return returnCode;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/ValidatableWizardDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/ValidatableWizardDialog.java
new file mode 100644
index 00000000..4003b782
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/dialogs/ValidatableWizardDialog.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 Helen Bershadskaya 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:
+ * Helen Bershadskaya - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui.dialogs;
+
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.mylyn.commons.ui.CommonImages;
+import org.eclipse.mylyn.internal.commons.ui.Messages;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Wizard dialog for displaying repository settings page. Necessary so we can add a validate button in the button bar.
+ *
+ * @author Helen Bershadskaya
+ * @since 3.7
+ */
+public class ValidatableWizardDialog extends EnhancedWizardDialog {
+
+ private static final String VALIDATE_BUTTON_KEY = "validate"; //$NON-NLS-1$
+
+ private Button validateServerButton;
+
+ private static final int VALIDATE_BUTTON_ID = 2000;
+
+ /**
+ * @see WizardDialog#WizardDialog(Shell, IWizard)
+ */
+ public ValidatableWizardDialog(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ setHelpAvailable(false);
+ }
+
+ @Override
+ protected void createExtraButtons(Composite composite) {
+ validateServerButton = createButton(composite, VALIDATE_BUTTON_ID,
+ Messages.ValidatableWizardDialog_Validate_Button_Label, false);
+ validateServerButton.setImage(CommonImages.getImage(CommonImages.VALIDATE));
+ validateServerButton.setVisible(false);
+ setButtonLayoutData(validateServerButton);
+ }
+
+ @Override
+ public void updateExtraButtons() {
+ IValidatable validatable = getValidatablePage();
+ if (validatable != null && validatable.needsValidation()) {
+ if (!validateServerButton.isVisible()) {
+ validateServerButton.setVisible(true);
+ }
+ validateServerButton.setEnabled(validatable.canValidate());
+ } else {
+ if (validateServerButton != null && validateServerButton.isVisible()) {
+ validateServerButton.setVisible(false);
+ }
+ }
+ }
+
+ private IValidatable getValidatablePage() {
+ IValidatable validatable = null;
+ IWizardPage currentPage = getCurrentPage();
+ if (currentPage instanceof IValidatable) {
+ validatable = (IValidatable) currentPage;
+ } else if (currentPage instanceof IAdaptable) {
+ validatable = (IValidatable) ((IAdaptable) currentPage).getAdapter(IValidatable.class);
+ }
+ return validatable;
+ }
+
+ @Override
+ protected boolean handleExtraButtonPressed(int buttonId) {
+ if (buttonId == VALIDATE_BUTTON_ID) {
+ IValidatable validatable = getValidatablePage();
+ if (validatable != null) {
+ validatable.validate();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Modeled after WizardDialog.saveAndSetEnabledState(), but that one is private, so create our own
+ */
+ @Override
+ protected HashMap<String, Boolean> saveAndSetEnabledStateMylyn() {
+ HashMap<String, Boolean> savedEnabledState = null;
+ if (getShell() != null) {
+ savedEnabledState = new HashMap<String, Boolean>();
+ if (validateServerButton != null && validateServerButton.getShell() == getShell()) {
+ savedEnabledState.put(VALIDATE_BUTTON_KEY, validateServerButton.getEnabled());
+ validateServerButton.setEnabled(false);
+ }
+ }
+ return savedEnabledState;
+ }
+
+ /**
+ * Modeled after WizardDialog.restoreEnabledState() and WizardDialog.restoreUIState() -- couldn't override those
+ * since they are private, so create our own. Currently only single button to work with, so don't create two
+ * separate methods
+ */
+ @Override
+ protected void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState) {
+ if (savedEnabledState != null) {
+ Boolean savedValidateEnabledState = savedEnabledState.get(VALIDATE_BUTTON_KEY);
+ if (validateServerButton != null && savedValidateEnabledState != null) {
+ validateServerButton.setEnabled(savedValidateEnabledState);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/wizard/ScreenshotCreationPage.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/wizard/ScreenshotCreationPage.java
new file mode 100644
index 00000000..51b40f57
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/commons/ui/wizard/ScreenshotCreationPage.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 Balazs Brinkus 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:
+ * Balazs Brinkus - initial API and implementation
+ * Tasktop Technologies - improvements
+ * Willian Mitsuda - improvements
+ * Hiroyuki Inaba - improvements
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.ui.wizard;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.mylyn.commons.ui.screenshots.ScreenshotViewer;
+import org.eclipse.mylyn.internal.commons.ui.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A wizard page to create a screenshot from the display.
+ * <p>
+ * NOTE: this class exposes a lot of implementation detail and is likely to change.
+ *
+ * @author Balazs Brinkus
+ * @author Willian Mitsuda
+ * @author Mik Kersten
+ * @author Hiroyuki Inaba
+ * @author Benjamin Muskalla
+ * @since 3.7
+ */
+public class ScreenshotCreationPage extends WizardPage {
+
+ private ScreenshotViewer viewer;
+
+ public ScreenshotCreationPage() {
+ super("ScreenShotAttachment"); //$NON-NLS-1$
+ setTitle(Messages.ScreenshotCreationPage_CAPTURE_SCRRENSHOT);
+ setDescription(Messages.ScreenshotCreationPage_After_capturing
+ + Messages.ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE);
+ }
+
+ public void createControl(Composite parent) {
+ viewer = new ScreenshotViewer(parent, SWT.BORDER | SWT.FLAT) {
+ @Override
+ protected void stateChanged() {
+ getContainer().updateButtons();
+ }
+ };
+ viewer.setDialogSettings(getDialogSettings());
+ setControl(viewer.getControl());
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return (viewer != null) && viewer.isComplete();
+ }
+
+ public boolean isImageDirty() {
+ return viewer.isDirty();
+ }
+
+ public Image createImage() {
+ // NOTE: may get invoked from non UI thread
+ return viewer.createImage();
+ }
+
+ public void setImageDirty(boolean imageDirty) {
+ viewer.setDirty(imageDirty);
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/AnimationUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/AnimationUtil.java
new file mode 100644
index 00000000..63248bef
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/AnimationUtil.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * 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 org.eclipse.mylyn.internal.commons.ui;
+
+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;
+
+/**
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ */
+public class AnimationUtil {
+
+ 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 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(Messages.SwtUtil_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);
+
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorCanvas.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorCanvas.java
index de996b03..ab86dbd6 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorCanvas.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorCanvas.java
@@ -19,13 +19,16 @@ import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Composite;
/**
* A tiny control just for color display
*
* @author Willian Mitsuda
+ * @deprecated use {@link ColorDialog} instead
*/
+@Deprecated
public class ColorCanvas extends Canvas {
private final Color color;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorSelectionWindow.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorSelectionWindow.java
index 66d0981d..d4940b32 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorSelectionWindow.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ColorSelectionWindow.java
@@ -24,6 +24,7 @@ import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
@@ -32,8 +33,8 @@ import org.eclipse.swt.widgets.Shell;
* Popup window for color selection
*
* @author Willian Mitsuda
+ * @deprecated use {@link ColorDialog} instead
*/
-// FIXME 3.5 remove this class
@Deprecated
public class ColorSelectionWindow extends Window {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiConstants.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiConstants.java
new file mode 100644
index 00000000..857964b6
--- /dev/null
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiConstants.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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 org.eclipse.mylyn.internal.commons.ui;
+
+/**
+ * @author Steffen Pingel
+ */
+public class CommonsUiConstants {
+
+ public static final String ID_PLUGIN = "org.eclipse.mylyn.commons.ui"; //$NON-NLS-1$
+
+}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiPlugin.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiPlugin.java
index 966681cc..20138266 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiPlugin.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CommonsUiPlugin.java
@@ -19,7 +19,9 @@ import org.osgi.framework.BundleContext;
/**
* @author Mik Kersten
* @author Steffen Pingel
+ * @deprecated use {@link CommonsUiConstants} instead
*/
+@Deprecated
public class CommonsUiPlugin extends AbstractUIPlugin {
public static final String ID_PLUGIN = "org.eclipse.mylyn.commons.ui"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CompositeSyncImageDescriptor.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CompositeSyncImageDescriptor.java
index 93c17168..0bcc42d6 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CompositeSyncImageDescriptor.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/CompositeSyncImageDescriptor.java
@@ -13,7 +13,7 @@ package org.eclipse.mylyn.internal.commons.ui;
import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
+import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListItem.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListItem.java
index 4f21d32e..528402fa 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListItem.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListItem.java
@@ -21,13 +21,15 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.swt.widgets.Display;
/**
- * Based on {@link org.eclipse.ui.internal.progress.ProgressInfoItem}.
+ * Based on <code>org.eclipse.ui.internal.progress.ProgressInfoItem</code>.
*
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.ControlListItem} instead
*/
+@Deprecated
public abstract class ControlListItem extends Composite {
static String DARK_COLOR_KEY = "org.eclipse.mylyn.commons.ui.ControlListItem.DARK_COLOR"; //$NON-NLS-1$
@@ -71,7 +73,7 @@ public abstract class ControlListItem extends Composite {
// Mac has different Gamma value
int shift = "carbon".equals(SWT.getPlatform()) ? -25 : -10;//$NON-NLS-1$
- Color lightColor = PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color lightColor = Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
// Determine a dark color by shifting the list color
RGB darkRGB = new RGB(Math.max(0, lightColor.getRed() + shift), Math.max(0, lightColor.getGreen() + shift),
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListViewer.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListViewer.java
index ac7f6975..888fab5a 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListViewer.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/ControlListViewer.java
@@ -41,7 +41,9 @@ import org.eclipse.swt.widgets.Widget;
* Based on {@link org.eclipse.ui.internal.progress.DetailedProgressViewer}.
*
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.ControlListViewer} instead
*/
+@Deprecated
@SuppressWarnings("restriction")
public abstract class ControlListViewer extends StructuredViewer {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/Messages.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/Messages.java
index 32057033..13e081a5 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/Messages.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/Messages.java
@@ -57,4 +57,24 @@ public class Messages extends NLS {
public static String ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE;
+ public static String AbstractColumnViewerSupport_Restore_defaults;
+
+ public static String DatePickerPanel_Today;
+
+ public static String TextControl_FindToolTip;
+
+ public static String TextControl_AccessibleListenerFindButton;
+
+ public static String CollapseAllAction_Label;
+
+ public static String CollapseAllAction_ToolTip;
+
+ public static String ExpandAllAction_Label;
+
+ public static String ExpandAllAction_ToolTip;
+
+ public static String PropertiesAction_Properties;
+
+ public static String ValidatableWizardDialog_Validate_Button_Label;
+
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/NotificationPopupColors.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/NotificationPopupColors.java
index ef623826..cf3f5798 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/NotificationPopupColors.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/NotificationPopupColors.java
@@ -14,21 +14,20 @@ package org.eclipse.mylyn.internal.commons.ui;
import org.eclipse.jface.resource.DeviceResourceException;
import org.eclipse.jface.resource.ResourceManager;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotificationPopup;
+import org.eclipse.mylyn.commons.ui.GradientColors;
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>
+ * Based on FormColors of UI Forms.
*
* @author Benjamin Pasero (initial contribution from RSSOwl, see bug 177974)
* @author Mik Kersten
+ * @deprecated use {@link GradientColors} instead
*/
+@Deprecated
public class NotificationPopupColors {
private final Display display;
@@ -186,4 +185,5 @@ public class NotificationPopupColors {
return manager.getDevice().getSystemColor(SWT.COLOR_BLACK);
}
}
+
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SectionComposite.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SectionComposite.java
index 39729bcc..a8e4d1c1 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SectionComposite.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SectionComposite.java
@@ -31,12 +31,14 @@ import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.SectionComposite} instead
*/
+@Deprecated
public class SectionComposite extends SharedScrolledComposite {
- FormToolkit toolkit;
+ private FormToolkit toolkit;
- public Composite content;
+ private final Composite content;
public SectionComposite(Composite parent, int style) {
super(parent, style | SWT.V_SCROLL);
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SwtUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SwtUtil.java
index 797b3e62..6b5dbdc3 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SwtUtil.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/SwtUtil.java
@@ -24,7 +24,9 @@ import org.eclipse.swt.widgets.TreeItem;
/**
* @author Mik Kersten
* @author Steffen Pingel
+ * @deprecated use {@link AnimationUtil} instead
*/
+@Deprecated
public class SwtUtil {
public static final long FADE_RESCHEDULE_DELAY = 80;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/TaskBarManager.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/TaskBarManager.java
index eb506651..17832dd8 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/TaskBarManager.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/TaskBarManager.java
@@ -25,7 +25,9 @@ import org.eclipse.ui.PlatformUI;
/**
* @author Shawn Minto
+ * @deprecated use {@link org.eclipse.mylyn.commons.workbench.TaskBarManager} instead
*/
+@Deprecated
public class TaskBarManager {
private static final String TASK_BAR_MENU_MANAGER_KEY = "org.eclipse.mylyn.commons.TaskBarMenuManager.instance"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/WindowUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/WindowUtil.java
index 6742b556..524fed4f 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/WindowUtil.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/WindowUtil.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2011 Frank Becker and others.
+ * Copyright (c) 2000, 2008 IBM Corporation 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:
- * Frank Becker - initial API and implementation
+ * IBM Corporation - initial API and implementation
+ * Frank Becker - fixes for Mylyn
*******************************************************************************/
package org.eclipse.mylyn.internal.commons.ui;
@@ -19,12 +20,12 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Monitor;
/**
- * This class copies the code from org.eclipse.jface.window because we can not access the protected method
- * getConstrainedShellBounds. getConstrainedShellBounds has now the window as the first parameter.
+ * Based on {@link org.eclipse.jface.window.Window#getConstrainedShellBounds(Rectangle)}.
*
* @author Frank Becker
*/
public class WindowUtil {
+
/**
* Returns the monitor whose client area contains the given point. If no monitor contains the point, returns the
* monitor that is closest to the point. If this is ever made public, it should be moved into a separate utility
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/messages.properties b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/messages.properties
index 731ed704..3a85441a 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/messages.properties
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/commons/ui/messages.properties
@@ -31,3 +31,16 @@ DateSelectionDialog_Date_Selection=Date Selection
ScreenshotCreationPage_After_capturing=After capturing, you can crop the image and make drawings on it. This window will not be captured.
ScreenshotCreationPage_CAPTURE_SCRRENSHOT=Capture Screenshot
ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE=Note that you can continue to interact with the workbench in order to set up the screenshot.
+
+AbstractColumnViewerSupport_Restore_defaults=Restore Defaults
+DatePickerPanel_Today=Today
+TextControl_FindToolTip=Find
+TextControl_AccessibleListenerFindButton=Find
+
+CollapseAllAction_Label=Collapse All
+CollapseAllAction_ToolTip=Collapse All
+ExpandAllAction_Label=Expand All
+ExpandAllAction_ToolTip=Expand All
+PropertiesAction_Properties=Properties
+
+ValidatableWizardDialog_Validate_Button_Label=&Validate \ No newline at end of file
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSorter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSorter.java
index 50267bcf..fbdca8c7 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSorter.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSorter.java
@@ -24,9 +24,15 @@ import org.eclipse.swt.widgets.Item;
/**
* @author Shawn Minto
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.AbstractColumnViewerSorter} instead
*/
+@Deprecated
public abstract class AbstractColumnViewerSorter<V extends ColumnViewer, I extends Item> extends ViewerSorter {
+ /**
+ * @deprecated use {@link org.eclipse.mylyn.commons.core.CoreUtil.compare()} instead
+ */
+ @Deprecated
protected <T> int compare(Comparable<T> key1, T key2) {
if (key1 == null) {
return (key2 != null) ? 1 : 0;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java
index 57942f40..8281221d 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java
@@ -45,7 +45,9 @@ import org.eclipse.ui.XMLMemento;
/**
* @author Shawn Minto
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.AbstractColumnViewerSupport} instead
*/
+@Deprecated
public abstract class AbstractColumnViewerSupport<T extends Item> {
private static class ColumnState {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java
index f884fbb9..9a068dc7 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java
@@ -32,7 +32,9 @@ import org.eclipse.ui.progress.WorkbenchJob;
/**
* @author Mik Kersten
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.AbstractFilteredTree} instead
*/
+@Deprecated
public abstract class AbstractFilteredTree extends EnhancedFilteredTree {
private static final int FILTER_WIDTH_MIN = 60;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotification.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotification.java
index acb6e6ea..7c9e59a5 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotification.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotification.java
@@ -19,7 +19,9 @@ import org.eclipse.swt.graphics.Image;
/**
* @author Rob Elves
* @author Mik Kersten
+ * @deprecated use {@link org.eclipse.mylyn.internal.tasks.ui.notifications.notifications.AbstractNotification} instead
*/
+@Deprecated
public abstract class AbstractNotification implements Comparable<AbstractNotification>, IAdaptable {
public abstract void open();
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java
index d7672436..986c372a 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java
@@ -19,11 +19,11 @@ 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.mylyn.commons.ui.GradientColors;
import org.eclipse.mylyn.internal.commons.ui.Messages;
-import org.eclipse.mylyn.internal.commons.ui.NotificationPopupColors;
-import org.eclipse.mylyn.internal.commons.ui.SwtUtil;
-import org.eclipse.mylyn.internal.commons.ui.SwtUtil.FadeJob;
-import org.eclipse.mylyn.internal.commons.ui.SwtUtil.IFadeListener;
+import org.eclipse.mylyn.internal.commons.ui.AnimationUtil;
+import org.eclipse.mylyn.internal.commons.ui.AnimationUtil.FadeJob;
+import org.eclipse.mylyn.internal.commons.ui.AnimationUtil.IFadeListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
@@ -51,7 +51,9 @@ import org.eclipse.ui.PlatformUI;
* @author Benjamin Pasero
* @author Mik Kersten
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.AbstractNotificationPopup} instead
*/
+@Deprecated
public abstract class AbstractNotificationPopup extends Window {
private static final int TITLE_HEIGHT = 24;
@@ -72,7 +74,7 @@ public abstract class AbstractNotificationPopup extends Window {
protected LocalResourceManager resources;
- private NotificationPopupColors color;
+ private GradientColors color;
private final Display display;
@@ -246,7 +248,7 @@ public abstract class AbstractNotificationPopup extends Window {
}
private void initResources() {
- color = new NotificationPopupColors(display, resources);
+ color = new GradientColors(display, resources);
}
@Override
@@ -331,7 +333,7 @@ public abstract class AbstractNotificationPopup extends Window {
shell.setAlpha(0);
}
shell.setVisible(true);
- fadeJob = SwtUtil.fadeIn(shell, new IFadeListener() {
+ fadeJob = AnimationUtil.fadeIn(shell, new IFadeListener() {
public void faded(Shell shell, int alpha) {
if (shell.isDisposed()) {
return;
@@ -526,7 +528,7 @@ public abstract class AbstractNotificationPopup extends Window {
if (fadeJob != null) {
fadeJob.cancelAndWait(false);
}
- fadeJob = SwtUtil.fadeOut(getShell(), new IFadeListener() {
+ fadeJob = AnimationUtil.fadeOut(getShell(), new IFadeListener() {
public void faded(Shell shell, int alpha) {
if (!shell.isDisposed()) {
if (alpha == 0) {
@@ -535,7 +537,7 @@ public abstract class AbstractNotificationPopup extends Window {
if (fadeJob != null) {
fadeJob.cancelAndWait(false);
}
- fadeJob = SwtUtil.fastFadeIn(shell, new IFadeListener() {
+ fadeJob = AnimationUtil.fastFadeIn(shell, new IFadeListener() {
public void faded(Shell shell, int alpha) {
if (shell.isDisposed()) {
return;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java
index b4219053..2b57ec13 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java
@@ -26,7 +26,9 @@ import org.eclipse.ui.progress.WorkbenchJob;
/**
* @author Mik Kersten
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.AdaptiveRefreshPolicy} instead
*/
+@Deprecated
public class AdaptiveRefreshPolicy {
private int refreshDelay = 1500;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ClipboardCopier.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ClipboardCopier.java
index 52a9e7b3..a36d1641 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ClipboardCopier.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ClipboardCopier.java
@@ -23,7 +23,9 @@ import org.eclipse.ui.PlatformUI;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.ClipboardCopier} instead
*/
+@Deprecated
public class ClipboardCopier {
public interface TextProvider {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonColors.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonColors.java
index 175b1d3b..1e621d4e 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonColors.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonColors.java
@@ -16,8 +16,9 @@ import org.eclipse.swt.widgets.Display;
/**
* @author Mik Kersten
- * @since 3.0
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.compatibility.CommonColors} instead
*/
+@Deprecated
public class CommonColors {
public static final Color HYPERLINK_WIDGET = new Color(Display.getDefault(), 12, 81, 172);
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFonts.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFonts.java
index 36384537..213f785d 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFonts.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFonts.java
@@ -22,8 +22,9 @@ import org.eclipse.swt.widgets.Display;
/**
* @author Mik Kersten
- * @since 3.0
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.compatibility.CommonFonts} instead
*/
+@Deprecated
public class CommonFonts {
public static Font BOLD;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java
index dfe129dc..a3d6a63e 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java
@@ -23,7 +23,9 @@ import org.eclipse.ui.internal.forms.widgets.FormUtil;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.CommonFormUtil} instead
*/
+@Deprecated
public class CommonFormUtil {
public static void disableScrollingOnFocus(ScrolledForm form) {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImageManger.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImageManger.java
index 008d747a..5dd16e6f 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImageManger.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImageManger.java
@@ -25,7 +25,9 @@ import org.eclipse.ui.internal.WorkbenchImages;
/**
* @author Steffen Pingel
* @author Kevin Sawicki
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.CommonImageManger} instead
*/
+@Deprecated
public class CommonImageManger {
private static final String[] IMAGE_EXTENSIONS = { "jpg", "gif", "png", "tiff", "tif", "bmp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java
index 7e96e6a3..97b286c6 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java
@@ -25,8 +25,9 @@ import org.eclipse.swt.graphics.Image;
/**
* @author Mik Kersten
- * @since 3.0
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.CommonImages} instead
*/
+@Deprecated
public class CommonImages {
private static final URL baseURL = CommonsUiPlugin.getDefault().getBundle().getEntry("/icons/"); //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonPropertyTester.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonPropertyTester.java
index cfed1519..a7737dc9 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonPropertyTester.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonPropertyTester.java
@@ -15,9 +15,15 @@ import org.eclipse.core.expressions.PropertyTester;
/**
* @author Steffen Pingel
+ * @deprecated
*/
+@Deprecated
public abstract class CommonPropertyTester extends PropertyTester {
+ /**
+ * @deprecated use {@link org.eclipse.mylyn.commons.core.CoreUtil#equals()} instead
+ */
+ @Deprecated
protected boolean equals(boolean value, Object expectedValue) {
return (expectedValue == null) ? value == true : new Boolean(value).equals(expectedValue);
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonTextSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonTextSupport.java
index 49438b27..af3ab73d 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonTextSupport.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonTextSupport.java
@@ -55,7 +55,9 @@ import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
* {@link SourceViewer} controls.
*
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.editors.CommonTextSupport} instead
*/
+@Deprecated
public class CommonTextSupport {
private class UndoRedoListener implements IOperationHistoryListener {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonThemes.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonThemes.java
index 014d6255..a1804f85 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonThemes.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonThemes.java
@@ -14,7 +14,9 @@ package org.eclipse.mylyn.internal.provisional.commons.ui;
/**
* @author Mik Kersten
* @since 3.0
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.compatibility.CommonThemes} instead
*/
+@Deprecated
public class CommonThemes {
public static final String COLOR_INCOMING_BACKGROUND = "org.eclipse.mylyn.tasks.ui.colors.incoming.background"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java
index f89e3950..acd0ab32 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java
@@ -34,7 +34,9 @@ import org.eclipse.ui.PlatformUI;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.CommonUiUtil} instead
*/
+@Deprecated
public class CommonUiUtil {
private static final String KEY_ENABLED = "org.eclipse.mylyn.commons.ui.enabled"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePicker.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePicker.java
index 2a73df51..6fe7f3ab 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePicker.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePicker.java
@@ -48,8 +48,9 @@ import org.eclipse.ui.forms.widgets.ImageHyperlink;
*
* @author Bahadir Yagan
* @author Mik Kersten
- * @since 1.0
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.DatePicker} instead
*/
+@Deprecated
public class DatePicker extends Composite {
public final static String TITLE_DIALOG = Messages.DatePicker_Choose_Date;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePickerPanel.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePickerPanel.java
index 58c9b65b..a16286a9 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePickerPanel.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePickerPanel.java
@@ -43,7 +43,9 @@ import org.eclipse.ui.forms.widgets.Hyperlink;
* @author Bahadir Yagan
* @author Mik Kersten
* @author Rob Elves
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.DatePickerPanel} instead
*/
+@Deprecated
public class DatePickerPanel extends Composite implements KeyListener, ISelectionProvider {
private org.eclipse.swt.widgets.List timeList = null;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DateSelectionDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DateSelectionDialog.java
index 7ae3e9de..f3af41a5 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DateSelectionDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DateSelectionDialog.java
@@ -30,7 +30,9 @@ import org.eclipse.swt.widgets.Shell;
* @author Ken Sueda
* @author Mik Kersten
* @author Rob Elves
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.DateSelectionDialog} instead
*/
+@Deprecated
public class DateSelectionDialog extends Dialog {
private Date selectedDate = null;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DecoratingPatternStyledCellLabelProvider.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DecoratingPatternStyledCellLabelProvider.java
index ca3bdbc7..7e33d733 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DecoratingPatternStyledCellLabelProvider.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DecoratingPatternStyledCellLabelProvider.java
@@ -42,7 +42,9 @@ import org.eclipse.ui.internal.misc.StringMatcher.Position;
*
* @author Kevin Sawicki
* @see DecoratingFileSearchLabelProvider
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.DecoratingPatternStyledCellLabelProvider} instead
*/
+@Deprecated
public class DecoratingPatternStyledCellLabelProvider extends DecoratingStyledCellLabelProvider implements
IPropertyChangeListener, ILabelProvider {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DelayedRefreshJob.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DelayedRefreshJob.java
index a6376278..6fd73004 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DelayedRefreshJob.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DelayedRefreshJob.java
@@ -27,7 +27,9 @@ import org.eclipse.ui.progress.WorkbenchJob;
*
* @author Steffen Pingel
* @author Mik Kersten
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.DelayedRefreshJob} instead
*/
+@Deprecated
public abstract class DelayedRefreshJob extends WorkbenchJob {
static final long REFRESH_DELAY_DEFAULT = 200;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java
index 7d790f47..a39595a9 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java
@@ -31,8 +31,10 @@ import org.eclipse.ui.dialogs.PatternFilter;
* A {@link FilteredTree} that uses the new look on Eclipse 3.5 and later.
*
* @author Hiroyuki Inaba
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.EnhancedFilteredTree} instead
*/
// TODO e3.5 remove this class and replace with FilteredTree
+@Deprecated
public class EnhancedFilteredTree extends FilteredTree {
protected boolean useNewLook;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientCanvas.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientCanvas.java
index 75cfe781..57acad8e 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientCanvas.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientCanvas.java
@@ -26,7 +26,10 @@ import org.eclipse.swt.widgets.Listener;
/**
* Based on {@link org.eclipse.ui.internal.forms.widgets.FormHeading}.
+ *
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.GradientCanvas} instead
*/
+@Deprecated
@SuppressWarnings("restriction")
public class GradientCanvas extends Canvas {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java
index 7c88aadc..4ba71787 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java
@@ -33,7 +33,9 @@ import org.eclipse.ui.themes.IThemeManager;
/**
* @author Mik Kersten
* @author Frank Becker
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.GradientDrawer} instead
*/
+@Deprecated
public abstract class GradientDrawer {
private final Listener CATEGORY_GRADIENT_DRAWER = new Listener() {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientToolTip.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientToolTip.java
index 748f07e9..d97b2e77 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientToolTip.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientToolTip.java
@@ -14,7 +14,7 @@ package org.eclipse.mylyn.internal.provisional.commons.ui;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.resource.LocalResourceManager;
import org.eclipse.jface.window.ToolTip;
-import org.eclipse.mylyn.internal.commons.ui.NotificationPopupColors;
+import org.eclipse.mylyn.commons.ui.GradientColors;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridLayout;
@@ -26,11 +26,12 @@ import org.eclipse.swt.widgets.Event;
* A Custom JFace ToolTip that applies a gradient to the contents
*
* @author Shawn Minto
- * @since 3.2
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.GradientToolTip} instead
*/
+@Deprecated
public abstract class GradientToolTip extends ToolTip {
- private NotificationPopupColors colors;
+ private GradientColors colors;
private LocalResourceManager resourceManager;
@@ -46,7 +47,7 @@ public abstract class GradientToolTip extends ToolTip {
private void initResources(Control control) {
resourceManager = new LocalResourceManager(JFaceResources.getResources());
- colors = new NotificationPopupColors(control.getDisplay(), resourceManager);
+ colors = new GradientColors(control.getDisplay(), resourceManager);
}
@Override
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java
index f67dfda2..04e5924d 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java
@@ -15,7 +15,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.core.ICoreRunnable} instead
*/
+@Deprecated
public interface ICoreRunnable {
public void run(IProgressMonitor monitor) throws CoreException;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/IFilteredTreeListener.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/IFilteredTreeListener.java
index 5f17b305..04219e55 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/IFilteredTreeListener.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/IFilteredTreeListener.java
@@ -13,7 +13,9 @@ package org.eclipse.mylyn.internal.provisional.commons.ui;
/**
* @author Mik Kersten
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.IFilteredTreeListener} instead
*/
+@Deprecated
public interface IFilteredTreeListener {
public void filterTextChanged(String text);
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java
index 60bdcf30..f0d3d16f 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java
@@ -24,7 +24,9 @@ import org.osgi.framework.Version;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.PlatformUiUtil} instead
*/
+@Deprecated
public class PlatformUiUtil {
private static Boolean internalBrowserAvailable;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java
index 69285e67..13010ce0 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java
@@ -38,7 +38,9 @@ import org.eclipse.swt.widgets.Shell;
* A helper class for running operations in dialogs. Based on {@link WizardDialog}.
*
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.ProgressContainer} instead
*/
+@Deprecated
public class ProgressContainer implements IRunnableContext {
private static final String FOCUS_CONTROL = "focusControl"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java
index 704eab13..db8b4303 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java
@@ -35,7 +35,9 @@ import org.eclipse.ui.forms.IFormColors;
* @author Eric Booth
* @author Leo Dos Santos
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.RichToolTip} instead
*/
+@Deprecated
public abstract class RichToolTip extends GradientToolTip {
private final static int X_SHIFT = PlatformUiUtil.getToolTipXShift();
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScalingHyperlink.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScalingHyperlink.java
index 303bb947..d1e04e64 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScalingHyperlink.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScalingHyperlink.java
@@ -26,8 +26,9 @@ import org.eclipse.ui.forms.widgets.ImageHyperlink;
*
* @author Leo Dos Santos
* @author Mik Kersten
- * @since 3.0
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.ScalingHyperlink} instead
*/
+@Deprecated
public class ScalingHyperlink extends ImageHyperlink {
private boolean strikeThrough;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java
index 62d97a21..24d0d6f4 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java
@@ -33,7 +33,9 @@ import org.eclipse.swt.widgets.Composite;
* @author Mik Kersten
* @author Hiroyuki Inaba
* @author Benjamin Muskalla
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.wizard.ScreenshotCreationPage} instead
*/
+@Deprecated
public class ScreenshotCreationPage extends WizardPage {
private static final String DIALOG_SETTINGS = ScreenshotCreationPage.class.getCanonicalName();
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SearchHistoryPopUpDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SearchHistoryPopUpDialog.java
index 75acc293..a9b2d29e 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SearchHistoryPopUpDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SearchHistoryPopUpDialog.java
@@ -52,7 +52,9 @@ import org.eclipse.ui.PlatformUI;
/**
* @author Shawn Minto
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.search.SearchHistoryPopupDialog} instead
*/
+@Deprecated
public class SearchHistoryPopUpDialog extends PopupDialog {
private static final int MAX_HISTORY_NO_FILTER = 3;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectionProviderAdapter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectionProviderAdapter.java
index 76e7f047..c3aa5546 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectionProviderAdapter.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectionProviderAdapter.java
@@ -24,7 +24,9 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
* listeners.
*
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.SelectionProviderAdapter} instead
*/
+@Deprecated
public class SelectionProviderAdapter extends EventManager implements ISelectionProvider, ISelectionChangedListener {
private ISelection selection;
@@ -61,8 +63,8 @@ public class SelectionProviderAdapter extends EventManager implements ISelection
public void selectionChanged(final SelectionChangedEvent event) {
this.selection = event.getSelection();
Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
+ for (Object listener2 : listeners) {
+ final ISelectionChangedListener listener = (ISelectionChangedListener) listener2;
SafeRunner.run(new SafeRunnable() {
public void run() {
listener.selectionChanged(event);
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java
index e6bdccd5..c2b0bed6 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java
@@ -43,11 +43,12 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout;
* GUI control designed to display build service messages. These messages may contain links that can be clicked by the
* user.
*
- * @since 3.5
* @author Robert Elves
* @author Steffen Pingel
* @author Torkild Ulvøy Resheim
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.ServiceMessageControl} instead
*/
+@Deprecated
public abstract class ServiceMessageControl {
private static final String NOTIFICATIONS_PREF_PAGE = "org.eclipse.mylyn.commons.notifications.preferencePages.Notifications"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SubstringPatternFilter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SubstringPatternFilter.java
index 809db995..a93b94fd 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SubstringPatternFilter.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SubstringPatternFilter.java
@@ -15,7 +15,9 @@ import org.eclipse.ui.dialogs.PatternFilter;
/**
* @author Mik Kersten
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.SubstringPatternFilter} instead
*/
+@Deprecated
public class SubstringPatternFilter extends PatternFilter {
@Override
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableSorter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableSorter.java
index 0e7e97c4..01fcf4d9 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableSorter.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableSorter.java
@@ -16,7 +16,9 @@ import org.eclipse.swt.widgets.TableColumn;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.TableSorter} instead
*/
+@Deprecated
public abstract class TableSorter extends AbstractColumnViewerSorter<TableViewer, TableColumn> {
@Override
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java
index 42dfaafd..342f66fe 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java
@@ -14,6 +14,11 @@ import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.dialogs.PatternFilter;
+/**
+ * @author Shawn Minto
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.TableTreePatternFilter} instead
+ */
+@Deprecated
public class TableTreePatternFilter extends PatternFilter {
@Override
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableViewerSupport.java
index eb31eb11..489d9639 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableViewerSupport.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableViewerSupport.java
@@ -25,7 +25,9 @@ import org.eclipse.swt.widgets.TableColumn;
* @author Frank Becker
* @author Steffen Pingel
* @author Shawn Minto
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.TableViewerSupport} instead
*/
+@Deprecated
public class TableViewerSupport extends AbstractColumnViewerSupport<TableColumn> {
private final Table table;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java
index 0ac8df35..224d8900 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java
@@ -59,7 +59,9 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* @author Shawn Minto
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.search.TextSearchControl} instead
*/
+@Deprecated
public class TextSearchControl extends Composite {
private static final String FIND_TEXT_MEMENTO_ELEMENT = "text"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeSorter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeSorter.java
index 64caf4ce..84125257 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeSorter.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeSorter.java
@@ -17,7 +17,9 @@ import org.eclipse.swt.widgets.TreeColumn;
/**
* @author Shawn Minto
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.TreeSorter} instead
*/
+@Deprecated
public abstract class TreeSorter extends AbstractColumnViewerSorter<TreeViewer, TreeColumn> {
@Override
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java
index 66551cfd..f595bea0 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java
@@ -23,7 +23,9 @@ import org.eclipse.swt.widgets.TreeColumn;
/**
* @author Shawn Minto
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.TreeViewerSupport} instead
*/
+@Deprecated
public class TreeViewerSupport extends AbstractColumnViewerSupport<TreeColumn> {
private final Tree tree;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java
index 3363e431..28215d35 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java
@@ -35,7 +35,9 @@ import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
* @author Mik Kersten
* @author Rob Elves
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.WorkbenchActionSupport} instead
*/
+@Deprecated
@SuppressWarnings("restriction")
public class WorkbenchActionSupport implements ISelectionChangedListener {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java
index 9072a26c..84f451f0 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java
@@ -50,7 +50,9 @@ import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
/**
* @author Mik Kersten
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.WorkbenchUtil} instead
*/
+@Deprecated
public class WorkbenchUtil {
public static final String GROUP_EDIT = "group.edit"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/CollapseAllAction.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/CollapseAllAction.java
index 80e75670..80599ebf 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/CollapseAllAction.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/CollapseAllAction.java
@@ -19,7 +19,9 @@ import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
/**
* @author Mik Kersten
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.actions.CollapseAllAction} instead
*/
+@Deprecated
public class CollapseAllAction extends Action {
private final AbstractTreeViewer viewer;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java
index 6aff05eb..5fe4bc33 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java
@@ -19,7 +19,9 @@ import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
/**
* @author Mik Kersten
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.actions.ExpandAllAction} instead
*/
+@Deprecated
public class ExpandAllAction extends Action {
private final AbstractTreeViewer viewer;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java
index 13634ea5..24ceccfc 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java
@@ -17,7 +17,9 @@ import org.eclipse.ui.actions.BaseSelectionListenerAction;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.PropertiesAction} instead
*/
+@Deprecated
public class PropertiesAction extends BaseSelectionListenerAction {
public PropertiesAction() {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractDeleteLineHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractDeleteLineHandler.java
index 20904699..962579f2 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractDeleteLineHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractDeleteLineHandler.java
@@ -24,7 +24,9 @@ import org.eclipse.ui.texteditor.TextViewerDeleteLineTarget;
* and copyToClipboard.
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.AbstractDeleteLineHandler} instead
*/
+@Deprecated
public class AbstractDeleteLineHandler extends AbstractTextViewerHandler implements IHandler {
protected final int type;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractTextViewerHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractTextViewerHandler.java
index 14ea0723..6177c57c 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractTextViewerHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractTextViewerHandler.java
@@ -23,7 +23,9 @@ import org.eclipse.ui.handlers.HandlerUtil;
* Abstract command handler that can get the current text viewer.
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.AbstractTextViewerHandler} instead
*/
+@Deprecated
public abstract class AbstractTextViewerHandler extends AbstractHandler {
/**
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineHandler.java
index f667ec0a..e06e8431 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineHandler.java
@@ -17,9 +17,13 @@ import org.eclipse.ui.texteditor.DeleteLineAction;
* Command handler for cut line command (whole)
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.CutLineHandler} instead
*/
+@Deprecated
public class CutLineHandler extends AbstractDeleteLineHandler {
+
public CutLineHandler() {
super(DeleteLineAction.WHOLE, true);
}
+
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToBeginningHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToBeginningHandler.java
index dfd1f07f..61e98f82 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToBeginningHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToBeginningHandler.java
@@ -17,9 +17,13 @@ import org.eclipse.ui.texteditor.DeleteLineAction;
* Command handler for cut line command (to beginning)
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.CutLineToBeginningHandler} instead
*/
+@Deprecated
public class CutLineToBeginningHandler extends AbstractDeleteLineHandler {
+
public CutLineToBeginningHandler() {
super(DeleteLineAction.TO_BEGINNING, true);
}
+
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToEndHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToEndHandler.java
index e63eb72c..0e639d9c 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToEndHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToEndHandler.java
@@ -17,9 +17,13 @@ import org.eclipse.ui.texteditor.DeleteLineAction;
* Command handler for cut line command (to end)
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.CutLineToEndHandler} instead
*/
+@Deprecated
public class CutLineToEndHandler extends AbstractDeleteLineHandler {
+
public CutLineToEndHandler() {
super(DeleteLineAction.TO_END, true);
}
+
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineHandler.java
index e7e0deba..65cf7f1f 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineHandler.java
@@ -17,9 +17,13 @@ import org.eclipse.ui.texteditor.DeleteLineAction;
* Command handler for delete line command (whole)
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.DeleteLineHandler} instead
*/
+@Deprecated
public class DeleteLineHandler extends AbstractDeleteLineHandler {
+
public DeleteLineHandler() {
super(DeleteLineAction.WHOLE, false);
}
+
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToBeginningHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToBeginningHandler.java
index 3ba313bb..5c1c9ac8 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToBeginningHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToBeginningHandler.java
@@ -17,9 +17,13 @@ import org.eclipse.ui.texteditor.DeleteLineAction;
* Command handler for delete line command (to beginning)
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.DeleteLineToBeginningHandler} instead
*/
+@Deprecated
public class DeleteLineToBeginningHandler extends AbstractDeleteLineHandler {
+
public DeleteLineToBeginningHandler() {
super(DeleteLineAction.TO_BEGINNING, false);
}
+
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToEndHandler.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToEndHandler.java
index c750d712..23fec8a3 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToEndHandler.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToEndHandler.java
@@ -17,9 +17,13 @@ import org.eclipse.ui.texteditor.DeleteLineAction;
* Command handler for delete line command (to end)
*
* @author David Green
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.texteditor.DeleteLineToEndHandler} instead
*/
+@Deprecated
public class DeleteLineToEndHandler extends AbstractDeleteLineHandler {
+
public DeleteLineToEndHandler() {
super(DeleteLineAction.TO_END, false);
}
+
}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/AbstractInPlaceDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/AbstractInPlaceDialog.java
index 694c0a82..fe6f49e4 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/AbstractInPlaceDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/AbstractInPlaceDialog.java
@@ -44,8 +44,9 @@ import org.eclipse.ui.PlatformUI;
* Abstract class for an in-place popup dialog that has a cancel button and sends and ok event when the dialog is closed
*
* @author Shawn Minto
- * @since 3.3
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.AbstractInPlaceDialog} instead
*/
+@Deprecated
public abstract class AbstractInPlaceDialog extends PopupDialog {
public static final int ID_CLEAR = IDialogConstants.CLIENT_ID + 1;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java
index bbed9126..4105b17f 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java
@@ -32,8 +32,9 @@ import org.eclipse.swt.widgets.Shell;
*
* @author Helen Bershadskaya
* @author Frank Becker
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.EnhancedWizardDialog} instead
*/
-
+@Deprecated
public abstract class EnhancedWizardDialog extends WizardDialog {
public EnhancedWizardDialog(Shell parentShell, IWizard newWizard) {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java
index 6564a49d..be47a1c8 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java
@@ -15,8 +15,9 @@ package org.eclipse.mylyn.internal.provisional.commons.ui.dialogs;
* Listener interface for close events from an {@link AbstractInPlaceDialog}
*
* @author Shawn Minto
- * @since 3.3
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.IInPlaceDialogListener} instead
*/
+@Deprecated
public interface IInPlaceDialogListener {
public void buttonPressed(InPlaceDialogEvent event);
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java
index 4684de4f..9e8e706c 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java
@@ -13,7 +13,9 @@ package org.eclipse.mylyn.internal.provisional.commons.ui.dialogs;
/**
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.IValidatable} instead
*/
+@Deprecated
public interface IValidatable {
public boolean canValidate();
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceCheckBoxTreeDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceCheckBoxTreeDialog.java
index ff27ebf1..1af1ea4e 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceCheckBoxTreeDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceCheckBoxTreeDialog.java
@@ -38,8 +38,9 @@ import org.eclipse.ui.progress.WorkbenchJob;
/**
* @author Shawn Minto
- * @since 3.3
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.InPlaceCheckBoxTreeDialog} instead
*/
+@Deprecated
public class InPlaceCheckBoxTreeDialog extends AbstractInPlaceDialog {
private final Map<String, String> validValues;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDateSelectionDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDateSelectionDialog.java
index 74cf7e64..8d562f50 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDateSelectionDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDateSelectionDialog.java
@@ -30,8 +30,9 @@ import org.eclipse.swt.widgets.Shell;
* @author Mik Kersten
* @author Rob Elves
* @author Shawn Minto
- * @since 3.3
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.InPlaceDateSelectionDialog} instead
*/
+@Deprecated
public class InPlaceDateSelectionDialog extends AbstractInPlaceDialog {
private Date selectedDate = null;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDialogEvent.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDialogEvent.java
index dd7b08f3..784fd3e5 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDialogEvent.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDialogEvent.java
@@ -15,8 +15,9 @@ package org.eclipse.mylyn.internal.provisional.commons.ui.dialogs;
* Event sent with an {@link IInPlaceDialogListener} that contains information about the close event that occurred
*
* @author Shawn Minto
- * @since 3.3
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.InPlaceDialogEvent} instead
*/
+@Deprecated
public class InPlaceDialogEvent {
private final int returnCode;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java
index eafd5bad..41de108c 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java
@@ -13,9 +13,6 @@ package org.eclipse.mylyn.internal.provisional.commons.ui.dialogs;
import org.eclipse.osgi.util.NLS;
-/**
- * @since 3.3
- */
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.messages"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java
index 600f37bb..226d2fbe 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java
@@ -26,7 +26,9 @@ import org.eclipse.swt.widgets.Shell;
* Wizard dialog for displaying repository settings page. Necessary so we can add a validate button in the button bar.
*
* @author Helen Bershadskaya
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.ValidatableWizardDialog} instead
*/
+@Deprecated
public class ValidatableWizardDialog extends EnhancedWizardDialog {
private static final String VALIDATE_BUTTON_KEY = "validate"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java
index 51999a76..a136d3d3 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java
@@ -46,7 +46,9 @@ import org.eclipse.ui.statushandlers.StatusManager;
*
* @author Shawn Minto
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.WebBrowserDialog} instead
*/
+@Deprecated
public class WebBrowserDialog extends MessageDialog {
private String text;
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/EditorBusyIndicator.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/EditorBusyIndicator.java
index 18de4e8a..83db3c8a 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/EditorBusyIndicator.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/EditorBusyIndicator.java
@@ -24,7 +24,9 @@ import org.eclipse.ui.PlatformUI;
*
* @author Shawn Minto
* @author Steffen Pingel
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.EditorBusyIndicator} instead
*/
+@Deprecated
public class EditorBusyIndicator {
private class Animator implements Runnable {
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/IBusyEditor.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/IBusyEditor.java
index 3f8c8e75..ec5ad50b 100644
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/IBusyEditor.java
+++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/IBusyEditor.java
@@ -20,7 +20,9 @@ import org.eclipse.ui.part.WorkbenchPart;
*
* @author Shawn Minto
* @see EditorBusyIndicator
+ * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.IBusyEditor} instead
*/
+@Deprecated
public interface IBusyEditor {
/**

Back to the top