Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui')
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSorter.java109
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java433
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java245
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotification.java45
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java610
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java139
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ClipboardCopier.java93
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonColors.java41
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFonts.java107
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java70
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImageManger.java71
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java430
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonPropertyTester.java31
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonTextSupport.java334
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonThemes.java60
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java275
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonsUiUtil.java146
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePicker.java325
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePickerPanel.java285
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DateSelectionDialog.java106
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DecoratingPatternStyledCellLabelProvider.java255
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DelayedRefreshJob.java105
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java156
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientCanvas.java352
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java215
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientToolTip.java89
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java25
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/IFilteredTreeListener.java23
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/Messages.java33
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java198
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java258
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java208
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScalingHyperlink.java110
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java92
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SearchHistoryPopUpDialog.java455
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectionProviderAdapter.java80
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java338
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SubstringPatternFilter.java31
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableSorter.java39
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java32
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableViewerSupport.java133
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java488
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeSorter.java40
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java131
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java257
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java339
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/CollapseAllAction.java42
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java42
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/Messages.java38
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java34
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/messages.properties5
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractDeleteLineHandler.java56
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractTextViewerHandler.java50
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineHandler.java29
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToBeginningHandler.java29
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToEndHandler.java29
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineHandler.java29
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToBeginningHandler.java29
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToEndHandler.java29
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/AbstractInPlaceDialog.java319
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java124
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java25
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java27
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceCheckBoxTreeDialog.java204
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDateSelectionDialog.java97
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDialogEvent.java39
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java28
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java126
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java156
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/messages.properties11
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/EditorBusyIndicator.java143
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/IBusyEditor.java41
-rw-r--r--org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/messages.properties14
73 files changed, 0 insertions, 10232 deletions
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
deleted file mode 100644
index fbdca8c7..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSorter.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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.ViewerSorter;
-import org.eclipse.swt.SWT;
-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;
- } else if (key2 == null) {
- return -1;
- }
- return key1.compareTo(key2);
- }
-
- abstract I getSortColumn(V viewer);
-
- abstract int getSortDirection(V viewer);
-
- abstract int getColumnIndex(V viewer, I column);
-
- @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);
- }
-
- protected int compareDefault(V viewer, Object e1, Object e2) {
- return super.compare(viewer, e1, e2);
- }
-
- @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/internal/provisional/commons/ui/AbstractColumnViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java
deleted file mode 100644
index 8281221d..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractColumnViewerSupport.java
+++ /dev/null
@@ -1,433 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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.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;
-import org.eclipse.ui.IMemento;
-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 {
- // 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);
-
- IMemento[] 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
- }
-
- IMemento 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];
- IMemento 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) {
- IMemento 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/internal/provisional/commons/ui/AbstractFilteredTree.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java
deleted file mode 100644
index 9a068dc7..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractFilteredTree.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-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.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Point;
-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.ui.dialogs.PatternFilter;
-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;
-
- private static final int FILTER_WIDTH_MAX = 300;
-
- private static final float FILTER_WIDTH_RATIO = 0.35f;
-
- public static final String LABEL_FIND = Messages.AbstractFilteredTree_Find;
-
- private WorkbenchJob refreshJob;
-
- private AdaptiveRefreshPolicy refreshPolicy;
-
- private Composite progressComposite;
-
- private Composite searchComposite;
-
- private boolean showProgress = false;
-
- private String previousFilterText;
-
- /**
- * XXX: using reflection to gain access
- *
- * @param parent
- * @param treeStyle
- * @param filter
- */
- public AbstractFilteredTree(Composite parent, int treeStyle, PatternFilter filter) {
- super(parent, treeStyle, filter, true);
- try {
- // the super constructor calls doCreateRefreshJob() which assigns refreshJob
- refreshPolicy = new AdaptiveRefreshPolicy(refreshJob);
-
- } catch (Exception e) {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, "Could not get refresh job", e)); //$NON-NLS-1$
- }
- setInitialText(LABEL_FIND);
- }
-
- @Override
- protected WorkbenchJob doCreateRefreshJob() {
- this.refreshJob = super.doCreateRefreshJob();
- return this.refreshJob;
- }
-
- @Override
- protected void createControl(Composite parent, int treeStyle) {
- super.createControl(parent, treeStyle);
-
- // Override superclass layout settings...
- GridLayout layout = (GridLayout) getLayout();
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- }
-
- @Override
- protected Control createTreeControl(Composite parent, int style) {
- progressComposite = createProgressComposite(parent);
-// progressComposite.setVisible(false);
-// ((GridData) progressComposite.getLayoutData()).exclude = true;
-
- searchComposite = createSearchComposite(parent);
- if (searchComposite != null) {
- searchComposite.setVisible(false);
- ((GridData) searchComposite.getLayoutData()).exclude = true;
- }
-
- return super.createTreeControl(parent, style);
- }
-
- @Override
- protected Composite createFilterControls(final Composite parent) {
- // replace filterComposite by a new composite
- filterComposite = new Composite(parent.getParent(), SWT.NONE);
- GridLayout gridLayout = new GridLayout(1, false);
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- gridLayout.marginLeft = 3;
- gridLayout.marginTop = 5;
- gridLayout.marginBottom = 3;
- gridLayout.verticalSpacing = 0;
- filterComposite.setLayout(gridLayout);
-
- // let FilteredTree create the find and clear control
- super.createFilterControls(parent);
- GridDataFactory.fillDefaults()
- .align(SWT.BEGINNING, SWT.CENTER)
- .grab(false, false)
- .hint(FILTER_WIDTH_MIN, SWT.DEFAULT)
- .minSize(FILTER_WIDTH_MIN, SWT.DEFAULT)
- .applyTo(parent);
- filterComposite.addControlListener(new ControlAdapter() {
- boolean handlingEvents;
-
- @Override
- public void controlResized(ControlEvent e) {
- if (handlingEvents) {
- return;
- }
- try {
- handlingEvents = true;
- Point size = parent.getParent().getSize();
- int width = Math.max(FILTER_WIDTH_MIN, (int) (size.x * FILTER_WIDTH_RATIO));
- int offset = 1;
- if (parent.getParent().getLayoutData() instanceof GridData) {
- offset = ((GridLayout) parent.getParent().getLayout()).marginWidth
- + ((GridLayout) parent.getParent().getLayout()).marginLeft
- + ((GridLayout) parent.getParent().getLayout()).horizontalSpacing;
- }
- ((GridData) parent.getLayoutData()).widthHint = Math.min(width, FILTER_WIDTH_MAX) + offset;
- ((GridData) filterText.getParent().getLayoutData()).widthHint = Math.min(width, FILTER_WIDTH_MAX);
- parent.getParent().layout();
- } finally {
- handlingEvents = false;
- }
- }
- });
- filterText.addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.character == SWT.ESC && e.doit) {
- setFilterText(""); //$NON-NLS-1$
- }
- }
- });
- ((GridData) filterText.getLayoutData()).verticalAlignment = SWT.CENTER;
-
- // move original filterComposite on new filterComposite
- parent.setParent(filterComposite);
-
- Composite workingSetComposite = createActiveWorkingSetComposite(filterComposite);
- GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, false).applyTo(workingSetComposite);
-
- Composite activeTaskComposite = createActiveTaskComposite(filterComposite);
- GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(true, false).applyTo(activeTaskComposite);
-
- gridLayout.numColumns = filterComposite.getChildren().length;
- return parent;
- }
-
- protected abstract Composite createProgressComposite(Composite container);
-
- protected abstract Composite createActiveWorkingSetComposite(Composite container);
-
- protected abstract Composite createActiveTaskComposite(Composite container);
-
- protected Composite createSearchComposite(Composite container) {
- return null;
- }
-
- @Override
- protected void textChanged() {
- // this call allows the filtered tree to preserve the selection when the clear button is used.
- // It is necessary to correctly set the private narrowingDown flag in the super class.
- // Note that the scheduling of the refresh job that is done in the super class will be overridden
- // by the call to refreshPolicy.textChanged().
- String text = getFilterString();
- if (text == null || text.equals(previousFilterText)) {
- return;
- }
- super.textChanged();
-
- previousFilterText = text;
-
- if (refreshPolicy != null) {
- if (LABEL_FIND.equals(text) && !useNewLook) {
- clearText();
- refreshPolicy.textChanged(""); //$NON-NLS-1$
- } else {
- refreshPolicy.textChanged(text);
- }
- }
- // bug 165353 work-around for premature return at FilteredTree.java:374
- updateToolbar(true);
- }
-
- @Deprecated
- protected Job getRefreshJob() {
- return refreshJob;
- }
-
- public AdaptiveRefreshPolicy getRefreshPolicy() {
- return refreshPolicy;
- }
-
- public boolean isShowProgress() {
- return showProgress;
- }
-
- public void setShowProgress(boolean showProgress) {
- this.showProgress = showProgress;
- progressComposite.setVisible(showProgress);
- ((GridData) progressComposite.getLayoutData()).exclude = !showProgress;
- getParent().getParent().layout(true, true);
- }
-
- public void setShowSearch(boolean showSearch) {
- if (searchComposite != null) {
- searchComposite.setVisible(showSearch);
- ((GridData) searchComposite.getLayoutData()).exclude = !showSearch;
- getParent().getParent().layout(true, true);
- }
- }
-}
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
deleted file mode 100644
index 7c9e59a5..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotification.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.IAdaptable;
-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();
-
- public abstract String getDescription();
-
- public abstract String getLabel();
-
- public abstract Image getNotificationImage();
-
- public abstract Image getNotificationKindImage();
-
- public abstract Date getDate();
-
- public abstract void setDate(Date date);
-
- public Object getToken() {
- return null;
- }
-
-}
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
deleted file mode 100644
index 986c372a..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java
+++ /dev/null
@@ -1,610 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2009 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Benjamin Pasero - intial API and implementation
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.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.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.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;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseTrackAdapter;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Region;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Monitor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @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;
-
- 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) {
- // always use the launching workbench window
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- if (windows != null && windows.length > 0) {
- IWorkbenchWindow workbenchWindow = windows[0];
- if (workbenchWindow != null && !workbenchWindow.getShell().isDisposed()) {
- Image image = getShell().getImage();
- int diff = Integer.MAX_VALUE;
- if (image != null && image.getBounds().height <= maximumHeight) {
- diff = maximumHeight - image.getBounds().height;
- } else {
- image = null;
- }
-
- Image[] images = getShell().getImages();
- if (images != null && images.length > 0) {
- // find the icon that is closest in size, but not larger than maximumHeight
- for (Image image2 : images) {
- int newDiff = maximumHeight - image2.getBounds().height;
- if (newDiff >= 0 && newDiff <= diff) {
- diff = newDiff;
- image = image2;
- }
- }
- }
-
- return image;
- }
- }
- return null;
- }
-
- /**
- * Override to populate with notifications.
- *
- * @param parent
- */
- protected void createContentArea(Composite parent) {
- // empty by default
- }
-
- /**
- * Override to customize the title bar
- */
- protected void createTitleArea(Composite parent) {
- ((GridData) parent.getLayoutData()).heightHint = TITLE_HEIGHT;
-
- Label titleImageLabel = new Label(parent, SWT.NONE);
- titleImageLabel.setImage(getPopupShellImage(TITLE_HEIGHT));
-
- Label titleTextLabel = new Label(parent, SWT.NONE);
- titleTextLabel.setText(getPopupShellTitle());
- titleTextLabel.setFont(CommonFonts.BOLD);
- titleTextLabel.setForeground(getTitleForeground());
-// titleTextLabel.setForeground(color.getTitleText());
- titleTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
- titleTextLabel.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
-
- final Label button = new Label(parent, SWT.NONE);
- button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
- button.addMouseTrackListener(new MouseTrackAdapter() {
- @Override
- public void mouseEnter(MouseEvent e) {
- button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE_HOVER));
- }
-
- @Override
- public void mouseExit(MouseEvent e) {
- button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
- }
- });
- button.addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- close();
- setReturnCode(CANCEL);
- }
-
- });
- }
-
- protected Color getTitleForeground() {
- return color.getTitleText();
- }
-
- private void initResources() {
- color = new 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/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java
deleted file mode 100644
index 2b57ec13..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/AdaptiveRefreshPolicy.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-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;
-
- private final Set<IFilteredTreeListener> listeners = new HashSet<IFilteredTreeListener>();
-
- private String oldText = ""; //$NON-NLS-1$
-
- protected Job refreshJob;
-
- @Deprecated
- public AdaptiveRefreshPolicy(Job refreshJob, Text filterText) {
- this(refreshJob);
- }
-
- public AdaptiveRefreshPolicy(Job refreshJob) {
- Assert.isNotNull(refreshJob);
- this.refreshJob = refreshJob;
- refreshJob.addJobChangeListener(REFRESH_JOB_LISTENER);
- }
-
- public void dispose() {
- refreshJob.removeJobChangeListener(REFRESH_JOB_LISTENER);
- }
-
- protected final IJobChangeListener REFRESH_JOB_LISTENER = new IJobChangeListener() {
-
- public void aboutToRun(IJobChangeEvent event) {
- // ignore
- }
-
- public void awake(IJobChangeEvent event) {
- // ignore
- }
-
- public void done(IJobChangeEvent event) {
- if (event.getResult().isOK()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- for (IFilteredTreeListener listener : listeners) {
- listener.filterTextChanged(oldText);
- }
- }
- });
- }
- }
-
- public void running(IJobChangeEvent event) {
- // ignore
- }
-
- public void scheduled(IJobChangeEvent event) {
- // ignore
- }
-
- public void sleeping(IJobChangeEvent event) {
- // ignore
- }
- };
-
- public void textChanged(String text) {
- if (text == null || text.equals(oldText)) {
- return;
- }
-
- refreshJob.cancel();
- int delay = 0;
- int textLength = text.length();
- if (textLength > 0) {
- delay = (int) (this.refreshDelay / (textLength * 0.6));
- }
- refreshJob.schedule(delay);
-
- this.oldText = text;
- }
-
- /**
- * the filter has changed in some way (not the text)
- */
- public void filterChanged() {
- refreshJob.cancel();
- refreshJob.schedule(refreshDelay / 2);
- }
-
- /**
- * for testing purposes only
- */
- public void internalForceRefresh() {
- ((WorkbenchJob) refreshJob).runInUIThread(new NullProgressMonitor());
- }
-
- public void addListener(IFilteredTreeListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(IFilteredTreeListener listener) {
- listeners.remove(listener);
- }
-
- public void setRefreshDelay(int refreshDelay) {
- this.refreshDelay = refreshDelay;
- }
-
- public int getRefreshDelay() {
- return refreshDelay;
- }
-
-}
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
deleted file mode 100644
index a36d1641..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ClipboardCopier.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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.provisional.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;
-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 {
-
- 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$
-
- public static ClipboardCopier getDefault() {
- return instance;
- }
-
- private Clipboard clipboard;
-
- 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) {
- Display display = PlatformUI.getWorkbench().getDisplay();
- clipboard = new Clipboard(display);
- }
-
- TextTransfer textTransfer = TextTransfer.getInstance();
- clipboard.setContents(new Object[] { text }, new Transfer[] { textTransfer });
- }
-
- public void dispose() {
- if (clipboard != null) {
- clipboard.dispose();
- clipboard = null;
- }
- }
-
-}
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
deleted file mode 100644
index 1e621d4e..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonColors.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author Mik Kersten
- * @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);
-
- public static final Color TEXT_QUOTED = new Color(Display.getDefault(), 38, 86, 145);
-
- public static final Color TEXT_SPELLING_ERROR = new Color(Display.getDefault(), 255, 0, 0);
-
- public static final Color GRAY_MID = new Color(Display.getDefault(), 100, 100, 100);
-
- /**
- * NOTE: disposal of JFaceResources fonts handled by registry.
- */
- public static void dispose() {
- HYPERLINK_WIDGET.dispose();
- TEXT_QUOTED.dispose();
- TEXT_SPELLING_ERROR.dispose();
- }
-
-}
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
deleted file mode 100644
index 213f785d..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFonts.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.jface.resource.FontRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author Mik Kersten
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.compatibility.CommonFonts} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/CommonFormUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java
deleted file mode 100644
index a3d6a63e..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonFormUtil.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui;
-
-import java.lang.reflect.Method;
-
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-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) {
- form.setData(FormUtil.FOCUS_SCROLLING, Boolean.FALSE);
- }
-
- public static void ensureVisible(Control control) {
- ScrolledComposite form = FormUtil.getScrolledComposite(control);
- if (form != null) {
- if (control instanceof StyledText) {
- // bug 299392: ensure that the caret is visible for styled text but avoid scrolling form if only a portion of the control is visible
- Point origin = FormUtil.getControlLocation(form, control);
- Point caretLocation = ((StyledText) control).getCaret().getLocation();
- origin.x += caretLocation.x;
- origin.y += caretLocation.y;
- FormUtil.ensureVisible(form, origin, new Point(20, 20));
- } else {
- FormUtil.ensureVisible(form, control);
- }
- }
- }
-
- /**
- * Programmatically expand the provided ExpandableComposite, using reflection to fire the expansion listeners (see
- * bug#70358)
- *
- * @param comp
- */
- public static void setExpanded(ExpandableComposite comp, boolean expanded) {
- if (comp.isExpanded() != expanded) {
- Method method = null;
- try {
- method = ExpandableComposite.class.getDeclaredMethod("programmaticToggleState"); //$NON-NLS-1$
- method.setAccessible(true);
- method.invoke(comp);
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
-}
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
deleted file mode 100644
index 5dd16e6f..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImageManger.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * 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
- * Perforce - fixes for bug 343892
- * GitHub - fixes for bug 350333
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.resource.LocalResourceManager;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-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$
-
- private final LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources());
-
- public CommonImageManger() {
- }
-
- public void dispose() {
- resourceManager.dispose();
- }
-
- public Image getFileImage(String filename) {
- if (filename != null) {
- int dotIndex = filename.lastIndexOf('.');
- if (dotIndex != -1) {
- String fileType = filename.substring(dotIndex + 1);
- for (String element2 : IMAGE_EXTENSIONS) {
- if (element2.equalsIgnoreCase(fileType)) {
- return CommonImages.getImage(CommonImages.IMAGE_FILE);
- }
- }
- }
- String file = new Path(filename).lastSegment();
- if (file != null) {
- return getImage(PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(filename));
- }
- }
- return WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FILE);
- }
-
- public Image getImage(ImageDescriptor imageDescriptor) {
- return (Image) resourceManager.get(imageDescriptor);
- }
-
- public LocalResourceManager getResourceManager() {
- return resourceManager;
- }
-
-}
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
deleted file mode 100644
index 97b286c6..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-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
- * @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$
-
- 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;
- }
-
- public static Image getCompositeContainerImage(ImageDescriptor icon, boolean wide) {
- if (icon == null) {
- return null;
- }
- String key = "" + icon.hashCode(); //$NON-NLS-1$
- if (wide) {
- key += ".wide"; //$NON-NLS-1$
- }
- Image image = getImageRegistry().get(key);
- if (image == null) {
- CompositeContainerImageDescriptor imageDescriptor = new CompositeContainerImageDescriptor(icon,
- OVERLAY_CLEAR, wide);
- image = imageDescriptor.createImage(true);
- getImageRegistry().put(key, image);
- }
- return image;
- }
-
- public static Image getCompositeSynchImage(ImageDescriptor icon, boolean background) {
- String key = "" + icon.hashCode(); //$NON-NLS-1$
- if (background) {
- key += ".background"; //$NON-NLS-1$
- }
-
- Image image = getImageRegistry().get(key);
- if (image == null) {
- CompositeSyncImageDescriptor imageDescriptor = new CompositeSyncImageDescriptor(icon, background);
- image = imageDescriptor.createImage(true);
- getImageRegistry().put(key, image);
- }
- return image;
- }
-
- private static ImageRegistry getImageRegistry() {
- if (imageRegistry == null) {
- imageRegistry = new ImageRegistry();
- }
-
- return imageRegistry;
- }
-
- private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
- if (baseURL == null) {
- throw new MalformedURLException();
- }
-
- StringBuffer buffer = new StringBuffer(prefix);
- buffer.append('/');
- buffer.append(name);
- return new URL(baseURL, buffer.toString());
- }
-
- private static Image[] progressImages;
-
- public static Image[] getProgressImages() {
-
- if (progressImages != null) {
- return progressImages;
- }
-
- progressImages = new Image[8];
-
- for (int i = 1; i <= 8; i++) {
- ImageDescriptor imageDescriptor = create(T_EVIEW + "/progress", i + ".png"); //$NON-NLS-1$ //$NON-NLS-2$
- progressImages[i - 1] = getImage(imageDescriptor);
- }
-
- return progressImages;
-
- }
-}
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
deleted file mode 100644
index a7737dc9..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonPropertyTester.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-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
deleted file mode 100644
index af3ab73d..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonTextSupport.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.operations.IOperationHistoryListener;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.commands.ActionHandler;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.ActiveShellExpression;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.handlers.IHandlerActivation;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
-import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
-
-/**
- * Utility class that enables edit actions, content assist and quick fixing for {@link TextViewer} and
- * {@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 {
-
- private TextViewer viewer;
-
- public void historyNotification(OperationHistoryEvent event) {
- if (viewer != null && selectionChangedListener != null && Display.getCurrent() != null) {
- selectionChangedListener.selectionChanged(new SelectionChangedEvent(viewer, viewer.getSelection()));
- }
- }
-
- public void setViewer(TextViewer viewer) {
- this.viewer = viewer;
- }
-
- }
-
- private class TextViewerFocusListener implements FocusListener {
-
- private final boolean spellCheck;
-
- private final TextViewer viewer;
-
- public TextViewerFocusListener(TextViewer viewer, boolean spellCheck) {
- this.viewer = viewer;
- this.spellCheck = spellCheck;
- }
-
- public void focusGained(FocusEvent e) {
- if (selectionChangedListener != null) {
- selectionChangedListener.selectionChanged(new SelectionChangedEvent(viewer, viewer.getSelection()));
- }
- activateHandlers(viewer, spellCheck);
- }
-
- public void focusLost(FocusEvent e) {
- deactivateHandlers();
- if (selectionChangedListener != null) {
- // make sure selection no text is selected when control looses focus
- StyledText st = (StyledText) e.widget;
- st.setSelectionRange(st.getCaretOffset(), 0);
- // update action enablement
- selectionChangedListener.selectionChanged(new SelectionChangedEvent(viewer, StructuredSelection.EMPTY));
- }
- }
- }
-
- private static final String KEY_TEXT_VIEWER = "textViewer"; //$NON-NLS-1$
-
- private static boolean canDoGlobalAction(String actionId, TextViewer textViewer) {
- if (actionId.equals(ActionFactory.CUT.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.CUT);
- } else if (actionId.equals(ActionFactory.COPY.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.COPY);
- } else if (actionId.equals(ActionFactory.PASTE.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.PASTE);
- } else if (actionId.equals(ActionFactory.DELETE.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.DELETE);
- } else if (actionId.equals(ActionFactory.UNDO.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.UNDO);
- } else if (actionId.equals(ActionFactory.REDO.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.REDO);
- } else if (actionId.equals(ActionFactory.SELECT_ALL.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.SELECT_ALL);
- }
- return false;
- }
-
- public static boolean canPerformAction(String actionId, Control focusControl) {
- TextViewer viewer = getTextViewer(focusControl);
- if (viewer != null) {
- return canDoGlobalAction(actionId, viewer);
- }
- if (actionId.equals(ActionFactory.UNDO.getId()) || actionId.equals(ActionFactory.REDO.getId())) {
- return false;
- }
- return true;
- }
-
- private static boolean canPerformDirectly(String id, Control control) {
- if (control instanceof Text) {
- Text text = (Text) control;
- if (id.equals(ActionFactory.CUT.getId())) {
- text.cut();
- return true;
- }
- if (id.equals(ActionFactory.COPY.getId())) {
- text.copy();
- return true;
- }
- if (id.equals(ActionFactory.PASTE.getId())) {
- text.paste();
- return true;
- }
- if (id.equals(ActionFactory.SELECT_ALL.getId())) {
- text.selectAll();
- return true;
- }
- if (id.equals(ActionFactory.DELETE.getId())) {
- int count = text.getSelectionCount();
- if (count == 0) {
- int caretPos = text.getCaretPosition();
- text.setSelection(caretPos, caretPos + 1);
- }
- text.insert(""); //$NON-NLS-1$
- return true;
- }
- }
- return false;
- }
-
- public static void doAction(String actionId, Control focusControl) {
- if (canPerformDirectly(actionId, focusControl)) {
- return;
- }
- TextViewer viewer = getTextViewer(focusControl);
- if (viewer != null) {
- doGlobalAction(actionId, viewer);
- }
- }
-
- private static boolean doGlobalAction(String actionId, TextViewer textViewer) {
- if (actionId.equals(ActionFactory.CUT.getId())) {
- textViewer.doOperation(ITextOperationTarget.CUT);
- return true;
- } else if (actionId.equals(ActionFactory.COPY.getId())) {
- textViewer.doOperation(ITextOperationTarget.COPY);
- return true;
- } else if (actionId.equals(ActionFactory.PASTE.getId())) {
- textViewer.doOperation(ITextOperationTarget.PASTE);
- return true;
- } else if (actionId.equals(ActionFactory.DELETE.getId())) {
- textViewer.doOperation(ITextOperationTarget.DELETE);
- return true;
- } else if (actionId.equals(ActionFactory.UNDO.getId())) {
- textViewer.doOperation(ITextOperationTarget.UNDO);
- return true;
- } else if (actionId.equals(ActionFactory.REDO.getId())) {
- textViewer.doOperation(ITextOperationTarget.REDO);
- return true;
- } else if (actionId.equals(ActionFactory.SELECT_ALL.getId())) {
- textViewer.doOperation(ITextOperationTarget.SELECT_ALL);
- return true;
- }
- return false;
- }
-
- public static TextViewer getTextViewer(Widget widget) {
- if (widget instanceof StyledText) {
- Object data = widget.getData(KEY_TEXT_VIEWER);
- if (data instanceof TextViewer) {
- return (TextViewer) data;
- }
- }
- return null;
- }
-
- public static void setTextViewer(Widget widget, TextViewer textViewer) {
- widget.setData(KEY_TEXT_VIEWER, textViewer);
- }
-
- public IHandlerActivation contentAssistHandlerActivation;
-
- private final IHandlerService handlerService;
-
- private IHandlerActivation quickAssistHandlerActivation;
-
- private ISelectionChangedListener selectionChangedListener;
-
- private final UndoRedoListener undoRedoListener;
-
- public CommonTextSupport(IHandlerService handlerService) {
- Assert.isNotNull(handlerService);
- this.handlerService = handlerService;
- this.undoRedoListener = new UndoRedoListener();
- }
-
- private IHandlerActivation activateHandler(TextViewer viewer, int operation, String actionDefinitionId) {
- IHandler handler = createActionHandler(viewer, operation, actionDefinitionId);
- return handlerService.activateHandler(actionDefinitionId, handler, //
- new ActiveShellExpression(viewer.getTextWidget().getShell()));
- }
-
- private void activateHandlers(TextViewer viewer, boolean spellCheck) {
- deactivateHandlers();
- if (spellCheck) {
- quickAssistHandlerActivation = activateHandler(viewer, ISourceViewer.QUICK_ASSIST,
- ITextEditorActionDefinitionIds.QUICK_ASSIST);
- }
- contentAssistHandlerActivation = activateHandler(viewer, ISourceViewer.CONTENTASSIST_PROPOSALS,
- ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
-
- undoRedoListener.setViewer(viewer);
- OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(undoRedoListener);
- }
-
- public void configure(final TextViewer viewer, Document document, boolean spellCheck) {
- if (spellCheck && viewer instanceof ISourceViewer) {
- configureAsEditor((ISourceViewer) viewer, document);
- } else {
- viewer.setDocument(document);
- }
- install(viewer, spellCheck);
- }
-
- /** Configures annotation model for spell checking. */
- private void configureAsEditor(ISourceViewer viewer, Document document) {
- IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
- final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(viewer, null, annotationAccess,
- EditorsUI.getSharedTextColors());
- Iterator<?> e = new MarkerAnnotationPreferences().getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- support.setAnnotationPreference((AnnotationPreference) e.next());
- }
- support.install(EditorsUI.getPreferenceStore());
- viewer.getTextWidget().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- support.uninstall();
- }
- });
- AnnotationModel annotationModel = new AnnotationModel();
- viewer.setDocument(document, annotationModel);
- }
-
- private IHandler createActionHandler(final ITextOperationTarget viewer, final int operation,
- String actionDefinitionId) {
- Action action = new Action() {
- @Override
- public void run() {
- if (viewer.canDoOperation(operation)) {
- viewer.doOperation(operation);
- }
- }
- };
- action.setActionDefinitionId(actionDefinitionId);
- return new ActionHandler(action);
- }
-
- private void deactivateHandlers() {
- if (quickAssistHandlerActivation != null) {
- handlerService.deactivateHandler(quickAssistHandlerActivation);
- quickAssistHandlerActivation = null;
- }
- if (contentAssistHandlerActivation != null) {
- handlerService.deactivateHandler(contentAssistHandlerActivation);
- contentAssistHandlerActivation = null;
- }
-
- undoRedoListener.setViewer(null);
- OperationHistoryFactory.getOperationHistory().removeOperationHistoryListener(undoRedoListener);
- }
-
- public void dispose() {
- deactivateHandlers();
- }
-
- public ISelectionChangedListener getSelectionChangedListener() {
- return selectionChangedListener;
- }
-
- public void install(final TextViewer viewer, boolean spellCheck) {
- viewer.getControl().addFocusListener(new TextViewerFocusListener(viewer, spellCheck));
- if (selectionChangedListener != null) {
- viewer.addSelectionChangedListener(selectionChangedListener);
- }
- setTextViewer(viewer.getControl(), viewer);
- }
-
- public void setSelectionChangedListener(ISelectionChangedListener selectionChangedListener) {
- this.selectionChangedListener = selectionChangedListener;
- }
-
-}
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
deleted file mode 100644
index a1804f85..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonThemes.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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.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$
-
- 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/internal/provisional/commons/ui/CommonUiUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java
deleted file mode 100644
index e00b2217..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonUiUtil.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * 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.provisional.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.core.runtime.jobs.ISchedulingRule;
-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.internal.commons.ui.CommonsUiPlugin;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-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$
-
- public static void busyCursorWhile(final ICoreRunnable runnable) throws OperationCanceledException, 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();
- }
- }
- };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runner);
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- throw (CoreException) e.getCause();
- } else {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, "Unexpected exception", e)); //$NON-NLS-1$
- }
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- 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 {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, "Unexpected exception", e)); //$NON-NLS-1$
- }
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- public static void runInUi(ICoreRunnable runnable, ISchedulingRule rule) throws CoreException {
- runInUi(PlatformUI.getWorkbench().getProgressService(), runnable, rule);
- }
-
- public static void runInUi(IRunnableContext context, final ICoreRunnable runnable, ISchedulingRule rule)
- 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();
- }
- }
- };
- PlatformUI.getWorkbench().getProgressService().runInUI(context, runner, rule);
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- throw (CoreException) e.getCause();
- } else {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.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 CommonUiUtil.toLabel(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/internal/provisional/commons/ui/CommonsUiUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonsUiUtil.java
deleted file mode 100644
index 5e6edcb6..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonsUiUtil.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-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.internal.commons.ui.CommonsUiPlugin;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Steffen Pingel
- * @deprecated use {@link CommonUiUtil} instead
- */
-@Deprecated
-public class CommonsUiUtil {
-
- public static void busyCursorWhile(final ICoreRunnable runnable) throws OperationCanceledException, 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();
- }
- }
- };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runner);
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- throw (CoreException) e.getCause();
- } else {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, "Unexpected exception", e)); //$NON-NLS-1$
- }
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- 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 {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, "Unexpected exception", e)); //$NON-NLS-1$
- }
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- public static void runInUi(ICoreRunnable runnable, ISchedulingRule rule) throws CoreException {
- runInUi(PlatformUI.getWorkbench().getProgressService(), runnable, rule);
- }
-
- public static void runInUi(IRunnableContext context, final ICoreRunnable runnable, ISchedulingRule rule)
- 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();
- }
- }
- };
- PlatformUI.getWorkbench().getProgressService().runInUI(context, runner, rule);
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- throw (CoreException) e.getCause();
- } else {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.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;
- }
- }
-
-}
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
deleted file mode 100644
index 6fe7f3ab..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePicker.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.commons.ui.Messages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.IInPlaceDialogListener;
-import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.InPlaceDateSelectionDialog;
-import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.InPlaceDialogEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * Temporary date picker from patch posted to: https://bugs.eclipse.org/bugs/show_bug.cgi?taskId=19945 see bug# 19945
- * TODO: remove this class when an SWT date picker is added
- *
- * @author Bahadir Yagan
- * @author Mik Kersten
- * @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;
-
- public static final String LABEL_CHOOSE = Messages.DatePicker_Choose_Date;
-
- private Text dateText;
-
- private Button pickButton;
-
- private Calendar date;
-
- private final List<SelectionListener> pickerListeners = new LinkedList<SelectionListener>();
-
- private DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
-
- private String initialText = LABEL_CHOOSE;
-
- private final boolean includeTimeOfday;
-
- private final int hourOfDay = 0;
-
- private int selectedHourOfDay = 0;
-
- private ImageHyperlink clearControl;
-
- public DatePicker(Composite parent, int style, String initialText, boolean includeHours, int selectedHourOfDay) {
- super(parent, style);
- this.initialText = initialText;
- this.includeTimeOfday = includeHours;
- this.selectedHourOfDay = selectedHourOfDay;
- initialize((style & SWT.FLAT) != 0 ? SWT.FLAT : 0);
- }
-
- public DateFormat getDateFormat() {
- return dateFormat;
- }
-
- public void setDatePattern(String pattern) {
- this.dateFormat = new SimpleDateFormat(pattern);
- }
-
- public void setDateFormat(DateFormat dateFormat) {
- this.dateFormat = dateFormat;
- }
-
- private void initialize(int style) {
- GridLayout gridLayout = new GridLayout(3, false);
- gridLayout.horizontalSpacing = 0;
- gridLayout.verticalSpacing = 0;
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- this.setLayout(gridLayout);
-
- dateText = new Text(this, style);
- GridData dateTextGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
- dateTextGridData.heightHint = 5;
- dateTextGridData.grabExcessHorizontalSpace = true;
- dateTextGridData.verticalAlignment = SWT.FILL;
-
- dateText.setLayoutData(dateTextGridData);
- dateText.setText(initialText);
- dateText.addFocusListener(new FocusAdapter() {
- Calendar calendar = Calendar.getInstance();
-
- @Override
- public void focusLost(FocusEvent e) {
- Date reminderDate;
- try {
- reminderDate = dateFormat.parse(dateText.getText());
- calendar.setTime(reminderDate);
- date = calendar;
- updateDateText();
- notifyPickerListeners();
- } catch (ParseException e1) {
- updateDateText();
- }
-
- }
- });
-
- clearControl = new ImageHyperlink(this, SWT.NONE);
- clearControl.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR_DISABLED));
- clearControl.setHoverImage(CommonImages.getImage(CommonImages.FIND_CLEAR));
- clearControl.setToolTipText(Messages.DatePicker_Clear);
- clearControl.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- dateSelected(false, null);
- }
-
- });
- clearControl.setBackground(clearControl.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- GridData clearButtonGridData = new GridData();
- clearButtonGridData.horizontalIndent = 3;
- clearControl.setLayoutData(clearButtonGridData);
-
- pickButton = new Button(this, style | SWT.ARROW | SWT.DOWN);
- GridData pickButtonGridData = new GridData(SWT.RIGHT, SWT.FILL, false, true);
- pickButtonGridData.verticalIndent = 0;
- pickButtonGridData.horizontalIndent = 3;
- pickButton.setLayoutData(pickButtonGridData);
- pickButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent arg0) {
- final Calendar newCalendar = Calendar.getInstance();
- newCalendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
- newCalendar.set(Calendar.MINUTE, 0);
- newCalendar.set(Calendar.SECOND, 0);
- newCalendar.set(Calendar.MILLISECOND, 0);
- if (date != null) {
- newCalendar.setTime(date.getTime());
- }
- Shell shell = pickButton.getShell();
- if (shell == null) {
- //fall back
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- } else {
- shell = new Shell(PlatformUI.getWorkbench().getDisplay());
- }
- }
-
- final InPlaceDateSelectionDialog dialog = new InPlaceDateSelectionDialog(shell, pickButton,
- newCalendar, DatePicker.TITLE_DIALOG, includeTimeOfday, selectedHourOfDay);
- dialog.addEventListener(new IInPlaceDialogListener() {
-
- public void buttonPressed(InPlaceDialogEvent event) {
- Calendar selectedCalendar = null;
- if (event.getReturnCode() == Window.OK && dialog.getDate() != null) {
- selectedCalendar = newCalendar;
- selectedCalendar.setTime(dialog.getDate());
- }
- dateSelected(event.getReturnCode() == Window.CANCEL, selectedCalendar);
- }
- });
- dialog.open();
- }
- });
- updateClearControlVisibility();
- pack();
- setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- }
-
- public void addPickerSelectionListener(SelectionListener listener) {
- pickerListeners.add(listener);
- }
-
- /**
- * must check for null return value
- *
- * @return Calendar
- */
- public Calendar getDate() {
- return date;
- }
-
- @Override
- public void setBackground(Color backgroundColor) {
- super.setBackground(backgroundColor);
- dateText.setBackground(backgroundColor);
- if ((getStyle() & SWT.FLAT) != 0) {
- pickButton.setBackground(backgroundColor);
- clearControl.setBackground(backgroundColor);
- } else {
- pickButton.setBackground(null);
- clearControl.setBackground(null);
- }
- }
-
- public void setDate(Calendar date) {
- this.date = date;
- updateDateText();
- }
-
- // private void showDatePicker(int x, int y) {
- // pickerShell = new Shell(SWT.APPLICATION_MODAL);//| SWT.ON_TOP
- // pickerShell.setText("Shell");
- // pickerShell.setLayout(new FillLayout());
- // if (date == null) {
- // date = new GregorianCalendar();
- // }
- // // datePickerPanel.setDate(date);
- // datePickerPanel = new DatePickerPanel(pickerShell, SWT.NONE, date);
- // datePickerPanel.addSelectionChangedListener(new
- // ISelectionChangedListener() {
- //
- // public void selectionChanged(SelectionChangedEvent event) {
- // if(!event.getSelection().isEmpty()) {
- // dateSelected(event.getSelection().isEmpty(),
- // ((DateSelection)event.getSelection()).getDate());
- // } else {
- // dateSelected(false, null);
- // }
- // }});
- //
- // pickerShell.setSize(new Point(240, 180));
- // pickerShell.setLocation(new Point(x, y));
- //
- // datePickerPanel.addKeyListener(new KeyListener() {
- // public void keyPressed(KeyEvent e) {
- // if (e.keyCode == SWT.ESC) {
- // dateSelected(true, null);
- // }
- // }
- //
- // public void keyReleased(KeyEvent e) {
- // }
- // });
- //
- // pickerShell.addFocusListener(new FocusListener() {
- //
- // public void focusGained(FocusEvent e) {
- //
- // }
- //
- // public void focusLost(FocusEvent e) {
- //
- // }});
- //
- // pickerShell.pack();
- // pickerShell.open();
- // }
-
- /** Called when the user has selected a date */
- protected void dateSelected(boolean canceled, Calendar selectedDate) {
-
- if (!canceled) {
- this.date = selectedDate != null ? selectedDate : null;
- updateDateText();
- notifyPickerListeners();
- }
-
- }
-
- private void notifyPickerListeners() {
- for (SelectionListener listener : pickerListeners) {
- listener.widgetSelected(null);
- }
- }
-
- private void updateDateText() {
- if (date != null) {
- Date currentDate = new Date(date.getTimeInMillis());
- dateText.setText(dateFormat.format(currentDate));
- } else {
- dateText.setEnabled(false);
- dateText.setText(LABEL_CHOOSE);
- dateText.setEnabled(true);
- }
-
- updateClearControlVisibility();
- }
-
- private void updateClearControlVisibility() {
- if (clearControl != null && clearControl.getLayoutData() instanceof GridData) {
- GridData gd = (GridData) clearControl.getLayoutData();
- gd.exclude = date == null;
- clearControl.getParent().layout();
- }
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- dateText.setEnabled(enabled);
- pickButton.setEnabled(enabled);
- clearControl.setEnabled(enabled);
- super.setEnabled(enabled);
- }
-
-}
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
deleted file mode 100644
index a16286a9..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DatePickerPanel.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * 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:
- * Bahadir Yagan - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DateTime;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-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;
-
- private ISelection selection = null;
-
- private Calendar date = null;
-
- private DateTime calendar = null;
-
- private final List<ISelectionChangedListener> selectionListeners = new ArrayList<ISelectionChangedListener>();
-
- private int hourOfDay = 0;
-
- /**
- * @Since 3.3
- */
- public DatePickerPanel(Composite parent, int style, Calendar initialDate, boolean includeTime, int hourOfDay) {
- this(parent, style, initialDate, includeTime, hourOfDay, -1);
- }
-
- public DatePickerPanel(Composite parent, int style, Calendar initialDate, boolean includeTime, int hourOfDay,
- int marginSize) {
- super(parent, style);
- this.date = initialDate;
- this.hourOfDay = hourOfDay;
- initialize(includeTime, marginSize);
- setDate(date);
- //this.setBackground()
- }
-
- private void initialize(boolean includeTime, int marginSize) {
- if (date == null) {
- date = Calendar.getInstance();
- date.set(Calendar.HOUR_OF_DAY, hourOfDay);
- date.set(Calendar.MINUTE, 0);
- date.set(Calendar.SECOND, 0);
- date.set(Calendar.MILLISECOND, 0);
- }
-
- GridLayout gridLayout = new GridLayout();
- if (includeTime) {
- gridLayout.numColumns = 2;
- } else {
- gridLayout.numColumns = 1;
- }
- if (marginSize != -1) {
- gridLayout.marginWidth = marginSize;
- }
- this.setLayout(gridLayout);
-
- calendar = new DateTime(this, SWT.CALENDAR);
- calendar.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- date.set(Calendar.YEAR, calendar.getYear());
- date.set(Calendar.MONTH, calendar.getMonth());
- date.set(Calendar.DAY_OF_MONTH, calendar.getDay());
- setSelection(new DateSelection(date, true));
- notifyListeners(new SelectionChangedEvent(DatePickerPanel.this, getSelection()));
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- date.set(Calendar.YEAR, calendar.getYear());
- date.set(Calendar.MONTH, calendar.getMonth());
- date.set(Calendar.DAY_OF_MONTH, calendar.getDay());
- setSelection(new DateSelection(date));
- notifyListeners(new SelectionChangedEvent(DatePickerPanel.this, getSelection()));
- }
- });
-
- if (includeTime) {
- createTimeList(this);
- }
-
- Hyperlink todayLink = new Hyperlink(this, SWT.NONE);
- todayLink.setText(Messages.DatePickerPanel_Today);
- todayLink.setUnderlined(true);
- todayLink.setForeground(CommonColors.HYPERLINK_WIDGET);
- GridDataFactory.fillDefaults().span(2, 1).grab(true, false).align(SWT.CENTER, SWT.TOP).applyTo(todayLink);
- todayLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- Calendar today = Calendar.getInstance();
- ISelection selection = getSelection();
- if (selection instanceof DateSelection && !selection.isEmpty()) {
- Calendar selectedDate = ((DateSelection) selection).getDate();
- if (selectedDate != null) {
- today.set(Calendar.HOUR_OF_DAY, selectedDate.get(Calendar.HOUR_OF_DAY));
- today.set(Calendar.MINUTE, selectedDate.get(Calendar.MINUTE));
- today.set(Calendar.SECOND, selectedDate.get(Calendar.SECOND));
- today.set(Calendar.MILLISECOND, selectedDate.get(Calendar.MILLISECOND));
- }
- }
- setDate(today, true);
- }
- });
- }
-
- /**
- * This method initializes the month combo
- */
- private void createTimeList(Composite composite) {
-
- DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
- Calendar tempCalendar = Calendar.getInstance();
- tempCalendar.set(Calendar.MINUTE, 0);
- tempCalendar.set(Calendar.SECOND, 0);
- String[] times = new String[24];
- for (int x = 0; x < 24; x++) {
- tempCalendar.set(Calendar.HOUR_OF_DAY, x);
- String timeString = dateFormat.format(tempCalendar.getTime());
- times[x] = timeString;
- }
-
- ListViewer listViewer = new ListViewer(composite);
-
- listViewer.setContentProvider(new ArrayContentProvider());
- listViewer.setInput(times);
-
- timeList = listViewer.getList();
-
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- date.set(Calendar.HOUR_OF_DAY, timeList.getSelectionIndex());
- date.set(Calendar.MINUTE, 0);
- setSelection(new DateSelection(date));
- notifyListeners(new SelectionChangedEvent(DatePickerPanel.this, getSelection()));
- }
- });
-
- listViewer.addOpenListener(new IOpenListener() {
-
- public void open(OpenEvent event) {
- date.set(Calendar.HOUR_OF_DAY, timeList.getSelectionIndex());
- date.set(Calendar.MINUTE, 0);
- setSelection(new DateSelection(date, true));
- notifyListeners(new SelectionChangedEvent(DatePickerPanel.this, getSelection()));
- }
- });
-
- GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 50).applyTo(timeList);
- if (date != null) {
- listViewer.setSelection(new StructuredSelection(times[date.get(Calendar.HOUR_OF_DAY)]), true);
- } else {
- listViewer.setSelection(new StructuredSelection(times[8]), true);
- }
- timeList.addKeyListener(this);
- }
-
- public void setDate(Calendar date) {
- setDate(date, false);
- }
-
- /**
- * @since 3.3
- */
- public void setDate(Calendar date, boolean notifyListeners) {
- this.date = date;
- calendar.setYear(date.get(Calendar.YEAR));
- calendar.setMonth(date.get(Calendar.MONTH));
- calendar.setDay(date.get(Calendar.DAY_OF_MONTH));
- if (notifyListeners) {
- setSelection(new DateSelection(date, false));
- notifyListeners(new SelectionChangedEvent(DatePickerPanel.this, getSelection()));
- }
- }
-
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.ESC) {
- SelectionChangedEvent changeEvent = new SelectionChangedEvent(this, new ISelection() {
- public boolean isEmpty() {
- return true;
- }
- });
- notifyListeners(changeEvent);
- }
- }
-
- public void keyReleased(KeyEvent e) {
- }
-
- private void notifyListeners(SelectionChangedEvent event) {
- for (ISelectionChangedListener listener : selectionListeners) {
- listener.selectionChanged(event);
- }
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionListeners.add(listener);
- }
-
- public ISelection getSelection() {
- return selection;
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- selectionListeners.remove(listener);
- }
-
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-
- public class DateSelection implements ISelection {
- private final Calendar date;
-
- private final boolean isDefaultSelection;
-
- public DateSelection(Calendar calendar) {
- this(calendar, false);
- }
-
- public DateSelection(Calendar calendar, boolean isDefaultSelection) {
- date = calendar;
- this.isDefaultSelection = isDefaultSelection;
-
- }
-
- public boolean isEmpty() {
- return date == null;
- }
-
- public boolean isDefaultSelection() {
- return isDefaultSelection;
- }
-
- public Calendar getDate() {
- return date;
- }
-
- }
-
-}
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
deleted file mode 100644
index f3af41a5..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DateSelectionDialog.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.mylyn.internal.commons.ui.Messages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePickerPanel.DateSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-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;
-
- private String title = Messages.DateSelectionDialog_Date_Selection;
-
- private final Calendar initialCalendar = Calendar.getInstance();
-
- private boolean includeTime = true;
-
- private int hourOfDay = 0;
-
- public DateSelectionDialog(Shell parentShell, Calendar initialDate, String title, boolean includeTime, int hourOfDay) {
- super(parentShell);
- this.includeTime = includeTime;
- this.hourOfDay = hourOfDay;
- if (title != null) {
- this.title = title;
- }
- if (initialDate != null) {
- this.initialCalendar.setTime(initialDate.getTime());
- }
- selectedDate = initialCalendar.getTime();
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText(title);
- final DatePickerPanel datePanel = new DatePickerPanel(parent, SWT.NULL, initialCalendar, includeTime, hourOfDay);
- datePanel.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- if (!event.getSelection().isEmpty()) {
- DateSelection dateSelection = (DateSelection) event.getSelection();
- selectedDate = dateSelection.getDate().getTime();
- if (dateSelection.isDefaultSelection()) {
- okPressed();
- }
- }
- }
- });
-
- datePanel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
-
- applyDialogFont(datePanel);
- return datePanel;
- }
-
- @Override
- public boolean close() {
- return super.close();
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- }
-
- @Override
- protected void buttonPressed(int buttonId) {
- super.buttonPressed(buttonId);
- if (buttonId == IDialogConstants.CLIENT_ID + 1) {
- selectedDate = null;
- okPressed();
- }
- }
-
- public Date getDate() {
- return selectedDate;
- }
-}
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
deleted file mode 100644
index 7e33d733..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DecoratingPatternStyledCellLabelProvider.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * 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:
- * IBM Corporation - initial API and implementation
- * Perforce - enhancements for bug 319469
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IDecorationContext;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.StyledCellLabelProvider;
-import org.eclipse.jface.viewers.StyledString;
-import org.eclipse.jface.viewers.StyledString.Styler;
-import org.eclipse.jface.viewers.ViewerColumn;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.misc.StringMatcher;
-import org.eclipse.ui.internal.misc.StringMatcher.Position;
-
-/**
- * A decorating styled label provider that supports highlighting of substrings that match a pattern. Based on
- * {@link DecoratingFileSearchLabelProvider}.
- *
- * @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 {
-
- /**
- * Color to use to decorate matches.
- */
- static final String HIGHLIGHT_BG_COLOR_NAME = "org.eclipse.jdt.ui.ColoredLabels.match_highlight"; //$NON-NLS-1$
-
- static final Styler HIGHLIGHT_STYLE = StyledString.createColorRegistryStyler(null, HIGHLIGHT_BG_COLOR_NAME);
-
- private static class PatternStyledLabelProvider extends StyledCellLabelProvider implements IStyledLabelProvider,
- IColorProvider, IFontProvider {
-
- private final ILabelProvider labelProvider;
-
- private StringMatcher matcher = null;
-
- public PatternStyledLabelProvider(ILabelProvider provider) {
- this.labelProvider = provider;
- }
-
- /**
- * Set the pattern to highlight
- *
- * @param pattern
- */
- public void setPattern(String pattern) {
- if (pattern != null && pattern.length() > 0) {
- this.matcher = new StringMatcher(pattern, true, false);
- } else {
- this.matcher = null;
- }
- }
-
- public StyledString getStyledText(Object element) {
- StyledString styled = null;
- String label = this.labelProvider.getText(element);
- if (matcher == null || label.length() == 0) {
- styled = new StyledString(label);
- } else {
- styled = new StyledString();
- int start = 0;
- int end = 0;
- int length = label.length();
- Position position = matcher.find(label, start, length);
- while (position != null) {
- end = position.getStart();
- styled.append(label.substring(start, end));
- start = position.getEnd();
- styled.append(label.substring(end, start), HIGHLIGHT_STYLE);
- position = matcher.find(label, start, length);
- }
- if (start > 0 && start < length) {
- styled.append(label.substring(start));
- }
- }
- return styled;
- }
-
- public Image getImage(Object element) {
- return this.labelProvider.getImage(element);
- }
-
- public Font getFont(Object element) {
- if (labelProvider instanceof IFontProvider) {
- return ((IFontProvider) this.labelProvider).getFont(element);
- }
- return null;
- }
-
- public Color getForeground(Object element) {
- if (labelProvider instanceof IColorProvider) {
- return ((IColorProvider) this.labelProvider).getForeground(element);
- }
- return null;
- }
-
- public Color getBackground(Object element) {
- if (labelProvider instanceof IColorProvider) {
- return ((IColorProvider) this.labelProvider).getBackground(element);
- }
- return null;
- }
-
- }
-
- private final ILabelProvider labelProvider;
-
- /**
- * Create a new repository search styled label provider that wraps an {@link ILabelProvider}
- *
- * @param labelProvider
- * @param decorator
- * @param decorationContext
- */
- public DecoratingPatternStyledCellLabelProvider(ILabelProvider labelProvider, ILabelDecorator decorator,
- IDecorationContext decorationContext) {
- super(new PatternStyledLabelProvider(labelProvider), decorator, decorationContext);
- this.labelProvider = labelProvider;
- }
-
- /**
- * @see org.eclipse.jface.viewers.StyledCellLabelProvider#initialize(org.eclipse.jface.viewers.ColumnViewer,
- * org.eclipse.jface.viewers.ViewerColumn)
- */
- @Override
- public void initialize(ColumnViewer viewer, ViewerColumn column) {
- PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
- JFaceResources.getColorRegistry().addListener(this);
-
- setOwnerDrawEnabled(PlatformUI.getPreferenceStore()
- .getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS));
-
- super.initialize(viewer, column);
- }
-
- /**
- * Get underyling label provider
- *
- * @return label provider
- */
- public ILabelProvider getLabelProvider() {
- return this.labelProvider;
- }
-
- /**
- * @see org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider#dispose()
- */
- @Override
- public void dispose() {
- PlatformUI.getPreferenceStore().removePropertyChangeListener(this);
- JFaceResources.getColorRegistry().removeListener(this);
- this.labelProvider.dispose();
- super.dispose();
- }
-
- /**
- * Set the pattern to highlight
- *
- * @param pattern
- */
- public void setPattern(String pattern) {
- ((PatternStyledLabelProvider) getStyledStringProvider()).setPattern(pattern);
- }
-
- /**
- * Refresh the labels on viewer associated with this label provider. This method must be called on the UI-thread.
- */
- protected void refresh() {
- ColumnViewer viewer = getViewer();
- if (viewer != null) {
- boolean coloredLabels = PlatformUI.getPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.USE_COLORED_LABELS);
- if (coloredLabels || coloredLabels != isOwnerDrawEnabled()) {
- setOwnerDrawEnabled(coloredLabels);
- viewer.refresh();
- }
- }
- }
-
- /**
- * Schedule a refresh of this label provider. This method can be called from any thread.
- */
- protected void scheduleRefresh() {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
-
- /**
- * @param event
- */
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (IWorkbenchPreferenceConstants.USE_COLORED_LABELS.equals(property)
- || HIGHLIGHT_BG_COLOR_NAME.equals(property)) {
- scheduleRefresh();
- }
- }
-
- /**
- * Get text of element from underyling label provider
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- return this.labelProvider.getText(element);
- }
-
- /**
- * Override preparation of style range to add border dot about highlight regions that don't have colors applied
- *
- * @see org.eclipse.jface.viewers.StyledCellLabelProvider#prepareStyleRange(org.eclipse.swt.custom.StyleRange,
- * boolean)
- */
- @Override
- protected StyleRange prepareStyleRange(StyleRange styleRange, boolean applyColors) {
- boolean addBorder = !applyColors && styleRange.background != null;
- styleRange = super.prepareStyleRange(styleRange, applyColors);
- if (addBorder) {
- styleRange.borderStyle = SWT.BORDER_DOT;
- }
- return styleRange;
- }
-
-}
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
deleted file mode 100644
index 6fd73004..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/DelayedRefreshJob.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * TODO use extensible deltas instead of Objects for refresh
- *
- * @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;
-
- static final long REFRESH_DELAY_MAX = REFRESH_DELAY_DEFAULT * 2;
-
- // FIXME make private
- protected final StructuredViewer viewer;
-
- private static final int NOT_SCHEDULED = -1;
-
- private final LinkedHashSet<Object> queue = new LinkedHashSet<Object>();
-
- private long scheduleTime = NOT_SCHEDULED;
-
- public DelayedRefreshJob(StructuredViewer viewer, String name) {
- super(name);
- Assert.isNotNull(viewer);
- this.viewer = viewer;
- setSystem(true);
- }
-
- // XXX needs to be called from UI thread
- public void refreshNow() {
- queue.add(null);
- runInUIThread(new NullProgressMonitor());
- }
-
- public synchronized void refresh() {
- refreshElement(null);
- }
-
- public synchronized void refreshElements(Object[] elements) {
- queue.addAll(Arrays.asList(elements));
- if (scheduleTime == NOT_SCHEDULED) {
- scheduleTime = System.currentTimeMillis();
- schedule(REFRESH_DELAY_DEFAULT);
- } else if (System.currentTimeMillis() - scheduleTime < REFRESH_DELAY_MAX - REFRESH_DELAY_DEFAULT) {
- // reschedule to aggregate more refreshes
- cancel();
- schedule(REFRESH_DELAY_DEFAULT);
- }
- }
-
- public synchronized void refreshElement(Object element) {
- refreshElements(new Object[] { element });
- }
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (viewer.getControl() == null || viewer.getControl().isDisposed()) {
- return Status.CANCEL_STATUS;
- }
-
- final Object[] items;
- synchronized (this) {
- if (queue.contains(null)) {
- items = null;
- } else {
- items = queue.toArray(new Object[0]);
- }
- queue.clear();
- scheduleTime = NOT_SCHEDULED;
- }
-
- doRefresh(items);
-
- return Status.OK_STATUS;
- }
-
- protected abstract void doRefresh(final Object[] items);
-
-} \ No newline at end of file
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
deleted file mode 100644
index a39595a9..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/EnhancedFilteredTree.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Hiroyuki Inaba 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:
- * Hiroyuki Inaba - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
-import org.eclipse.ui.dialogs.FilteredTree;
-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;
-
- private TextSearchControl searchControl;
-
- public EnhancedFilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) {
- super(parent, treeStyle, filter);
- }
-
- public EnhancedFilteredTree(Composite parent, int treeStyle, PatternFilter filter) {
- super(parent, treeStyle, filter);
- }
-
- public EnhancedFilteredTree(Composite parent) {
- super(parent);
- }
-
- @Override
- protected void createControl(Composite parent, int treeStyle) {
- super.createControl(parent, treeStyle);
-
- // set this after so that there isn't a double border created around the search
- useNewLook = setNewLook(this);
- }
-
- @Override
- protected Composite createFilterControls(Composite parent) {
- createFilterText(parent);
- return parent;
- }
-
- public static boolean setNewLook(FilteredTree tree) {
- try {
- Field newStyleField = FilteredTree.class.getDeclaredField("useNewLook"); //$NON-NLS-1$
- newStyleField.setAccessible(true);
- newStyleField.setBoolean(tree, true);
- return newStyleField.getBoolean(tree);
- } catch (Exception e) {
- // ignore
- }
- return false;
- }
-
- @Override
- protected void createFilterText(Composite parent) {
- super.createFilterText(parent);
-
- // This code is here to make it so that the key listener for the down arrow listens to the KeyEvent.doit
- // flag so that the history popup dialog can be keyboard accessible and the down arrow works to select items
- // from the history
- if (searchControl != null && searchControl.hasHistorySupport()) {
- Text textControl = searchControl.getTextControl();
- KeyListener downArrowListener = null;
- Listener[] listeners = textControl.getListeners(SWT.KeyDown);
- if (listeners != null && listeners.length > 0) {
- for (Listener listener : listeners) {
- if (listener instanceof TypedListener
- && ((TypedListener) listener).getEventListener()
- .getClass()
- .getName()
- .startsWith("org.eclipse.ui.dialogs.FilteredTree$") //$NON-NLS-1$
- && ((TypedListener) listener).getEventListener() instanceof KeyListener) {
- downArrowListener = (KeyListener) ((TypedListener) listener).getEventListener();
- break;
- }
- }
- }
- if (downArrowListener != null) {
- final KeyListener oldKeyListener = downArrowListener;
- textControl.removeKeyListener(downArrowListener);
- textControl.addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.doit) {
- oldKeyListener.keyPressed(e);
- }
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.doit) {
- oldKeyListener.keyReleased(e);
- }
- }
- });
- }
- }
-
- }
-
- @Override
- protected Text doCreateFilterText(Composite parent) {
- searchControl = new TextSearchControl(parent, true, getHistoryPopupDialog());
-
- searchControl.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- if (e.detail == TextSearchControl.ICON_CANCEL) {
- clearText();
- }
- if (e.detail == TextSearchControl.ICON_SEARCH) {
- textChanged();
- }
- }
- });
- searchControl.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
- return searchControl.getTextControl();
- }
-
- public TextSearchControl getTextSearchControl() {
- return searchControl;
- }
-
- protected SearchHistoryPopUpDialog getHistoryPopupDialog() {
- return new SearchHistoryPopUpDialog(getShell(), SWT.TOP);
- }
-}
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
deleted file mode 100644
index 57acad8e..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientCanvas.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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}.
- *
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.GradientCanvas} instead
- */
-@Deprecated
-@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/internal/provisional/commons/ui/GradientDrawer.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java
deleted file mode 100644
index 4ba71787..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientDrawer.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * 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
- * Frank Becker - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Region;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Scrollable;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Tree;
-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() {
- public void handleEvent(Event event) {
- if (shouldApplyGradient(event)) {
- Scrollable scrollable = (Scrollable) event.widget;
- GC gc = event.gc;
-
- Rectangle area = scrollable.getClientArea();
- Rectangle rect = event.getBounds();
-
- /* Paint the selection beyond the end of last column */
- expandRegion(event, scrollable, gc, area);
-
- /* Draw Gradient Rectangle */
- Color oldForeground = gc.getForeground();
- Color oldBackground = gc.getBackground();
-
- gc.setForeground(categoryGradientEnd);
- gc.drawLine(0, rect.y, area.width, rect.y);
-
- gc.setForeground(categoryGradientStart);
- gc.setBackground(categoryGradientEnd);
-
- // gc.setForeground(categoryGradientStart);
- // gc.setBackground(categoryGradientEnd);
- // gc.setForeground(new Clr(Display.getCurrent(), 255, 0, 0));
-
- gc.fillGradientRectangle(0, rect.y + 1, area.width, rect.height, true);
-
- /* Bottom Line */
- // gc.setForeground();
- gc.setForeground(categoryGradientEnd);
- gc.drawLine(0, rect.y + rect.height - 1, area.width, rect.y + rect.height - 1);
-
- gc.setForeground(oldForeground);
- gc.setBackground(oldBackground);
- /* Mark as Background being handled */
- event.detail &= ~SWT.BACKGROUND;
- }
- }
-
- private void expandRegion(Event event, Scrollable scrollable, GC gc, Rectangle area) {
- int columnCount;
- if (scrollable instanceof Table) {
- columnCount = ((Table) scrollable).getColumnCount();
- } else {
- columnCount = ((Tree) scrollable).getColumnCount();
- }
-
- if (event.index == columnCount - 1 || columnCount == 0) {
- int width = area.x + area.width - event.x;
- if (width > 0) {
- Region region = new Region();
- gc.getClipping(region);
- region.add(event.x, event.y, width, event.height);
- gc.setClipping(region);
- region.dispose();
- }
- }
- }
- };
-
- protected abstract boolean shouldApplyGradient(Event event);
-
- private final IPropertyChangeListener THEME_CHANGE_LISTENER = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IThemeManager.CHANGE_CURRENT_THEME)
- || event.getProperty().equals(CommonThemes.COLOR_SCHEDULED_PAST)
- || event.getProperty().equals(CommonThemes.COLOR_COMPLETED_TODAY)
- || event.getProperty().equals(CommonThemes.COLOR_COMPLETED)
- || event.getProperty().equals(CommonThemes.COLOR_OVERDUE)
- || event.getProperty().equals(CommonThemes.COLOR_SCHEDULED_TODAY)
- || event.getProperty().equals(CommonThemes.COLOR_SCHEDULED_PAST)
- || event.getProperty().equals(CommonThemes.COLOR_SCHEDULED_TODAY)
- || event.getProperty().equals(CommonThemes.COLOR_SCHEDULED_THIS_WEEK)
- || event.getProperty().equals(CommonThemes.COLOR_TASK_ACTIVE)
- || CommonThemes.isCommonTheme(event.getProperty())) {
- configureGradientColors();
- }
- }
- };
-
- private boolean gradientListenerAdded = false;
-
- private final IThemeManager themeManager;
-
- private Color categoryGradientStart;
-
- private Color categoryGradientEnd;
-
- private final TreeViewer treeViewer;
-
- public GradientDrawer(IThemeManager theThemeManager, TreeViewer treeViewer) {
- this.themeManager = theThemeManager;
- this.treeViewer = treeViewer;
- treeViewer.getControl().addDisposeListener(new DisposeListener() {
-
- public void widgetDisposed(DisposeEvent e) {
- if (themeManager != null) {
- themeManager.removePropertyChangeListener(THEME_CHANGE_LISTENER);
- }
- }
- });
- configureGradientColors();
- themeManager.addPropertyChangeListener(THEME_CHANGE_LISTENER);
- }
-
- private void configureGradientColors() {
- categoryGradientStart = themeManager.getCurrentTheme()
- .getColorRegistry()
- .get(CommonThemes.COLOR_CATEGORY_GRADIENT_START);
- categoryGradientEnd = themeManager.getCurrentTheme()
- .getColorRegistry()
- .get(CommonThemes.COLOR_CATEGORY_GRADIENT_END);
-
- boolean customized = true;
- if (categoryGradientStart != null && categoryGradientStart.getRed() == 240
- && categoryGradientStart.getGreen() == 240 && categoryGradientStart.getBlue() == 240
- && categoryGradientEnd != null && categoryGradientEnd.getRed() == 220
- && categoryGradientEnd.getGreen() == 220 && categoryGradientEnd.getBlue() == 220) {
- customized = false;
- }
-
- if (gradientListenerAdded == false && categoryGradientStart != null
- && !categoryGradientStart.equals(categoryGradientEnd)) {
- getViewer().getTree().addListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
- gradientListenerAdded = true;
- if (!customized) {
- // Set parent-based colors
- Color parentBackground = getViewer().getTree().getParent().getBackground();
- double GRADIENT_TOP;// = 1.05;// 1.02;
- double GRADIENT_BOTTOM;// = .995;// 1.035;
-
- // Constants to darken or lighten the default gradients
- if ("Windows 7".equals(System.getProperty("os.name"))) { //$NON-NLS-1$//$NON-NLS-2$
- GRADIENT_TOP = 1.05;
- GRADIENT_BOTTOM = 1.09;
- } else {
- GRADIENT_TOP = 1.05;
- GRADIENT_BOTTOM = .995;
- }
-
- int red = Math.max(0, Math.min(255, (int) (parentBackground.getRed() * GRADIENT_TOP)));
- int green = Math.max(0, Math.min(255, (int) (parentBackground.getGreen() * GRADIENT_TOP)));
- int blue = Math.max(0, Math.min(255, (int) (parentBackground.getBlue() * GRADIENT_TOP)));
-
- try {
- categoryGradientStart = new Color(Display.getDefault(), red, green, blue);
- } catch (Exception e) {
- categoryGradientStart = getViewer().getTree().getParent().getBackground();
-// StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set color: " + red //$NON-NLS-1$
-// + ", " + green + ", " + blue, e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- red = Math.min(255, Math.max(0, (int) (parentBackground.getRed() / GRADIENT_BOTTOM)));
- green = Math.min(255, Math.max(0, (int) (parentBackground.getGreen() / GRADIENT_BOTTOM)));
- blue = Math.min(255, Math.max(0, (int) (parentBackground.getBlue() / GRADIENT_BOTTOM)));
-
- try {
- categoryGradientEnd = new Color(Display.getDefault(), red, green, blue);
- } catch (Exception e) {
- categoryGradientStart = getViewer().getTree().getParent().getBackground();
-// StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set color: " + red //$NON-NLS-1$
-// + ", " + green + ", " + blue, e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- } else if (categoryGradientStart != null && categoryGradientStart.equals(categoryGradientEnd)) {
- getViewer().getTree().removeListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
- gradientListenerAdded = false;
- }
- }
-
- public TreeViewer getViewer() {
- return treeViewer;
- }
-
-}
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
deleted file mode 100644
index d97b2e77..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/GradientToolTip.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * 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.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.commons.ui.GradientColors;
-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
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.GradientToolTip} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/ICoreRunnable.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java
deleted file mode 100644
index 04e5924d..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ICoreRunnable.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui;
-
-import org.eclipse.core.runtime.CoreException;
-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
deleted file mode 100644
index 04219e55..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/IFilteredTreeListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.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/Messages.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/Messages.java
deleted file mode 100644
index a62e7b51..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/Messages.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 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.internal.provisional.commons.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.provisional.commons.ui.messages"; //$NON-NLS-1$
-
- public static String AbstractColumnViewerSupport_Restore_defaults;
-
- public static String DatePickerPanel_Today;
-
- public static String TextControl_FindToolTip;
-
- public static String TextControl_AccessibleListenerFindButton;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
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
deleted file mode 100644
index f0d3d16f..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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.ui.forms.widgets.Section;
-import org.osgi.framework.Bundle;
-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;
-
- 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 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(WorkbenchUtil.getShell(), 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/internal/provisional/commons/ui/ProgressContainer.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java
deleted file mode 100644
index 13010ce0..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ProgressContainer.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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
- * @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$
-
- // 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/internal/provisional/commons/ui/RichToolTip.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java
deleted file mode 100644
index db8b4303..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/RichToolTip.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * 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
- * Kevin Barnes, IBM Corporation - fix for bug 277974
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Scrollable;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.forms.IFormColors;
-
-/**
- * @author Mik Kersten
- * @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();
-
- private final static int Y_SHIFT = 1;
-
- private final Control control;
-
- private Object data;
-
- private boolean enabled;
-
- private boolean triggeredByMouse = true;
-
- private ColumnViewer viewer;
-
- private boolean visible;
-
- public RichToolTip(Control control) {
- super(control);
- this.control = control;
- setEnabled(true);
- setShift(new Point(1, 1));
- }
-
- @Override
- protected void afterHideToolTip(Event event) {
- triggeredByMouse = true;
- visible = false;
- }
-
- protected Object computeData(Widget hoverWidget) {
- return hoverWidget.getData();
- }
-
- private boolean contains(int x, int y) {
- if (control instanceof Scrollable) {
- return ((Scrollable) control).getClientArea().contains(x, y);
- } else {
- return control.getBounds().contains(x, y);
- }
- }
-
- public void dispose() {
- hide();
- }
-
- private Rectangle getBounds(Widget widget) {
- if (widget instanceof ToolItem) {
- ToolItem w = (ToolItem) widget;
- return w.getBounds();
- }
- if (widget instanceof TableItem) {
- TableItem w = (TableItem) widget;
- return w.getBounds();
- }
- if (widget instanceof TreeItem) {
- TreeItem w = (TreeItem) widget;
- return w.getBounds();
- }
- return null;
- }
-
- public Object getData() {
- return data;
- }
-
- @Override
- public Point getLocation(Point tipSize, Event event) {
- Widget widget = getTipWidget(event);
- if (widget != null) {
- Rectangle bounds = getBounds(widget);
- if (bounds != null) {
- if (data instanceof ViewerCell) {
- bounds = ((ViewerCell) data).getBounds();
- }
- return control.toDisplay(bounds.x + X_SHIFT, bounds.y + bounds.height + Y_SHIFT);
- }
- }
- return super.getLocation(tipSize, event);//control.toDisplay(event.x + xShift, event.y + yShift);
- }
-
- protected Widget getTipWidget(Event event) {
- Point widgetPosition = new Point(event.x, event.y);
- Widget widget = event.widget;
- if (widget instanceof ToolBar) {
- ToolBar w = (ToolBar) widget;
- return w.getItem(widgetPosition);
- }
- if (widget instanceof Table) {
- Table w = (Table) widget;
- return w.getItem(widgetPosition);
- }
- if (widget instanceof Tree) {
- Tree w = (Tree) widget;
- return w.getItem(widgetPosition);
- }
-
- return widget;
- }
-
- protected Color getTitleColor() {
- return CommonsUiPlugin.getDefault().getFormColors(control.getDisplay()).getColor(IFormColors.TITLE);
- }
-
- public ColumnViewer getViewer() {
- return viewer;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public boolean isTriggeredByMouse() {
- return triggeredByMouse;
- }
-
- public boolean isVisible() {
- return visible;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public void setViewer(ColumnViewer viewer) {
- this.viewer = viewer;
- }
-
- @Override
- protected boolean shouldCreateToolTip(Event event) {
- data = null;
-
- if (isTriggeredByMouse() && !enabled) {
- return false;
- }
-
- if (super.shouldCreateToolTip(event)) {
- Widget tipWidget = getTipWidget(event);
- if (tipWidget != null) {
- if (viewer != null) {
- data = viewer.getCell(new Point(event.x, event.y));
- } else {
- Rectangle bounds = getBounds(tipWidget);
- if (tipWidget instanceof ScalingHyperlink) {
- data = computeData(tipWidget);
- } else if (bounds != null && contains(bounds.x, bounds.y)) {
- data = computeData(tipWidget);
- }
- }
- }
- }
-
- if (data == null) {
- hide();
- return false;
- } else {
- return true;
- }
- }
-
- @Override
- public void show(Point location) {
- triggeredByMouse = false;
- super.show(location);
- }
-
-}
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
deleted file mode 100644
index d1e04e64..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScalingHyperlink.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * Enhanced {@link ImageHyperlink} that truncates the link text at the end rather than the middle if it is wider than
- * the available space. Also provides default color and underline on hover.
- *
- * @author Leo Dos Santos
- * @author Mik Kersten
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.ScalingHyperlink} instead
- */
-@Deprecated
-public class ScalingHyperlink extends ImageHyperlink {
-
- private boolean strikeThrough;
-
- protected final MouseTrackListener MOUSE_TRACK_LISTENER = new MouseTrackListener() {
-
- public void mouseEnter(MouseEvent e) {
- setUnderlined(true);
- }
-
- public void mouseExit(MouseEvent e) {
- setUnderlined(false);
- }
-
- public void mouseHover(MouseEvent e) {
- }
- };
-
- public ScalingHyperlink(Composite parent, int style) {
- super(parent, style);
- }
-
- @Override
- public void dispose() {
- removeMouseTrackListener(MOUSE_TRACK_LISTENER);
- super.dispose();
- }
-
- public void registerMouseTrackListener() {
- addMouseTrackListener(MOUSE_TRACK_LISTENER);
- }
-
- public boolean isStrikeThrough() {
- return strikeThrough;
- }
-
- @Override
- protected void paintText(GC gc, Rectangle bounds) {
- super.paintText(gc, bounds);
- if (strikeThrough) {
- Point totalSize = computeTextSize(SWT.DEFAULT, SWT.DEFAULT);
- int textWidth = Math.min(bounds.width, totalSize.x);
- int textHeight = totalSize.y;
-
- // int descent = gc.getFontMetrics().getDescent();
- int lineY = bounds.y + (textHeight / 2); // - descent + 1;
- gc.drawLine(bounds.x, lineY, bounds.x + textWidth, lineY);
- }
- }
-
- public void setStrikeThrough(boolean strikethrough) {
- this.strikeThrough = strikethrough;
- }
-
- @Override
- protected String shortenText(GC gc, String t, int width) {
- if (t == null) {
- return null;
- }
-
- if ((getStyle() & SWT.SHORT) != 0) {
- return t;
- }
-
- String returnText = t;
- if (gc.textExtent(t).x > width) {
- for (int i = t.length(); i > 0; i--) {
- String test = t.substring(0, i);
- test = test + "..."; //$NON-NLS-1$
- if (gc.textExtent(test).x < width) {
- returnText = test;
- break;
- }
- }
- }
- return returnText;
- }
-
-} \ No newline at end of file
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
deleted file mode 100644
index 24d0d6f4..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.commons.ui.screenshots.ScreenshotViewer;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-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
- * @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();
-
- 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);
- }
-
- @Override
- protected IDialogSettings getDialogSettings() {
- CommonsUiPlugin plugin = CommonsUiPlugin.getDefault();
- IDialogSettings settings = plugin.getDialogSettings();
- IDialogSettings section = settings.getSection(DIALOG_SETTINGS);
- if (section == null) {
- section = settings.addNewSection(DIALOG_SETTINGS);
- }
- return section;
- }
-
-}
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
deleted file mode 100644
index a9b2d29e..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SearchHistoryPopUpDialog.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.PopupDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-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.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-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;
-
- private static final int MAX_HISTORY_FILTER = 10;
-
- private final int side;
-
- private Rectangle trimBounds;
-
- private TextSearchControl textSearchControl;
-
- private Text textControl;
-
- private TableViewer historyTable;
-
- private TableTreePatternFilter patternFilter;
-
- private Composite additionalControlsComposite;
-
- public SearchHistoryPopUpDialog(Shell parent, int side) {
- super(parent, PopupDialog.HOVER_SHELLSTYLE, false, false, false, false, false, null, null);
- this.side = side;
- updateBounds();
- }
-
- @Override
- protected void initializeBounds() {
- Rectangle monitorBounds = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell()
- .getMonitor()
- .getClientArea();
- Rectangle bounds = getShell().getBounds();
- int x = 0;
- int y = 0;
-
- switch (side) {
- case SWT.TOP:
- x = trimBounds.x;
- y = trimBounds.y + trimBounds.height;
- if (x + bounds.width > monitorBounds.x + monitorBounds.width) {
- x = (trimBounds.x + trimBounds.width) - bounds.width;
- }
- break;
- case SWT.BOTTOM:
- x = trimBounds.x;
- y = trimBounds.y - bounds.height;
- if (x + bounds.width > monitorBounds.x + monitorBounds.width) {
- x = (trimBounds.x + trimBounds.width) - bounds.width;
- }
- break;
- case SWT.RIGHT:
- x = (trimBounds.x + trimBounds.width) - bounds.width;
- y = trimBounds.y + trimBounds.height;
- break;
- case SWT.LEFT:
- x = trimBounds.x;
- y = trimBounds.y + trimBounds.height;
- break;
- }
- getShell().setBounds(x, y, Math.max(trimBounds.width, bounds.width), bounds.height);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- getShell().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- Control createDialogArea = createDialogArea(parent);
- return createDialogArea;
- }
-
- @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, false).applyTo(composite);
-
- createTable(composite);
-
- additionalControlsComposite = new Composite(composite, SWT.NONE);
- gl = new GridLayout();
- gl.marginHeight = 0;
- gl.marginWidth = 0;
- gl.horizontalSpacing = 0;
- gl.verticalSpacing = 0;
- gl.numColumns = 1;
- additionalControlsComposite.setLayout(gl);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(additionalControlsComposite);
-
- createAdditionalSearchRegion(additionalControlsComposite);
- if (additionalControlsComposite.getChildren().length == 0) {
- additionalControlsComposite.dispose();
- additionalControlsComposite = null;
- }
-
- parent.pack();
-
- return parent;
- }
-
- private void createTable(Composite composite) {
- historyTable = new TableViewer(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.NO_SCROLL);
- TableColumn bindingNameColumn = new TableColumn(historyTable.getTable(), SWT.LEFT);
- // XXX fix this
- bindingNameColumn.setWidth(2000);
- historyTable.setUseHashlookup(true);
-
- historyTable.setContentProvider(new ITreeContentProvider() {
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- public void dispose() {
-
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Collection<?>) {
- Object[] elements = ((Collection<?>) inputElement).toArray();
- return reverseArray(elements);
- }
- return new Object[0];
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public Object[] getChildren(Object parentElement) {
- return null;
- }
-
- private Object[] reverseArray(Object[] originalArray) {
- int i = 0;
- int j = originalArray.length - 1;
-
- while (i < j) {
- Object firstElement = originalArray[i];
- originalArray[i] = originalArray[j];
- originalArray[j] = firstElement;
-
- i++;
- j--;
- }
- return originalArray;
- }
-
- });
-
- if (textSearchControl != null) {
- historyTable.setInput(textSearchControl.getSearchHistory());
- } else {
- historyTable.setInput(Collections.emptyList());
- }
- historyTable.addOpenListener(new IOpenListener() {
-
- public void open(OpenEvent event) {
- String text = getTextFromSelection(event.getSelection());
- if (text != null) {
- textSearchControl.getTextControl().setText(text);
- textControl.setSelection(text.length());
- textSearchControl.addToSearchHistory(text);
- }
- close();
- }
-
- });
-
- // XXX CHANGE TO SELECTION LISTENER??
- historyTable.getTable().addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseDown(MouseEvent e) {
- String text = getTextFromSelection(historyTable.getSelection());
- if (text != null) {
- textSearchControl.getTextControl().setText(text);
- textSearchControl.addToSearchHistory(text);
- }
- textSearchControl.getTextControl().setFocus();
- close();
- }
- });
- patternFilter = new TableTreePatternFilter();
- patternFilter.setIncludeLeadingWildcard(true);
- patternFilter.setPattern(textSearchControl.getTextControl().getText());
- historyTable.addFilter(patternFilter);
- if (textControl.getText().length() > 0) {
- historyTable.setSorter(new ViewerSorter());
- historyTable.setItemCount(Math.min(historyTable.getTable().getItemCount(), MAX_HISTORY_FILTER));
- } else {
- historyTable.setSorter(null);
- historyTable.setItemCount(Math.min(historyTable.getTable().getItemCount(), MAX_HISTORY_NO_FILTER));
- }
- GridDataFactory.fillDefaults()
- .grab(true, false)
- .hint(trimBounds.width, SWT.DEFAULT)
- .applyTo(historyTable.getTable());
- setHistoryTableVisible(historyTable.getTable().getItemCount() > 0);
- }
-
- private void setHistoryTableVisible(boolean isVisible) {
- GridData layoutData = (GridData) historyTable.getTable().getLayoutData();
- historyTable.getTable().setVisible(isVisible);
- boolean wasVisible = !layoutData.exclude;
- layoutData.exclude = !isVisible;
- if (wasVisible != isVisible || isVisible) {
- getShell().pack();
- }
- initializeBounds();
- }
-
- private boolean shouldOpen() {
- return (historyTable != null && historyTable.getTable() != null && historyTable.getTable().isVisible())
- || additionalControlsComposite != null;
- }
-
- private String getTextFromSelection(ISelection selection) {
- if (selection instanceof StructuredSelection) {
- Object firstElement = ((StructuredSelection) selection).getFirstElement();
- if (firstElement instanceof String) {
- return (String) firstElement;
- }
-
- }
- return null;
- }
-
- private boolean isOpen = false;
-
- @Override
- public int open() {
- if (!isOpen) {
- isOpen = true;
- int rc = super.open();
- if (!shouldOpen()) {
- close();
- }
- return rc;
- }
- return 0;
- }
-
- public void asyncClose() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if ((textControl != null && !textControl.isDisposed() && textControl.isFocusControl())
- || !hasFocus(getShell())) {
- close();
- }
- }
- });
- }
-
- @Override
- public boolean close() {
- if (patternFilter != null) {
- patternFilter.setPattern(null);
- }
- boolean b = super.close();
- isOpen = !b;
- return b;
- }
-
- private boolean updateBounds() {
- Rectangle bounds;
- if (textSearchControl == null || textSearchControl.getTextControl() == null
- || textSearchControl.getTextControl().isDisposed()) {
- bounds = new Rectangle(0, 0, 0, 0);
- } else {
- bounds = textSearchControl.getBounds();
- Point absPosition = textSearchControl.toDisplay(textSearchControl.getLocation());
- bounds.x = absPosition.x - bounds.x;
- bounds.y = absPosition.y - bounds.y;
- }
- if (trimBounds == null || !trimBounds.equals(bounds)) {
- this.trimBounds = bounds;
- return true;
- }
- return false;
- }
-
- public void attach(final TextSearchControl textSearchControl) {
- Assert.isNotNull(textSearchControl);
- Assert.isNotNull(textSearchControl.getTextControl());
- this.textSearchControl = textSearchControl;
- this.textControl = textSearchControl.getTextControl();
- textSearchControl.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- if (!hasFocus(textControl)) {
- // user shouldn't be modifying the text if it doesnt have focus
- return;
- }
- if (!isOpen && textControl != null && !textControl.isDisposed() && textControl.getText().length() > 0) {
- updateBounds();
- open();
- }
- if (isOpen && historyTable != null && !historyTable.getTable().isDisposed() && patternFilter != null) {
- patternFilter.setPattern(textControl.getText());
- historyTable.setSelection(null);
- historyTable.refresh();
- if (textControl.getText().length() > 0) {
- historyTable.setSorter(new ViewerSorter());
- historyTable.setItemCount(Math.min(historyTable.getTable().getItemCount(), MAX_HISTORY_FILTER));
- } else {
- historyTable.setSorter(null);
- historyTable.setItemCount(Math.min(historyTable.getTable().getItemCount(),
- MAX_HISTORY_NO_FILTER));
- }
- setHistoryTableVisible(historyTable.getTable().getItemCount() > 0);
- if (!shouldOpen()) {
- asyncClose();
- }
- }
- }
- });
-
- textControl.addDisposeListener(new DisposeListener() {
-
- public void widgetDisposed(DisposeEvent e) {
- close();
- }
- });
-
- textControl.addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.character == SWT.ESC && isOpen) {
- close();
- e.doit = false;
- } else if (e.stateMask == 0 && e.keyCode == SWT.ARROW_DOWN && isOpen && historyTable.getTable() != null
- && !historyTable.getTable().isDisposed() && historyTable.getTable().getItemCount() > 0) {
- historyTable.getTable().select(0);
- historyTable.getTable().setFocus();
- e.doit = false;
- } else if ((e.stateMask & SWT.MOD1) != 0 && e.keyCode == SWT.ARROW_DOWN && !isOpen) {
- updateBounds();
- open();
- e.doit = false;
- }
- }
- });
-
- Listener moveResizeListener = new Listener() {
-
- public void handleEvent(Event event) {
- if (isOpen) {
- if (updateBounds()) {
- initializeBounds();
- }
- }
- }
- };
- textSearchControl.addListener(SWT.Move, moveResizeListener);
- textSearchControl.addListener(SWT.Resize, moveResizeListener);
-
- textControl.addFocusListener(new FocusListener() {
-
- public void focusLost(FocusEvent e) {
- asyncClose();
- }
-
- public void focusGained(FocusEvent e) {
- }
- });
- }
-
- private boolean hasFocus(Control control) {
- if (control != null && !control.isDisposed() && control.isFocusControl()) {
- return true;
- }
- if (control instanceof Composite) {
- for (Control child : ((Composite) control).getChildren()) {
- if (hasFocus(child)) {
- return true;
- }
- }
- }
- return false;
- }
-
- protected void createAdditionalSearchRegion(Composite composite) {
- }
-
-}
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
deleted file mode 100644
index c3aa5546..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectionProviderAdapter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * 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.provisional.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
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.SelectionProviderAdapter} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/ServiceMessageControl.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java
deleted file mode 100644
index c2b0bed6..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*******************************************************************************
- * 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
- * Itema AS - Refactored into commons
- * Itema AS - Added configure button, bug #329897
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-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.Link;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-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.
- *
- * @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$
-
- protected static Font setHeaderFontSizeAndStyle(Control text) {
- float sizeFactor = 1.2f;
- Font initialFont = text.getFont();
- FontData[] fontData = initialFont.getFontData();
- for (FontData element : fontData) {
- element.setHeight((int) (element.getHeight() * sizeFactor));
- element.setStyle(element.getStyle() | SWT.BOLD);
- }
- final Font textFont = new Font(text.getDisplay(), fontData);
- text.setFont(textFont);
- text.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- textFont.dispose();
- }
- });
- Color color = getFormColors(text.getDisplay()).getColor(IFormColors.TITLE);
- text.setForeground(color);
- return textFont;
- }
-
- private static FormColors formColors;
-
- public static FormColors getFormColors(Display display) {
- if (formColors == null) {
- formColors = new FormColors(display);
- formColors.markShared();
- }
- return formColors;
- }
-
- private ImageHyperlink closeLink;
-
- private ImageHyperlink configureLink;
-
- private Link descriptionLabel;
-
- private GradientCanvas head;
-
- private GridData headData;
-
- private Label imageLabel;
-
- private final Composite parent;
-
- private Label titleLabel;
-
- private String eventId;
-
- private String preferencesPageId;
-
- public ServiceMessageControl(Composite parent) {
- this.parent = parent;
- setPreferencesPageId(NOTIFICATIONS_PREF_PAGE);
- }
-
- public String getPreferencesPageId() {
- return preferencesPageId;
- }
-
- public void setPreferencesPageId(String preferencesPageId) {
- this.preferencesPageId = preferencesPageId;
- }
-
- /**
- * Disposes of the widget and performs a layout update.
- */
- protected void close() {
- if (head != null && !head.isDisposed()) {
- head.dispose();
- }
- if (!parent.isDisposed()) {
- parent.layout(true);
- }
- }
-
- /**
- * Returns <code>true</code> if the control has closed and is currently not showing any messages.
- *
- * @return <code>true</code> if the control is closed
- */
- protected boolean isClosed() {
- return (head == null || head.isDisposed());
- }
-
- /**
- * Implement to handle the message control closing.
- */
- protected abstract void closeMessage();
-
- /**
- * Returns the shell of the parent composite.
- *
- * @return the shell
- */
- protected Shell getShell() {
- return parent.getShell();
- }
-
- /**
- * Creates the GUI of the service message control.
- *
- * @param parent
- * the parent composite
- * @return the control
- */
- public Control createControl(Composite parent) {
- FormColors colors = getFormColors(parent.getDisplay());
- head = new GradientCanvas(parent, SWT.NONE);
- GridLayout headLayout = new GridLayout();
- headLayout.marginHeight = 0;
- headLayout.marginWidth = 0;
- headLayout.horizontalSpacing = 0;
- headLayout.verticalSpacing = 0;
- headLayout.numColumns = 1;
- head.setLayout(headLayout);
- headData = new GridData(SWT.FILL, SWT.TOP, true, false);
- head.setLayoutData(headData);
-
- Color top = colors.getColor(IFormColors.H_GRADIENT_END);
- Color bot = colors.getColor(IFormColors.H_GRADIENT_START);
- head.setBackgroundGradient(new Color[] { bot, top }, new int[] { 100 }, true);
- head.setSeparatorVisible(true);
- head.setSeparatorAlignment(SWT.TOP);
-
- head.putColor(IFormColors.H_BOTTOM_KEYLINE1, colors.getColor(IFormColors.H_BOTTOM_KEYLINE1));
- head.putColor(IFormColors.H_BOTTOM_KEYLINE2, colors.getColor(IFormColors.H_BOTTOM_KEYLINE2));
- head.putColor(IFormColors.H_HOVER_LIGHT, colors.getColor(IFormColors.H_HOVER_LIGHT));
- head.putColor(IFormColors.H_HOVER_FULL, colors.getColor(IFormColors.H_HOVER_FULL));
- head.putColor(IFormColors.TB_TOGGLE, colors.getColor(IFormColors.TB_TOGGLE));
- head.putColor(IFormColors.TB_TOGGLE_HOVER, colors.getColor(IFormColors.TB_TOGGLE_HOVER));
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 3;
- head.setLayout(layout);
-
- imageLabel = new Label(head, SWT.NONE);
-
- titleLabel = new Label(head, SWT.NONE);
-
- setHeaderFontSizeAndStyle(titleLabel);
-
- Composite buttonsComp = new Composite(head, SWT.NONE);
- TableWrapData data = new TableWrapData();
- data.align = TableWrapData.RIGHT;
- buttonsComp.setLayoutData(data);
- GridLayout gLayout = new GridLayout(2, false);
- gLayout.horizontalSpacing = 0;
- gLayout.verticalSpacing = 0;
- gLayout.marginHeight = 0;
- gLayout.marginWidth = 0;
- gLayout.verticalSpacing = 0;
-
- buttonsComp.setLayout(gLayout);
-
- if (getPreferencesPageId() != null) {
- configureLink = new ImageHyperlink(buttonsComp, SWT.NONE);
- configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE));
- configureLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkEntered(HyperlinkEvent e) {
- configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE_HOVER));
- }
-
- @Override
- public void linkExited(HyperlinkEvent e) {
- configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE));
- }
-
- @Override
- public void linkActivated(HyperlinkEvent e) {
- PreferenceDialog pd = PreferencesUtil.createPreferenceDialogOn(getShell(), getPreferencesPageId(),
- new String[0], eventId);
- // Only close the message if the did not cancel the operation
- if (pd != null) {
- pd.open();
- }
- }
- });
- // Initially invisible, must have eventId for this to be of any use.
- configureLink.setVisible(eventId != null);
- }
-
- closeLink = new ImageHyperlink(buttonsComp, SWT.NONE);
- closeLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
- // data = new TableWrapData();
- // data.align = TableWrapData.RIGHT;
- // closeLink.setLayoutData(data);
- closeLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- closeMessage();
- }
-
- @Override
- public void linkEntered(HyperlinkEvent e) {
- closeLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE_HOVER));
- }
-
- @Override
- public void linkExited(HyperlinkEvent e) {
- closeLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
- }
- });
-
- // spacer
- new Label(head, SWT.NONE).setText(" "); //$NON-NLS-1$
-
- descriptionLabel = new Link(head, SWT.WRAP);
- descriptionLabel.addSelectionListener(getLinkListener());
-
- data = new TableWrapData();
- data.colspan = 2;
- data.grabHorizontal = true;
- descriptionLabel.setLayoutData(data);
-
- return head;
- }
-
- /**
- * Must be implemented for custom handling of description links.
- *
- * @see #setDescription(String)
- * @return the selection listener
- */
- protected abstract SelectionListener getLinkListener();
-
- protected void setDescription(String description) {
- descriptionLabel.setText(description);
- parent.layout(true, true);
- }
-
- /**
- * Sets the title of the control.
- *
- * @param title
- * the title to set
- */
- protected void setTitle(String title) {
- titleLabel.setText(title);
- head.layout(true);
- }
-
- /**
- * Sets the eventId of the message being displayed. How to handle certain kind of messages can be configured in
- * preference settings if this property is set to a legal value. The event identifiers are declared using the
- * <i>org.eclipse.mylyn.commons.notifications.notifications</i> extension point.
- *
- * @param eventId
- * the event identifier for the displayed message
- */
- protected void setEventId(String eventId) {
- this.eventId = eventId;
- if (configureLink != null) {
- configureLink.setVisible(eventId != null);
- }
- }
-
- /**
- * Sets the title image of the control.
- *
- * @param image
- * the title image
- */
- protected void setTitleImage(Image image) {
- imageLabel.setImage(image);
- head.layout(true);
- }
-
- /**
- * Creates the control unless the parent has been disposed.
- */
- protected boolean ensureControl() {
- if (parent.isDisposed()) {
- return false;
- }
-
- if (head == null || head.isDisposed()) {
- createControl(parent);
- }
- return true;
- }
-
-}
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
deleted file mode 100644
index a93b94fd..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/SubstringPatternFilter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-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
- public void setPattern(String patternString) {
- if (patternString == null || patternString.startsWith("*")) { //$NON-NLS-1$
- super.setPattern(patternString);
- } else {
- super.setPattern("*" + patternString); //$NON-NLS-1$
- }
- }
-}
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
deleted file mode 100644
index 01fcf4d9..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableSorter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import org.eclipse.jface.viewers.TableViewer;
-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
- 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/internal/provisional/commons/ui/TableTreePatternFilter.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java
deleted file mode 100644
index 342f66fe..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableTreePatternFilter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-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
- protected boolean isParentMatch(Viewer viewer, Object element) {
- if (viewer instanceof AbstractTreeViewer) {
- return super.isParentMatch(viewer, element);
- }
- return false;
- }
-
-}
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
deleted file mode 100644
index 489d9639..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TableViewerSupport.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.TableViewerSupport} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/TextSearchControl.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java
deleted file mode 100644
index 224d8900..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TextSearchControl.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchMessages;
-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$
-
- private static final String FIND_MEMENTO_ELEMENT = "historyItem"; //$NON-NLS-1$
-
- private static final String FIND_MEMENTO_TYPE = "filteredTreeFindHistory"; //$NON-NLS-1$
-
- private static final int MAX_HISTORY_ITEMS = 50;
-
- /**
- * Image descriptor for enabled clear button.
- */
- private static final String CLEAR_ICON = "org.eclipse.ui.internal.dialogs.CLEAR_ICON"; //$NON-NLS-1$
-
- /**
- * Image descriptor for enabled clear button.
- */
- private static final String FIND_ICON = "org.eclipse.ui.internal.dialogs.FIND_ICON"; //$NON-NLS-1$
-
- /* SWT STYLE BIT AVAILABLE ON 3.5 AND HIGHER */
- public static final int ICON_SEARCH = 1 << 9;
-
- /* SWT STYLE BIT AVAILABLE ON 3.5 AND HIGHER */
- public static final int ICON_CANCEL = 1 << 8;
-
- /**
- * Get image descriptors for the clear button.
- */
- static {
- ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
- "$nl$/icons/full/etool16/clear_co.gif"); //$NON-NLS-1$
- if (descriptor != null) {
- JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor);
- }
-
- descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(CommonsUiPlugin.ID_PLUGIN,
- "$nl$/icons/etool16/find.png"); //$NON-NLS-1$
- if (descriptor != null) {
- JFaceResources.getImageRegistry().put(FIND_ICON, descriptor);
- }
- }
-
- private final Text textControl;
-
- private Control clearControl;
-
- private Control findControl;
-
- private final boolean automaticFind;
-
- private final Set<SelectionListener> selectionListeners = new HashSet<SelectionListener>();
-
- private Collection<String> searchHistory = new LinkedHashSet<String>();
-
- private boolean hasHistorySupport;
-
- private static Boolean useNativeSearchField;
-
- @SuppressWarnings("restriction")
- public TextSearchControl(Composite parent, boolean automaticFind, SearchHistoryPopUpDialog historyDialog) {
- super(parent, getCompositeStyle(automaticFind, parent));
- this.automaticFind = automaticFind;
-
- int textStyle = SWT.SINGLE;
- int numColumns = 1;
- if (useNativeSearchField(automaticFind, parent)) {
- if (automaticFind) {
- textStyle |= SWT.SEARCH | ICON_CANCEL;
- } else {
- textStyle |= SWT.SEARCH | ICON_SEARCH | ICON_CANCEL;
- }
- } else {
- super.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- super.setFont(parent.getFont());
- numColumns = 2;
- if (!automaticFind) {
- numColumns += 1;
- }
- }
- GridLayoutFactory.swtDefaults()
- .margins(0, 0)
- .extendedMargins(0, 0, 0, 0)
- .spacing(0, 1)
- .numColumns(numColumns)
- .applyTo(this);
-
- textControl = new Text(this, textStyle);
-
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- textControl.setLayoutData(gridData);
-
- if (useNativeSearchField == null || !useNativeSearchField) {
- findControl = createLabelButtonControl(this, textControl,
- JFaceResources.getImageRegistry().getDescriptor(FIND_ICON),
- Messages.TextControl_AccessibleListenerFindButton, Messages.TextControl_FindToolTip, ICON_SEARCH);
- clearControl = createLabelButtonControl(this, textControl,
- JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON),
- WorkbenchMessages.FilteredTree_ClearToolTip,//FilteredTree_AccessibleListenerClearButton,
- WorkbenchMessages.FilteredTree_ClearToolTip, ICON_CANCEL);
- addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- updateButtonVisibilityAndEnablement();
-
- }
- });
- updateButtonVisibilityAndEnablement();
- }
-
- if (historyDialog != null) {
- historyDialog.attach(this);
- hasHistorySupport = true;
- }
-
- registerListeners();
- }
-
- public boolean hasHistorySupport() {
- return hasHistorySupport;
- }
-
- private void registerListeners() {
- addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- if (textControl != null && !textControl.isDisposed()) {
- addToSearchHistory(textControl.getText());
- }
-
- }
- });
- textControl.addFocusListener(new FocusAdapter() {
-
- @Override
- public void focusLost(FocusEvent e) {
- if (textControl != null && !textControl.isDisposed()) {
- addToSearchHistory(textControl.getText());
- }
- }
- });
- }
-
- private static int getCompositeStyle(boolean automaticFind, Composite parent) {
- if (useNativeSearchField(automaticFind, parent)) {
- return SWT.NONE;
- }
- return SWT.BORDER;
- }
-
- private static boolean useNativeSearchField(boolean automaticFind, Composite parent) {
- if (parent != null) {
- if (useNativeSearchField == null) {
- useNativeSearchField = Boolean.FALSE;
- Text testText = null;
- try {
- int style = SWT.SEARCH | ICON_CANCEL;
- if (automaticFind) {
- style |= ICON_SEARCH;
- }
- testText = new Text(parent, style);
- useNativeSearchField = new Boolean((testText.getStyle() & ICON_CANCEL) != 0
- && (!automaticFind || (testText.getStyle() & ICON_SEARCH) != 0));
- } finally {
- if (testText != null) {
- testText.dispose();
- }
- }
-
- }
- } else {
- useNativeSearchField = Boolean.FALSE;
- }
- return useNativeSearchField.booleanValue();
- }
-
- private Control createLabelButtonControl(Composite parent, final Text textControl,
- ImageDescriptor activeImageDescriptor, final String accessibilityText, String toolTipText, final int detail) {
-
- final Image nativeImage = parent.getDisplay().getSystemImage(detail);
-
- final Image activeImage = nativeImage != null ? nativeImage : activeImageDescriptor.createImage();
- final Image inactiveImage = new Image(parent.getDisplay(), activeImage, SWT.IMAGE_GRAY);
- final Image pressedImage = inactiveImage;
-
- final Label labelButton = new Label(parent, SWT.NONE);
- labelButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- labelButton.setImage(inactiveImage);
- labelButton.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- labelButton.setToolTipText(toolTipText);
- labelButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (nativeImage == null && activeImage != null && !activeImage.isDisposed()) {
- activeImage.dispose();
- }
- if (inactiveImage != null && !inactiveImage.isDisposed()) {
- inactiveImage.dispose();
- }
- if (pressedImage != null && !pressedImage.isDisposed()) {
- pressedImage.dispose();
- }
- }
- });
- labelButton.addMouseListener(new MouseAdapter() {
- private MouseMoveListener fMoveListener;
-
- @Override
- public void mouseDown(MouseEvent e) {
- labelButton.setImage(pressedImage);
- fMoveListener = new MouseMoveListener() {
- private boolean fMouseInButton = true;
-
- public void mouseMove(MouseEvent e) {
- boolean mouseInButton = isMouseInButton(e);
- if (mouseInButton != fMouseInButton) {
- fMouseInButton = mouseInButton;
- labelButton.setImage(mouseInButton ? pressedImage : inactiveImage);
- }
- }
- };
- labelButton.addMouseMoveListener(fMoveListener);
- }
-
- @Override
- public void mouseUp(MouseEvent e) {
- if (fMoveListener != null) {
- labelButton.removeMouseMoveListener(fMoveListener);
- fMoveListener = null;
- boolean mouseInButton = isMouseInButton(e);
- labelButton.setImage(mouseInButton ? activeImage : inactiveImage);
- if (mouseInButton) {
- if (textControl.isEnabled() && textControl.getText().length() > 0) {
- notifySelectionChanged(detail);
- }
- }
- }
- }
-
- private boolean isMouseInButton(MouseEvent e) {
- Point buttonSize = labelButton.getSize();
- return 0 <= e.x && e.x < buttonSize.x && 0 <= e.y && e.y < buttonSize.y;
- }
- });
-
- labelButton.addMouseTrackListener(new MouseTrackListener() {
- public void mouseEnter(MouseEvent e) {
- if (labelButton.getImage() != activeImage) {
- labelButton.setImage(activeImage);
- }
- }
-
- public void mouseExit(MouseEvent e) {
- if (labelButton.getImage() != inactiveImage) {
- labelButton.setImage(inactiveImage);
- }
- }
-
- public void mouseHover(MouseEvent e) {
- }
- });
-
- labelButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = accessibilityText;
- }
- });
- labelButton.getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
- @Override
- public void getRole(AccessibleControlEvent e) {
- e.detail = ACC.ROLE_PUSHBUTTON;
- }
- });
- return labelButton;
- }
-
- @Override
- public void addTraverseListener(TraverseListener listener) {
- textControl.addTraverseListener(listener);
- }
-
- @Override
- public void removeTraverseListener(TraverseListener listener) {
- textControl.removeTraverseListener(listener);
- }
-
- public void addSelectionListener(SelectionListener listener) {
- textControl.addSelectionListener(listener);
- selectionListeners.add(listener);
- }
-
- public void removeSelectionListener(SelectionListener listener) {
- textControl.removeSelectionListener(listener);
- selectionListeners.remove(listener);
- }
-
- public void addModifyListener(ModifyListener listener) {
- textControl.addModifyListener(listener);
- }
-
- public void removeModifyListener(ModifyListener listener) {
- textControl.removeModifyListener(listener);
- }
-
- private void notifySelectionChanged(int detail) {
- if (useNativeSearchField != null && useNativeSearchField) {
- // notification should happen via the widgets selection listener
- return;
- }
- Event event = new Event();
- event.detail = detail;
- event.widget = textControl;
- event.display = textControl.getDisplay();
-
- SelectionEvent e = new SelectionEvent(event);
- for (Object element : selectionListeners) {
- ((SelectionListener) element).widgetDefaultSelected(e);
- }
- }
-
- private void updateButtonVisibilityAndEnablement() {
- if (textControl != null && !textControl.isDisposed()) {
- boolean hasText = textControl.getText().length() > 0;
-
- setFindButtonVisibility(!(hasText && automaticFind));
- setClearButtonVisibility(hasText);
- }
- }
-
- private void setFindButtonVisibility(boolean visible) {
- if (findControl != null && !findControl.isDisposed()) {
- findControl.setVisible(visible);
- if (findControl.getLayoutData() instanceof GridData) {
- ((GridData) findControl.getLayoutData()).exclude = !visible;
- findControl.getParent().layout();
- }
- }
- }
-
- private void setClearButtonVisibility(boolean visible) {
- if (clearControl != null && !clearControl.isDisposed()) {
- clearControl.setVisible(visible);
- if (clearControl.getLayoutData() instanceof GridData) {
- ((GridData) clearControl.getLayoutData()).exclude = !visible;
- clearControl.getParent().layout();
- }
- }
- }
-
- public Text getTextControl() {
- return textControl;
- }
-
- public String getText() {
- if (textControl != null && !textControl.isDisposed()) {
- return textControl.getText();
- }
- return ""; //$NON-NLS-1$
- }
-
- public void setText(String text) {
- if (textControl != null && !textControl.isDisposed()) {
- textControl.setText(text);
- }
- }
-
- @Override
- public void setBackground(Color color) {
- if (useNativeSearchField != null && useNativeSearchField) {
- super.setBackground(color);
- }
- }
-
- public Collection<String> getSearchHistory() {
- return Collections.unmodifiableCollection(searchHistory);
- }
-
- void addToSearchHistory(String searchString) {
- if (searchString != null && searchString.trim().length() > 0) {
- searchHistory.remove(searchString);
- searchHistory.add(searchString);
- }
- }
-
- public void saveState(IMemento memento) {
- if (memento == null) {
- return;
- }
-
- IMemento rootMemento = memento.createChild(FIND_MEMENTO_TYPE);
- int i = 0;
- for (String text : searchHistory) {
- IMemento child = rootMemento.createChild(FIND_MEMENTO_ELEMENT);
- child.putString(FIND_TEXT_MEMENTO_ELEMENT, text);
- i++;
- if (i > MAX_HISTORY_ITEMS) {
- break;
- }
- }
- }
-
- public void restoreState(IMemento memento) {
- if (memento == null) {
- return;
- }
- List<String> history = new ArrayList<String>();
-
- IMemento rootMemento = memento.getChild(FIND_MEMENTO_TYPE);
- if (rootMemento != null) {
- IMemento[] children = rootMemento.getChildren(FIND_MEMENTO_ELEMENT);
- if (children != null && children.length > 0) {
- for (IMemento child : children) {
- String historyItem = child.getString(FIND_TEXT_MEMENTO_ELEMENT);
- // add to the end of the list
- history.add(history.size(), historyItem);
- }
- }
- }
- if (history != null) {
- searchHistory = history;
- }
- }
-}
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
deleted file mode 100644
index 84125257..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeSorter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui;
-
-import org.eclipse.jface.viewers.TreeViewer;
-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
- 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/internal/provisional/commons/ui/TreeViewerSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java
deleted file mode 100644
index f595bea0..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/TreeViewerSupport.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.TreeViewerSupport} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/WorkbenchActionSupport.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java
deleted file mode 100644
index 28215d35..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchActionSupport.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * Manages commons workbench actions for editing text.
- *
- * @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 {
-
- private class GlobalAction extends Action {
-
- private final String actionId;
-
- public GlobalAction(String actionId) {
- this.actionId = actionId;
- }
-
- @Override
- public void run() {
- if (callback != null) {
- callback.doAction(actionId, callback.getFocusControl());
- updateActions(callback.getSelection());
- }
- }
-
- public void selectionChanged(ISelection selection) {
- if (callback != null) {
- setEnabled(callback.canPerformAction(actionId, callback.getFocusControl()));
- } else {
- setEnabled(false);
- }
- }
- }
-
- public static class WorkbenchActionCallback {
-
- public boolean canPerformAction(String actionId, Control control) {
- return CommonTextSupport.canPerformAction(actionId, control);
- }
-
- public void doAction(String actionId, Control control) {
- CommonTextSupport.doAction(actionId, control);
- }
-
- public Control getFocusControl() {
- return Display.getDefault().getFocusControl();
- }
-
- public ISelection getSelection() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null && window.getSelectionService() != null) {
- return window.getSelectionService().getSelection();
- }
- return null;
- }
-
- }
-
- private WorkbenchActionCallback callback;
-
- private final GlobalAction copyAction;
-
- private final GlobalAction cutAction;
-
- private final GlobalAction findAction;
-
- private final GlobalAction pasteAction;
-
- private final GlobalAction redoAction;
-
- private final GlobalAction selectAllAction;
-
- private final GlobalAction undoAction;
-
- public WorkbenchActionSupport() {
- cutAction = new GlobalAction(ActionFactory.CUT.getId());
- cutAction.setText(WorkbenchMessages.Workbench_cut);
- cutAction.setToolTipText(WorkbenchMessages.Workbench_cutToolTip);
- cutAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
- cutAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
- cutAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
- cutAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT);
-
- pasteAction = new GlobalAction(ActionFactory.PASTE.getId());
- pasteAction.setText(WorkbenchMessages.Workbench_paste);
- pasteAction.setToolTipText(WorkbenchMessages.Workbench_pasteToolTip);
- pasteAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- pasteAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- pasteAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
- pasteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE);
-
- copyAction = new GlobalAction(ActionFactory.COPY.getId());
- copyAction.setText(WorkbenchMessages.Workbench_copy);
- copyAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- copyAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- copyAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
- copyAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
-
- undoAction = new GlobalAction(ActionFactory.UNDO.getId());
- undoAction.setText(WorkbenchMessages.Workbench_undo);
- undoAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- undoAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- undoAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
- undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
-
- redoAction = new GlobalAction(ActionFactory.REDO.getId());
- redoAction.setText(WorkbenchMessages.Workbench_redo);
- redoAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- redoAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- redoAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
- redoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.REDO);
-
- selectAllAction = new GlobalAction(ActionFactory.SELECT_ALL.getId());
- selectAllAction.setText(WorkbenchMessages.Workbench_selectAll);
- selectAllAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
- selectAllAction.setEnabled(true);
-
- findAction = new GlobalAction(ActionFactory.FIND.getId());
- findAction.setText(WorkbenchMessages.Workbench_findReplace);
- findAction.setImageDescriptor(CommonImages.FIND);
- findAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_REPLACE);
- }
-
- public void contributeActions(IMenuManager manager) {
- manager.add(undoAction);
- manager.add(redoAction);
- manager.add(new Separator());
- manager.add(cutAction);
- manager.add(copyAction);
- manager.add(pasteAction);
- manager.add(selectAllAction);
- manager.add(new Separator());
- }
-
- public void forceEditActionsEnabled() {
- cutAction.setEnabled(true);
- copyAction.setEnabled(true);
- pasteAction.setEnabled(true);
- selectAllAction.setEnabled(true);
- undoAction.setEnabled(false);
- redoAction.setEnabled(false);
- }
-
- public WorkbenchActionCallback getCallback() {
- return callback;
- }
-
- public Action getCopyAction() {
- return copyAction;
- }
-
- public Action getCutAction() {
- return cutAction;
- }
-
- public Action getFindAction() {
- return findAction;
- }
-
- public Action getPasteAction() {
- return pasteAction;
- }
-
- public Action getRedoAction() {
- return redoAction;
- }
-
- public Action getSelectAllAction() {
- return selectAllAction;
- }
-
- public Action getUndoAction() {
- return undoAction;
- }
-
- public void install(IActionBars bars) {
- bars.setGlobalActionHandler(ActionFactory.CUT.getId(), cutAction);
- bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
- bars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
- bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
- bars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
- bars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllAction);
- bars.setGlobalActionHandler(ActionFactory.FIND.getId(), findAction);
- bars.updateActionBars();
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof TextSelection) {
- // only update global actions
- updateActions(event.getSelection());
- } else if (selection.isEmpty()) {
- // XXX a styled text widget has lost focus, re-enable all edit actions
- forceEditActionsEnabled();
- }
- }
-
- public void setCallback(WorkbenchActionCallback callback) {
- this.callback = callback;
- }
-
- public void uninstall(IActionBars bars) {
- bars.setGlobalActionHandler(ActionFactory.CUT.getId(), null);
- bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), null);
- bars.setGlobalActionHandler(ActionFactory.COPY.getId(), null);
- bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), null);
- bars.setGlobalActionHandler(ActionFactory.REDO.getId(), null);
- bars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), null);
- bars.setGlobalActionHandler(ActionFactory.FIND.getId(), null);
- bars.updateActionBars();
- }
-
- public void updateActions(ISelection selection) {
- cutAction.selectionChanged(selection);
- copyAction.selectionChanged(selection);
- pasteAction.selectionChanged(selection);
- undoAction.selectionChanged(selection);
- redoAction.selectionChanged(selection);
- selectAllAction.selectionChanged(selection);
- findAction.selectionChanged(selection);
- }
-
-}
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
deleted file mode 100644
index 84f451f0..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * 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
- * IBM Corporation - helper methods from
- * org.eclipse.wst.common.frameworks.internal.ui.WTPActivityHelper
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Calendar;
-
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-import org.eclipse.mylyn.internal.commons.ui.Messages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.activities.IIdentifier;
-import org.eclipse.ui.activities.IWorkbenchActivitySupport;
-import org.eclipse.ui.browser.IWebBrowser;
-import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.internal.browser.WebBrowserPreference;
-import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
-import org.eclipse.ui.services.IServiceLocator;
-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$
-
- public static final String GROUP_FILE = "group.file"; //$NON-NLS-1$
-
- public static final String GROUP_REFRESH = "group.refresh"; //$NON-NLS-1$
-
- public static final String GROUP_FILTER = "group.filter"; //$NON-NLS-1$
-
- public static final String GROUP_NAVIGATE = "group.navigate"; //$NON-NLS-1$
-
- public static final String GROUP_NEW = "group.new"; //$NON-NLS-1$
-
- public static final String GROUP_OPEN = "group.open"; //$NON-NLS-1$
-
- public static final String GROUP_PREFERENCES = "group.preferences"; //$NON-NLS-1$
-
- public static final String GROUP_PROPERTIES = "group.properties"; //$NON-NLS-1$
-
- public static final String GROUP_RUN = "group.run"; //$NON-NLS-1$
-
- // TODO e3.6 IProgressConstants2#SHOW_IN_TASKBAR_ICON_PROPERTY
- public static final QualifiedName SHOW_IN_TASKBAR_ICON_PROPERTY = new QualifiedName(
- "org.eclipse.ui.workbench.progress", "inTaskBarIcon"); //$NON-NLS-1$//$NON-NLS-2$
-
- // FIXME remove this again
- private static final boolean TEST_MODE;
-
- static {
- String application = System.getProperty("eclipse.application", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (application.length() > 0) {
- TEST_MODE = application.endsWith("testapplication"); //$NON-NLS-1$
- } else {
- // eclipse 3.3 does not the eclipse.application property
- String commands = System.getProperty("eclipse.commands", ""); //$NON-NLS-1$ //$NON-NLS-2$
- TEST_MODE = commands.contains("testapplication\n"); //$NON-NLS-1$
- }
- }
-
-// public static IViewPart getFromActivePerspective(String viewId) {
-// if (PlatformUI.isWorkbenchRunning()) {
-// IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-// if (activePage != null) {
-// return activePage.findView(viewId);
-// }
-// }
-// return null;
-// }
-
- public static IViewPart showViewInActiveWindow(String viewId) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- try {
- return page.showView(viewId);
- } catch (PartInitException e) {
- // ignore
- }
- }
- }
- return null;
- }
-
- /**
- * Return the modal shell that is currently open. If there isn't one then return null.
- * <p>
- * <b>Note: Applied from patch on bug 99472.</b>
- *
- * @param shell
- * A shell to exclude from the search. May be <code>null</code>.
- * @return Shell or <code>null</code>.
- */
- private static Shell getModalShellExcluding(Shell shell) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- Shell[] shells = workbench.getDisplay().getShells();
- int modal = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL | SWT.PRIMARY_MODAL;
- for (Shell shell2 : shells) {
- if (shell2.equals(shell)) {
- break;
- }
- // Do not worry about shells that will not block the user.
- if (shell2.isVisible()) {
- int style = shell2.getStyle();
- if ((style & modal) != 0) {
- return shell2;
- }
- }
- }
- return null;
- }
-
- /**
- * Utility method to get the best parenting possible for a dialog. If there is a modal shell create it so as to
- * avoid two modal dialogs. If not then return the shell of the active workbench window. If neither can be found
- * return null.
- * <p>
- * <b>Note: Applied from patch on bug 99472.</b>
- *
- * @return Shell or <code>null</code>
- */
- public static Shell getShell() {
- if (!PlatformUI.isWorkbenchRunning() || PlatformUI.getWorkbench().isClosing()) {
- return null;
- }
- Shell modal = getModalShellExcluding(null);
- if (modal != null) {
- return modal;
- }
- return getNonModalShell();
- }
-
- /**
- * Get the active non modal shell. If there isn't one return null.
- * <p>
- * <b>Note: Applied from patch on bug 99472.</b>
- *
- * @return Shell
- */
- private static Shell getNonModalShell() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- if (windows.length > 0) {
- return windows[0].getShell();
- }
- } else {
- return window.getShell();
- }
-
- return null;
- }
-
- /**
- * @return whether the UI is set up to filter contributions (has defined activity categories).
- */
- public static final boolean isFiltering() {
- return !PlatformUI.getWorkbench().getActivitySupport().getActivityManager().getDefinedActivityIds().isEmpty();
- }
-
- public static boolean allowUseOf(Object object) {
- if (!isFiltering()) {
- return true;
- }
- if (object instanceof IPluginContribution) {
- IPluginContribution contribution = (IPluginContribution) object;
- if (contribution.getPluginId() != null) {
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
- IIdentifier identifier = workbenchActivitySupport.getActivityManager().getIdentifier(
- createUnifiedId(contribution));
- return identifier.isEnabled();
- }
- }
- if (object instanceof String) {
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
- IIdentifier identifier = workbenchActivitySupport.getActivityManager().getIdentifier((String) object);
- return identifier.isEnabled();
- }
- return true;
- }
-
- private static final String createUnifiedId(IPluginContribution contribution) {
- if (contribution.getPluginId() != null) {
- return contribution.getPluginId() + '/' + contribution.getLocalId();
- }
- return contribution.getLocalId();
- }
-
- /**
- * Opens <code>location</code> in a web-browser according to the Eclipse workbench preferences.
- *
- * @param location
- * the url to open
- * @see #openUrl(String, int)
- */
- public static void openUrl(String location) {
- openUrl(location, SWT.NONE);
- }
-
- /**
- * Opens <code>location</code> in a web-browser according to the Eclipse workbench preferences.
- *
- * @param location
- * the url to open
- * @param customFlags
- * additional flags that are passed to {@link IWorkbenchBrowserSupport}, pass
- * {@link IWorkbenchBrowserSupport#AS_EXTERNAL} to force opening external browser
- */
- public static void openUrl(String location, int customFlags) {
- try {
- URL url = null;
- if (location != null) {
- url = new URL(location);
- }
- if (WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.EXTERNAL
- || (customFlags & IWorkbenchBrowserSupport.AS_EXTERNAL) != 0) {
- try {
- IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
- support.getExternalBrowser().openURL(url);
- } catch (PartInitException e) {
- Status status = new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN,
- Messages.WorkbenchUtil_Browser_Initialization_Failed);
- CommonsUiPlugin.getDefault().getLog().log(status);
- if (!TEST_MODE) {
- MessageDialog.openError(getShell(), Messages.WorkbenchUtil_Open_Location_Title,
- status.getMessage());
- }
- }
- } else {
- IWebBrowser browser = null;
- int flags = customFlags;
- if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
- flags |= IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR
- | IWorkbenchBrowserSupport.NAVIGATION_BAR;
- } else {
- flags |= IWorkbenchBrowserSupport.AS_EXTERNAL | IWorkbenchBrowserSupport.LOCATION_BAR
- | IWorkbenchBrowserSupport.NAVIGATION_BAR;
- }
-
- String generatedId = "org.eclipse.mylyn.web.browser-" + Calendar.getInstance().getTimeInMillis(); //$NON-NLS-1$
- browser = WorkbenchBrowserSupport.getInstance().createBrowser(flags, generatedId, null, null);
- browser.openURL(url);
- }
- } catch (PartInitException e) {
- Status status = new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN,
- Messages.WorkbenchUtil_Browser_Initialization_Failed, e);
- CommonsUiPlugin.getDefault().getLog().log(status);
- if (!TEST_MODE) {
- MessageDialog.openError(getShell(), Messages.WorkbenchUtil_Open_Location_Title, status.getMessage());
- }
- } catch (MalformedURLException e) {
- if (location != null && location.trim().equals("")) { //$NON-NLS-1$
- Status status = new Status(IStatus.WARNING, CommonsUiPlugin.ID_PLUGIN,
- Messages.WorkbenchUtil_No_URL_Error, e);
- if (!TEST_MODE) {
- MessageDialog.openWarning(getShell(), Messages.WorkbenchUtil_Open_Location_Title,
- status.getMessage());
- } else {
- CommonsUiPlugin.getDefault().getLog().log(status);
- }
- } else {
- Status status = new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, NLS.bind(
- Messages.WorkbenchUtil_Invalid_URL_Error, location), e);
- if (!TEST_MODE) {
- MessageDialog.openError(getShell(), Messages.WorkbenchUtil_Open_Location_Title, status.getMessage());
- } else {
- CommonsUiPlugin.getDefault().getLog().log(status);
- }
- }
- }
- }
-
- public static void addDefaultGroups(IMenuManager menuManager) {
- menuManager.add(new Separator(GROUP_NEW));
- menuManager.add(new Separator(GROUP_OPEN));
- menuManager.add(new Separator(GROUP_EDIT));
- menuManager.add(new Separator(GROUP_FILE));
- menuManager.add(new Separator(GROUP_RUN));
- menuManager.add(new Separator(GROUP_NAVIGATE));
- menuManager.add(new Separator(GROUP_REFRESH));
- menuManager.add(new Separator(GROUP_FILTER));
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menuManager.add(new Separator(GROUP_PROPERTIES));
- }
-
- public static Object openProperties(IServiceLocator serviceLocator) {
- IHandlerService service = (IHandlerService) serviceLocator.getService(IHandlerService.class);
- if (service != null) {
- try {
- return service.executeCommand(IWorkbenchActionDefinitionIds.PROPERTIES, null);
- } catch (NotEnabledException e) {
- // ignore
- } catch (Exception e) {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN,
- "Opening repository properties failed", e)); //$NON-NLS-1$
- }
- }
- return IStatus.CANCEL;
- }
-
-}
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
deleted file mode 100644
index 80599ebf..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/CollapseAllAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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.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;
-
- 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/internal/provisional/commons/ui/actions/ExpandAllAction.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java
deleted file mode 100644
index 5fe4bc33..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/ExpandAllAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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.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;
-
- 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/internal/provisional/commons/ui/actions/Messages.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/Messages.java
deleted file mode 100644
index 1d4ee05c..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/Messages.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui.actions;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.provisional.commons.ui.actions.messages"; //$NON-NLS-1$
-
- 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;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-
-}
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
deleted file mode 100644
index 24ceccfc..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui.actions;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
-import org.eclipse.ui.PlatformUI;
-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() {
- super(Messages.PropertiesAction_Properties);
- }
-
- @Override
- public void run() {
- WorkbenchUtil.openProperties(PlatformUI.getWorkbench());
- }
-
-}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/messages.properties b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/messages.properties
deleted file mode 100644
index 1c807241..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/messages.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-CollapseAllAction_Label=Collapse All
-CollapseAllAction_ToolTip=Collapse All
-ExpandAllAction_Label=Expand All
-ExpandAllAction_ToolTip=Expand All
-PropertiesAction_Properties=Properties
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
deleted file mode 100644
index 962579f2..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractDeleteLineHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.ui.texteditor.TextViewerDeleteLineTarget;
-
-/**
- * Abstract command handler that uses {@link TextViewerDeleteLineTarget}. Subclasses can specify the type of delete line
- * 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;
-
- protected final boolean copyToClipboard;
-
- protected AbstractDeleteLineHandler(int type, boolean copyToClipboard) {
- this.type = type;
- this.copyToClipboard = copyToClipboard;
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ITextViewer viewer = getTextViewer(event);
- if (viewer != null) {
- TextViewerDeleteLineTarget target = new TextViewerDeleteLineTarget(viewer);
-
- try {
- ITextSelection textSelection = (ITextSelection) viewer.getSelectionProvider().getSelection();
-
- target.deleteLine(viewer.getDocument(), textSelection, type, copyToClipboard);
- } catch (BadLocationException e) {
- throw new ExecutionException(e.getMessage(), e);
- }
- }
- return null;
- }
-
-}
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
deleted file mode 100644
index 6177c57c..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/AbstractTextViewerHandler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.custom.StyledText;
-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 {
-
- /**
- * get the {@link ITextViewer} for the given event. Depends on the <tt>activeFocusControl</tt> event variable being
- * an instanceof {@link StyledText}. The {@link StyledText#getData(String))} is expected to have a value for one of
- * <code>ITextViewer.class.getName()</code> or <code>ISourceViewer.class.getName()</code>.
- *
- * @return the text viewer or null if it cannot be found
- */
- protected ITextViewer getTextViewer(ExecutionEvent event) throws ExecutionException {
- Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl"); //$NON-NLS-1$
- if (activeFocusControl instanceof StyledText) {
- StyledText textWidget = (StyledText) activeFocusControl;
- ITextViewer viewer = (ITextViewer) textWidget.getData(ITextViewer.class.getName());
- if (viewer == null) {
- viewer = (ITextViewer) textWidget.getData(ISourceViewer.class.getName());
- }
- return viewer;
- }
- return null;
- }
-} \ No newline at end of file
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
deleted file mode 100644
index e06e8431..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-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
deleted file mode 100644
index 61e98f82..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToBeginningHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-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
deleted file mode 100644
index 0e639d9c..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/CutLineToEndHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-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
deleted file mode 100644
index 65cf7f1f..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-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
deleted file mode 100644
index 5c1c9ac8..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToBeginningHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-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
deleted file mode 100644
index 23fec8a3..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/commands/DeleteLineToEndHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Tasktop Technologies Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.commons.ui.commands;
-
-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
deleted file mode 100644
index fe6f49e4..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/AbstractInPlaceDialog.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui.dialogs;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-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.CommonsUiPlugin;
-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;
-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
- * @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;
-
- 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) {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN,
- "Error while notifying IInPlaceCloseListener", exception)); //$NON-NLS-1$
- }
- });
- }
- }
-
- @Override
- protected void initializeBounds() {
- Rectangle monitorBounds = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .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/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java
deleted file mode 100644
index 4105b17f..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/EnhancedWizardDialog.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.EnhancedWizardDialog} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java
deleted file mode 100644
index be47a1c8..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IInPlaceDialogListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui.dialogs;
-
-/**
- * Listener interface for close events from an {@link AbstractInPlaceDialog}
- *
- * @author Shawn Minto
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.IInPlaceDialogListener} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/dialogs/IValidatable.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java
deleted file mode 100644
index 9e8e706c..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/IValidatable.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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.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();
-
- public boolean needsValidation();
-
- public void validate();
-
-}
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
deleted file mode 100644
index 1af1ea4e..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceCheckBoxTreeDialog.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui.dialogs;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.internal.provisional.commons.ui.EnhancedFilteredTree;
-import org.eclipse.mylyn.internal.provisional.commons.ui.SubstringPatternFilter;
-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.Shell;
-import org.eclipse.ui.dialogs.PatternFilter;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * @author Shawn Minto
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.InPlaceCheckBoxTreeDialog} instead
- */
-@Deprecated
-public class InPlaceCheckBoxTreeDialog extends AbstractInPlaceDialog {
-
- private final Map<String, String> validValues;
-
- private CheckboxFilteredTree valueTree;
-
- private final Set<String> selectedValues;
-
- private final String dialogLabel;
-
- private class CheckboxFilteredTree extends EnhancedFilteredTree {
-
- public CheckboxFilteredTree(Composite parent, int treeStyle, PatternFilter filter) {
- super(parent, treeStyle, filter);
- }
-
- @Override
- protected WorkbenchJob doCreateRefreshJob() {
- WorkbenchJob job = super.doCreateRefreshJob();
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- if (event.getResult() != null && event.getResult().isOK() && !getViewer().getTree().isDisposed()) {
- getViewer().setCheckedElements(selectedValues.toArray());
- }
- }
- });
- return job;
- }
-
- @Override
- protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
- return new CheckboxTreeViewer(parent, style);
- }
-
- @Override
- public CheckboxTreeViewer getViewer() {
- return (CheckboxTreeViewer) super.getViewer();
- }
-
- }
-
- public InPlaceCheckBoxTreeDialog(Shell shell, Control openControl, List<String> values,
- Map<String, String> validValues, String dialogLabel) {
- super(shell, SWT.RIGHT, openControl);
- Assert.isNotNull(values);
- Assert.isNotNull(validValues);
- Assert.isNotNull(dialogLabel);
- this.selectedValues = new HashSet<String>(values);
- this.validValues = validValues;
- this.dialogLabel = dialogLabel;
- setShellStyle(getShellStyle());
- }
-
- @Override
- protected Control createControl(Composite parent) {
- getShell().setText(dialogLabel);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = MARGIN_SIZE;
- layout.marginWidth = MARGIN_SIZE;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- composite.setLayout(layout);
- GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
- composite.setLayoutData(gd);
-
- valueTree = new CheckboxFilteredTree(composite, SWT.CHECK | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL
- | SWT.BORDER, new SubstringPatternFilter());
- gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
- gd.heightHint = 175;
- gd.widthHint = 160;
- CheckboxTreeViewer viewer = valueTree.getViewer();
- viewer.getControl().setLayoutData(gd);
-
- if (validValues != null) {
-
- viewer.setContentProvider(new ITreeContentProvider() {
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Map<?, ?>) {
- return ((Map<?, ?>) parentElement).keySet().toArray();
- }
- return null;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- });
-
- //viewer.setSorter(new ViewerSorter());
- viewer.setLabelProvider(new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element instanceof String) {
- return validValues.get(element);
- }
- return super.getText(element);
- }
- });
- viewer.setInput(validValues);
-
- Set<String> invalidValues = new HashSet<String>();
-
- // Remove any currently entered invalid values
- for (String value : selectedValues) {
- if (!validValues.containsKey(value)) {
- invalidValues.add(value);
- }
- }
-
- // Remove any unselected values
- for (String value : validValues.keySet()) {
- if (!viewer.setChecked(value, true)) {
- invalidValues.add(value);
- }
- }
-
- selectedValues.removeAll(invalidValues);
-
- viewer.setCheckedElements(selectedValues.toArray());
-
- }
-
- viewer.addCheckStateListener(new ICheckStateListener() {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (event.getChecked()) {
- selectedValues.add((String) event.getElement());
- } else {
- selectedValues.remove(event.getElement());
- }
- }
-
- });
-
- return valueTree;
- }
-
- public Set<String> getSelectedValues() {
- return new HashSet<String>(selectedValues);
- }
-
-}
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
deleted file mode 100644
index 8d562f50..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDateSelectionDialog.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui.dialogs;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.mylyn.internal.commons.ui.Messages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePickerPanel;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePickerPanel.DateSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Ken Sueda
- * @author Mik Kersten
- * @author Rob Elves
- * @author Shawn Minto
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.forms.InPlaceDateSelectionDialog} instead
- */
-@Deprecated
-public class InPlaceDateSelectionDialog extends AbstractInPlaceDialog {
-
- private Date selectedDate = null;
-
- private String title = Messages.DateSelectionDialog_Date_Selection;
-
- private final Calendar initialCalendar = Calendar.getInstance();
-
- private boolean includeTime = true;
-
- private int hourOfDay = 0;
-
- public InPlaceDateSelectionDialog(Shell parentShell, Control openControl, Calendar initialDate, String title,
- boolean includeTime, int hourOfDay) {
- super(parentShell, SWT.RIGHT, openControl);
- this.includeTime = includeTime;
- this.hourOfDay = hourOfDay;
- if (title != null) {
- this.title = title;
- }
- if (initialDate != null) {
- this.initialCalendar.setTime(initialDate.getTime());
- }
- selectedDate = initialCalendar.getTime();
- }
-
- @Override
- protected Control createControl(Composite parent) {
- getShell().setText(title);
- final DatePickerPanel datePanel = new DatePickerPanel(parent, SWT.NULL, initialCalendar, includeTime,
- hourOfDay, MARGIN_SIZE);
- datePanel.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- if (!event.getSelection().isEmpty()) {
- DateSelection dateSelection = (DateSelection) event.getSelection();
- selectedDate = dateSelection.getDate().getTime();
- if (dateSelection.isDefaultSelection()) {
- close();
- }
- }
- }
- });
-
- datePanel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
-
- return datePanel;
- }
-
- @Override
- public boolean close() {
- return super.close();
- }
-
- @Override
- protected void createButtons(Composite composite) {
- }
-
- public Date getDate() {
- return selectedDate;
- }
-}
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
deleted file mode 100644
index 784fd3e5..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/InPlaceDialogEvent.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui.dialogs;
-
-/**
- * Event sent with an {@link IInPlaceDialogListener} that contains information about the close event that occurred
- *
- * @author Shawn Minto
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.dialogs.InPlaceDialogEvent} instead
- */
-@Deprecated
-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/internal/provisional/commons/ui/dialogs/Messages.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java
deleted file mode 100644
index 41de108c..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/Messages.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui.dialogs;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.messages"; //$NON-NLS-1$
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-
- public static String ValidatableWizardDialog_Validate_Button_Label;
-}
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
deleted file mode 100644
index 226d2fbe..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.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.internal.provisional.commons.ui.CommonImages;
-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
- * @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$
-
- 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/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java
deleted file mode 100644
index a136d3d3..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/WebBrowserDialog.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * 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.internal.provisional.commons.ui.dialogs;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.reflect.Method;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-import org.eclipse.mylyn.internal.provisional.commons.ui.PlatformUiUtil;
-import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.StatusTextEvent;
-import org.eclipse.swt.browser.StatusTextListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-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;
-import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-/**
- * Dialog that show the contents of an HTML page or the content of a URL in a dialog.
- *
- * @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;
-
- private Browser browser;
-
- private Label statusLabel;
-
- public WebBrowserDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
- int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
- defaultIndex);
- this.setShellStyle(SWT.SHELL_TRIM | SWT.RESIZE);
- }
-
- public void setText(String text) {
- this.text = text;
- if (browser != null) {
- browser.setText(text);
- }
- }
-
- public String getText() {
- return text;
- }
-
- public boolean setUrl(String url, String postData, String[] headers) {
- // TODO e3.6 replace reflection with call to setUrl(...)
- Method method;
- try {
- method = Browser.class.getDeclaredMethod("setUrl", String.class, String.class, //$NON-NLS-1$
- String[].class);
- return (Boolean) method.invoke(getBrowser(), url, postData, headers);
- } catch (Exception e) {
- return false;
- }
- }
-
- public static int openText(Shell parent, String title, String message, String text) {
- if (PlatformUiUtil.hasInternalBrowser()) {
- WebBrowserDialog dialog = new WebBrowserDialog(parent, title, null, message, NONE,
- new String[] { IDialogConstants.OK_LABEL }, 0);
- dialog.setText(text);
- return dialog.open();
- } else {
- File file = null;
- try {
- file = File.createTempFile("temp", ".html"); //$NON-NLS-1$ //$NON-NLS-2$
- file.deleteOnExit();
- BufferedWriter writer = new BufferedWriter(new FileWriter(file));
- try {
- writer.write(message);
- } finally {
- writer.close();
- }
- } catch (IOException e) {
- if (file != null) {
- file.delete();
- }
- StatusManager.getManager().handle(
- new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN,
- "Unexpected error while displaying page", e), StatusManager.LOG); //$NON-NLS-1$
- return Window.CANCEL;
- }
- WorkbenchUtil.openUrl(file.toURI().toString(), IWorkbenchBrowserSupport.AS_EXTERNAL);
- return Window.OK;
- }
- }
-
- @Override
- public Control createCustomArea(Composite parent) {
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- parent.setLayout(layout);
-
- browser = new Browser(parent, SWT.BORDER);
- GridDataFactory.fillDefaults().grab(true, true).applyTo(browser);
-
- statusLabel = new Label(parent, SWT.NONE);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(statusLabel);
-
- browser.addStatusTextListener(new StatusTextListener() {
- public void changed(StatusTextEvent event) {
- statusLabel.setText((event.text != null) ? event.text : ""); //$NON-NLS-1$
- }
- });
- if (text != null) {
- browser.setText(text);
- }
-
- Dialog.applyDialogFont(parent);
- return parent;
- }
-
- public Browser getBrowser() {
- return browser;
- }
-
- @Override
- protected Point getInitialSize() {
- return new Point(500, 500);
- }
-
-}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/messages.properties b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/messages.properties
deleted file mode 100644
index 718c58b9..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/messages.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-###############################################################################
-# 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
-###############################################################################
-ValidatableWizardDialog_Validate_Button_Label=&Validate
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
deleted file mode 100644
index 83db3c8a..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/EditorBusyIndicator.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui.editor;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.internal.commons.ui.CommonsUiPlugin;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Provides a spinner animation for the tab title of an editor.
- *
- * @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 {
-
- int imageDataIndex = 0;
-
- private final Image[] images;
-
- private boolean stopped;
-
- public Animator(Image[] images) {
- this.images = images;
- }
-
- public void run() {
- if (stopped) {
- return;
- }
-
- try {
- Image image = images[imageDataIndex];
- imageDataIndex = (imageDataIndex + 1) % images.length;
-
- if (updateTitleImage(image)) {
- PlatformUI.getWorkbench().getDisplay().timerExec(UPDATE_INTERVAL, this);
- }
- } catch (Exception e) {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, "Failed to update animation", e)); //$NON-NLS-1$
- }
- }
-
- public void stop() {
- stopped = true;
- }
- }
-
- private static final int UPDATE_INTERVAL = 90;
-
- private Animator animator;
-
- private final IBusyEditor editor;
-
- private Image[] images;
-
- private Image oldImage;
-
- public EditorBusyIndicator(IBusyEditor editor) {
- this.editor = editor;
- }
-
- /**
- * Starts the busy indication.
- *
- * @see #stop()
- */
- public void start() {
- if (animator != null) {
- stop();
- }
-
- try {
- if (images == null) {
- images = CommonImages.getProgressImages();
- // if image fails to load do not continue
- if (images == null) {
- return;
- }
- }
-
- oldImage = editor.getTitleImage();
-
- if (images.length > 1) {
- animator = new Animator(images);
- animator.run();
- }
- } catch (SWTException e) {
- CommonsUiPlugin.getDefault()
- .getLog()
- .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, "Failed to start animation", e)); //$NON-NLS-1$
- }
- }
-
- /**
- * Stops the animation.
- *
- * @see #start()
- */
- public void stop() {
- if (animator != null) {
- animator.stop();
- animator = null;
-
- updateTitleImage(oldImage);
- oldImage = null;
- }
- }
-
- private boolean updateTitleImage(final Image image) {
- if (!PlatformUI.getWorkbench().isClosing()) {
- if (image != null && !image.isDisposed()) {
- editor.setTitleImage(image);
- return true;
- } else {
- if (oldImage != null && !oldImage.isDisposed()) {
- editor.setTitleImage(oldImage);
- }
- }
- }
- return false;
- }
-
-}
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
deleted file mode 100644
index ec5ad50b..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/editor/IBusyEditor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * 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.provisional.commons.ui.editor;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.part.WorkbenchPart;
-
-/**
- * A callback for modifying the title image of an editor. Clients that provide busy animations should implement this
- * interface and delegate to the respective methods in {@link WorkbenchPart}.
- *
- * @author Shawn Minto
- * @see EditorBusyIndicator
- * @deprecated use {@link org.eclipse.mylyn.commons.ui.workbench.IBusyEditor} instead
- */
-@Deprecated
-public interface IBusyEditor {
-
- /**
- * Updates the title image of the editor to <code>image</code>.
- *
- * @param image
- * the image
- */
- public void setTitleImage(Image image);
-
- /**
- * Returns the current title image of the editor.
- */
- public Image getTitleImage();
-
-}
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/messages.properties b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/messages.properties
deleted file mode 100644
index 09161032..00000000
--- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/messages.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2009, 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
-###############################################################################
-AbstractColumnViewerSupport_Restore_defaults=Restore Defaults
-DatePickerPanel_Today=Today
-TextControl_FindToolTip=Find
-TextControl_AccessibleListenerFindButton=Find

Back to the top