Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2git2009-02-18 14:09:48 -0500
committercvs2git2009-02-18 14:09:48 -0500
commit4a07c4742886728574392fdc3e821abf2e8b0c06 (patch)
treecca17323d808607acf7195e0fa07a310e3649985
parent3d971544900483c5c2263c186bb31a998540ac9b (diff)
downloadorg.eclipse.mylyn.tasks-4a07c4742886728574392fdc3e821abf2e8b0c06.tar.gz
org.eclipse.mylyn.tasks-4a07c4742886728574392fdc3e821abf2e8b0c06.tar.xz
org.eclipse.mylyn.tasks-4a07c4742886728574392fdc3e821abf2e8b0c06.zip
This commit was manufactured by cvs2svn to create tag 'R_3_0_5_e_3_3'.R_3_0_5_e_3_3
Sprout from e_3_3_m_3_0_x 2009-02-12 02:14:26 UTC spingel 'NEW - bug 248778: [releng] backport changes to Eclipse 3.3' Cherrypick from e_3_4_m_3_0_x 2009-02-18 19:09:46 UTC relves '263318: [m3.0.5] Fix for Bugzilla (BMO) bug 26257 Breaks Mylyn': org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF org.eclipse.mylyn.bugzilla.ui/plugin.xml org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF org.eclipse.mylyn.sdk-feature/feature.xml org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java org.eclipse.mylyn.test-feature/feature.xml org.eclipse.mylyn.trac-feature/feature.xml org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF org.eclipse.mylyn.trac.ui/META-INF/MANIFEST.MF Delete: org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityListenerTest.java org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockAttributeFactory.java
-rw-r--r--org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java315
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java13
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java13
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml3
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java7
-rw-r--r--org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.sdk-feature/feature.xml2
-rw-r--r--org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java134
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java86
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java34
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java8
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java8
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java83
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java14
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java7
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityListenerTest.java106
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java1006
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockAttributeFactory.java54
-rw-r--r--org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java36
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java9
-rw-r--r--org.eclipse.mylyn.test-feature/feature.xml2
-rw-r--r--org.eclipse.mylyn.trac-feature/feature.xml6
-rw-r--r--org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.trac.ui/META-INF/MANIFEST.MF2
41 files changed, 579 insertions, 1444 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF
index 129a2464f..bf17f0e5f 100644
--- a/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Bugzilla Connector Core
Bundle-SymbolicName: org.eclipse.mylyn.bugzilla.core;singleton:=true
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 3.0.5.qualifier
Bundle-Activator: org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.tasks.core;bundle-version="[3.0.0,4.0.0)",
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
index db3193829..0c55ec14f 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
@@ -151,6 +151,8 @@ public enum BugzillaAttribute {
NEW_COMMENT("new comment", "new_comment", TaskAttribute.TYPE_LONG_RICH_TEXT, true, false),
+ TOKEN("token", "token", null, true, true), //$NON-NLS-1$ //$NON-NLS-2$
+
// Used by search engine
LI("used by search engine", "li", null, true, false),
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
index 61297723d..0a255cd35 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
@@ -166,7 +166,7 @@ public class BugzillaClient {
protected String characterEncoding;
- private boolean authenticated;
+ private boolean loggedIn;
private final Map<String, String> configParameters;
@@ -254,7 +254,7 @@ public class BugzillaClient {
for (int attempt = 0; attempt < 2; attempt++) {
// force authentication
- if (!authenticated && hasAuthenticationCredentials()) {
+ if (!loggedIn && hasAuthenticationCredentials()) {
authenticate(monitor);
}
@@ -292,10 +292,10 @@ public class BugzillaClient {
getMethod.getResponseBodyNoop();
// login or reauthenticate due to an expired session
getMethod.releaseConnection();
- authenticated = false;
+ loggedIn = false;
authenticate(monitor);
} else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
- authenticated = false;
+ loggedIn = false;
getMethod.getResponseBodyNoop();
getMethod.releaseConnection();
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
@@ -316,12 +316,12 @@ public class BugzillaClient {
public void logout(IProgressMonitor monitor) throws IOException, CoreException {
monitor = Policy.monitorFor(monitor);
- authenticated = true;
+ loggedIn = true;
String loginUrl = repositoryUrl + "/relogin.cgi";
GzipGetMethod method = null;
try {
method = getConnect(loginUrl, monitor);
- authenticated = false;
+ loggedIn = false;
httpClient.getState().clearCookies();
} finally {
if (method != null) {
@@ -351,14 +351,15 @@ public class BugzillaClient {
}
public void authenticate(IProgressMonitor monitor) throws CoreException {
- monitor = Policy.monitorFor(monitor);
if (!hasAuthenticationCredentials()) {
- authenticated = false;
+ loggedIn = false;
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(),
"Authentication credentials missing."));
}
+ monitor = Policy.monitorFor(monitor);
+
GzipPostMethod postMethod = null;
try {
@@ -389,7 +390,7 @@ public class BugzillaClient {
int code = WebUtil.execute(httpClient, hostConfiguration, postMethod, monitor);
if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) {
- authenticated = false;
+ loggedIn = false;
postMethod.getResponseBodyNoop();
postMethod.releaseConnection();
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
@@ -397,7 +398,7 @@ public class BugzillaClient {
"HTTP authentication failed."));
} else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
- authenticated = false;
+ loggedIn = false;
postMethod.getResponseBodyNoop();
postMethod.releaseConnection();
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
@@ -405,7 +406,7 @@ public class BugzillaClient {
"Proxy authentication required"));
} else if (code != HttpURLConnection.HTTP_OK) {
- authenticated = false;
+ loggedIn = false;
postMethod.getResponseBodyNoop();
postMethod.releaseConnection();
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
@@ -415,12 +416,12 @@ public class BugzillaClient {
if (hasAuthenticationCredentials()) {
for (Cookie cookie : httpClient.getState().getCookies()) {
if (cookie.getName().equals(COOKIE_BUGZILLA_LOGIN)) {
- authenticated = true;
+ loggedIn = true;
break;
}
}
- if (!authenticated) {
+ if (!loggedIn) {
InputStream input = getResponseStream(postMethod, monitor);
try {
parseHtmlError(input);
@@ -430,7 +431,7 @@ public class BugzillaClient {
}
} else {
// anonymous login
- authenticated = true;
+ loggedIn = true;
}
} catch (IOException e) {
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
@@ -468,7 +469,9 @@ public class BugzillaClient {
GzipPostMethod postMethod = null;
try {
-
+ if (!loggedIn && hasAuthenticationCredentials()) {
+ authenticate(new SubProgressMonitor(monitor, 1));
+ }
String queryUrl = query.getUrl();
int start = queryUrl.indexOf('?');
@@ -599,7 +602,7 @@ public class BugzillaClient {
} else {
if (attempt == 0) {
// empty configuration, retry authenticate
- authenticated = false;
+ loggedIn = false;
break;
} else {
throw new CoreException(
@@ -612,7 +615,7 @@ public class BugzillaClient {
}
}
- if (authenticated) {
+ if (loggedIn) {
parseHtmlError(stream);
return null;
}
@@ -656,7 +659,7 @@ public class BugzillaClient {
Assert.isNotNull(contentType);
hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor);
- if (!authenticated && hasAuthenticationCredentials()) {
+ if (!loggedIn && hasAuthenticationCredentials()) {
authenticate(monitor);
}
GzipPostMethod postMethod = null;
@@ -729,7 +732,7 @@ public class BugzillaClient {
GzipPostMethod postMethod = null;
monitor = Policy.monitorFor(monitor);
hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor);
- if (!authenticated && hasAuthenticationCredentials()) {
+ if (!loggedIn && hasAuthenticationCredentials()) {
authenticate(monitor);
}
@@ -765,6 +768,11 @@ public class BugzillaClient {
String postfix = null;
String postfix2 = null;
monitor = Policy.monitorFor(monitor);
+
+ if (!loggedIn && hasAuthenticationCredentials()) {
+ authenticate(monitor);
+ }
+
if (taskData == null) {
return null;
} else if (taskData.isNew()) {
@@ -804,7 +812,6 @@ public class BugzillaClient {
String title = "";
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) {
-
if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.TITLE
&& !((HtmlTag) (token.getValue())).isEndTag()) {
isTitle = true;
@@ -874,7 +881,7 @@ public class BugzillaClient {
return new RepositoryResponse(ResponseKind.TASK_UPDATED, taskData.getTaskId());
}
} catch (ParseException e) {
- authenticated = false;
+ loggedIn = false;
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_INTERNAL, "Unable to parse response from " + repositoryUrl.toString() + "."));
} finally {
@@ -968,18 +975,23 @@ public class BugzillaClient {
// go through all of the attributes and add them to the bug post
Collection<TaskAttribute> attributes = model.getRoot().getAttributes().values();
Iterator<TaskAttribute> itr = attributes.iterator();
+ boolean tokenFound = false;
+ boolean tokenRequired = false;
while (itr.hasNext()) {
TaskAttribute a = itr.next();
if (a == null) {
continue;
+ } else if (a.getId().equalsIgnoreCase(BugzillaAttribute.TOKEN.getKey())) {
+ tokenFound = true;
} else if (a.getId().equals(BugzillaAttribute.QA_CONTACT.getKey())
|| a.getId().equals(BugzillaAttribute.ASSIGNED_TO.getKey())) {
cleanIfShortLogin(a);
} else if (a.getId().equals(BugzillaAttribute.REPORTER.getKey())
|| a.getId().equals(BugzillaAttribute.CC.getKey())
|| a.getId().equals(BugzillaAttribute.REMOVECC.getKey())
- || a.getId().equals(BugzillaAttribute.CREATION_TS.getKey())) {
+ || a.getId().equals(BugzillaAttribute.CREATION_TS.getKey())
+ || a.getId().equals(BugzillaAttribute.BUG_STATUS.getKey())) {
continue;
}
@@ -1015,46 +1027,143 @@ public class BugzillaClient {
}
// add the operation to the bug post
- TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
- if (attributeOperation == null) {
- fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
+ String bugzillaVersion = null;
+ if (repositoryConfiguration != null) {
+ bugzillaVersion = repositoryConfiguration.getInstallVersion();
} else {
- TaskAttribute originalOperation = model.getRoot().getAttribute(
- TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue());
- if (originalOperation == null) {
- // Work around for bug#241012
+ bugzillaVersion = "2.18";
+ }
+ if (bugzillaVersion.compareTo("3.2") < 0) {
+
+ TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ if (attributeOperation == null) {
fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
} else {
- String inputAttributeId = originalOperation.getMetaData().getValue(
- TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
+ TaskAttribute originalOperation = model.getRoot().getAttribute(
+ TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue());
if (originalOperation == null) {
+ // Work around for bug#241012
fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
- } else if (inputAttributeId == null || inputAttributeId.equals("")) {
- String sel = attributeOperation.getValue();
- fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, sel));
} else {
- fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, attributeOperation.getValue()));
- TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute(
- inputAttributeId);
- if (inputAttribute != null) {
- if (inputAttribute.getOptions().size() > 0) {
- String sel = inputAttribute.getValue();
- String knob = inputAttribute.getId();
- if (knob.equals(BugzillaOperation.resolve.getInputId())) {
- knob = BugzillaAttribute.RESOLUTION.getKey();
+ String inputAttributeId = originalOperation.getMetaData().getValue(
+ TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
+ if (originalOperation == null) {
+ fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
+ } else if (inputAttributeId == null || inputAttributeId.equals("")) {
+ String sel = attributeOperation.getValue();
+ fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, sel));
+ } else {
+ fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, attributeOperation.getValue()));
+ TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute(
+ inputAttributeId);
+ if (inputAttribute != null) {
+ if (inputAttribute.getOptions().size() > 0) {
+ String sel = inputAttribute.getValue();
+ String knob = inputAttribute.getId();
+ if (knob.equals(BugzillaOperation.resolve.getInputId())) {
+ knob = BugzillaAttribute.RESOLUTION.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
+ } else {
+ String sel = inputAttribute.getValue();
+ String knob = attributeOperation.getValue();
+ if (knob.equals(BugzillaOperation.reassign.toString())) {
+ knob = BugzillaAttribute.ASSIGNED_TO.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, sel));
}
- fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
- } else {
- String sel = inputAttribute.getValue();
- String knob = attributeOperation.getValue();
- if (knob.equals(BugzillaOperation.reassign.toString())) {
- knob = BugzillaAttribute.ASSIGNED_TO.getKey();
+ }
+ }
+ }
+ if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null
+ && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) {
+ fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(
+ TaskAttribute.COMMENT_NEW).getValue()));
+ } else if (attributeOperation != null
+ && attributeOperation.getValue().equals(BugzillaOperation.duplicate.toString())) {
+ // fix for bug#198677
+ fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, ""));
+ }
+ }
+ } else {
+ // A token is required for bugzilla 3.2.1 and newer
+ tokenRequired = bugzillaVersion.compareTo("3.2") > 0;
+ String fieldName = BugzillaAttribute.BUG_STATUS.getKey();
+ TaskAttribute attributeStatus = model.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ if (attributeOperation == null) {
+ fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue()));
+ } else {
+ TaskAttribute originalOperation = model.getRoot().getAttribute(
+ TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue());
+ if (originalOperation == null) {
+ // Work around for bug#241012
+ fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue()));
+ } else {
+ String inputAttributeId = originalOperation.getMetaData().getValue(
+ TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
+ if (originalOperation == null) {
+ fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue()));
+ } else {
+ String selOp = attributeOperation.getValue().toUpperCase();
+ if (selOp.equals("NONE")) {
+ selOp = attributeStatus.getValue();
+ }
+ if (selOp.equals("ACCEPT")) {
+ selOp = "ASSIGNED";
+ }
+ if (selOp.equals("RESOLVE")) {
+ selOp = "RESOLVED";
+ }
+ if (selOp.equals("VERIFY")) {
+ selOp = "VERIFIED";
+ }
+ if (selOp.equals("CLOSE")) {
+ selOp = "CLOSED";
+ }
+ if (selOp.equals("REOPEN")) {
+ selOp = "REOPENED";
+ }
+ if (selOp.equals("DUPLICATE")) {
+ selOp = "RESOLVED";
+ String knob = BugzillaAttribute.RESOLUTION.getKey();
+ fields.put(knob, new NameValuePair(knob, "DUPLICATE"));
+ }
+
+ fields.put(fieldName, new NameValuePair(fieldName, selOp));
+ if (inputAttributeId != null && !inputAttributeId.equals("")) {
+ TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute(
+ inputAttributeId);
+ if (inputAttribute != null) {
+ if (inputAttribute.getOptions().size() > 0) {
+ String sel = inputAttribute.getValue();
+ String knob = inputAttribute.getId();
+ if (knob.equals(BugzillaOperation.resolve.getInputId())) {
+ knob = BugzillaAttribute.RESOLUTION.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
+ } else {
+ String sel = inputAttribute.getValue();
+ String knob = attributeOperation.getValue();
+ if (knob.equals("duplicate")) {
+ knob = inputAttributeId;
+ }
+ if (knob.equals(BugzillaOperation.reassign.toString())) {
+ knob = BugzillaAttribute.ASSIGNED_TO.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, sel));
+ }
}
- fields.put(knob, new NameValuePair(knob, sel));
}
}
}
}
+
+ if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null
+ && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) {
+ fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(
+ TaskAttribute.COMMENT_NEW).getValue()));
+ }
}
if (model.getRoot().getMappedAttribute(BugzillaAttribute.SHORT_DESC.getKey()) != null) {
@@ -1062,16 +1171,6 @@ public class BugzillaClient {
BugzillaAttribute.SHORT_DESC.getKey()).getValue()));
}
- if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null
- && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) {
- fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(
- TaskAttribute.COMMENT_NEW).getValue()));
- } else if (attributeOperation != null
- && attributeOperation.getValue().equals(BugzillaOperation.duplicate.toString())) {
- // fix for bug#198677
- fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, ""));
- }
-
TaskAttribute attributeRemoveCC = model.getRoot().getMappedAttribute(BugzillaAttribute.REMOVECC.getKey());
if (attributeRemoveCC != null) {
List<String> removeCC = attributeRemoveCC.getValues();
@@ -1083,21 +1182,36 @@ public class BugzillaClient {
}
}
- if (groupSecurityEnabled) {
- // get security info from html and include in post
- Map<String, String> groupIds = getGroupSecurityInformation(model, monitor);
- for (String key : groupIds.keySet()) {
- fields.put(key, new NameValuePair(key, groupIds.get(key)));
- }
+ // check for security token (required for successful submit on Bugzilla 3.2.1 and greater but not in xml until Bugzilla 3.2.3 bug#263318)
+ if (groupSecurityEnabled || (!tokenFound && tokenRequired)) {
+ // get security and token if exists from html and include in post
+ HtmlInformation htmlInfo = getHtmlOnlyInformation(model, monitor);
+
+ if (groupSecurityEnabled) {
+ for (String key : htmlInfo.getGroups().keySet()) {
+ fields.put(key, new NameValuePair(key, htmlInfo.getGroups().get(key)));
+ }
+ }
+ if (htmlInfo.getToken() != null && htmlInfo.getToken().length() > 0 && tokenRequired) {
+ NameValuePair tokenPair = fields.get(BugzillaAttribute.TOKEN.getKey());
+ if (tokenPair != null) {
+ tokenPair.setValue(htmlInfo.getToken());
+ } else {
+ fields.put(BugzillaAttribute.TOKEN.getKey(), new NameValuePair(BugzillaAttribute.TOKEN.getKey(),
+ htmlInfo.getToken()));
+ }
+ }
}
return fields.values().toArray(new NameValuePair[fields.size()]);
}
- private Map<String, String> getGroupSecurityInformation(TaskData taskData, IProgressMonitor monitor)
- throws CoreException {
- Map<String, String> groupSecurityInformation = new HashMap<String, String>();
+ private HtmlInformation getHtmlOnlyInformation(TaskData taskData, IProgressMonitor monitor) throws CoreException {
+ HtmlInformation htmlInfo = new HtmlInformation();
+ if (!loggedIn && hasAuthenticationCredentials()) {
+ authenticate(new SubProgressMonitor(monitor, 1));
+ }
hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor);
String bugUrl = taskData.getRepositoryUrl() + IBugzillaConstants.URL_GET_SHOW_BUG + taskData.getTaskId();
@@ -1122,8 +1236,13 @@ public class BugzillaClient {
String id = tag.getAttribute("id");
String checkedValue = tag.getAttribute("checked");
String type = tag.getAttribute("type");
+ String name = tag.getAttribute("name");
+ String value = tag.getAttribute("value");
if (type != null && type.equalsIgnoreCase("checkbox") && id != null && id.startsWith("bit-")) {
- groupSecurityInformation.put(id, checkedValue);
+ htmlInfo.getGroups().put(id, checkedValue);
+ } else if (name != null && name.equalsIgnoreCase(BugzillaAttribute.TOKEN.getKey())
+ && value != null && value.length() > 0) {
+ htmlInfo.setToken(value);
}
}
}
@@ -1140,7 +1259,7 @@ public class BugzillaClient {
}
}
}
- return groupSecurityInformation;
+ return htmlInfo;
}
public static String stripTimeZone(String longTime) {
@@ -1206,7 +1325,7 @@ public class BugzillaClient {
found = found || title.indexOf(value) != -1;
}
if (found) {
- authenticated = false;
+ loggedIn = false;
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title));
}
@@ -1234,13 +1353,24 @@ public class BugzillaClient {
}
found = false;
for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(
+ BugzillaLanguageSettings.COMMAND_SUSPICIOUS_ACTION).iterator(); iterator.hasNext()
+ && !found;) {
+ String value = iterator.next().toLowerCase(Locale.ENGLISH);
+ found = found || title.indexOf(value) != -1;
+ }
+ if (found) {
+ throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
+ IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION));
+ }
+ found = false;
+ for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(
BugzillaLanguageSettings.COMMAND_ERROR_LOGGED_OUT).iterator(); iterator.hasNext()
&& !found;) {
String value = iterator.next().toLowerCase(Locale.ENGLISH);
found = found || title.indexOf(value) != -1;
}
if (found) {
- authenticated = false;
+ loggedIn = false;
// throw new
// BugzillaException(IBugzillaConstants.LOGGED_OUT);
throw new CoreException(new BugzillaStatus(IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN,
@@ -1267,7 +1397,7 @@ public class BugzillaClient {
"A repository error has occurred.", body));
} catch (ParseException e) {
- authenticated = false;
+ loggedIn = false;
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_INTERNAL, "Unable to parse response from " + repositoryUrl.toString() + "."));
} finally {
@@ -1277,7 +1407,7 @@ public class BugzillaClient {
public TaskHistory getHistory(String taskId, IProgressMonitor monitor) throws IOException, CoreException {
hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor);
- if (!authenticated && hasAuthenticationCredentials()) {
+ if (!loggedIn && hasAuthenticationCredentials()) {
authenticate(monitor);
}
GzipGetMethod method = null;
@@ -1291,12 +1421,12 @@ public class BugzillaClient {
try {
return parser.retrieveHistory(bugzillaLanguageSettings);
} catch (LoginException e) {
- authenticated = false;
+ loggedIn = false;
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(),
IBugzillaConstants.INVALID_CREDENTIALS));
} catch (ParseException e) {
- authenticated = false;
+ loggedIn = false;
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_INTERNAL, "Unable to parse response from "
+ repositoryUrl.toString() + "."));
@@ -1393,7 +1523,7 @@ public class BugzillaClient {
}
} catch (CoreException c) {
if (c.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN && authenticationAttempt < 1) {
- authenticated = false;
+ loggedIn = false;
authenticationAttempt++;
//StatusHandler.log(c.getStatus());
} else {
@@ -1442,7 +1572,7 @@ public class BugzillaClient {
hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor);
for (int attempt = 0; attempt < 2; attempt++) {
// force authentication
- if (!authenticated && hasAuthenticationCredentials()) {
+ if (!loggedIn && hasAuthenticationCredentials()) {
authenticate(monitor);
}
@@ -1477,10 +1607,10 @@ public class BugzillaClient {
headMethod.getResponseBody();
// login or reauthenticate due to an expired session
headMethod.releaseConnection();
- authenticated = false;
+ loggedIn = false;
authenticate(monitor);
} else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
- authenticated = false;
+ loggedIn = false;
headMethod.getResponseBody();
headMethod.releaseConnection();
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
@@ -1545,4 +1675,27 @@ public class BugzillaClient {
}
}
+ private class HtmlInformation {
+ private final Map<String, String> groups;
+
+ private String token;
+
+ public HtmlInformation() {
+ groups = new HashMap<String, String>();
+ }
+
+ public Map<String, String> getGroups() {
+ return groups;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ }
+
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java
index c70bf2c47..4b3dcdbcb 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java
@@ -35,6 +35,8 @@ public class BugzillaLanguageSettings {
public static final String COMMAND_ERROR_LOGGED_OUT = "error_logged_out";
+ public static final String COMMAND_SUSPICIOUS_ACTION = "suspicious_action";
+
public static final String COMMAND_BAD_LOGIN = "bad_login";
public static final String COMMAND_PROCESSED = "processed";
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
index 4f4f77583..31f629252 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
@@ -61,7 +61,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
private static final String CHANGED_BUGS_CGI_QUERY = "/buglist.cgi?query_format=advanced&chfieldfrom=";
- private static final String CLIENT_LABEL = "Bugzilla (supports uncustomized 2.18-3.0)";
+ private static final String CLIENT_LABEL = "Bugzilla (supports uncustomized 2.18-3.2)";
private static final String COMMENT_FORMAT = "yyyy-MM-dd HH:mm";
@@ -251,7 +251,6 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
}
}
- return;
} catch (UnsupportedEncodingException e) {
throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
"Repository configured with unsupported encoding: " + repository.getCharacterEncoding()
@@ -394,6 +393,8 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
enSetting.addLanguageAttribute("bad_login", "error");
enSetting.addLanguageAttribute("processed", "processed");
enSetting.addLanguageAttribute("changes_submitted", "Changes submitted");
+ enSetting.addLanguageAttribute("changes_submitted", "added to Bug");
+ enSetting.addLanguageAttribute("suspicious_action", "Suspicious action");
languages.add(enSetting);
}
@@ -490,6 +491,14 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
if (taskData.isPartial()) {
return false;
}
+
+ // Security token
+ // Updated on the task upon each open (synch) to keep the most current token available for submission - bug#263318
+ TaskAttribute attrSecurityToken = taskData.getRoot().getMappedAttribute(BugzillaAttribute.TOKEN.getKey());
+ if (attrSecurityToken != null && !attrSecurityToken.getValue().equals("")) { //$NON-NLS-1$
+ task.setAttribute(BugzillaAttribute.TOKEN.getKey(), attrSecurityToken.getValue());
+ }
+
String lastKnownMod = task.getAttribute(BugzillaAttribute.DELTA_TS.getKey());
if (lastKnownMod != null) {
TaskAttribute attrModification = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
index 766a3a8b1..4d9b59999 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
@@ -256,6 +256,9 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
// TODO: Move retry handling into client
if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
return client.postTaskData(taskData, monitor);
+ } else if (e.getStatus().getCode() == IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION) {
+ taskData.getRoot().removeAttribute(BugzillaAttribute.TOKEN.getKey());
+ return client.postTaskData(taskData, monitor);
} else {
throw e;
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
index 2fa7da469..e23a04470 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
@@ -100,13 +100,17 @@ public interface IBugzillaConstants {
public static final String ENCODING_UTF_8 = "UTF-8";
+ public static final int REPOSITORY_STATUS_SUSPICIOUS_ACTION = 99;
+
/** Supported bugzilla repository versions */
static public enum BugzillaServerVersion {
- SERVER_218, SERVER_220, SERVER_222, SERVER_30;
+ SERVER_218, SERVER_220, SERVER_222, SERVER_30, SERVER_32;
@Override
public String toString() {
switch (this) {
+ case SERVER_32:
+ return "3.2";
case SERVER_30:
return "3.0";
case SERVER_222:
@@ -122,6 +126,9 @@ public interface IBugzillaConstants {
/** returns null if version string unknown* */
static public BugzillaServerVersion fromString(String version) {
+ if (version.equals(SERVER_32.toString())) {
+ return SERVER_32;
+ }
if (version.equals(SERVER_30.toString())) {
return SERVER_30;
}
@@ -174,6 +181,10 @@ public interface IBugzillaConstants {
static final String TEST_BUGZILLA_31_URL = "http://mylyn.eclipse.org/bugs31";
+ static final String TEST_BUGZILLA_322_URL = "http://mylyn.eclipse.org/bugs322"; //$NON-NLS-1$
+
+ static final String TEST_BUGZILLA_323_URL = "http://mylyn.eclipse.org/bugs323"; //$NON-NLS-1$
+
// Default values for keys
static final String[] DEFAULT_STATUS_VALUES = { "Unconfirmed", "New", "Assigned", "Reopened", "Resolved",
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
index 4ecf21d5b..1252a8249 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
@@ -484,6 +484,11 @@ public class RepositoryConfiguration implements Serializable {
// old bugzilla workflow is used
addOperation(bugReport, BugzillaOperation.reassign);
addOperation(bugReport, BugzillaOperation.reassignbycomponent);
+ } else {
+ TaskAttribute operationAttribute = bugReport.getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED);
+ if (operationAttribute != null) {
+ operationAttribute.getMetaData().setReadOnly(false);
+ }
}
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF
index 0c1efda27..d318b5f73 100644
--- a/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Bugzilla Connector UI
Bundle-SymbolicName: org.eclipse.mylyn.bugzilla.ui; singleton:=true
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 3.0.5.qualifier
Bundle-Activator: org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.ui,
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index 176eabe7c..b7ffe1b35 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -54,7 +54,8 @@
<languageAttribute command="bad_login" response="Ung├╝ltiger Benutzername oder ung├╝ltiges Passwort"/>
<languageAttribute command="bad_login" response="error"/>
<languageAttribute command="processed" response="processed"/>
- <languageAttribute command="changes_submitted" response="Changes submitted"/>
+ <languageAttribute command="changes_submitted" response="Changes submitted"/>
+ <languageAttribute command="suspicious_action" response="Suspicious action"/>
</language>
</extension>
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
index db2f707ce..7e3eed632 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
@@ -144,6 +144,13 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
return;
}
+ // Force the most recent known good token onto the outgoing task data to ensure submit
+ // bug#263318
+ TaskAttribute attrToken = getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.TOKEN.getKey());
+ if (attrToken != null) {
+ attrToken.setValue(getModel().getTask().getAttribute(BugzillaAttribute.TOKEN.getKey()));
+ }
+
super.doSubmit();
}
diff --git a/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF
index 91c55190f..45b4c074e 100644
--- a/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Help
Bundle-SymbolicName: org.eclipse.mylyn.help.ui;singleton:=true
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 3.0.5.qualifier
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.core.runtime,
diff --git a/org.eclipse.mylyn.sdk-feature/feature.xml b/org.eclipse.mylyn.sdk-feature/feature.xml
index e1c568f97..c2765fb21 100644
--- a/org.eclipse.mylyn.sdk-feature/feature.xml
+++ b/org.eclipse.mylyn.sdk-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.mylyn.sdk_feature"
label="Mylyn SDK"
- version="3.0.2.qualifier"
+ version="3.0.5.qualifier"
provider-name="Eclipse.org"
plugin="org.eclipse.mylyn">
diff --git a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
index 7f1477f53..f2f5912e0 100644
--- a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Tasks Core
Bundle-SymbolicName: org.eclipse.mylyn.tasks.core;singleton:=true
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 3.0.5.qualifier
Bundle-Vendor: Eclipse.org
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime,
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
index 2ec55caaa..aa6fd8642 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
@@ -397,7 +397,7 @@ public abstract class AbstractTask extends AbstractTaskContainer implements ITas
*/
@Deprecated
public boolean isPastReminder() {
- if (isCompleted() || scheduledForDate == null || !getScheduledForDate().isDay()) {
+ if (isCompleted() || scheduledForDate == null || !(getScheduledForDate() instanceof DayDateRange)) {
return false;
} else {
if (/*!internalIsFloatingScheduledDate() && */scheduledForDate.getEndDate().compareTo(
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
index af4e0d87e..90533ef2a 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -21,16 +21,7 @@ import org.eclipse.core.runtime.Assert;
* @since 3.0
*/
public class DateRange implements Comparable<DateRange> {
-
- private static final long DAY = 1000 * 60 * 60 * 24;
-
- private static final String DESCRIPTION_PREVIOUS_WEEK = "Previous Week";
-
- private static final String DESCRIPTION_THIS_WEEK = "This Week";
-
- private static final String DESCRIPTION_NEXT_WEEK = "Next Week";
-
- private static final String DESCRIPTION_WEEK_AFTER_NEXT = "Two Weeks";
+ protected static final long DAY = 1000 * 60 * 60 * 24;
private final Calendar startDate;
@@ -74,115 +65,42 @@ public class DateRange implements Comparable<DateRange> {
*/
@Override
public String toString() {
- boolean isThisWeek = TaskActivityUtil.getCurrentWeek().includes(this);
- Calendar endNextWeek = TaskActivityUtil.getCalendar();
- endNextWeek.add(Calendar.DAY_OF_YEAR, 7);
- boolean isNextWeek = TaskActivityUtil.getNextWeek().includes(this) && this.before(endNextWeek);
- if (isDay() && (isThisWeek || isNextWeek)) {
- String day = "";
- switch (getStartDate().get(Calendar.DAY_OF_WEEK)) {
- case Calendar.MONDAY:
- day = "Monday";
- break;
- case Calendar.TUESDAY:
- day = "Tuesday";
- break;
- case Calendar.WEDNESDAY:
- day = "Wednesday";
- break;
- case Calendar.THURSDAY:
- day = "Thursday";
- break;
- case Calendar.FRIDAY:
- day = "Friday";
- break;
- case Calendar.SATURDAY:
- day = "Saturday";
- break;
- case Calendar.SUNDAY:
- day = "Sunday";
- break;
- }
- if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == getStartDate().get(Calendar.DAY_OF_WEEK)) {
- return day + " - Today";
- } else {
- return day;
- }
- } else if (isThisWeek()) {
- return DESCRIPTION_THIS_WEEK;
- } else if (isNextWeek()) {
- return DESCRIPTION_NEXT_WEEK;
- } else if (isWeekAfterNext()) {
- return DESCRIPTION_WEEK_AFTER_NEXT;
- } else if (isPreviousWeek()) {
- return DESCRIPTION_PREVIOUS_WEEK;
- }
- return DateFormat.getDateInstance(DateFormat.MEDIUM).format(startDate.getTime());
- /* + " to "+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(endDate.getTime());*/
- }
-
- private boolean isWeekAfterNext() {
- return TaskActivityUtil.getCurrentWeek().next().next().compareTo(this) == 0;
- }
-
- public DateRange next() {
- if (isDay()) {
- return create(Calendar.DAY_OF_YEAR, 1);
- } else if (isWeek()) {
- return create(Calendar.WEEK_OF_YEAR, 1);
- }
- return null;
+ return toString(true);
}
- public DateRange previous() {
- if (isDay()) {
- return create(Calendar.DAY_OF_YEAR, -1);
- } else if (isWeek()) {
- return create(Calendar.WEEK_OF_YEAR, -1);
- }
- return null;
- }
-
- private DateRange create(int field, int multiplier) {
- Calendar previousStart = (Calendar) getStartDate().clone();
- Calendar previousEnd = (Calendar) getEndDate().clone();
- previousStart.add(field, 1 * multiplier);
- previousEnd.add(field, 1 * multiplier);
- return new DateRange(previousStart, previousEnd);
- }
-
- private boolean isNextWeek() {
- return TaskActivityUtil.getCurrentWeek().next().compareTo(this) == 0;
- }
-
- public boolean isThisWeek() {
- if (isWeek()) {
- return this.includes(Calendar.getInstance());
- }
- return false;
+ public String toString(boolean useDayOfWeekForNextWeek) {
+ return DateFormat.getDateInstance(DateFormat.MEDIUM).format(startDate.getTime());
+ /* + " to "+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(endDate.getTime());*/
}
- private boolean isPreviousWeek() {
- if (isWeek()) {
- Calendar cal = Calendar.getInstance();
- cal.add(Calendar.WEEK_OF_YEAR, -1);
- return this.includes(cal);
- }
- return false;
- }
+// protected DateRange create(int field, int multiplier) {
+// Calendar previousStart = (Calendar) getStartDate().clone();
+// Calendar previousEnd = (Calendar) getEndDate().clone();
+// previousStart.add(field, 1 * multiplier);
+// previousEnd.add(field, 1 * multiplier);
+// return new DateRange(previousStart, previousEnd);
+// }
- public boolean isDay() {
- return ((getEndDate().getTimeInMillis() - getStartDate().getTimeInMillis()) == DAY - 1);
- }
+// public boolean isDay() {
+// return ((getEndDate().getTimeInMillis() - getStartDate().getTimeInMillis()) == DAY - 1);
+// }
+//
+// public boolean isWeek() {
+// return ((getEndDate().getTimeInMillis() - getStartDate().getTimeInMillis()) == (DAY * 7) - 1);
+// }
- public boolean isWeek() {
- return ((getEndDate().getTimeInMillis() - getStartDate().getTimeInMillis()) == (DAY * 7) - 1);
+ public boolean isPresent() {
+ return this.getStartDate().before(Calendar.getInstance()) && this.getEndDate().after(Calendar.getInstance());
}
public boolean isPast() {
return getEndDate().compareTo(Calendar.getInstance()) < 0;
}
+ public boolean isFuture() {
+ return !isPresent() && this.getStartDate().after(Calendar.getInstance());
+ }
+
public boolean isBefore(DateRange scheduledDate) {
return this.getEndDate().compareTo(scheduledDate.getStartDate()) < 0;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java
new file mode 100644
index 000000000..6ad489dab
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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.core;
+
+import java.util.Calendar;
+
+/**
+ * @author Rob Elves
+ */
+public class DayDateRange extends DateRange {
+
+ public DayDateRange(Calendar startDate, Calendar endDate) {
+ super(startDate, endDate);
+ }
+
+ public DayDateRange next() {
+ return create(Calendar.DAY_OF_YEAR, 1);
+ }
+
+ public DayDateRange previous() {
+ return create(Calendar.DAY_OF_YEAR, -1);
+ }
+
+ protected DayDateRange create(int field, int multiplier) {
+ Calendar previousStart = (Calendar) getStartDate().clone();
+ Calendar previousEnd = (Calendar) getEndDate().clone();
+ previousStart.add(field, 1 * multiplier);
+ previousEnd.add(field, 1 * multiplier);
+ return new DayDateRange(previousStart, previousEnd);
+ }
+
+ @Override
+ public String toString(boolean useDayOfWeekForNextWeek) {
+ boolean isThisWeek = TaskActivityUtil.getCurrentWeek().includes(this);
+ Calendar endNextWeek = TaskActivityUtil.getCalendar();
+ endNextWeek.add(Calendar.DAY_OF_YEAR, 7);
+ boolean isNextWeek = TaskActivityUtil.getNextWeek().includes(this) && this.before(endNextWeek);
+ if (isThisWeek || (useDayOfWeekForNextWeek && isNextWeek)) {
+ String day = "";
+ switch (getStartDate().get(Calendar.DAY_OF_WEEK)) {
+ case Calendar.MONDAY:
+ day = "Monday";
+ break;
+ case Calendar.TUESDAY:
+ day = "Tuesday";
+ break;
+ case Calendar.WEDNESDAY:
+ day = "Wednesday";
+ break;
+ case Calendar.THURSDAY:
+ day = "Thursday";
+ break;
+ case Calendar.FRIDAY:
+ day = "Friday";
+ break;
+ case Calendar.SATURDAY:
+ day = "Saturday";
+ break;
+ case Calendar.SUNDAY:
+ day = "Sunday";
+ break;
+ }
+ if (isPresent()) {
+ return day + " - Today";
+ } else {
+ return day;
+ }
+ }
+ return super.toString(useDayOfWeekForNextWeek);
+ }
+
+ public static boolean isDayRange(Calendar calStart, Calendar calEnd) {
+ // bug 248683
+ long diff = (calEnd.getTimeInMillis() - calStart.getTimeInMillis()) - (DAY - 1);
+ return Math.abs(diff) <= 60 * 60 * 1000;
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
index dcf494f82..271c53dda 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -32,11 +32,11 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
private final DateRange range;
public ScheduledTaskContainer(TaskActivityManager activityManager, DateRange range, String summary) {
- super(summary == null ? range.toString() : summary);
+ super(summary == null ? range.toString(false) : summary);
this.activityManager = activityManager;
this.range = range;
if (summary == null) {
- this.summary = range.toString();
+ this.summary = range.toString(false);
} else {
this.summary = summary;
}
@@ -54,14 +54,16 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
return range.getStartDate().before(Calendar.getInstance()) && range.getEndDate().after(Calendar.getInstance());
}
- public boolean isWeekDay() {
- return TaskActivityUtil.getCurrentWeek().isCurrentWeekDay(range);
- }
+// public boolean isWeekDay() {
+// return TaskActivityUtil.getCurrentWeek().isCurrentWeekDay(range);
+// }
- public boolean isToday() {
- return isPresent()
- && range.getStartDate().get(Calendar.DAY_OF_YEAR) == range.getEndDate().get(Calendar.DAY_OF_YEAR);
- }
+// public boolean isToday() {
+// if (range instanceof DayDateRange) {
+// return ((DayDateRange) range).isToday();
+// }
+// return false;
+// }
// public Collection<ITask> getChildren() {
// Set<ITask> children = new HashSet<ITask>();
@@ -131,7 +133,7 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
}
// Add due tasks if not the This Week container
- if (!(range instanceof WeekDateRange && isPresent())) {
+ if (!(range instanceof WeekDateRange && ((WeekDateRange) range).isPresent())) {
for (ITask task : activityManager.getDueTasks(range.getStartDate(), range.getEndDate())) {
if (activityManager.isOwnedByUser(task)) {
children.add(task);
@@ -140,9 +142,10 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
}
// All over due/scheduled tasks are present in the Today folder
- if (isToday()) {
+ if ((range instanceof DayDateRange) && ((DayDateRange) range).isPresent()) {
for (ITask task : activityManager.getOverScheduledTasks()) {
- if (task instanceof AbstractTask && !((AbstractTask) task).getScheduledForDate().isWeek()) {
+ if (task instanceof AbstractTask
+ && !(((AbstractTask) task).getScheduledForDate() instanceof WeekDateRange)) {
children.add(task);
}
}
@@ -154,9 +157,10 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
}
}
- if (range.isThisWeek()) {
+ if (range instanceof WeekDateRange && ((WeekDateRange) range).isThisWeek()) {
for (ITask task : activityManager.getOverScheduledTasks()) {
- if (task instanceof AbstractTask && ((AbstractTask) task).getScheduledForDate().isWeek()) {
+ if (task instanceof AbstractTask
+ && ((AbstractTask) task).getScheduledForDate() instanceof WeekDateRange) {
children.add(task);
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
index 399502381..11ea2b788 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -328,7 +328,7 @@ public class TaskActivityManager implements ITaskActivityManager {
Set<ITask> result = scheduledTasks.get(range);
if (result != null && !result.isEmpty()) {
resultingTasks.addAll(result);
- } else {
+ } else if (!(range instanceof WeekDateRange)) {
return getScheduledTasks(range.getStartDate(), range.getEndDate());
}
}
@@ -627,7 +627,7 @@ public class TaskActivityManager implements ITaskActivityManager {
if (date == null || isComplete) {
return false;
} else {
- if (date.getEndDate().compareTo(TaskActivityUtil.getCalendar()) < 0 && date.isDay()) {
+ if (date.getEndDate().compareTo(TaskActivityUtil.getCalendar()) < 0 && date instanceof DayDateRange) {
return true;
} else {
return false;
@@ -733,7 +733,7 @@ public class TaskActivityManager implements ITaskActivityManager {
private boolean isSheduledForPastWeek(DateRange range) {
if (range != null) {
- return range.isWeek() && range.isPast();
+ return (range instanceof WeekDateRange && range.isPast());
}
return false;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
index 340840ba1..b69923f11 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -239,7 +239,7 @@ public class TaskActivityUtil {
return new WeekDateRange(weekStart, weekEnd);
}
- public static DateRange getWeekOf(Date date) {
+ public static WeekDateRange getWeekOf(Date date) {
Calendar weekStart = getCalendar();
weekStart.setTime(date);
Calendar weekEnd = getCalendar();
@@ -250,7 +250,7 @@ public class TaskActivityUtil {
return new WeekDateRange(weekStart, weekEnd);
}
- public static DateRange getDayOf(Date date) {
+ public static DayDateRange getDayOf(Date date) {
Calendar dayStart = getCalendar();
dayStart.setTime(date);
Calendar dayEnd = getCalendar();
@@ -258,6 +258,6 @@ public class TaskActivityUtil {
snapStartOfDay(dayStart);
snapEndOfDay(dayEnd);
- return new DateRange(dayStart, dayEnd);
+ return new DayDateRange(dayStart, dayEnd);
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
index 787d06773..aa3d77eea 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -20,7 +20,15 @@ import java.util.List;
*/
public class WeekDateRange extends DateRange {
- private final List<DateRange> days = new ArrayList<DateRange>();
+ private static final String DESCRIPTION_WEEK_AFTER_NEXT = "Two Weeks";
+
+ private static final String DESCRIPTION_PREVIOUS_WEEK = "Previous Week";
+
+ private static final String DESCRIPTION_THIS_WEEK = "This Week";
+
+ private static final String DESCRIPTION_NEXT_WEEK = "Next Week";
+
+ private final List<DayDateRange> days = new ArrayList<DayDateRange>();
public WeekDateRange(Calendar startDate, Calendar endDate) {
super(startDate, endDate);
@@ -36,7 +44,7 @@ public class WeekDateRange extends DateRange {
return remainingDays;
}
- public List<DateRange> getDaysOfWeek() {
+ public List<DayDateRange> getDaysOfWeek() {
if (days.isEmpty()) {
for (int x = TaskActivityUtil.getStartDay(); x < (TaskActivityUtil.getStartDay() + 7); x++) {
Calendar dayStart = TaskActivityUtil.getCalendar();
@@ -55,7 +63,7 @@ public class WeekDateRange extends DateRange {
dayEnd.set(Calendar.DAY_OF_WEEK, x);
}
- days.add(new DateRange(dayStart, dayEnd));
+ days.add(new DayDateRange(dayStart, dayEnd));
}
}
return days;
@@ -64,10 +72,10 @@ public class WeekDateRange extends DateRange {
/**
* @return today's DayDateRange, null if does not exist (now > endDate)
*/
- public DateRange getToday() {
- DateRange today = null;
+ public DayDateRange getToday() {
+ DayDateRange today = null;
Calendar now = TaskActivityUtil.getCalendar();
- for (DateRange range : getDaysOfWeek()) {
+ for (DayDateRange range : getDaysOfWeek()) {
if (range.includes(now)) {
today = range;
break;
@@ -78,7 +86,7 @@ public class WeekDateRange extends DateRange {
TaskActivityUtil.snapStartOfDay(todayStart);
Calendar todayEnd = TaskActivityUtil.getCalendar();
TaskActivityUtil.snapEndOfDay(todayEnd);
- today = new DateRange(todayStart, todayEnd);
+ today = new DayDateRange(todayStart, todayEnd);
}
return today;
}
@@ -90,6 +98,57 @@ public class WeekDateRange extends DateRange {
return getDaysOfWeek().contains(range);
}
+ private boolean isNextWeek() {
+ return TaskActivityUtil.getNextWeek().compareTo(this) == 0;
+ }
+
+ public boolean isThisWeek() {
+ //if (isWeek()) {
+ return this.includes(Calendar.getInstance());
+ //}
+ //return false;
+ }
+
+ private boolean isPreviousWeek() {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.WEEK_OF_YEAR, -1);
+ return this.includes(cal);
+ }
+
+ private boolean isWeekAfterNext() {
+ return TaskActivityUtil.getNextWeek().next().compareTo(this) == 0;
+ }
+
+ public WeekDateRange next() {
+ return create(Calendar.WEEK_OF_YEAR, 1);
+ }
+
+ public WeekDateRange previous() {
+ return create(Calendar.WEEK_OF_YEAR, -1);
+ }
+
+ protected WeekDateRange create(int field, int multiplier) {
+ Calendar previousStart = (Calendar) getStartDate().clone();
+ Calendar previousEnd = (Calendar) getEndDate().clone();
+ previousStart.add(field, 1 * multiplier);
+ previousEnd.add(field, 1 * multiplier);
+ return new WeekDateRange(previousStart, previousEnd);
+ }
+
+ @Override
+ public String toString(boolean useDayOfWeekForNextWeek) {
+ if (isWeekAfterNext()) {
+ return DESCRIPTION_WEEK_AFTER_NEXT;
+ } else if (isThisWeek()) {
+ return DESCRIPTION_THIS_WEEK;
+ } else if (isNextWeek()) {
+ return DESCRIPTION_NEXT_WEEK;
+ } else if (isPreviousWeek()) {
+ return DESCRIPTION_PREVIOUS_WEEK;
+ }
+ return super.toString(useDayOfWeekForNextWeek);
+ }
+
public DateRange getDayOfWeek(int dayNum) {
if (dayNum > 0 && dayNum <= 7) {
for (DateRange day : getDaysOfWeek()) {
@@ -98,6 +157,12 @@ public class WeekDateRange extends DateRange {
}
}
}
- return null;
+ throw new IllegalArgumentException("Valid day values are 1 - 7");
+ }
+
+ public static boolean isWeekRange(Calendar calStart, Calendar calEnd) {
+ // bug 248683
+ long diff = (calEnd.getTimeInMillis() - calStart.getTimeInMillis()) - (DAY * 7 - 1);
+ return Math.abs(diff) <= 60 * 60 * 1000;
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
index 9a3a4dacf..f0cfe8271 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -34,7 +34,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.DateRange;
+import org.eclipse.mylyn.internal.tasks.core.DayDateRange;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
@@ -47,6 +47,7 @@ import org.eclipse.mylyn.internal.tasks.core.TaskExternalizationException;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskTask;
import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
+import org.eclipse.mylyn.internal.tasks.core.WeekDateRange;
import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractTaskListFactory;
import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
import org.eclipse.mylyn.tasks.core.IAttributeContainer;
@@ -615,7 +616,14 @@ public final class DelegatingTaskExternalizer {
calStart.setTime(startDate);
Calendar calEnd = TaskActivityUtil.getCalendar();
calEnd.setTime(endDate);
- task.setScheduledForDate(new DateRange(calStart, calEnd));
+ if (DayDateRange.isDayRange(calStart, calEnd)) {
+ task.setScheduledForDate(new DayDateRange(calStart, calEnd));
+ } else if (WeekDateRange.isWeekRange(calStart, calEnd)) {
+ task.setScheduledForDate(new WeekDateRange(calStart, calEnd));
+ } else {
+ // Neither week nor day found, default to today
+ task.setScheduledForDate(TaskActivityUtil.getDayOf(new Date()));
+ }
}
}
if (element.hasAttribute(KEY_REMINDED) && element.getAttribute(KEY_REMINDED).compareTo(VAL_TRUE) == 0) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
index 0fb97d114..b78779799 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java
index 98f06e000..90ee70549 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -46,15 +46,16 @@ public class ScheduledPresentationTest extends TestCase {
}
public void testWeekStartChange() {
+ TaskListInterestFilter filter = new TaskListInterestFilter();
TasksUiPlugin.getTaskActivityManager().setWeekStartDay(Calendar.MONDAY);
DateRange lastDay = TaskActivityUtil.getCurrentWeek().getDayOfWeek(Calendar.SUNDAY);
AbstractTask task1 = new LocalTask("task 1", "Task 1");
TasksUiPlugin.getTaskList().addTask(task1);
TasksUiPlugin.getTaskActivityManager().setScheduledFor(task1, lastDay);
- assertTrue(TaskListInterestFilter.isInterestingForThisWeek(null, task1));
+ assertTrue(filter.isInterestingForThisWeek(null, task1));
TasksUiPlugin.getTaskActivityManager().setWeekStartDay(Calendar.SUNDAY);
- assertFalse(TaskListInterestFilter.isInterestingForThisWeek(null, task1));
+ assertFalse(filter.isInterestingForThisWeek(null, task1));
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityListenerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityListenerTest.java
deleted file mode 100644
index e665caa02..000000000
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityListenerTest.java
+++ /dev/null
@@ -1,106 +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.tasks.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
-import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
-import org.eclipse.mylyn.tasks.tests.connector.MockTask;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Shawn Minto
- */
-public class TaskActivityListenerTest extends TestCase {
-
- private class MockTaskActivationListener extends TaskActivationAdapter {
-
- private boolean hasActivated = false;
-
- private boolean hasPreActivated = false;
-
- private boolean hasDeactivated = false;
-
- private boolean hasPreDeactivated = false;
-
- public void reset() {
- hasActivated = false;
- hasPreActivated = false;
-
- hasDeactivated = false;
- hasPreDeactivated = false;
-
- }
-
- @Override
- public void preTaskActivated(ITask task) {
- assertFalse(hasActivated);
- hasPreActivated = true;
- }
-
- @Override
- public void preTaskDeactivated(ITask task) {
- assertFalse(hasDeactivated);
- hasPreDeactivated = true;
- }
-
- @Override
- public void taskActivated(ITask task) {
- assertTrue(hasPreActivated);
- hasActivated = true;
- }
-
- @Override
- public void taskDeactivated(ITask task) {
- assertTrue(hasPreDeactivated);
- hasDeactivated = true;
- }
-
- }
-
- private ITaskActivityManager taskActivityManager;
-
- @Override
- protected void setUp() throws Exception {
- taskActivityManager = TasksUi.getTaskActivityManager();
- taskActivityManager.deactivateActiveTask();
- }
-
- public void testTaskActivation() {
- MockTask task = new MockTask("test:activation");
- MockTaskActivationListener listener = new MockTaskActivationListener();
- try {
- taskActivityManager.addActivationListener(listener);
- try {
- taskActivityManager.activateTask(task);
- assertTrue(listener.hasPreActivated);
- assertTrue(listener.hasActivated);
- assertFalse(listener.hasPreDeactivated);
- assertFalse(listener.hasDeactivated);
-
- listener.reset();
- } finally {
- taskActivityManager.deactivateTask(task);
- }
- assertFalse(listener.hasPreActivated);
- assertFalse(listener.hasActivated);
- assertTrue(listener.hasPreDeactivated);
- assertTrue(listener.hasDeactivated);
- } finally {
- TasksUiPlugin.getTaskActivityManager().removeActivationListener(listener);
- }
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
deleted file mode 100644
index f44f0b8f3..000000000
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
+++ /dev/null
@@ -1,1006 +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.tasks.tests;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.context.core.InteractionContext;
-import org.eclipse.mylyn.internal.context.core.InteractionContextManager;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITaskList;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.RefactorRepositoryUrlOperation;
-import org.eclipse.mylyn.internal.tasks.ui.TaskListManager;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.monitor.core.InteractionEvent;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.tests.connector.MockAttributeFactory;
-import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
-import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryQuery;
-import org.eclipse.mylyn.tasks.tests.connector.MockTask;
-
-/**
- * @author Mik Kersten
- */
-public class TaskListManagerTest extends TestCase {
-
- private TaskListManager manager;
-
- private TaskRepository repository;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, false);
- manager = TasksUiPlugin.getTaskListManager();
- for (TaskRepository repository : TasksUiPlugin.getRepositoryManager().getAllRepositories()) {
- TasksUiPlugin.getRepositoryManager().removeRepository(repository,
- TasksUiPlugin.getDefault().getRepositoriesFilePath());
- }
- manager.resetTaskList();
- assertEquals(0, manager.getTaskList().getAllTasks().size());
-// manager.readExistingOrCreateNewList();
- TasksUiPlugin.getExternalizationManager().save(true);
- TasksUiPlugin.getDefault().reloadDataDirectory();
-
- repository = new TaskRepository(MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL);
- TasksUiPlugin.getRepositoryManager().addRepository(repository);
-
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- TasksUiPlugin.getRepositoryManager().removeRepository(repository,
- TasksUiPlugin.getDefault().getRepositoriesFilePath());
- manager.resetTaskList();
- TasksUiPlugin.getExternalizationManager().save(true);
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- }
-
- public void testUncategorizedTasksNotLost() throws CoreException {
- MockRepositoryQuery query = new MockRepositoryQuery("Test");
- manager.getTaskList().addQuery(query);
- MockTask task = new MockTask("1");
- manager.getTaskList().addTask(task, query);
- manager.getTaskList().addTask(task, manager.getTaskList().getDefaultCategory());
- assertTrue(query.contains(task.getHandleIdentifier()));
- assertTrue(manager.getTaskList().getDefaultCategory().contains(task.getHandleIdentifier()));
-
- TasksUiPlugin.getExternalizationManager().requestSave();
- manager.resetTaskList();
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- assertFalse(manager.getTaskList().getDefaultCategory().contains(task.getHandleIdentifier()));
- TasksUiPlugin.getDefault().reloadDataDirectory();
-
- assertTrue(manager.getTaskList().getDefaultCategory().contains(task.getHandleIdentifier()));
-
- }
-
- public void testQueryAndCategoryNameClash() {
- TaskCategory category = new TaskCategory("TestClash");
- manager.getTaskList().addCategory(category);
- assertTrue(manager.getTaskList().getCategories().contains(category));
- assertEquals(2, manager.getTaskList().getCategories().size());
-
- MockRepositoryQuery query = new MockRepositoryQuery("TestClash");
- manager.getTaskList().addQuery(query);
- assertTrue(manager.getTaskList().getCategories().contains(category));
- assertEquals(2, manager.getTaskList().getCategories().size());
-
- manager.getTaskList().deleteCategory(category);
- }
-
- public void testUniqueTaskID() {
- LocalTask task1 = TasksUiInternal.createNewLocalTask("label");
- manager.getTaskList().addTask(task1);
- LocalTask task2 = TasksUiInternal.createNewLocalTask("label");
- manager.getTaskList().addTask(task2);
- assertEquals(2, manager.getTaskList().getLastLocalTaskId());
- manager.getTaskList().deleteTask(task2);
- LocalTask task3 = TasksUiInternal.createNewLocalTask("label");
- manager.getTaskList().addTask(task3);
- assertTrue(task3.getHandleIdentifier() + " should end with 3", task3.getHandleIdentifier().endsWith("3"));
- assertEquals(3, manager.getTaskList().getLastLocalTaskId());
-
- assertEquals(2, manager.getTaskList().getAllTasks().size());
- manager.saveTaskList();
- manager.resetTaskList();
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- assertEquals(0, manager.getTaskList().getLastLocalTaskId());
- manager.readExistingOrCreateNewList();
- assertEquals(2, manager.getTaskList().getAllTasks().size());
- assertEquals(3, manager.getTaskList().getLastLocalTaskId());
- ITask task4 = TasksUiInternal.createNewLocalTask("label");
- assertTrue(task4.getHandleIdentifier() + " should end with 4", task4.getHandleIdentifier().endsWith("4"));
- }
-
- public void testSingleTaskDeletion() {
- MockTask task = new MockTask("1");
- task.setLastReadTimeStamp("now");
- manager.getTaskList().addTask(task,
- manager.getTaskList().getUnmatchedContainer(LocalRepositoryConnector.REPOSITORY_URL));
- assertEquals(1, manager.getTaskList().getAllTasks().size());
- manager.getTaskList().deleteTask(task);
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- manager.getTaskList().addTask(task,
- manager.getTaskList().getUnmatchedContainer(LocalRepositoryConnector.REPOSITORY_URL));
- assertEquals(1, manager.getTaskList().getAllTasks().size());
-
- manager.saveTaskList();
-
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
- assertEquals(1, manager.getTaskList().getAllTasks().size());
-
- manager.getTaskList().deleteTask(task);
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- manager.saveTaskList();
- assertEquals(0, manager.getTaskList().getAllTasks().size());
-
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- }
-
- private void runRepositoryUrlOperation(String oldUrl, String newUrl) {
- try {
- new RefactorRepositoryUrlOperation(oldUrl, newUrl).run(new NullProgressMonitor());
- } catch (Exception e) {
- fail();
- }
- }
-
- public void testMigrateTaskContextFiles() throws IOException {
- File fileA = ContextCorePlugin.getContextStore().getFileForContext("http://a-1");
- fileA.createNewFile();
- fileA.deleteOnExit();
- assertTrue(fileA.exists());
- runRepositoryUrlOperation("http://a", "http://b");
- File fileB = ContextCorePlugin.getContextStore().getFileForContext("http://b-1");
- assertTrue(fileB.exists());
- assertFalse(fileA.exists());
- }
-
- public void testMigrateQueryUrlHandles() {
- RepositoryQuery query = new MockRepositoryQuery("mquery");
- query.setRepositoryUrl("http://foo.bar");
- query.setUrl("http://foo.bar/b");
- manager.getTaskList().addQuery(query);
- assertTrue(manager.getTaskList().getRepositoryQueries("http://foo.bar").size() > 0);
- runRepositoryUrlOperation("http://foo.bar", "http://bar.baz");
- assertTrue(manager.getTaskList().getRepositoryQueries("http://foo.bar").size() == 0);
- assertTrue(manager.getTaskList().getRepositoryQueries("http://bar.baz").size() > 0);
- IRepositoryQuery changedQuery = manager.getTaskList().getRepositoryQueries("http://bar.baz").iterator().next();
- assertEquals("http://bar.baz/b", changedQuery.getUrl());
- }
-
- public void testMigrateQueryHandles() {
- RepositoryQuery query = new MockRepositoryQuery("mquery");
- query.setRepositoryUrl("http://a");
- manager.getTaskList().addQuery(query);
- runRepositoryUrlOperation("http://a", "http://b");
- assertFalse(manager.getTaskList().getRepositoryQueries("http://b").isEmpty());
- assertTrue(manager.getTaskList().getRepositoryQueries("http://a").isEmpty());
- }
-
-// public void testMigrateQueryHits() {
-// AbstractRepositoryQuery query = new MockRepositoryQuery("mquery",
-// manager.getTaskList());
-// query.setRepositoryUrl("http://a");
-// manager.getTaskList().addQuery(query);
-// AbstractQueryHit hit = new MockQueryHit(manager.getTaskList(), "http://a",
-// "", "123");
-// query.addHit(hit);
-// runRepositoryUrlOperation("http://a", "http://b");
-// assertNotNull(manager.getTaskList().getQueryHit("http://b-123"));
-// assertEquals("http://b-123", hit.getHandleIdentifier());
-// }
-
- public void testMigrateTaskHandles() {
- AbstractTask task = new MockTask("http://a", "123");
- AbstractTask task2 = new MockTask("http://other", "other");
- manager.getTaskList().addTask(task);
- manager.getTaskList().addTask(task2);
-
- RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), task.getConnectorKind(),
- task.getRepositoryUrl(), task.getTaskId(), task.getTaskKind());
- TasksUiPlugin.getTaskDataStorageManager().setNewTaskData(taskData);
- assertNotNull(TasksUiPlugin.getTaskDataStorageManager().getNewTaskData(task.getRepositoryUrl(),
- task.getTaskId()));
-
- RepositoryTaskData taskData2 = new RepositoryTaskData(new MockAttributeFactory(), task2.getConnectorKind(),
- task2.getRepositoryUrl(), task2.getTaskId(), task2.getTaskKind());
- taskData2.setNewComment("TEST");
- TasksUiPlugin.getTaskDataStorageManager().setNewTaskData(taskData2);
- assertNotNull(TasksUiPlugin.getTaskDataStorageManager().getNewTaskData(task2.getRepositoryUrl(),
- task2.getTaskId()));
- assertEquals("TEST", TasksUiPlugin.getTaskDataStorageManager().getNewTaskData(task2.getRepositoryUrl(),
- task2.getTaskId()).getNewComment());
-
- runRepositoryUrlOperation("http://a", "http://b");
- assertNull(manager.getTaskList().getTask("http://a-123"));
- assertNotNull(manager.getTaskList().getTask("http://b-123"));
- assertNotNull(TasksUiPlugin.getTaskDataStorageManager().getNewTaskData("http://b", "123"));
- RepositoryTaskData otherData = TasksUiPlugin.getTaskDataStorageManager().getNewTaskData(
- task2.getRepositoryUrl(), task2.getTaskId());
- assertNotNull(otherData);
- assertEquals("TEST", otherData.getNewComment());
- }
-
- public void testMigrateTaskHandlesWithExplicitSet() {
- AbstractTask task = new MockTask("http://a", "123");
- task.setUrl("http://a/task/123");
- manager.getTaskList().addTask(task);
- runRepositoryUrlOperation("http://a", "http://b");
- assertNull(manager.getTaskList().getTask("http://a-123"));
- assertNotNull(manager.getTaskList().getTask("http://b-123"));
- assertEquals("http://b/task/123", task.getUrl());
- }
-
- public void testRefactorMetaContextHandles() {
- String firstUrl = "http://repository1.com/bugs";
- String secondUrl = "http://repository2.com/bugs";
- AbstractTask task1 = new MockTask(firstUrl, "1");
- AbstractTask task2 = new MockTask(firstUrl, "2");
- manager.getTaskList().addTask(task1);
- manager.getTaskList().addTask(task2);
- Calendar startDate = Calendar.getInstance();
- Calendar endDate = Calendar.getInstance();
- endDate.add(Calendar.MINUTE, 5);
-
- Calendar startDate2 = Calendar.getInstance();
- startDate2.add(Calendar.MINUTE, 15);
- Calendar endDate2 = Calendar.getInstance();
- endDate2.add(Calendar.MINUTE, 25);
-
- ContextCorePlugin.getContextManager().resetActivityMetaContext();
- InteractionContext metaContext = ContextCorePlugin.getContextManager().getActivityMetaContext();
- assertEquals(0, metaContext.getInteractionHistory().size());
-
- ContextCorePlugin.getContextManager().processActivityMetaContextEvent(
- new InteractionEvent(InteractionEvent.Kind.ATTENTION,
- InteractionContextManager.ACTIVITY_STRUCTUREKIND_TIMING, task1.getHandleIdentifier(), "origin",
- null, InteractionContextManager.ACTIVITY_DELTA_ADDED, 1f, startDate.getTime(),
- endDate.getTime()));
-
- ContextCorePlugin.getContextManager().processActivityMetaContextEvent(
- new InteractionEvent(InteractionEvent.Kind.ATTENTION,
- InteractionContextManager.ACTIVITY_STRUCTUREKIND_TIMING, task2.getHandleIdentifier(), "origin",
- null, InteractionContextManager.ACTIVITY_DELTA_ADDED, 1f, startDate2.getTime(),
- endDate2.getTime()));
-
- assertEquals(2, metaContext.getInteractionHistory().size());
- assertEquals(60 * 1000 * 5, TasksUiPlugin.getTaskActivityManager().getElapsedTime(task1));
- assertEquals(2 * 60 * 1000 * 5, TasksUiPlugin.getTaskActivityManager().getElapsedTime(task2));
- runRepositoryUrlOperation(firstUrl, secondUrl);
- metaContext = ContextCorePlugin.getContextManager().getActivityMetaContext();
- assertEquals(2, metaContext.getInteractionHistory().size());
- assertEquals(60 * 1000 * 5, TasksUiPlugin.getTaskActivityManager().getElapsedTime(new MockTask(secondUrl, "1")));
- assertEquals(2 * 60 * 1000 * 5, TasksUiPlugin.getTaskActivityManager().getElapsedTime(
- new MockTask(secondUrl, "2")));
- assertEquals(secondUrl + "-1", metaContext.getInteractionHistory().get(0).getStructureHandle());
- }
-
- public void testIsActiveToday() {
- AbstractTask task = new LocalTask("1", "task-1");
- assertFalse(TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task));
-
- task.setScheduledForDate(TaskActivityUtil.getCurrentWeek().getToday());
- assertTrue(TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task));
-
- task.setReminded(true);
- assertTrue(TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task));
- task.setReminded(true);
-
-// Calendar inAnHour = Calendar.getInstance();
-// inAnHour.set(Calendar.HOUR_OF_DAY, inAnHour.get(Calendar.HOUR_OF_DAY) + 1);
-// inAnHour.getTime();
-// task.setScheduledForDate(inAnHour.getTime());
-// Calendar tomorrow = Calendar.getInstance();
-// TaskActivityUtil.snapToNextDay(tomorrow);
-// assertEquals(-1, inAnHour.compareTo(tomorrow));
-// assertTrue(TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task));
- }
-
- public void testScheduledForToday() {
- AbstractTask task = new LocalTask("1", "task-1");
- task.setScheduledForDate(TaskActivityUtil.getCurrentWeek().getToday());
- assertTrue(TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task));
- task.setScheduledForDate(TaskActivityUtil.getCurrentWeek().getToday().next());
- assertFalse(TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task));
- }
-
- public void testSchedulePastEndOfMonth() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.MONTH, Calendar.SEPTEMBER);
- calendar.set(Calendar.DAY_OF_MONTH, 30);
- TaskActivityUtil.snapForwardNumDays(calendar, 1);
- assertEquals("Should be October", Calendar.OCTOBER, calendar.get(Calendar.MONTH));
- }
-
- public void testIsCompletedToday() {
- ITask task = new LocalTask("1", "task 1");
- task.setCompletionDate(new Date());
- assertTrue(TasksUiPlugin.getTaskActivityManager().isCompletedToday(task));
-
- MockTask mockTask = new MockTask("1");
- mockTask.setOwner("unknown");
- manager.getTaskList().addTask(mockTask);
- mockTask.setCompletionDate(new Date());
- assertFalse("completed: " + mockTask.getCompletionDate(), TasksUiPlugin.getTaskActivityManager()
- .isCompletedToday(mockTask));
-
- mockTask = new MockTask("2");
- manager.getTaskList().addTask(mockTask);
- mockTask.setCompletionDate(new Date());
- repository.setAuthenticationCredentials("testUser", "testPassword");
- mockTask.setOwner("testUser");
- assertTrue(TasksUiPlugin.getTaskActivityManager().isCompletedToday(mockTask));
-
- }
-
- public void testMoveCategories() {
-// assertEquals(0, manager.getTaskList()
-// .getOrphanContainer(LocalRepositoryConnector.REPOSITORY_URL)
-// .getChildren()
-// .size());
-
- assertTrue(manager.getTaskList().getDefaultCategory().isEmpty());
-
- AbstractTask task1 = new LocalTask("t1", "t1");
-
- TaskCategory cat1 = new TaskCategory("cat1");
- manager.getTaskList().addCategory(cat1);
- TaskCategory cat2 = new TaskCategory("cat2");
- manager.getTaskList().addCategory(cat2);
-
- manager.getTaskList().addTask(task1, cat1);
- assertEquals(1, manager.getTaskList().getContainerForHandle("cat1").getChildren().size());
- assertEquals(0, manager.getTaskList().getContainerForHandle("cat2").getChildren().size());
-
- manager.getTaskList().addTask(task1, cat2);
- assertEquals(0, manager.getTaskList().getContainerForHandle("cat1").getChildren().size());
- assertEquals(1, manager.getTaskList().getContainerForHandle("cat2").getChildren().size());
- }
-
- public void testMoveToRoot() {
-// assertEquals(0, manager.getTaskList()
-// .getOrphanContainer(LocalRepositoryConnector.REPOSITORY_URL)
-// .getChildren()
-// .size());
- assertTrue(manager.getTaskList().getDefaultCategory().isEmpty());
-
- AbstractTask task1 = new LocalTask("t1", "t1");
- manager.getTaskList().addTask(task1,
- manager.getTaskList().getUnmatchedContainer(LocalRepositoryConnector.REPOSITORY_URL));
- assertEquals(1, manager.getTaskList().getDefaultCategory().getChildren().size());
- assertEquals(manager.getTaskList().getDefaultCategory(), TaskCategory.getParentTaskCategory(task1));
-
- TaskCategory cat1 = new TaskCategory("c1");
- manager.getTaskList().addCategory(cat1);
-
- manager.getTaskList().addTask(task1, cat1);
- assertEquals(0, manager.getTaskList().getDefaultCategory().getChildren().size());
- assertEquals(cat1, TaskCategory.getParentTaskCategory(task1));
-
- manager.getTaskList().addTask(task1,
- manager.getTaskList().getUnmatchedContainer(LocalRepositoryConnector.REPOSITORY_URL));
- assertEquals(1, manager.getTaskList().getDefaultCategory().getChildren().size());
- assertEquals(0, cat1.getChildren().size());
- assertEquals(manager.getTaskList().getDefaultCategory(), TaskCategory.getParentTaskCategory(task1));
- }
-
- public void testCategoryPersistance() {
- MockTask task = new MockTask("1");
- TaskCategory category = new TaskCategory("cat");
- manager.getTaskList().addCategory(category);
- manager.getTaskList().addTask(task, category);
- assertNotNull(manager.getTaskList());
- assertEquals(2, manager.getTaskList().getCategories().size());
-
- manager.saveTaskList();
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
- assertEquals("" + manager.getTaskList().getCategories(), 2, manager.getTaskList().getCategories().size());
- assertEquals(1, manager.getTaskList().getAllTasks().size());
- }
-
- public void testDeleteCategory() {
- assertNotNull(manager.getTaskList());
- assertEquals(1, manager.getTaskList().getCategories().size());
- TaskCategory category = new TaskCategory("cat");
- manager.getTaskList().addCategory(category);
- assertEquals(2, manager.getTaskList().getCategories().size());
- manager.getTaskList().deleteCategory(category);
- assertEquals(1, manager.getTaskList().getCategories().size());
- }
-
- public void testDeleteCategoryMovesTasksToRoot() {
- AbstractTask task = new MockTask("delete");
- TaskCategory category = new TaskCategory("cat");
- manager.getTaskList().addCategory(category);
- manager.getTaskList().addTask(task, category);
- assertEquals(0, manager.getTaskList().getDefaultCategory().getChildren().size());
- manager.getTaskList().deleteCategory(category);
- manager.getTaskList().getUnmatchedContainer(MockRepositoryConnector.REPOSITORY_URL);
- }
-
- public void testRenameCategory() {
-
- assertNotNull(manager.getTaskList());
-
- TaskCategory category = new TaskCategory("cat");
- manager.getTaskList().addCategory(category);
- assertEquals(2, manager.getTaskList().getCategories().size());
- String newDesc = "newDescription";
- manager.getTaskList().renameContainer(category, newDesc);
- AbstractTaskCategory container = manager.getTaskList().getContainerForHandle(newDesc);
- assertNotNull(container);
- assertEquals(newDesc, container.getSummary());
- manager.getTaskList().deleteCategory(container);
- assertEquals(1, manager.getTaskList().getCategories().size());
- }
-
- public void testDeleteCategoryAfterRename() {
- String newDesc = "newDescription";
- assertNotNull(manager.getTaskList());
- assertEquals(1, manager.getTaskList().getCategories().size());
- TaskCategory category = new TaskCategory("cat");
- manager.getTaskList().addCategory(category);
- assertEquals(2, manager.getTaskList().getCategories().size());
- manager.getTaskList().renameContainer(category, newDesc);
- manager.getTaskList().deleteCategory(category);
- assertEquals(1, manager.getTaskList().getCategories().size());
- }
-
- public void testCreateSameCategoryName() {
- assertNotNull(manager.getTaskList());
- assertEquals(1, manager.getTaskList().getCategories().size());
- TaskCategory category = new TaskCategory("cat");
- manager.getTaskList().addCategory(category);
- assertEquals(2, manager.getTaskList().getCategories().size());
- TaskCategory category2 = new TaskCategory("cat");
- manager.getTaskList().addCategory(category2);
- assertEquals(2, manager.getTaskList().getCategories().size());
- ITaskContainer container = manager.getTaskList().getContainerForHandle("cat");
- assertEquals(container, category);
- }
-
- public void testDeleteRootTask() {
- AbstractTask task = new LocalTask("1", "label");
- manager.getTaskList().addTask(task);
- manager.getTaskList().deleteTask(task);
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- assertEquals(0, manager.getTaskList().getDefaultCategory().getChildren().size());
- }
-
- public void testDeleteFromCategory() {
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- assertEquals(0, manager.getTaskList().getDefaultCategory().getChildren().size());
- //assertEquals(0, manager.getTaskList().getArchiveContainer().getChildren().size());
- assertEquals(1, manager.getTaskList().getCategories().size());
-
- AbstractTask task = new LocalTask("1", "label");
- TaskCategory category = new TaskCategory("handleAndDescription");
- manager.getTaskList().addTask(task);
- assertEquals(1, manager.getTaskList().getDefaultCategory().getChildren().size());
-
- manager.getTaskList().addCategory(category);
- manager.getTaskList().addTask(task, category);
- assertEquals(2, manager.getTaskList().getCategories().size());
- assertEquals(1, category.getChildren().size());
- assertEquals(0, manager.getTaskList().getDefaultCategory().getChildren().size());
- assertEquals(1, manager.getTaskList().getAllTasks().size());
-
- manager.getTaskList().deleteTask(task);
- assertEquals(0, manager.getTaskList().getAllTasks().size());
- assertEquals(0, manager.getTaskList().getDefaultCategory().getChildren().size());
- assertEquals(0, category.getChildren().size());
- }
-
- public void testDeleteRepositoryTask() {
- String repositoryUrl = "http://somewhere.com";
- repository = new TaskRepository(MockRepositoryConnector.REPOSITORY_KIND, repositoryUrl);
- TasksUiPlugin.getRepositoryManager().addRepository(repository);
- MockTask task = new MockTask(repositoryUrl, "1");
- TaskList taskList = TasksUiPlugin.getTaskList();
- taskList.addTask(task, manager.getTaskList().getDefaultCategory());
- MockRepositoryQuery query = new MockRepositoryQuery("query");
- taskList.addQuery(query);
- taskList.addTask(task, query);
- assertEquals(1, taskList.getAllTasks().size());
- assertEquals(1, manager.getTaskList().getDefaultCategory().getChildren().size());
- taskList.deleteTask(task);
- assertEquals(0, taskList.getAllTasks().size());
- assertEquals(0, manager.getTaskList().getDefaultCategory().getChildren().size());
- }
-
- public void testCreate() {
- MockTask repositoryTask = new MockTask("1");
- repositoryTask.setLastReadTimeStamp("now");
- manager.getTaskList().addTask(repositoryTask, manager.getTaskList().getDefaultCategory());
- assertEquals(1, manager.getTaskList().getDefaultCategory().getChildren().size());
- manager.saveTaskList();
-
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
- assertEquals(1, manager.getTaskList().getAllTasks().size());
- }
-
- public void testCreateAndMove() throws CoreException {
- MockTask repositoryTask = new MockTask("1");
- repositoryTask.setLastReadTimeStamp("now");
- manager.getTaskList().addTask(repositoryTask);
- assertEquals(1, manager.getTaskList().getAllTasks().size());
- TasksUiPlugin.getExternalizationManager().requestSave();
- TasksUiPlugin.getDefault().reloadDataDirectory();
- assertEquals(1, manager.getTaskList().getAllTasks().size());
- assertEquals(1, manager.getTaskList()
- .getUnmatchedContainer(MockRepositoryConnector.REPOSITORY_URL)
- .getChildren()
- .size());
-
- }
-
- public void testArchiveRepositoryTaskExternalization() {
- MockTask repositoryTask = new MockTask("1");
- repositoryTask.setLastReadTimeStamp("now");
- manager.getTaskList().addTask(repositoryTask);
- assertEquals(1, manager.getTaskList()
- .getUnmatchedContainer(MockRepositoryConnector.REPOSITORY_URL)
- .getChildren()
- .size());
- manager.saveTaskList();
-
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
- assertEquals(1, manager.getTaskList()
- .getUnmatchedContainer(MockRepositoryConnector.REPOSITORY_URL)
- .getChildren()
- .size());
- }
-
- public void testRepositoryTasksAndCategoriesMultiRead() {
- TaskCategory cat1 = new TaskCategory("Category 1");
- manager.getTaskList().addCategory(cat1);
-
- MockTask reportInCat1 = new MockTask("123");
- manager.getTaskList().addTask(reportInCat1, cat1);
- assertEquals(cat1, TaskCategory.getParentTaskCategory(reportInCat1));
-
- manager.saveTaskList();
- assertNotNull(manager.getTaskList());
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
-
- // read once
- Set<AbstractTaskCategory> readCats = manager.getTaskList().getTaskCategories();
- assertTrue(manager.getTaskList().getCategories().contains(cat1));
- Iterator<AbstractTaskCategory> iterator = readCats.iterator();
-
- boolean found = false;
- while (iterator.hasNext()) {
- ITaskContainer readCat1 = iterator.next();
- if (cat1.equals(readCat1)) {
- found = true;
- assertEquals(1, readCat1.getChildren().size());
- }
- }
- if (!found) {
- fail(" Category not found afer tasklist read");
- }
-
- manager.saveTaskList();
- assertNotNull(manager.getTaskList());
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
-
- // read again
- readCats = manager.getTaskList().getTaskCategories();
- assertTrue(manager.getTaskList().getCategories().contains(cat1));
-
- iterator = readCats.iterator();
- found = false;
- while (iterator.hasNext()) {
- ITaskContainer readCat1 = iterator.next();
- if (cat1.equals(readCat1)) {
- found = true;
- assertEquals(1, readCat1.getChildren().size());
- }
- }
- if (!found) {
- fail(" Category not found afer tasklist read");
- }
- }
-
- public void testSubTaskExternalization() {
- Set<AbstractTask> rootTasks = new HashSet<AbstractTask>();
- AbstractTask task1 = new LocalTask("1", "task1");
- manager.getTaskList().addTask(task1);
- rootTasks.add(task1);
-
- AbstractTask sub2 = new LocalTask("2", "sub 2");
- manager.getTaskList().addTask(sub2, task1);
- assertEquals(1, task1.getChildren().size());
- assertTrue(rootTasks.containsAll(manager.getTaskList().getDefaultCategory().getChildren()));
-
- manager.saveTaskList();
- assertNotNull(manager.getTaskList());
- manager.resetTaskList();
- manager.readExistingOrCreateNewList();
-
- assertNotNull(manager.getTaskList());
-
- // XXX: This should pass once sub tasks are handled properly
-// assertTrue(rootTasks.containsAll(manager.getTaskList().getOrphanContainer(
-// LocalRepositoryConnector.REPOSITORY_URL).getChildren()));
-
- Collection<ITask> readList = manager.getTaskList().getDefaultCategory().getChildren();
- for (ITask task : readList) {
- if (task.equals(task1)) {
- assertEquals(task1.getSummary(), task.getSummary());
- assertEquals(1, ((ITaskContainer) task).getChildren().size());
- }
- }
- }
-
- public void testCreationAndExternalization() throws CoreException {
- Set<AbstractTask> rootTasks = new HashSet<AbstractTask>();
- AbstractTask task1 = TasksUiInternal.createNewLocalTask("task 1");
- rootTasks.add(task1);
- assertEquals(1, manager.getTaskList().getAllTasks().size());
-
- AbstractTask sub1 = TasksUiInternal.createNewLocalTask("sub 1");
- manager.getTaskList().addTask(sub1, task1);
- assertEquals(4, manager.getTaskList().getRootElements().size());
-
- //manager.getTaskList().moveToContainer(sub1, manager.getTaskList().getArchiveContainer());
-
- AbstractTask task2 = TasksUiInternal.createNewLocalTask("task 2");
- rootTasks.add(task2);
- assertEquals(3, manager.getTaskList().getAllTasks().size());
-
- Set<TaskCategory> categories = new HashSet<TaskCategory>();
- Set<AbstractTask> cat1Contents = new HashSet<AbstractTask>();
- TaskCategory cat1 = new TaskCategory("Category 1");
- manager.getTaskList().addCategory(cat1);
- categories.add(cat1);
- assertEquals(5, manager.getTaskList().getRootElements().size());
-
- AbstractTask task3 = TasksUiInternal.createNewLocalTask("task 3");
- manager.getTaskList().addTask(task3, cat1);
- cat1Contents.add(task3);
- assertEquals(4, manager.getTaskList().getAllTasks().size());
- assertEquals(cat1, TaskCategory.getParentTaskCategory(task3));
- AbstractTask sub2 = TasksUiInternal.createNewLocalTask("sub 2");
- assertEquals(5, manager.getTaskList().getAllTasks().size());
- manager.getTaskList().addTask(sub2, task3);
- //manager.getTaskList().moveToContainer(sub2, manager.getTaskList().getArchiveContainer());
-
- AbstractTask task4 = TasksUiInternal.createNewLocalTask("task 4");
- manager.getTaskList().addTask(task4, cat1);
- cat1Contents.add(task4);
- assertEquals(6, manager.getTaskList().getAllTasks().size());
-
- MockTask reportInCat1 = new MockTask("123");
- manager.getTaskList().addTask(reportInCat1, cat1);
- assertEquals(cat1, TaskCategory.getParentTaskCategory(reportInCat1));
- cat1Contents.add(reportInCat1);
- assertEquals(7, manager.getTaskList().getAllTasks().size());
-
- assertEquals(5, manager.getTaskList().getRootElements().size());
-
- TasksUiPlugin.getExternalizationManager().requestSave();
- TasksUiPlugin.getDefault().reloadDataDirectory();
-
- Collection<ITask> readList = manager.getTaskList().getDefaultCategory().getChildren();
- for (ITask task : readList) {
- if (task.equals(task1)) {
- assertEquals(task1.getSummary(), task.getSummary());
- assertEquals(1, ((AbstractTaskContainer) task).getChildren().size());
- }
- }
-
- Set<AbstractTaskCategory> readCats = manager.getTaskList().getTaskCategories();
- assertTrue(manager.getTaskList().getCategories().contains(cat1));
- Iterator<AbstractTaskCategory> iterator = readCats.iterator();
- boolean found = false;
- while (iterator.hasNext()) {
- ITaskContainer readCat1 = iterator.next();
- if (cat1.equals(readCat1)) {
- found = true;
- for (ITask task : readCat1.getChildren()) {
- assertTrue(cat1Contents.contains(task));
- }
- }
- }
- if (!found) {
- fail(" Category not found afer tasklist read");
- }
- }
-
- public void testExternalizationOfHandlesWithDash() throws CoreException {
- AbstractTask task1 = TasksUiInternal.createNewLocalTask("task 1");
- manager.getTaskList().addTask(task1, manager.getTaskList().getDefaultCategory());
-
- TasksUiPlugin.getExternalizationManager().requestSave();
- TasksUiPlugin.getDefault().reloadDataDirectory();
- assertTrue(manager.getTaskList().getDefaultCategory().getChildren().contains(task1));
- }
-
- public void testgetQueriesAndHitsForHandle() {
- TaskList taskList = manager.getTaskList();
-
- MockTask hit1 = new MockTask("1");
- MockTask hit2 = new MockTask("2");
- MockTask hit3 = new MockTask("3");
-
- MockTask hit1twin = new MockTask("1");
- MockTask hit2twin = new MockTask("2");
- MockTask hit3twin = new MockTask("3");
-
- MockRepositoryQuery query1 = new MockRepositoryQuery("query1");
- MockRepositoryQuery query2 = new MockRepositoryQuery("query2");
-
- taskList.addQuery(query1);
- taskList.addQuery(query2);
- taskList.addTask(hit1, query1);
- taskList.addTask(hit2, query1);
- taskList.addTask(hit3, query1);
-
- assertEquals(3, query1.getChildren().size());
-
- taskList.addTask(hit1twin, query2);
- taskList.addTask(hit2twin, query2);
- taskList.addTask(hit3twin, query2);
-
- assertEquals(3, query2.getChildren().size());
-
- Set<AbstractTaskContainer> queriesReturned = hit1.getParentContainers();
- assertNotNull(queriesReturned);
- assertEquals(2, queriesReturned.size());
- assertTrue(queriesReturned.contains(query1));
- assertTrue(queriesReturned.contains(query2));
- }
-
-// public void testQueryHitHasParent() {
-// TaskList taskList = manager.getTaskList();
-//
-// MockQueryHit hit1 = new MockQueryHit(taskList,
-// MockRepositoryConnector.REPOSITORY_URL, "description1", "1");
-// assertNull(hit1.getParent());
-// MockRepositoryQuery query1 = new MockRepositoryQuery("query1",
-// manager.getTaskList());
-// query1.addHit(hit1);
-// assertEquals(query1, hit1.getParent());
-//
-// }
-
- public void testUpdateQueryHits() {
- ITaskList taskList = manager.getTaskList();
-
- MockTask hit1 = new MockTask("1");
- MockTask hit2 = new MockTask("2");
- MockTask hit3 = new MockTask("3");
-
- MockTask hit1twin = new MockTask("1");
- MockTask hit2twin = new MockTask("2");
- MockTask hit3twin = new MockTask("3");
-
- MockRepositoryQuery query1 = new MockRepositoryQuery("query1");
- taskList.addQuery(query1);
-
- taskList.addTask(hit1, query1);
- taskList.addTask(hit2, query1);
- taskList.addTask(hit3, query1);
-
- taskList.addTask(hit1twin, query1);
- taskList.addTask(hit2twin, query1);
- taskList.addTask(hit3twin, query1);
-
- assertEquals(3, query1.getChildren().size());
- for (ITask child : query1.getChildren()) {
- taskList.removeFromContainer(query1, child);
- }
- assertEquals(0, query1.getChildren().size());
- taskList.addTask(hit1, query1);
- taskList.addTask(hit2, query1);
- assertEquals(2, query1.getChildren().size());
- hit1.setNotified(true);
-
- taskList.addTask(hit1twin, query1);
- taskList.addTask(hit2twin, query1);
- taskList.addTask(hit3twin, query1);
- assertEquals(3, query1.getChildren().size());
- assertTrue(query1.getChildren().contains(hit1twin));
- assertTrue(query1.getChildren().contains(hit2twin));
- assertTrue(query1.getChildren().contains(hit3twin));
- for (ITask hit : query1.getChildren()) {
- if (hit.equals(hit1twin)) {
- assertTrue(((AbstractTask) hit).isNotified());
- } else {
- assertFalse(((AbstractTask) hit).isNotified());
- }
- }
- }
-
- public void testgetRepositoryTasks() {
-
- String repositoryUrl = "https://bugs.eclipse.org/bugs";
-
- String bugNumber = "106939";
-
- MockTask task1 = new MockTask(repositoryUrl, bugNumber);
- manager.getTaskList().addTask(task1);
-
- MockTask task2 = new MockTask("https://unresolved", bugNumber);
- manager.getTaskList().addTask(task2);
-
- TaskList taskList = manager.getTaskList();
- assertEquals(2, taskList.getAllTasks().size());
- Set<ITask> tasksReturned = taskList.getTasks(repositoryUrl);
- assertNotNull(tasksReturned);
- assertEquals(1, tasksReturned.size());
- assertTrue(tasksReturned.contains(task1));
- }
-
- public void testAllTasksDeactivation() {
- AbstractTask task1 = new LocalTask("task1", "description1");
- AbstractTask task2 = new LocalTask("task2", "description2");
- TaskList taskList = manager.getTaskList();
- taskList.addTask(task1);
- taskList.addTask(task2);
- assertNull(manager.getActiveTask());
-
- manager.activateTask(task2);
- assertEquals(task2, manager.getActiveTask());
-
- manager.deactivateAllTasks();
- assertNull(manager.getActiveTask());
- }
-
- public void testMarkTaskRead() {
- // TODO reimplement
-// String repositoryUrl = "http://mylyn.eclipse.org/bugs222";
-// MockTask task1 = new MockTask(repositoryUrl, "1");
-// MockTask task2 = new MockTask(repositoryUrl, "2");
-// task1.setSynchronizationState(SynchronizationState.INCOMING);
-// task2.setSynchronizationState(SynchronizationState.INCOMING);
-// List<ITaskElement> elements = new ArrayList<ITaskElement>();
-// elements.add(task1);
-// elements.add(task2);
-// MarkTaskReadAction readAction = new MarkTaskReadAction(elements);
-// readAction.run();
-// assertEquals(SynchronizationState.SYNCHRONIZED, task1.getSynchronizationState());
-// assertEquals(SynchronizationState.SYNCHRONIZED, task2.getSynchronizationState());
-//
-// manager.getTaskList().reset();
-// MockTask hit1 = new MockTask("1");
-// MockTask hit2 = new MockTask("2");
-// MockRepositoryQuery query = new MockRepositoryQuery("summary");
-// manager.getTaskList().addQuery(query);
-// manager.getTaskList().addTask(hit1, query);
-// manager.getTaskList().addTask(hit2, query);
-//
-// elements.clear();
-// elements.add(query);
-// readAction = new MarkTaskReadAction(elements);
-// readAction.run();
-// assertEquals(2, query.getChildren().size());
-// for (ITaskElement element : query.getChildren()) {
-// if (element instanceof MockTask) {
-// MockTask mockTask = (MockTask) element;
-// assertEquals(SynchronizationState.SYNCHRONIZED, mockTask.getSynchronizationState());
-// }
-// }
-
- }
-
- public void testMarkUnRead() {
- // TODO reimplement
-// String repositoryUrl = "http://mylyn.eclipse.org/bugs222";
-// MockTask task1 = new MockTask(repositoryUrl, "1");
-// MockTask task2 = new MockTask(repositoryUrl, "2");
-// assertEquals(SynchronizationState.SYNCHRONIZED, task1.getSynchronizationState());
-// assertEquals(SynchronizationState.SYNCHRONIZED, task2.getSynchronizationState());
-// List<ITaskElement> elements = new ArrayList<ITaskElement>();
-// elements.add(task1);
-// elements.add(task2);
-// MarkTaskUnreadAction unreadAction = new MarkTaskUnreadAction(elements);
-// unreadAction.run();
-// assertEquals(SynchronizationState.INCOMING, task1.getSynchronizationState());
-// assertEquals(SynchronizationState.INCOMING, task2.getSynchronizationState());
-//
-// manager.getTaskList().reset();
-// MockTask hit1 = new MockTask("1");
-// MockTask hit2 = new MockTask("2");
-// MockRepositoryQuery query = new MockRepositoryQuery("summary");
-// manager.getTaskList().addQuery(query);
-// manager.getTaskList().addTask(hit1, query);
-// manager.getTaskList().addTask(hit2, query);
-//
-// elements.clear();
-// elements.add(query);
-// MarkTaskReadAction readAction = new MarkTaskReadAction(elements);
-// readAction.run();
-// assertEquals(2, query.getChildren().size());
-// for (ITaskElement element : query.getChildren()) {
-// if (element instanceof MockTask) {
-// MockTask mockTask = (MockTask) element;
-// assertEquals(SynchronizationState.SYNCHRONIZED, mockTask.getSynchronizationState());
-// } else {
-// fail();
-// }
-// }
-//
-// unreadAction = new MarkTaskUnreadAction(elements);
-// unreadAction.run();
-// assertEquals(2, query.getChildren().size());
-// for (ITaskElement element : query.getChildren()) {
-// if (element instanceof MockTask) {
-// MockTask mockTask = (MockTask) element;
-// assertEquals(SynchronizationState.INCOMING, mockTask.getSynchronizationState());
-// } else {
-// fail();
-// }
-// }
- }
-
- public void testQueryHitsNotDropped() {
- MockTask task1 = new MockTask("1");
- MockTask task2 = new MockTask("2");
- task1.setLastReadTimeStamp("today");
- task2.setLastReadTimeStamp("today");
- MockRepositoryQuery query = new MockRepositoryQuery("summary");
- manager.getTaskList().addQuery(query);
- manager.getTaskList().addTask(task1, query);
- manager.getTaskList().addTask(task2, query);
- //assertEquals(0, manager.getTaskList().getArchiveContainer().getChildren().size());
- assertEquals(2, query.getChildren().size());
- TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
- MockRepositoryConnector.REPOSITORY_URL);
- Set<RepositoryQuery> queries = new HashSet<RepositoryQuery>();
- queries.add(query);
- TasksUiInternal.synchronizeQueries(new MockRepositoryConnector(), repository, queries, null, true);
- //assertEquals(2, manager.getTaskList().getArchiveContainer().getChildren().size());
- assertEquals(0, query.getChildren().size());
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockAttributeFactory.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockAttributeFactory.java
deleted file mode 100644
index 776ab6a81..000000000
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockAttributeFactory.java
+++ /dev/null
@@ -1,54 +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.tasks.tests.connector;
-
-import java.util.Date;
-
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractAttributeFactory;
-
-/**
- * @author Rob Elves
- */
-public class MockAttributeFactory extends AbstractAttributeFactory {
-
- private static final long serialVersionUID = 7713746838934802731L;
-
- @Override
- public boolean isHidden(String key) {
- // ignore
- return false;
- }
-
- @Override
- public String getName(String key) {
- // ignore
- return key;
- }
-
- @Override
- public boolean isReadOnly(String key) {
- // ignore
- return false;
- }
-
- @Override
- public String mapCommonAttributeKey(String key) {
- return key;
- }
-
- @Override
- public Date getDateForAttributeType(String attributeKey, String dateString) {
- // ignore
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
index 8b03931d7..02f58469a 100644
--- a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Tasks UI
Bundle-SymbolicName: org.eclipse.mylyn.tasks.ui;singleton:=true
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 3.0.5.qualifier
Bundle-Activator: org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.compare,
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
index 042a5e28a..e7fd0e88a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -121,7 +121,7 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
subMenuManager.add(action);
// Special case: This Week holds previous weeks' scheduled tasks
if (singleTaskSelection != null && singleTaskSelection.getScheduledForDate() != null
- && singleTaskSelection.getScheduledForDate().isWeek()
+ && singleTaskSelection.getScheduledForDate() instanceof WeekDateRange
&& singleTaskSelection.getScheduledForDate().isBefore(week)) {
// Tasks scheduled for 'someday' float into this week
action.setChecked(true);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
index 3e3588bbd..1906a5915 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
@@ -18,6 +18,7 @@ import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -381,7 +382,7 @@ public class TaskSelectionDialog extends FilteredItemsSelectionDialog {
/**
* Mylyn's task activation history
*/
- private final List<AbstractTask> history;
+ private final LinkedHashSet<AbstractTask> history;
private final TaskHistoryItemsComparator itemsComparator;
@@ -429,8 +430,8 @@ public class TaskSelectionDialog extends FilteredItemsSelectionDialog {
public TaskSelectionDialog(Shell parent) {
super(parent);
this.taskActivationHistory = TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory();
- this.history = new ArrayList<AbstractTask>(taskActivationHistory.getPreviousTasks());
- this.itemsComparator = new TaskHistoryItemsComparator(this.history);
+ this.history = new LinkedHashSet<AbstractTask>(taskActivationHistory.getPreviousTasks());
+ this.itemsComparator = new TaskHistoryItemsComparator(new ArrayList<AbstractTask>(history));
this.needsCreateTask = true;
this.labelProvider = new TaskElementLabelProvider(false);
this.showCompletedTasksAction = new ShowCompletedTasksAction();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java
index dc9af7a2e..a60fabf58 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java
@@ -229,12 +229,13 @@ public class RepositoryTextViewerConfiguration extends TextSourceViewerConfigura
@Override
public void hideHyperlinks() {
- Control cursorControl = sourceViewer.getTextWidget().getDisplay().getCursorControl();
- if (cursorControl != null) {
- cursorControl.setToolTipText(null);
+ if (currentTaskHyperlink != null) {
+ Control cursorControl = sourceViewer.getTextWidget().getDisplay().getCursorControl();
+ if (cursorControl != null) {
+ cursorControl.setToolTipText(null);
+ }
+ currentTaskHyperlink = null;
}
- currentTaskHyperlink = null;
-
super.hideHyperlinks();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
index 7795f1469..c16d4faef 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -21,6 +21,7 @@ import org.eclipse.mylyn.commons.core.DateUtil;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.internal.tasks.core.DayDateRange;
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
@@ -128,7 +129,7 @@ public class TaskEditorPlanningPart extends AbstractTaskEditorPart {
if (scheduleDatePicker != null && scheduleDatePicker.getScheduledDate() != null) {
if (task.getScheduledForDate() == null
|| (task.getScheduledForDate() != null && !scheduleDatePicker.getScheduledDate().equals(
- task.getScheduledForDate())) || (task).getScheduledForDate().isDay()) {
+ task.getScheduledForDate())) || (task).getScheduledForDate() instanceof DayDateRange) {
TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, scheduleDatePicker.getScheduledDate());
(task).setReminded(false);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
index da0564947..3095c8c4e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -34,6 +34,7 @@ import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractRetrieveTitleFr
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.internal.tasks.core.DayDateRange;
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
@@ -281,7 +282,7 @@ public class TaskPlanningEditor extends TaskFormPage {
if (scheduleDatePicker != null && scheduleDatePicker.getScheduledDate() != null) {
if (task.getScheduledForDate() == null
|| (task.getScheduledForDate() != null && !scheduleDatePicker.getScheduledDate().equals(
- task.getScheduledForDate())) || (task).getScheduledForDate().isDay()) {
+ task.getScheduledForDate())) || (task).getScheduledForDate() instanceof DayDateRange) {
TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, scheduleDatePicker.getScheduledDate());
(task).setReminded(false);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java
index a0d24963e..248295cbd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -50,9 +50,9 @@ public class TaskPropertyTester extends PropertyTester {
if (PROPERTY_CONNECTOR_KIND.equals(property)) {
return task.getConnectorKind().equals(expectedValue);
} else if (PROPERTY_CAN_POST_ATTACHMENT.equals(property)) {
- return equals(AttachmentUtil.canDownloadAttachment(task), expectedValue);
- } else if (PROPERTY_CAN_GET_ATTACHEMNT.equals(property)) {
return equals(AttachmentUtil.canUploadAttachment(task), expectedValue);
+ } else if (PROPERTY_CAN_GET_ATTACHEMNT.equals(property)) {
+ return equals(AttachmentUtil.canDownloadAttachment(task), expectedValue);
} else if (PROPERTY_HAS_EDITS.equals(property)) {
return equals(ClearOutgoingAction.hasOutgoingChanges(task), expectedValue);
} else if (PROPERTY_HAS_LOCAL_CONTEXT.equals(property)) {
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 6146e1326..e17543b9e 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
@@ -41,6 +41,7 @@ import org.eclipse.mylyn.internal.tasks.ui.TaskTransfer;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.actions.QueryImportAction;
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;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
@@ -209,8 +210,12 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
}
} else if (currentTarget instanceof ScheduledTaskContainer) {
ScheduledTaskContainer container = (ScheduledTaskContainer) currentTarget;
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
- container.getDateRange());
+ if (container instanceof Unscheduled) {
+ TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, null);
+ } else {
+ TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
+ container.getDateRange());
+ }
} else if (currentTarget == null) {
TasksUiInternal.getTaskList().addTask(newTask, TasksUiPlugin.getTaskList().getDefaultCategory());
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
index efac2757c..37a19ede6 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -23,6 +23,7 @@ import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Unscheduled;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
@@ -120,26 +121,37 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
return false;
}
- private static boolean shouldShowInFocusedWorkweekDateContainer(Object parent, ITask task) {
+ private boolean shouldShowInFocusedWorkweekDateContainer(Object parent, ITask task) {
if (parent instanceof ScheduledTaskContainer) {
+
ScheduledTaskContainer container = (ScheduledTaskContainer) parent;
- if (container.isWeekDay() || container.isPresent()) {
- return true;
+
+ if (container instanceof Unscheduled) {
+ return false;
}
-// if (!TasksUiPlugin.getTaskActivityManager().isWeekDay((ScheduledTaskContainer) parent)) {
-// return false;
-// }
- if (TasksUiPlugin.getTaskActivityManager().isOverdue(task)
- || TasksUiPlugin.getTaskActivityManager().isPastReminder((AbstractTask) task)) {
+
+ if (isDateRangeInteresting(container)) {
return true;
}
+// if (container.isWeekDay() || container.isPresent()) {
+// return true;
+// }
+//
+//// if (!TasksUiPlugin.getTaskActivityManager().isWeekDay((ScheduledTaskContainer) parent)) {
+//// return false;
+//// }
+// if (TasksUiPlugin.getTaskActivityManager().isOverdue(task)
+// || TasksUiPlugin.getTaskActivityManager().isPastReminder((AbstractTask) task)) {
+// return true;
+// }
+
}
return false;
}
- public static boolean isInterestingForThisWeek(Object parent, AbstractTask task) {
+ public boolean isInterestingForThisWeek(Object parent, AbstractTask task) {
if (parent instanceof ScheduledTaskContainer) {
return shouldShowInFocusedWorkweekDateContainer(parent, task);
} else {
@@ -151,7 +163,7 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
}
}
- public static boolean hasChanges(Object parent, ITask task) {
+ public boolean hasChanges(Object parent, ITask task) {
if (parent instanceof ScheduledTaskContainer && !(parent instanceof TaskScheduleContentProvider.Unscheduled)) {
if (!shouldShowInFocusedWorkweekDateContainer(parent, task)) {
return false;
@@ -160,7 +172,7 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
return hasChangesHelper(parent, task);
}
- private static boolean hasChangesHelper(Object parent, ITask task) {
+ private boolean hasChangesHelper(Object parent, ITask task) {
if (task.getSynchronizationState().isOutgoing()) {
return true;
} else if (task.getSynchronizationState().isIncoming()) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
index f2c33d9c6..41fd163e0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * 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
@@ -65,6 +65,7 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
WeekDateRange week = TaskActivityUtil.getCurrentWeek();
+ WeekDateRange nextWeek = TaskActivityUtil.getNextWeek();
timer.cancel();
timer = new Timer();
@@ -75,7 +76,11 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
}
containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), week));
- ScheduledTaskContainer nextWeekContainer = new ScheduledTaskContainer(taskActivityManager, week.next());
+ for (DateRange day : nextWeek.getDaysOfWeek()) {
+ containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), day));
+ }
+
+ ScheduledTaskContainer nextWeekContainer = new ScheduledTaskContainer(taskActivityManager, nextWeek);
containers.add(nextWeekContainer);
ScheduledTaskContainer twoWeeksContainer = new ScheduledTaskContainer(taskActivityManager, week.next()
diff --git a/org.eclipse.mylyn.test-feature/feature.xml b/org.eclipse.mylyn.test-feature/feature.xml
index dab751488..a109fd0e4 100644
--- a/org.eclipse.mylyn.test-feature/feature.xml
+++ b/org.eclipse.mylyn.test-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.mylyn.test_feature"
label="Mylyn Test Feature"
- version="3.0.2.qualifier"
+ version="3.0.5.qualifier"
plugin="org.eclipse.mylyn">
<description url="http://eclipse.org/mylyn">
diff --git a/org.eclipse.mylyn.trac-feature/feature.xml b/org.eclipse.mylyn.trac-feature/feature.xml
index e23598eb0..dd44cbc1e 100644
--- a/org.eclipse.mylyn.trac-feature/feature.xml
+++ b/org.eclipse.mylyn.trac-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.mylyn.trac_feature"
label="Mylyn Connector: Trac"
- version="3.0.2.qualifier"
+ version="3.0.5.qualifier"
provider-name="Eclipse.org"
plugin="org.eclipse.mylyn">
@@ -84,14 +84,14 @@ Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in t
id="org.eclipse.mylyn.trac.ui"
download-size="0"
install-size="0"
- version="3.0.2.qualifier"
+ version="3.0.5.qualifier"
unpack="false"/>
<plugin
id="org.eclipse.mylyn.trac.core"
download-size="0"
install-size="0"
- version="3.0.2.qualifier"
+ version="3.0.5.qualifier"
unpack="false"/>
<plugin
diff --git a/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF
index 907bdb8a5..49ee54ecf 100644
--- a/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Trac Connector Core
Bundle-SymbolicName: org.eclipse.mylyn.trac.core;singleton:=true
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 3.0.5.qualifier
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.context.core;bundle-version="[3.0.0,4.0.0)",
diff --git a/org.eclipse.mylyn.trac.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.trac.ui/META-INF/MANIFEST.MF
index 9153bf2b3..b53f09002 100644
--- a/org.eclipse.mylyn.trac.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.trac.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Trac Connector UI
Bundle-SymbolicName: org.eclipse.mylyn.trac.ui;singleton:=true
-Bundle-Version: 3.0.2.qualifier
+Bundle-Version: 3.0.5.qualifier
Bundle-Activator: org.eclipse.mylyn.internal.trac.ui.TracUiPlugin
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.core.runtime,

Back to the top