Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java120
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryTest.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttributePart.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextEditor.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java52
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java18
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java39
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java2
17 files changed, 93 insertions, 218 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF
index 299a8e89e..b2af0ee17 100644
--- a/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF
@@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.tasks.bugs,
org.eclipse.mylyn.commons.core,
org.eclipse.ui.browser,
- org.eclipse.core.expressions
+ org.eclipse.core.expressions,
+ org.eclipse.equinox.security
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: mylyn-tasklist-tests.jar
Export-Package: org.eclipse.mylyn.tasks.tests;x-internal:=true,
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java
index 3e412948b..adeaf780e 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java
@@ -12,15 +12,22 @@
package org.eclipse.mylyn.tasks.tests;
import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import junit.framework.TestCase;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.security.storage.EncodingUtils;
+import org.eclipse.equinox.security.storage.ISecurePreferences;
+import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
@@ -43,25 +50,25 @@ public class TaskRepositoryManagerTest extends TestCase {
private static final String ANOTHER_URL = "http://codehaus.org";
-// private final String USERNAME = ".username"; //$NON-NLS-1$
-//
-// private final String PASSWORD = ".password"; //$NON-NLS-1$
-//
-// private final String AUTH_REPOSITORY = "org.eclipse.mylyn.tasklist.repositories"; //$NON-NLS-1$
-//
-// private final String AUTH_PASSWORD = AUTH_REPOSITORY + PASSWORD;
-//
-// private final String AUTH_USERNAME = AUTH_REPOSITORY + USERNAME;
-//
-// private final String AUTH_HTTP = "org.eclipse.mylyn.tasklist.repositories.httpauth"; //$NON-NLS-1$
-//
-// private final String AUTH_HTTP_PASSWORD = AUTH_HTTP + PASSWORD;
-//
-// private final String AUTH_HTTP_USERNAME = AUTH_HTTP + USERNAME;
-//
-// private final String AUTH_SCHEME = "Basic"; //$NON-NLS-1$
-//
-// private final String AUTH_REALM = ""; //$NON-NLS-1$
+ private final String USERNAME = ".username"; //$NON-NLS-1$
+
+ private final String PASSWORD = ".password"; //$NON-NLS-1$
+
+ private final String AUTH_REPOSITORY = "org.eclipse.mylyn.tasklist.repositories"; //$NON-NLS-1$
+
+ private final String AUTH_PASSWORD = AUTH_REPOSITORY + PASSWORD;
+
+ private final String AUTH_USERNAME = AUTH_REPOSITORY + USERNAME;
+
+ private final String AUTH_HTTP = "org.eclipse.mylyn.tasklist.repositories.httpauth"; //$NON-NLS-1$
+
+ private final String AUTH_HTTP_PASSWORD = AUTH_HTTP + PASSWORD;
+
+ private final String AUTH_HTTP_USERNAME = AUTH_HTTP + USERNAME;
+
+ private final String AUTH_SCHEME = "Basic"; //$NON-NLS-1$
+
+ private final String AUTH_REALM = ""; //$NON-NLS-1$
private TaskRepositoryManager manager;
@@ -81,44 +88,44 @@ public class TaskRepositoryManagerTest extends TestCase {
}
}
- // TODO e3.4 re-enable keystore tests
-// @SuppressWarnings("deprecation")
-// public void testsUseSecureStorage() throws Exception {
-// TaskRepository repository = new TaskRepository("bugzilla", "http://repository2/");
-// repository.setProperty(ITasksCoreConstants.PROPERTY_USE_SECURE_STORAGE, "true");
-// repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("testUserName",
-// "testPassword"), true);
-//
-// ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault()
-// .node(ITasksCoreConstants.ID_PLUGIN);
-// securePreferences = securePreferences.node(EncodingUtils.encodeSlashes(repository.getUrl()));
-// assertEquals("testPassword", securePreferences.get(AUTH_PASSWORD, null));
-// assertEquals("testUserName", repository.getProperty(AUTH_USERNAME));
-// assertEquals("shouldbenull", securePreferences.get(AUTH_USERNAME, "shouldbenull"));
-// assertNull(Platform.getAuthorizationInfo(new URL(repository.getUrl()), AUTH_REALM, AUTH_SCHEME));
-// }
-//
-// @SuppressWarnings("deprecation")
-// public void testsUseKeyring() throws Exception {
-// TaskRepository repository = new TaskRepository("bugzilla", "http://repository3/");
-// repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("testUserName",
-// "testPassword"), true);
-//
-// repository.setCredentials(AuthenticationType.HTTP,
-// new AuthenticationCredentials("httpUserName", "httpPassword"), true);
-//
-// ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault()
-// .node(ITasksCoreConstants.ID_PLUGIN);
-// securePreferences = securePreferences.node(EncodingUtils.encodeSlashes(repository.getUrl()));
-// assertNull(securePreferences.get(AUTH_PASSWORD, null));
-// assertNull("testUserName", repository.getProperty(AUTH_USERNAME));
-// Map map = Platform.getAuthorizationInfo(new URL(repository.getUrl()), AUTH_REALM, AUTH_SCHEME);
-// assertEquals("testUserName", map.get(AUTH_USERNAME));
-// assertEquals("testPassword", map.get(AUTH_PASSWORD));
-// assertEquals("httpUserName", map.get(AUTH_HTTP_USERNAME));
-// assertEquals("httpPassword", map.get(AUTH_HTTP_PASSWORD));
-// }
+ @SuppressWarnings("deprecation")
+ public void testsUseSecureStorage() throws Exception {
+ TaskRepository repository = new TaskRepository("bugzilla", "http://repository2/");
+ repository.setProperty(ITasksCoreConstants.PROPERTY_USE_SECURE_STORAGE, "true");
+ repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("testUserName",
+ "testPassword"), true);
+ ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault()
+ .node(ITasksCoreConstants.ID_PLUGIN);
+ securePreferences = securePreferences.node(EncodingUtils.encodeSlashes(repository.getUrl()));
+ assertEquals("testPassword", securePreferences.get(AUTH_PASSWORD, null));
+ assertEquals("testUserName", repository.getProperty(AUTH_USERNAME));
+ assertEquals("shouldbenull", securePreferences.get(AUTH_USERNAME, "shouldbenull"));
+ assertNull(Platform.getAuthorizationInfo(new URL(repository.getUrl()), AUTH_REALM, AUTH_SCHEME));
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testsUseKeyring() throws Exception {
+ TaskRepository repository = new TaskRepository("bugzilla", "http://repository3/");
+ repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("testUserName",
+ "testPassword"), true);
+
+ repository.setCredentials(AuthenticationType.HTTP,
+ new AuthenticationCredentials("httpUserName", "httpPassword"), true);
+
+ ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault()
+ .node(ITasksCoreConstants.ID_PLUGIN);
+ securePreferences = securePreferences.node(EncodingUtils.encodeSlashes(repository.getUrl()));
+ assertNull(securePreferences.get(AUTH_PASSWORD, null));
+ assertNull("testUserName", repository.getProperty(AUTH_USERNAME));
+ Map<?, ?> map = Platform.getAuthorizationInfo(new URL(repository.getUrl()), AUTH_REALM, AUTH_SCHEME);
+ assertEquals("testUserName", map.get(AUTH_USERNAME));
+ assertEquals("testPassword", map.get(AUTH_PASSWORD));
+ assertEquals("httpUserName", map.get(AUTH_HTTP_USERNAME));
+ assertEquals("httpPassword", map.get(AUTH_HTTP_PASSWORD));
+ }
+
+ // FIXME 3.3 re-enable test
// public void testMigrationToSecureStorage() throws Exception {
// TaskRepository repository1 = new TaskRepository("bugzilla", "http://repository1/");
//
@@ -148,7 +155,6 @@ public class TaskRepositoryManagerTest extends TestCase {
// assertEquals("testpassword", securePreferences.get(AUTH_PASSWORD, null));
// assertEquals("testhttpuser", securePreferences.get(AUTH_HTTP_USERNAME, null));
// assertEquals("testhttppassword", securePreferences.get(AUTH_HTTP_PASSWORD, null));
-//
// }
public void testRepositoryWithSlash() throws MalformedURLException {
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryTest.java
index c9a204f09..8e0e67f34 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryTest.java
@@ -99,7 +99,6 @@ public class TaskRepositoryTest extends TestCase {
assertTrue(Platform.isRunning());
}
- // TODO e3.4 move to new api
@SuppressWarnings("deprecation")
public void password(AuthenticationType authType) throws Exception {
URL url = new URL("http://url");
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java
deleted file mode 100644
index 0aed92281..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java
+++ /dev/null
@@ -1,40 +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.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-
-/**
- * @author Steffen Pingel
- */
-// TODO e3.4 replace with org.eclipse.ui.handlers.CollapseAllHandler
-public class CollapseAllHandler extends AbstractHandler {
-
- public static final String ID_COMMAND = "org.eclipse.ui.navigate.collapseAll"; //$NON-NLS-1$
-
- private final AbstractTreeViewer treeViewer;
-
- public CollapseAllHandler(AbstractTreeViewer treeViewer) {
- Assert.isNotNull(treeViewer);
- this.treeViewer = treeViewer;
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- treeViewer.collapseAll();
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
index cb488d25b..a204512f7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
@@ -34,10 +34,8 @@ public class UiLegendDialog extends PopupDialog {
private UiLegendControl content;
- // TODO e3.4 move to new api
- @SuppressWarnings("deprecation")
public UiLegendDialog(Shell parent) {
- super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE | SWT.ON_TOP, false, false, false, false, null, null);
+ super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE | SWT.ON_TOP, false, false, false, false, false, null, null);
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttributePart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttributePart.java
index dc1d54900..e896e08a6 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttributePart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttributePart.java
@@ -151,7 +151,7 @@ public class AttributePart extends AbstractLocalEditorPart {
final Composite textClient = toolkit.createComposite(section);
textClient.setBackground(null);
RowLayout rowLayout = new RowLayout();
- EditorUtil.center(rowLayout);
+ rowLayout.center = true;
rowLayout.marginLeft = 20;
rowLayout.marginTop = 1;
rowLayout.marginBottom = 1;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
index 42884929f..ed274e449 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
@@ -369,7 +369,10 @@ public class EditorUtil {
CommonUiUtil.setMenu(composite, menu);
}
- // TODO e3.4 replace reflection by assignment to RowLayout.center
+ /**
+ * @deprecated use {@link RowLayout#center} instead
+ */
+ @Deprecated
public static void center(RowLayout rowLayout) {
try {
Field field = RowLayout.class.getDeclaredField("center"); //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java
index ebf35d337..6a67ed81c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java
@@ -327,7 +327,7 @@ public class PlanningPart extends AbstractLocalEditorPart {
actualTimeComposite.setBackground(null);
actualTimeComposite.setBackgroundMode(SWT.INHERIT_FORCE);
RowLayout rowLayout = new RowLayout();
- EditorUtil.center(rowLayout);
+ rowLayout.center = true;
rowLayout.marginTop = 0;
rowLayout.marginBottom = 0;
actualTimeComposite.setLayout(rowLayout);
@@ -522,7 +522,7 @@ public class PlanningPart extends AbstractLocalEditorPart {
RowLayout rowLayout = new RowLayout();
rowLayout.marginTop = 0;
rowLayout.marginBottom = 0;
- EditorUtil.center(rowLayout);
+ rowLayout.center = true;
toolbarComposite.setLayout(rowLayout);
createActualTime(toolkit, toolbarComposite);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextEditor.java
index 56310f7f1..f88159fb3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextEditor.java
@@ -32,7 +32,6 @@ import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
import org.eclipse.mylyn.internal.tasks.ui.commands.ViewSourceHandler;
import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTextViewerConfiguration.Mode;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.editors.AbstractRenderingEngine;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
@@ -225,7 +224,7 @@ public class RichTextEditor {
this.toolkit = toolkit;
int style = this.style;
- if (!isReadOnly() && (style & TasksUiInternal.SWT_NO_SCROLL) == 0) {
+ if (!isReadOnly() && (style & SWT.NO_SCROLL) == 0) {
style |= SWT.V_SCROLL;
}
@@ -268,7 +267,7 @@ public class RichTextEditor {
show(defaultViewer.getControl());
}
- if (!isReadOnly() && (style & TasksUiInternal.SWT_NO_SCROLL) == 0) {
+ if (!isReadOnly() && (style & SWT.NO_SCROLL) == 0) {
editorComposite.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
index 049731153..33b7b7ad3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
@@ -32,7 +32,6 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.mylyn.internal.provisional.commons.ui.EnhancedFilteredTree;
import org.eclipse.mylyn.internal.provisional.commons.ui.SubstringPatternFilter;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
@@ -251,9 +250,8 @@ public class RepositorySearchResultView extends AbstractTextSearchViewPage imple
treeComposite.setLayout(layout);
}
- // TODO e3.5 use new FilteredTree API
- FilteredTree searchTree = new EnhancedFilteredTree(treeComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL,
- new SubstringPatternFilter());
+ FilteredTree searchTree = new FilteredTree(treeComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL,
+ new SubstringPatternFilter(), true);
return searchTree.getViewer();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java
index a31087686..c45cfebb9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java
@@ -13,53 +13,14 @@
package org.eclipse.mylyn.internal.tasks.ui.util;
-import java.lang.reflect.Method;
-
import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.widgets.ToolBar;
/**
* @author Steffen Pingel
*/
public class PlatformUtil {
- private static ByteArrayTransfer urlTransfer;
- static {
- // TODO e3.4 use URLTransfer directly and not through reflection
- // URLTransfer is package protected in Eclipse 3.3 (bug 100095)
- // use reflection to access instance for now
- try {
- Class<?> clazz = Class.forName("org.eclipse.swt.dnd.URLTransfer"); //$NON-NLS-1$
- Method method = clazz.getMethod("getInstance"); //$NON-NLS-1$
- if (method != null) {
- urlTransfer = (ByteArrayTransfer) method.invoke(null);
- }
- } catch (Throwable e) {
- // ignore
- }
- if (urlTransfer == null) {
- urlTransfer = new ByteArrayTransfer() {
-
- private static final String TYPE = "dummy"; //$NON-NLS-1$
-
- private final int TYPE_ID = registerType(TYPE);
-
- @Override
- protected int[] getTypeIds() {
- return new int[] { TYPE_ID };
- }
-
- @Override
- protected String[] getTypeNames() {
- return new String[] { TYPE };
- }
-
- };
- }
- }
-
/**
* bug 247182: file import dialog doesn't work on Mac OS X if the file extension has more than one dot.
*/
@@ -124,19 +85,6 @@ public class PlatformUtil {
return "gtk".equals(SWT.getPlatform()); //$NON-NLS-1$
}
- public static ByteArrayTransfer getUrlTransfer() {
- return urlTransfer;
- }
-
- /**
- * If a Gtk toolbar does not have a standard ToolItem but use only ControlContributions a dummy ToolItem needs to be
- * added to force the height of the tool bar to be > 0 pixels.
- */
- // TODO e3.4: remove, platform has been fixed
- public static boolean isToolBarHeightBroken(ToolBar toolBar) {
- return Platform.WS_GTK.equals(SWT.getPlatform()) && toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT, false).y == 0;
- }
-
public static boolean spinnerHasNativeBorder() {
return isMac();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
index 6970a15e3..cdc6473f2 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
@@ -116,9 +116,6 @@ import org.eclipse.ui.handlers.IHandlerService;
*/
public class TasksUiInternal {
- // TODO e3.4 replace with SWT.NO_SCROLL constant
- public static final int SWT_NO_SCROLL = 1 << 4;
-
public static final String ID_MENU_ACTIVE_TASK = "org.eclipse.mylyn.tasks.ui.menus.activeTask"; //$NON-NLS-1$
public static MultiRepositoryAwareWizard createNewTaskWizard(ITaskMapping taskSelection) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
index 2f8c07b2d..6bc6f2496 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
@@ -31,7 +31,6 @@ import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AbstractRetrieveTitleFromUrlJob;
-import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Unscheduled;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
@@ -43,6 +42,7 @@ import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.dnd.URLTransfer;
import org.eclipse.ui.PlatformUI;
/**
@@ -235,7 +235,7 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
} else {
return false;
}
- } else if (PlatformUtil.getUrlTransfer().isSupportedType(transferType)) {
+ } else if (URLTransfer.getInstance().isSupportedType(transferType)) {
return true;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
index 84da4a595..870f4af68 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
@@ -84,7 +84,6 @@ import org.eclipse.mylyn.internal.tasks.ui.actions.PresentationDropDownSelection
import org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeAutomaticallyAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.TaskListSortAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.TaskListViewActionGroup;
-import org.eclipse.mylyn.internal.tasks.ui.commands.CollapseAllHandler;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskListChangeAdapter;
import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.SortCriterion;
@@ -114,6 +113,7 @@ import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.RTFTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.URLTransfer;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.FocusAdapter;
@@ -162,6 +162,7 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.handlers.CollapseAllHandler;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.IShowInTarget;
@@ -275,9 +276,6 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
}
}
- // TODO e3.4 replace with SWT.NO_SCROLL constant
- public static final int SWT_NO_SCROLL = 1 << 4;
-
private static final String ID_SEPARATOR_FILTERS = "filters"; //$NON-NLS-1$
private static final String ID_SEPARATOR_TASKS = "tasks"; //$NON-NLS-1$
@@ -845,7 +843,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
themeManager.addPropertyChangeListener(THEME_CHANGE_LISTENER);
filteredTree = new TaskListFilteredTree(parent, SWT.MULTI | SWT.VERTICAL | /* SWT.H_SCROLL | */SWT.V_SCROLL
- | SWT_NO_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION, new SubstringPatternFilter(),
+ | SWT.NO_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION, new SubstringPatternFilter(),
getViewSite().getWorkbenchWindow());
// Set to empty string to disable native tooltips (windows only?)
// bug#160897
@@ -1022,7 +1020,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
private void initHandlers() {
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
- handlerService.activateHandler(CollapseAllHandler.ID_COMMAND, new CollapseAllHandler(getViewer()));
+ handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new CollapseAllHandler(getViewer()));
}
private void hookGlobalActions() {
@@ -1157,7 +1155,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
private void initDragAndDrop(Composite parent) {
Transfer[] dragTypes = new Transfer[] { LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
Transfer[] dropTypes = new Transfer[] { LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(),
- TextTransfer.getInstance(), RTFTransfer.getInstance(), PlatformUtil.getUrlTransfer() };
+ TextTransfer.getInstance(), RTFTransfer.getInstance(), URLTransfer.getInstance() };
getViewer().addDragSupport(DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK, dragTypes,
new TaskDragSourceListener(getViewer()));
@@ -1273,9 +1271,9 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
public void doubleClick(DoubleClickEvent event) {
if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
ITasksUiPreferenceConstants.ACTIVATE_WHEN_OPENED)) {
- AbstractTask selectedTask = TaskListView.getFromActivePerspective().getSelectedTask();
- if (selectedTask != null) {
- actionGroup.getActivateAction().run(selectedTask);
+ AbstractTask selectedTask = getSelectedTask();
+ if (selectedTask != null && !selectedTask.isActive()) {
+ TasksUi.getTaskActivityManager().activateTask(selectedTask);
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
index 8bb05a868..f4c19dd4f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
@@ -12,7 +12,6 @@
package org.eclipse.mylyn.tasks.ui;
-import java.lang.reflect.Constructor;
import java.util.Iterator;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -21,7 +20,7 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.TextPresentation;
import org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter;
import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
+import org.eclipse.jface.text.hyperlink.MultipleHyperlinkPresenter;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.ITask;
@@ -35,7 +34,7 @@ import org.eclipse.swt.graphics.RGB;
* @author Frank Becker
* @since 3.1
*/
-public final class TaskHyperlinkPresenter extends DefaultHyperlinkPresenter {
+public final class TaskHyperlinkPresenter extends MultipleHyperlinkPresenter {
private IRegion activeRegion;
@@ -47,14 +46,11 @@ public final class TaskHyperlinkPresenter extends DefaultHyperlinkPresenter {
private ITextViewer textViewer;
- private IHyperlinkPresenter multiplePresenter;
-
/**
* @see DefaultHyperlinkPresenter#DefaultHyperlinkPresenter(IPreferenceStore)
*/
public TaskHyperlinkPresenter(IPreferenceStore store) {
super(store);
- initMultipleHyperlinkSupport(IPreferenceStore.class, store);
}
/**
@@ -62,33 +58,12 @@ public final class TaskHyperlinkPresenter extends DefaultHyperlinkPresenter {
*/
public TaskHyperlinkPresenter(RGB color) {
super(color);
- initMultipleHyperlinkSupport(RGB.class, color);
- }
-
- @Override
- public boolean canShowMultipleHyperlinks() {
- return multiplePresenter != null;
- }
-
- // TODO e3.4 remove reflection
- @SuppressWarnings("unchecked")
- private <T> void initMultipleHyperlinkSupport(Class<T> argClass, T arg) {
- try {
- Class<IHyperlinkPresenter> clazz = (Class<IHyperlinkPresenter>) Class.forName("org.eclipse.jface.text.hyperlink.MultipleHyperlinkPresenter"); //$NON-NLS-1$
- Constructor<IHyperlinkPresenter> constructor = clazz.getDeclaredConstructor(argClass);
- multiplePresenter = constructor.newInstance(arg);
- } catch (Throwable t) {
- // ignore
- }
}
@Override
public void install(ITextViewer textViewer) {
this.textViewer = textViewer;
super.install(textViewer);
- if (multiplePresenter != null) {
- multiplePresenter.install(textViewer);
- }
}
@Override
@@ -96,9 +71,6 @@ public final class TaskHyperlinkPresenter extends DefaultHyperlinkPresenter {
hideHyperlinks();
this.textViewer = null;
super.uninstall();
- if (multiplePresenter != null) {
- multiplePresenter.uninstall();
- }
}
@SuppressWarnings("unchecked")
@@ -120,8 +92,8 @@ public final class TaskHyperlinkPresenter extends DefaultHyperlinkPresenter {
@Override
public void showHyperlinks(IHyperlink[] hyperlinks) {
- if (hyperlinks.length > 1 && multiplePresenter != null) {
- multiplePresenter.showHyperlinks(hyperlinks);
+ if (hyperlinks.length > 1) {
+ super.showHyperlinks(hyperlinks);
} else {
activeRegion = null;
if (hyperlinks.length > 0 && hyperlinks[0] instanceof TaskHyperlink) {
@@ -160,9 +132,6 @@ public final class TaskHyperlinkPresenter extends DefaultHyperlinkPresenter {
}
currentTaskHyperlink = null;
}
- if (multiplePresenter != null) {
- multiplePresenter.hideHyperlinks();
- }
super.hideHyperlinks();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java
index 13b548788..ffb262bc9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java
@@ -22,7 +22,6 @@ import org.eclipse.mylyn.internal.tasks.ui.editors.SingleSelectionAttributeEdito
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
import org.eclipse.mylyn.internal.tasks.ui.editors.TextAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTextViewerConfiguration.Mode;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
@@ -119,7 +118,7 @@ public class AttributeEditorFactory {
return new SingleSelectionAttributeEditor(model, taskAttribute);
} else if (TaskAttribute.TYPE_TASK_DEPENDENCY.equals(type)) {
RichTextAttributeEditor editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute,
- SWT.MULTI | TasksUiInternal.SWT_NO_SCROLL) {
+ SWT.MULTI | SWT.NO_SCROLL) {
@Override
public String getValue() {
return getAttributeMapper().getValueLabel(getTaskAttribute());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index a66c166de..8e48a81d5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -881,7 +881,7 @@ public class TaskEditor extends SharedHeaderFormEditor {
if (PlatformUtil.hasNarrowToolBar()) {
layout.marginTop = 0;
layout.marginBottom = 0;
- EditorUtil.center(layout);
+ layout.center = true;
}
composite.setLayout(layout);
composite.setBackground(null);

Back to the top