Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-11-24 03:12:52 +0000
committerrelves2006-11-24 03:12:52 +0000
commit919a0674236c5a90832fd41cafb869aaf978be04 (patch)
tree454ccd23a9b28bad06adb1c62e32c14814afc225
parent6d5f078a1811f728398a1df16f3a9b3bb15b3ae2 (diff)
downloadorg.eclipse.mylyn.tasks-919a0674236c5a90832fd41cafb869aaf978be04.tar.gz
org.eclipse.mylyn.tasks-919a0674236c5a90832fd41cafb869aaf978be04.tar.xz
org.eclipse.mylyn.tasks-919a0674236c5a90832fd41cafb869aaf978be04.zip
REOPENED - bug 142039: highlight bug report items changed since last viewing
https://bugs.eclipse.org/bugs/show_bug.cgi?id=142039
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java16
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java10
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java94
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataManagerTest.java (renamed from org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/OfflineTaskManagerTest.java)49
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java3
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java4
7 files changed, 112 insertions, 79 deletions
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 1981d6071..f0aac4714 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
@@ -295,7 +295,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
continue;
}
for (String option : optionValues) {
- attribute.addOptionValue(option, option);
+ attribute.addOption(option, option);
}
// TODO: bug#162428, bug#150680 - something along the lines of...
@@ -347,7 +347,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
a = BugzillaClient.makeNewAttribute(BugzillaReportElement.BUG_STATUS);
optionValues = repositoryConfiguration.getStatusValues();
for (String option : optionValues) {
- a.addOptionValue(option, option);
+ a.addOption(option, option);
}
a.setValue(IBugzillaConstants.VALUE_STATUS_NEW);
@@ -358,7 +358,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
optionValues = repositoryConfiguration.getVersions(newReport.getProduct());
Collections.sort(optionValues);
for (String option : optionValues) {
- a.addOptionValue(option, option);
+ a.addOption(option, option);
}
if (optionValues != null && optionValues.size() > 0) {
a.setValue(optionValues.get(optionValues.size() - 1));
@@ -371,7 +371,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
optionValues = repositoryConfiguration.getComponents(newReport.getProduct());
Collections.sort(optionValues);
for (String option : optionValues) {
- a.addOptionValue(option, option);
+ a.addOption(option, option);
}
if (optionValues != null && optionValues.size() > 0) {
a.setValue(optionValues.get(0));
@@ -383,7 +383,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
optionValues = repositoryConfiguration.getPlatforms();
Collections.sort(optionValues);
for (String option : optionValues) {
- a.addOptionValue(option, option);
+ a.addOption(option, option);
}
if (optionValues != null && optionValues.size() > 0) {
a.setValue(optionValues.get(0));
@@ -395,7 +395,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
a = BugzillaClient.makeNewAttribute(BugzillaReportElement.OP_SYS);
optionValues = repositoryConfiguration.getOSs();
for (String option : optionValues) {
- a.addOptionValue(option, option);
+ a.addOption(option, option);
}
if (optionValues != null && optionValues.size() > 0) {
a.setValue(optionValues.get(optionValues.size() - 1));
@@ -407,7 +407,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
a = BugzillaClient.makeNewAttribute(BugzillaReportElement.PRIORITY);
optionValues = repositoryConfiguration.getPriorities();
for (String option : optionValues) {
- a.addOptionValue(option, option);
+ a.addOption(option, option);
}
a.setValue(optionValues.get((optionValues.size() / 2)));
@@ -417,7 +417,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
a = BugzillaClient.makeNewAttribute(BugzillaReportElement.BUG_SEVERITY);
optionValues = repositoryConfiguration.getSeverities();
for (String option : optionValues) {
- a.addOptionValue(option, option);
+ a.addOption(option, option);
}
a.setValue(optionValues.get((optionValues.size() / 2)));
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java
index edce8fd0e..353094f24 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java
@@ -472,9 +472,9 @@ public class BugzillaProductPage extends WizardPage {
String bugzillaPlatform = null; // Bugzilla String for Platform
if (java2buzillaOSMap != null && java2buzillaOSMap.containsKey(OS) && opSysAttribute != null
- && opSysAttribute.getOptionValues() != null) {
+ && opSysAttribute.getOptions() != null) {
bugzillaOS = java2buzillaOSMap.get(OS);
- if (opSysAttribute != null && !opSysAttribute.getOptionValues().values().contains(bugzillaOS)) {
+ if (opSysAttribute != null && opSysAttribute.getOptionParameter(bugzillaOS) == null) {
// If the OS we found is not in the list of available
// options, set bugzillaOS
// to null, and just use "other"
@@ -489,7 +489,7 @@ public class BugzillaProductPage extends WizardPage {
if (platform != null && java2buzillaPlatformMap.containsKey(platform)) {
bugzillaPlatform = java2buzillaPlatformMap.get(platform);
if (platformAttribute != null
- && !platformAttribute.getOptionValues().values().contains(bugzillaPlatform)) {
+ && platformAttribute.getOptionParameter(bugzillaPlatform) == null) {
// If the platform we found is not int the list of available
// optinos, set the
// Bugzilla Platform to null, and juse use "other"
@@ -504,13 +504,13 @@ public class BugzillaProductPage extends WizardPage {
// Set the OS and the Platform in the model
if (bugzillaOS != null && opSysAttribute != null) {
opSysAttribute.setValue(bugzillaOS);
- } else if (opSysAttribute != null && opSysAttribute.getOptionValues().values().contains(OPTION_ALL)) {
+ } else if (opSysAttribute != null && opSysAttribute.getOptionParameter(OPTION_ALL) != null) {
opSysAttribute.setValue(OPTION_ALL);
}
if (bugzillaPlatform != null && platformAttribute != null) {
platformAttribute.setValue(bugzillaPlatform);
- } else if (platformAttribute != null && platformAttribute.getOptionValues().values().contains(OPTION_ALL)) {
+ } else if (platformAttribute != null && platformAttribute.getOptionParameter(OPTION_ALL) != null) {
opSysAttribute.setValue(OPTION_ALL);
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java
index 2751c891d..4b8fade65 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java
@@ -18,28 +18,28 @@ import java.util.List;
import java.util.Map;
/**
- * Class representing a report attribute
+ * Class representing a report attribute
*
* @author Rob Elves
*/
public class RepositoryTaskAttribute implements Serializable {
-
- private static final long serialVersionUID = 6959987055086133307L;
+
+ private static final long serialVersionUID = 6384803506644618720L;
/**
* Key for the author of a comment.
*
* TODO remove this key: Trac uses owner to denote the assignee of a ticket
* and AbstractRepository has a getOwner() method which is confusing
- */
+ */
public static final String USER_OWNER = "task.common.user.owner";
public static final String USER_CC = "task.common.user.cc";
-
+
public static final String COMMENT_TEXT = "task.common.comment.text";
-
+
public static final String COMMENT_DATE = "task.common.comment.date";
-
+
// THIS IS NOT BEING USED BUT RATHER "USER_OWNER" for comments
// TODO: use this id instead
public static final String COMMENT_AUTHOR = "task.common.comment.author";
@@ -51,9 +51,9 @@ public class RepositoryTaskAttribute implements Serializable {
public static final String ATTACHMENT_TYPE = "task.common.attachment.type";
public static final String ATTACHMENT_CTYPE = "task.common.attachment.ctype";
-
+
public static final String ATTACHMENT_DATE = "task.common.attachment.date";
-
+
public static final String ATTACHMENT_URL = "task.common.attachment.url";
public static final String ATTACHMENT_FILENAME = "filename";
@@ -63,7 +63,7 @@ public class RepositoryTaskAttribute implements Serializable {
public static final String RESOLUTION = "task.common.resolution";
public static final String STATUS = "task.common.status";
-
+
public static final String PRIORITY = "task.common.priority";
public static final String DATE_MODIFIED = "task.common.date.modified";
@@ -77,56 +77,54 @@ public class RepositoryTaskAttribute implements Serializable {
public static final String DATE_CREATION = "task.common.date.created";
public static final String KEYWORDS = "task.common.keywords";
-
+
/**
* Boolean attribute. If true, repository user needs to be added to the cc
* list.
*/
public static final String ADD_SELF_CC = "task.common.addselfcc";
-
+
public static final String NEW_CC = "task.common.newcc";
-
+
public static final String REMOVE_CC = "task.common.removecc";
/**
- * String constant used to represent true for boolean attributes.
+ * String constant used to represent true for boolean attributes.
*/
public static final String TRUE = "1";
-
+
/**
- * String constant used to represent false for boolean attributes.
+ * String constant used to represent false for boolean attributes.
*/
public static final String FALSE = "0";
-
+
private boolean hidden = false;
-
+
private boolean isReadOnly = false;
-
+
/** Attribute pretty printing name */
private String name;
/** Name of the option used when updating the attribute on the server */
private String key;
- /** Legal values of the attribute */
- private Map<String, String> optionValues;
+ /** Option parameters */
+ private Map<String, String> optionParameters;
+
+ /** Ordered list of legal attribute values */
+ private List<String> options;
/**
- * Attribute's values (selected or added)
+ * Attribute's values (selected or added)
*/
private List<String> values = new ArrayList<String>();
-// public RepositoryTaskAttribute(String key, ) {
-// this(element.toString(), element.isHidden());
-// setID(element.getKeyString());
-// setReadOnly(element.isReadOnly());
-// }
-
public RepositoryTaskAttribute(String key, String name, boolean hidden) {
this.key = key;
this.name = name;
this.hidden = hidden;
- optionValues = new HashMap<String, String>();
+ this.options = new ArrayList<String>();
+ optionParameters = new HashMap<String, String>();
}
public String getName() {
@@ -138,15 +136,19 @@ public class RepositoryTaskAttribute implements Serializable {
}
public boolean isReadOnly() {
- return isReadOnly ;
+ return isReadOnly;
}
-
+
public void setReadOnly(boolean readonly) {
this.isReadOnly = readonly;
}
- public Map<String, String> getOptionValues() {
- return optionValues;
+ public String getOptionParameter(String option) {
+ return optionParameters.get(options);
+ }
+
+ public List<String> getOptions() {
+ return options;
}
public String getValue() {
@@ -162,7 +164,7 @@ public class RepositoryTaskAttribute implements Serializable {
}
public void setValue(String value) {
- if(values.size() > 0) {
+ if (values.size() > 0) {
values.set(0, value);
} else {
values.add(value);
@@ -183,22 +185,11 @@ public class RepositoryTaskAttribute implements Serializable {
values.remove(values.indexOf(value));
}
}
-
+
public void clearValues() {
values.clear();
}
-// /**
-// * Sets the name of the option used when updating the attribute on the
-// * server
-// *
-// * @param parameterName
-// * The name of the option when updating from the server
-// */
-// public void setID(String parameterName) {
-// this.id = parameterName;
-// }
-
/**
* Adds an attribute option value
*
@@ -207,8 +198,9 @@ public class RepositoryTaskAttribute implements Serializable {
* @param parameterValue
* The option value used when sending the form to the server
*/
- public void addOptionValue(String readableValue, String parameterValue) {
- optionValues.put(readableValue, parameterValue);
+ public void addOption(String readableValue, String parameterValue) {
+ options.add(readableValue);
+ optionParameters.put(readableValue, parameterValue);
}
/**
@@ -233,12 +225,12 @@ public class RepositoryTaskAttribute implements Serializable {
public String toString() {
return getValue();
}
-
+
public boolean hasOptions() {
- return optionValues.size() > 0;
+ return optionParameters.size() > 0;
}
public void clearOptions() {
- optionValues.clear();
+ optionParameters.clear();
}
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/OfflineTaskManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataManagerTest.java
index e601895b8..ffdd83137 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/OfflineTaskManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataManagerTest.java
@@ -8,22 +8,27 @@
package org.eclipse.mylar.tasks.tests;
+import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import junit.framework.TestCase;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.mylar.internal.tasks.ui.TaskDataManager;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.RepositoryOperation;
+import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
+import org.eclipse.mylar.tasks.core.TaskComment;
import org.eclipse.mylar.tasks.tests.connector.MockAttributeFactory;
import org.eclipse.mylar.tasks.tests.connector.MockRepositoryConnector;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
-import junit.framework.TestCase;
-
/**
* @author Rob Elves
*/
-public class OfflineTaskManagerTest extends TestCase {
+public class TaskDataManagerTest extends TestCase {
TaskDataManager offlineTaskDataManager;
@@ -136,5 +141,43 @@ public class OfflineTaskManagerTest extends TestCase {
assertNull(offlineTaskDataManager.getTaskData(MockRepositoryConnector.REPOSITORY_URL, "1"));
assertNull(offlineTaskDataManager.getTaskData(MockRepositoryConnector.REPOSITORY_URL, "2"));
}
+
+ public void testLargeDataSet() throws Exception {
+ RepositoryTaskData taskData;
+ for(int x = 1; x < 1000; x++) {
+ taskData = new RepositoryTaskData(new MockAttributeFactory(),
+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, ""+x);
+
+
+ for(int y = 1; y < 60; y++) {
+ RepositoryTaskAttribute attribute = new RepositoryTaskAttribute(""+y, ""+y, false);
+ for(int z = 1; z < 10; z++) {
+ attribute.addOption(""+z, ""+z);
+ attribute.addValue(""+z);
+ }
+ taskData.addAttribute(""+y, attribute);
+ }
+
+ for(int y = 1; y < 5; y++) {
+ RepositoryOperation op = new RepositoryOperation(""+y, ""+y);
+ taskData.addOperation(op);
+ }
+
+ for(int y = 1; y < 30; y++) {
+ TaskComment comment = new TaskComment(new MockAttributeFactory(), taskData, y);
+ taskData.addComment(comment);
+ }
+
+ offlineTaskDataManager.put(taskData);
+ offlineTaskDataManager.put(taskData);
+ }
+ offlineTaskDataManager.save();
+ System.err.println("Saved");
+ File file = TasksUiPlugin.getDefault().getOfflineReportsFilePath().toFile();
+ System.err.println(file.length());
+ offlineTaskDataManager.clear();
+ offlineTaskDataManager.reloadFromFile();
+ assertNotNull(offlineTaskDataManager.getOldTaskData(AbstractRepositoryTask.getHandle(MockRepositoryConnector.REPOSITORY_URL, 400)));
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java
index 1f3996a40..78e226e34 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java
@@ -19,8 +19,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -654,10 +652,10 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
if (attribute.isHidden())
continue;
- Map<String, String> values = attribute.getOptionValues();
+ List<String> values = attribute.getOptions();
if (values == null)
- values = new HashMap<String, String>();
+ values = new ArrayList<String>();
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
data.horizontalSpan = 1;
@@ -673,12 +671,11 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
if (hasChanged(attribute)) {
attributeCombo.setBackground(TaskListColorsAndFonts.COLOR_ATTRIBUTE_CHANGED);
}
- attributeCombo.setLayoutData(data);
- Set<String> s = values.keySet();
- String[] a = s.toArray(new String[s.size()]);
- for (int i = 0; i < a.length; i++) {
- attributeCombo.add(a[i]);
+ attributeCombo.setLayoutData(data);
+ for (String val : values) {
+ attributeCombo.add(val);
}
+
if (attributeCombo.indexOf(value) != -1) {
attributeCombo.select(attributeCombo.indexOf(value));
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
index 5c8a8e469..6506388a1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
@@ -714,8 +714,9 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
/**
* Returns the path to the file caching the offline bug reports.
+ * PUBLIC FOR TESTING
*/
- private IPath getOfflineReportsFilePath() {
+ public IPath getOfflineReportsFilePath() {
IPath stateLocation = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle());
IPath configFile = stateLocation.append("offlineReports");
return configFile;
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
index 28de6e2c0..803ee14a8 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
@@ -237,10 +237,10 @@ public class TracOfflineTaskHandler implements IOfflineTaskHandler {
RepositoryTaskAttribute attr = factory.createAttribute(attribute.getTracKey());
if (values != null && values.length > 0) {
if (allowEmtpy) {
- attr.addOptionValue("", "");
+ attr.addOption("", "");
}
for (int i = 0; i < values.length; i++) {
- attr.addOptionValue(values[i].toString(), values[i].toString());
+ attr.addOption(values[i].toString(), values[i].toString());
}
} else {
// attr.setHidden(true);

Back to the top