diff options
author | mkersten | 2006-07-06 00:47:30 +0000 |
---|---|---|
committer | mkersten | 2006-07-06 00:47:30 +0000 |
commit | 6f349472f453609a630d48f7596ea92999810019 (patch) | |
tree | ee1d9deccbd363d206adc7d6c65806275ef115b1 | |
parent | 11ed436fe3bf44ab2272449793922861da79f51a (diff) | |
download | org.eclipse.mylyn.tasks-6f349472f453609a630d48f7596ea92999810019.tar.gz org.eclipse.mylyn.tasks-6f349472f453609a630d48f7596ea92999810019.tar.xz org.eclipse.mylyn.tasks-6f349472f453609a630d48f7596ea92999810019.zip |
Completed: 149509: AbstractQueryHit.id should be a String
https://bugs.eclipse.org/bugs/show_bug.cgi?id=149509
43 files changed, 260 insertions, 224 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java index 7ce5b1019..c5868f63d 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java @@ -92,7 +92,8 @@ public class BugzillaAttachmentHandler implements IAttachmentHandler { public void uploadAttachment(TaskRepository repository, AbstractRepositoryTask task, String comment, String description, File file, String contentType, boolean isPatch, Proxy proxySettings) throws CoreException { try { - uploadAttachment(repository.getUrl(), repository.getUserName(), repository.getPassword(), AbstractRepositoryTask.getTaskIdAsInt(task.getHandleIdentifier()), comment, description, file, contentType, isPatch, proxySettings); + int bugId = Integer.parseInt(AbstractRepositoryTask.getTaskId(task.getHandleIdentifier())); + uploadAttachment(repository.getUrl(), repository.getUserName(), repository.getPassword(), bugId, comment, description, file, contentType, isPatch, proxySettings); } catch (Exception e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaPlugin.PLUGIN_ID, 0, "could not download", e)); } @@ -248,7 +249,7 @@ public class BugzillaAttachmentHandler implements IAttachmentHandler { return false; } - return uploadAttachment(attachment.getReport().getRepositoryUrl(), uname, password, attachment.getReport().getId(), + return uploadAttachment(attachment.getReport().getRepositoryUrl(), uname, password, Integer.parseInt(attachment.getReport().getId()), attachment.getComment(), attachment.getDescription(), file, attachment.getContentType(), attachment.isPatch(), proxySettings); } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java index e13fa93fc..ac3488df2 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java @@ -84,7 +84,7 @@ public class BugzillaRepositoryUtil { LoginException, GeneralSecurityException { RepositoryTaskData bugReport = new RepositoryTaskData(new BugzillaAttributeFactory(), - BugzillaPlugin.REPOSITORY_KIND, repositoryUrl, id); + BugzillaPlugin.REPOSITORY_KIND, repositoryUrl, ""+id); setupExistingBugAttributes(repositoryUrl, bugReport); RepositoryReportFactory reportFactory = RepositoryReportFactory.getInstance(); diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/NewBugzillaReport.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/NewBugzillaReport.java index 347c91e67..ac7767351 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/NewBugzillaReport.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/NewBugzillaReport.java @@ -55,7 +55,7 @@ public class NewBugzillaReport extends RepositoryTaskData implements Serializabl * Creates a new <code>NewBugModel</code>. The id chosen for this bug is * based on the id of the last <code>NewBugModel</code> that was created. */ - public NewBugzillaReport(String repositoryURL, int offlineId) { + public NewBugzillaReport(String repositoryURL, String offlineId) { super(new BugzillaAttributeFactory(), BugzillaPlugin.REPOSITORY_KIND, repositoryURL, offlineId); } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugReportContentHandler.java index 9f9d68ff9..2298d5883 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugReportContentHandler.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugReportContentHandler.java @@ -133,10 +133,10 @@ public class SaxBugReportContentHandler extends DefaultHandler { switch (tag) { case BUG_ID: { try { - if (report.getId() != Integer.parseInt(parsedText)) { + if (!report.getId().equals(parsedText)) { errorMessage = "Requested report number does not match returned report number."; } - } catch (NumberFormatException e) { + } catch (Exception e) { errorMessage = "Bug id from server did not match requested id."; } diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java index 54751705b..9d52e5992 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java @@ -149,7 +149,7 @@ public class BugzillaRepositoryConnectorTest extends TestCase { assertEquals(task.getHandleIdentifier(), retrievedTask.getHandleIdentifier()); assertTrue(task.isDownloaded()); - assertEquals(1, task.getTaskData().getId()); + assertEquals(1, Integer.parseInt(task.getTaskData().getId())); } public void testSynchronize() throws InterruptedException, PartInitException, LoginException, BugzillaException, @@ -219,13 +219,13 @@ public class BugzillaRepositoryConnectorTest extends TestCase { public void testUniqueTaskObjects() { init222(); String repositoryURL = "repositoryURL"; - BugzillaQueryHit hit1 = new BugzillaQueryHit("description", "P1", repositoryURL, 1, null, "status"); + BugzillaQueryHit hit1 = new BugzillaQueryHit("description", "P1", repositoryURL, "1", null, "status"); ITask task1 = hit1.getOrCreateCorrespondingTask(); assertNotNull(task1); // taskList.renameTask(task1, "testing"); // task1.setDescription("testing"); - BugzillaQueryHit hit1Twin = new BugzillaQueryHit("description", "P1", repositoryURL, 1, null, "status"); + BugzillaQueryHit hit1Twin = new BugzillaQueryHit("description", "P1", repositoryURL, "1", null, "status"); ITask task2 = hit1Twin.getOrCreateCorrespondingTask(); assertEquals(task1.getDescription(), task2.getDescription()); } @@ -278,7 +278,7 @@ public class BugzillaRepositoryConnectorTest extends TestCase { // client.synchronize(task, true, null); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); - assertEquals(bugId, task.getTaskData().getId()); + assertEquals(bugId, Integer.parseInt(task.getTaskData().getId())); int numAttached = task.getTaskData().getAttachments().size(); String fileName = "test-attach-" + System.currentTimeMillis() + ".txt"; @@ -329,10 +329,10 @@ public class BugzillaRepositoryConnectorTest extends TestCase { init222(); BugzillaTask task4 = generateLocalTaskAndDownload("4"); - assertEquals(4, task4.getTaskData().getId()); + assertEquals(4, Integer.parseInt(task4.getTaskData().getId())); BugzillaTask task5 = generateLocalTaskAndDownload("5"); - assertEquals(5, task5.getTaskData().getId()); + assertEquals(5, Integer.parseInt(task5.getTaskData().getId())); Set<AbstractRepositoryTask> tasks = new HashSet<AbstractRepositoryTask>(); tasks.add(task4); @@ -390,7 +390,7 @@ public class BugzillaRepositoryConnectorTest extends TestCase { init222(); BugzillaTask task7 = generateLocalTaskAndDownload("7"); - assertEquals(7, task7.getTaskData().getId()); + assertEquals(7, Integer.parseInt(task7.getTaskData().getId())); Set<AbstractRepositoryTask> tasks = new HashSet<AbstractRepositoryTask>(); tasks.add(task7); @@ -400,12 +400,12 @@ public class BugzillaRepositoryConnectorTest extends TestCase { assertNotNull(recentTaskData); assertFalse(MylarTaskListPlugin.getDefault().getOfflineReportsFile().find( - IBugzillaConstants.TEST_BUGZILLA_222_URL, 7) == -1); + IBugzillaConstants.TEST_BUGZILLA_222_URL, "7") == -1); ArrayList<RepositoryTaskData> taskDataList = new ArrayList<RepositoryTaskData>(); taskDataList.add(task7.getTaskData()); MylarTaskListPlugin.getDefault().getOfflineReportsFile().remove(taskDataList); assertTrue(MylarTaskListPlugin.getDefault().getOfflineReportsFile().find( - IBugzillaConstants.TEST_BUGZILLA_222_URL, 7) == -1); + IBugzillaConstants.TEST_BUGZILLA_222_URL, "7") == -1); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task7.getSyncState()); // Task no longer stored offline @@ -478,7 +478,7 @@ public class BugzillaRepositoryConnectorTest extends TestCase { */ protected void timeTracker(int taskid, boolean enableDeadline) throws Exception { BugzillaTask bugtask = generateLocalTaskAndDownload("" + taskid); - assertEquals(taskid, bugtask.getTaskData().getId()); + assertEquals(taskid, Integer.parseInt(bugtask.getTaskData().getId())); Set<AbstractRepositoryTask> tasks = new HashSet<AbstractRepositoryTask>(); tasks.add(bugtask); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java index 09c8dc06f..0d1ca0213 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java @@ -31,7 +31,7 @@ public class NewBugWizardTest extends TestCase { public void testPlatformOptions() throws Exception { - NewBugzillaReport newReport = new NewBugzillaReport(IBugzillaConstants.TEST_BUGZILLA_220_URL, 1); + NewBugzillaReport newReport = new NewBugzillaReport(IBugzillaConstants.TEST_BUGZILLA_220_URL, "1"); TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL); BugzillaRepositoryUtil.setupNewBugAttributes(repository.getUrl(), null, repository.getUserName(), repository.getPassword(), newReport, null); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RepositoryReportFactoryTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RepositoryReportFactoryTest.java index 49302b6a9..584ffab98 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RepositoryReportFactoryTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RepositoryReportFactoryTest.java @@ -34,6 +34,10 @@ import org.eclipse.mylar.internal.tasklist.RepositoryTaskData; import org.eclipse.mylar.internal.tasklist.RepositoryTaskAttribute; import org.eclipse.mylar.provisional.tasklist.TaskRepository; +/** + * @author Rob Elves + * @author Mik Kersten + */ public class RepositoryReportFactoryTest extends TestCase { RepositoryReportFactory factory = RepositoryReportFactory.getInstance(); @@ -44,7 +48,7 @@ public class RepositoryReportFactoryTest extends TestCase { TaskRepository repository = getRepository(BugzillaPlugin.REPOSITORY_KIND, URL); RepositoryTaskData report = new RepositoryTaskData(attributeFactory, BugzillaPlugin.REPOSITORY_KIND, repository - .getUrl(), bugid); + .getUrl(), ""+bugid); BugzillaRepositoryUtil.setupExistingBugAttributes(repository.getUrl(), report); factory.populateReport(report, repository.getUrl(), null, repository.getUserName(), repository.getPassword(), null); @@ -70,7 +74,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testBugNotFound222() throws Exception { - int bugid = -1; + String bugid = "-1"; String errorMessage = ""; TaskRepository repository = getRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL); @@ -88,7 +92,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testInvalidCredentials222() throws Exception { - int bugid = 1; + String bugid = "1"; String errorMessage = ""; TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL); @@ -108,7 +112,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testReadingReport() throws Exception { - int bugid = 2; + String bugid = "2"; TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL); @@ -226,7 +230,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testReadingReport2201() throws Exception { - int bugid = 1; + String bugid = "1"; TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_2201_URL); @@ -275,7 +279,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testReadingReport2201Eclipse() throws Exception { - int bugid = 24448; + String bugid = "24448"; TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL); @@ -326,7 +330,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testReadingReport220() throws Exception { - int bugid = 1; + String bugid = "1"; TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL); @@ -368,7 +372,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testReadingReport218() throws Exception { - int bugid = 1; + String bugid = "1"; TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_218_URL); @@ -409,7 +413,7 @@ public class RepositoryReportFactoryTest extends TestCase { } public void testBugReportAPI() throws Exception { - int bugid = 3; + String bugid = "3"; TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL); diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/OpenBugsAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/OpenBugsAction.java index c446244eb..729cb1e93 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/OpenBugsAction.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/OpenBugsAction.java @@ -18,6 +18,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil; import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchResultView; import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaQueryHit; +import org.eclipse.mylar.internal.core.util.MylarStatusHandler; import org.eclipse.mylar.internal.tasklist.ui.TaskUiUtil; /** @@ -57,26 +58,13 @@ public class OpenBugsAction extends Action { // go through each of the selected items and show it in an editor for (Iterator<BugzillaQueryHit> it = selection.iterator(); it.hasNext();) { BugzillaQueryHit repositoryHit = it.next(); - // try { - // BugzillaQueryHit repositoryHit = (BugzillaQueryHit) - // match.getElement(); - String bugUrl = BugzillaRepositoryUtil.getBugUrlWithoutLogin(repositoryHit.getRepositoryUrl(), - repositoryHit.getId()); - TaskUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), "" + repositoryHit.getId(), bugUrl); - - // String repositoryUrl = (String) - // marker.getAttribute(IBugzillaConstants.HIT_MARKER_ATTR_REPOSITORY); - // Integer id = (Integer) - // marker.getAttribute(IBugzillaConstants.HIT_MARKER_ATTR_ID); - // BugzillaUITools.show(repositoryUrl, id.intValue()); - // } catch (CoreException e) { - // // if an error occurs, handle and log it - // ExceptionHandler.handle(e, - // SearchMessages.Search_Error_search_title, - // SearchMessages.Search_Error_search_message); //$NON-NLS-2$ - // //$NON-NLS-1$ - // BugzillaPlugin.log(e.getStatus()); - // } + try { + int id = Integer.parseInt(repositoryHit.getId()); + String bugUrl = BugzillaRepositoryUtil.getBugUrlWithoutLogin(repositoryHit.getRepositoryUrl(), id); + TaskUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), "" + repositoryHit.getId(), bugUrl); + } catch (NumberFormatException e) { + MylarStatusHandler.fail(e, "Could not open, malformed id: " + repositoryHit.getId(), true); + } } } diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java index 3ee419440..4ed08228f 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java @@ -662,8 +662,8 @@ public class ExistingBugEditor extends AbstractRepositoryTaskEditor { TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository( BugzillaPlugin.REPOSITORY_KIND, taskData.getRepositoryUrl()); serverBug = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository - .getPassword(), editorInput.getProxySettings(), repository.getCharacterEncoding(), taskData - .getId()); + .getPassword(), editorInput.getProxySettings(), repository.getCharacterEncoding(), + Integer.parseInt(taskData.getId())); // If no bug was found on the server, throw an exception so that // the // user gets the same message that appears when there is a diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaDescriptionSearchSorter.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaDescriptionSearchSorter.java index db6b3edf5..6a8cfc158 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaDescriptionSearchSorter.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaDescriptionSearchSorter.java @@ -62,10 +62,9 @@ public class BugzillaDescriptionSearchSorter extends ViewerSorter { public int category(Object element) { try { BugzillaQueryHit hit = (BugzillaQueryHit) element; - return hit.getId(); - + return Integer.parseInt(hit.getId()); } catch (Exception ignored) { - // ignore if there is a problem + // ignore if } // if that didn't work, use the default category method return super.category(element); diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaIdSearchSorter.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaIdSearchSorter.java index 7ddc639c4..2ed8eba30 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaIdSearchSorter.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaIdSearchSorter.java @@ -34,11 +34,11 @@ public class BugzillaIdSearchSorter extends ViewerSorter { try { // cast the object and get its bug id BugzillaQueryHit entry1 = (BugzillaQueryHit) e1; - Integer id1 = entry1.getId(); + Integer id1 = Integer.parseInt(entry1.getId()); // cast the other object and get its bug id BugzillaQueryHit entry2 = (BugzillaQueryHit) e2; - Integer id2 = entry2.getId(); + Integer id2 = Integer.parseInt(entry2.getId()); // if neither is null, compare the bug id's if (id1 != null && id2 != null) { @@ -65,10 +65,9 @@ public class BugzillaIdSearchSorter extends ViewerSorter { public int category(Object element) { try { BugzillaQueryHit hit = (BugzillaQueryHit) element; - return hit.getId(); - + return Integer.parseInt(hit.getId()); } catch (Exception ignored) { - // ignore if there is a problem + // ignore } // if that didn't work, use the default category method return super.category(element); diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaPrioritySearchSorter.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaPrioritySearchSorter.java index e0a0fef19..c87d449c5 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaPrioritySearchSorter.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaPrioritySearchSorter.java @@ -72,8 +72,7 @@ public class BugzillaPrioritySearchSorter extends ViewerSorter { public int category(Object element) { try { BugzillaQueryHit hit = (BugzillaQueryHit) element; - return hit.getId(); - + return Integer.parseInt(hit.getId()); } catch (Exception ignored) { // ignore if there is a problem } diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultCollector.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultCollector.java index c1813ecb5..330dc3fe1 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultCollector.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultCollector.java @@ -91,7 +91,7 @@ public class BugzillaSearchResultCollector implements IBugzillaSearchResultColle public void accept(BugzillaSearchHit hit) throws CoreException { String description = hit.getId() + ": " + hit.getDescription(); - BugzillaQueryHit queryHit = new BugzillaQueryHit(description, hit.getPriority(), hit.getRepositoryUrl(), hit + BugzillaQueryHit queryHit = new BugzillaQueryHit(description, hit.getPriority(), hit.getRepositoryUrl(), ""+hit .getId(), null, hit.getState()); ITask correspondingTask = MylarTaskListPlugin.getTaskListManager().getTaskList().getTask( diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultView.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultView.java index 6e995a887..1ef672315 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultView.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchResultView.java @@ -25,6 +25,7 @@ import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin; import org.eclipse.mylar.internal.bugzilla.ui.actions.BugzillaSortAction; import org.eclipse.mylar.internal.bugzilla.ui.actions.OpenBugsAction; import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaQueryHit; +import org.eclipse.mylar.internal.core.util.MylarStatusHandler; import org.eclipse.mylar.internal.tasklist.ui.TaskListColorsAndFonts; import org.eclipse.mylar.internal.tasklist.ui.TaskUiUtil; import org.eclipse.mylar.internal.tasklist.ui.views.TaskElementLabelProvider; @@ -252,27 +253,15 @@ public class BugzillaSearchResultView extends AbstractTextSearchViewPage impleme @Override protected void showMatch(Match match, int currentOffset, int currentLength, boolean activate) throws PartInitException { - // try { BugzillaQueryHit repositoryHit = (BugzillaQueryHit) match.getElement(); - String bugUrl = BugzillaRepositoryUtil.getBugUrlWithoutLogin(repositoryHit.getRepositoryUrl(), repositoryHit - .getId()); - TaskUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), "" + repositoryHit.getId(), bugUrl); - // Object element = getCurrentMatch().getElement(); - // if (element instanceof IMarker) { - // - // String repositoryUrl = (String) ((IMarker) element) - // .getAttribute(IBugzillaConstants.HIT_MARKER_ATTR_REPOSITORY); - // Integer id = (Integer) ((IMarker) - // element).getAttribute(IBugzillaConstants.HIT_MARKER_ATTR_ID); - // BugzillaUITools.show(repositoryUrl, id.intValue()); - // } - // } catch (CoreException e) { - // // if an error occurs, handle and log it - // ExceptionHandler.handle(e, SearchMessages.Search_Error_search_title, - // SearchMessages.Search_Error_search_message); //$NON-NLS-2$ - // //$NON-NLS-1$ - // BugzillaPlugin.log(e.getStatus()); - // } + + try { + int id = Integer.parseInt(repositoryHit.getId()); + String bugUrl = BugzillaRepositoryUtil.getBugUrlWithoutLogin(repositoryHit.getRepositoryUrl(), id); + TaskUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), "" + repositoryHit.getId(), bugUrl); + } catch (NumberFormatException e) { + MylarStatusHandler.fail(e, "Could not open, malformed id: " + repositoryHit.getId(), true); + } } @Override diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaOfflineTaskHandler.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaOfflineTaskHandler.java index f9e59d694..238683466 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaOfflineTaskHandler.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaOfflineTaskHandler.java @@ -63,9 +63,10 @@ public class BugzillaOfflineTaskHandler implements IOfflineTaskHandler { BugzillaPlugin.REPOSITORY_KIND, bugzillaTask.getRepositoryUrl()); Proxy proxySettings = MylarTaskListPlugin.getDefault().getProxySettings(); try { + int bugId = Integer.parseInt(AbstractRepositoryTask.getTaskId(bugzillaTask.getHandleIdentifier())); + return BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository - .getPassword(), proxySettings, repository.getCharacterEncoding(), AbstractRepositoryTask - .getTaskIdAsInt(bugzillaTask.getHandleIdentifier())); + .getPassword(), proxySettings, repository.getCharacterEncoding(), bugId); } catch (final LoginException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaPlugin.PLUGIN_ID, 0, "Report download failed. Ensure proper repository configuration of " + bugzillaTask.getRepositoryUrl() + " in " + TaskRepositoriesView.NAME + ".", e )); diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java index 1e4b81d0f..156643db1 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java @@ -27,7 +27,7 @@ public class BugzillaQueryHit extends AbstractQueryHit { private String status; - public BugzillaQueryHit(String description, String priority, String repositoryUrl, int id, BugzillaTask task, String status) { + public BugzillaQueryHit(String description, String priority, String repositoryUrl, String id, BugzillaTask task, String status) { super(repositoryUrl, description, id); super.priority = priority; this.task = task; diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java index e19d0cdcf..000e47e7e 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java @@ -131,7 +131,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { } catch (NumberFormatException nfe) { if (!forceSyncExecForTesting) { MessageDialog.openInformation(null, MylarTaskListPlugin.TITLE_DIALOG, "Invalid report id: " + id); - } + } return null; } @@ -351,7 +351,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { for (BugzillaSearchHit hit : collector.getResults()) { String description = hit.getId() + ": " + hit.getDescription(); newHits.add(new BugzillaQueryHit(description, hit.getPriority(), - repositoryQuery.getRepositoryUrl(), hit.getId(), null, hit.getState())); + repositoryQuery.getRepositoryUrl(), ""+hit.getId(), null, hit.getState())); } } }); diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java index 4199ad49d..117b08877 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java @@ -19,6 +19,7 @@ import java.util.List; import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin; import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement; import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil; +import org.eclipse.mylar.internal.core.util.MylarStatusHandler; import org.eclipse.mylar.internal.tasklist.Comment; import org.eclipse.mylar.internal.tasklist.RepositoryTaskAttribute; import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask; @@ -46,13 +47,15 @@ public class BugzillaTask extends AbstractRepositoryTask { } private void initFromHandle() { - int id = AbstractRepositoryTask.getTaskIdAsInt(getHandleIdentifier()); + String id = AbstractRepositoryTask.getTaskId(getHandleIdentifier()); String repositoryUrl = getRepositoryUrl(); - if (repositoryUrl != null) { - String url = BugzillaRepositoryUtil.getBugUrlWithoutLogin(repositoryUrl, id); + try { + String url = BugzillaRepositoryUtil.getBugUrlWithoutLogin(repositoryUrl, Integer.parseInt(id)); if (url != null) { super.setUrl(url); } + } catch (Exception e) { + MylarStatusHandler.fail(e, "Task initialization failed due to malformed id or URL: " + getHandleIdentifier(), false); } } @@ -62,9 +65,9 @@ public class BugzillaTask extends AbstractRepositoryTask { return super.getDescription(); } else { if (!isSynchronizing()) { - return AbstractRepositoryTask.getTaskIdAsInt(getHandleIdentifier()) + ": <Could not find bug>"; + return AbstractRepositoryTask.getTaskId(getHandleIdentifier()) + ": <Could not find bug>"; } else { - return AbstractRepositoryTask.getTaskIdAsInt(getHandleIdentifier()) + ":"; + return AbstractRepositoryTask.getTaskId(getHandleIdentifier()) + ":"; } } } @@ -99,8 +102,12 @@ public class BugzillaTask extends AbstractRepositoryTask { public String getUrl() { // fix for bug 103537 - should login automatically, but dont want to // show the login info in the query string - return BugzillaRepositoryUtil.getBugUrlWithoutLogin(getRepositoryUrl(), AbstractRepositoryTask - .getTaskIdAsInt(handle)); + try { + return BugzillaRepositoryUtil.getBugUrlWithoutLogin(getRepositoryUrl(), + Integer.parseInt(AbstractRepositoryTask.getTaskId(handle))); + } catch (NumberFormatException nfe) { + return super.getUrl(); + } } @Override diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java index d2f2f1bda..e80f1c01b 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java @@ -183,7 +183,7 @@ public class BugzillaTaskEditor extends MylarTaskEditor { */ public void showDirtyStatus(boolean isDirty) { String prefix = (isDirty) ? "*" : ""; - setPartName(prefix + "Bug #" + bugzillaEditorInput.getBugId()); + setPartName(prefix + "Bug #" + bugzillaEditorInput.getId()); } diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java index 42fc833ea..ce73ae4aa 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java @@ -37,10 +37,10 @@ public class BugzillaTaskEditorInput extends ExistingBugEditorInput { //private boolean offline; public BugzillaTaskEditorInput(TaskRepository repository, BugzillaTask bugTask, boolean offline) throws IOException, GeneralSecurityException { - super(repository, bugTask.getTaskData(), AbstractRepositoryTask.getTaskIdAsInt(bugTask.getHandleIdentifier())); + super(repository, bugTask.getTaskData(), AbstractRepositoryTask.getTaskId(bugTask.getHandleIdentifier())); this.bugTask = bugTask; // offlineBug = bugTask.getTaskData(); - bugId = AbstractRepositoryTask.getTaskIdAsInt(bugTask.getHandleIdentifier()); + id = AbstractRepositoryTask.getTaskId(bugTask.getHandleIdentifier()); bugTitle = ""; // this.offline = offline; } @@ -80,10 +80,10 @@ public class BugzillaTaskEditorInput extends ExistingBugEditorInput { return null; } - @Override - public int getBugId() { - return bugId; - } +// @Override +// public int getId() { +// return id; +// } // /** // * Returns the online server bug for this input @@ -121,18 +121,18 @@ public class BugzillaTaskEditorInput extends ExistingBugEditorInput { // } // // } - /** - * Returns true if the argument is a bug report editor input on the same bug - * id. - */ - @Override - public boolean equals(Object o) { - if (o instanceof BugzillaTaskEditorInput) { - BugzillaTaskEditorInput input = (BugzillaTaskEditorInput) o; - return getBugId() == input.getBugId(); - } - return false; - } +// /** +// * Returns true if the argument is a bug report editor input on the same bug +// * id. +// */ +// @Override +// public boolean equals(Object o) { +// if (o instanceof BugzillaTaskEditorInput) { +// BugzillaTaskEditorInput input = (BugzillaTaskEditorInput) o; +// return getBugId() == input.getBugId(); +// } +// return false; +// } /** * @return Returns the <code>BugzillaTask</code> diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java index d9b080cbe..62f1cf9c1 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java @@ -227,7 +227,7 @@ public class BugzillaTaskExternalizer extends DelegatingTaskExternalizer { */ public boolean readBugReport(BugzillaTask bugzillaTask) { RepositoryTaskData tempBug = OfflineTaskManager.findBug(bugzillaTask.getRepositoryUrl(), AbstractRepositoryTask - .getTaskIdAsInt(bugzillaTask.getHandleIdentifier())); + .getTaskId(bugzillaTask.getHandleIdentifier())); if (tempBug == null) { bugzillaTask.setTaskData(null); return true; @@ -274,7 +274,7 @@ public class BugzillaTaskExternalizer extends DelegatingTaskExternalizer { } } BugzillaQueryHit hit = new BugzillaQueryHit(label, priority, query.getRepositoryUrl(), AbstractRepositoryTask - .getTaskIdAsInt(handle), null, status); + .getTaskId(handle), null, status); if (element.hasAttribute(KEY_NOTIFIED_INCOMING) && element.getAttribute(KEY_NOTIFIED_INCOMING).compareTo(VAL_TRUE) == 0) { hit.setNotified(true); diff --git a/org.eclipse.mylyn.help.ui/doc/faq.html b/org.eclipse.mylyn.help.ui/doc/faq.html index df1b0ee95..83c1a4996 100644 --- a/org.eclipse.mylyn.help.ui/doc/faq.html +++ b/org.eclipse.mylyn.help.ui/doc/faq.html @@ -392,6 +392,7 @@ repository:</p> <a href="http://jira-dashboard.tigris.org/"> http://jira-dashboard.tigris.org/</a>. For supported versions see the <a href="http://www.eclipse.org/mylar/dl.php">download page</a>. </p> + <p> </p> <hr> <h3> </h3> <h3><a name="eclipse-views-tasks">How does the Mylar Task List relate to the Eclipse Tasks view?</a></h3> diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTaskListTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTaskListTests.java index 5e7974fa7..2f7baa038 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTaskListTests.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTaskListTests.java @@ -23,6 +23,7 @@ public class AllTaskListTests { TestSuite suite = new TestSuite("Test for org.eclipse.mylar.tasklist.tests"); // $JUnit-BEGIN$ + suite.addTestSuite(RepositoryTaskHandleTest.class); suite.addTestSuite(RepositoryTaskSynchronizationTest.class); suite.addTestSuite(TaskRepositoriesExternalizerTest.class); suite.addTestSuite(TaskListContentProviderTest.class); diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/BugzillaTaskTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/BugzillaTaskTest.java index dcd182311..4cb923380 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/BugzillaTaskTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/BugzillaTaskTest.java @@ -47,9 +47,9 @@ public class BugzillaTaskTest extends TestCase { } public void testCompletionDate() throws Exception { - BugzillaTask task = new BugzillaTask("handle", "description", true); + BugzillaTask task = new BugzillaTask("bug-1", "description", true); RepositoryTaskData report = new RepositoryTaskData(new BugzillaAttributeFactory(), - BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, 1); + BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, "1"); task.setTaskData(report); assertNull(task.getCompletionDate()); diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/RepositoryTaskHandleTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/RepositoryTaskHandleTest.java new file mode 100644 index 000000000..1943c8a19 --- /dev/null +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/RepositoryTaskHandleTest.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2004 - 2006 Mylar committers 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 + *******************************************************************************/ + +package org.eclipse.mylar.tasklist.tests; + +import junit.framework.TestCase; + +import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; +import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask; +import org.eclipse.mylar.internal.core.MylarContextManager; +import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask; +import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin; +import org.eclipse.mylar.provisional.tasklist.TaskListManager; + +/** + * @author Mik Kersten + */ +public class RepositoryTaskHandleTest extends TestCase { + + private TaskListManager manager = MylarTaskListPlugin.getTaskListManager(); + + @Override + protected void setUp() throws Exception { + super.setUp(); + manager = MylarTaskListPlugin.getTaskListManager(); + manager.resetTaskList(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + manager.resetTaskList(); + } + + public void testInvalidHandle() { +// MockRepositoryTask task = new MockRepositoryTask() + String url = "http://foo"; + assertEquals(url + MylarContextManager.CONTEXT_HANDLE_DELIM + "abc", AbstractRepositoryTask.getHandle(url, "abc")); + Exception caught = null; + try { + AbstractRepositoryTask.getHandle(url, "a-23"); + } catch (Exception e) { + caught = e; + } + assertNotNull(caught); + } + + public void testRepositoryUrlHandles() { + + String repository = IBugzillaConstants.ECLIPSE_BUGZILLA_URL; + String id = "123"; + String handle = AbstractRepositoryTask.getHandle(repository, id); + BugzillaTask bugTask = new BugzillaTask(handle, "label 124", true); + assertEquals(repository, bugTask.getRepositoryUrl()); + + manager.getTaskList().moveToRoot(bugTask); + manager.saveTaskList(); + manager.resetTaskList(); + manager.readExistingOrCreateNewList(); + + BugzillaTask readReport = (BugzillaTask) manager.getTaskList().getRootTasks().iterator().next(); + assertEquals(readReport.getDescription(), readReport.getDescription()); + assertEquals(readReport.getRepositoryUrl(), readReport.getRepositoryUrl()); + } +} diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/RepositoryTaskSynchronizationTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/RepositoryTaskSynchronizationTest.java index 6c75b980f..6e08e28ce 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/RepositoryTaskSynchronizationTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/RepositoryTaskSynchronizationTest.java @@ -56,7 +56,7 @@ public class RepositoryTaskSynchronizationTest extends TestCase { public void testHasIncoming() { AbstractRepositoryTask task = new MockRepositoryTask(HANDLE1); RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), - URL1, 1); + URL1, "1"); assertTrue(connector.checkHasIncoming(task, taskData)); task.setModifiedDateStamp("never"); assertTrue(connector.checkHasIncoming(task, taskData)); @@ -284,13 +284,13 @@ public class RepositoryTaskSynchronizationTest extends TestCase { RepositoryTaskData taskData = null; AbstractRepositoryTask task = new MockRepositoryTask(HANDLE1); - taskData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), URL1, 1); + taskData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), URL1, "1"); taskData.setAttributeValue(RepositoryTaskAttribute.DATE_MODIFIED, DATE_STAMP_1); task.setModifiedDateStamp(DATE_STAMP_1); task.setTaskData(taskData); task.setSyncState(localState); - newData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), URL1, 1); + newData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), URL1, "1"); switch (remoteState) { case CONFLICT: diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java index 0dfefd7f3..43f6fa645 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java @@ -190,27 +190,6 @@ public class TaskListManagerTest extends TestCase { manager.deactivateTask(manager.getTaskList().getActiveTask()); } - public void testRepositoryUrlHandles() { - - String repository = IBugzillaConstants.ECLIPSE_BUGZILLA_URL; - String id = "123"; - String handle = AbstractRepositoryTask.getHandle(repository, id); - BugzillaTask bugTask = new BugzillaTask(handle, "label 124", true); - assertEquals(repository, bugTask.getRepositoryUrl()); - - manager.getTaskList().moveToRoot(bugTask); - manager.saveTaskList(); -// manager.getTaskList().clear(); - manager.resetTaskList(); -// TaskList list = new TaskList(); -// manager.setTaskList(list); - manager.readExistingOrCreateNewList(); - - BugzillaTask readReport = (BugzillaTask) manager.getTaskList().getRootTasks().iterator().next(); - assertEquals(readReport.getDescription(), readReport.getDescription()); - assertEquals(readReport.getRepositoryUrl(), readReport.getRepositoryUrl()); - } - public void testDeleteQuery() { AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label", "1", manager.getTaskList()); manager.getTaskList().addQuery(query); @@ -290,7 +269,7 @@ public class TaskListManagerTest extends TestCase { } public void testCategoryPersistance() { - BugzillaTask task = new BugzillaTask("b1", "b 1", true); + BugzillaTask task = new BugzillaTask("bug-1", "b 1", true); TaskCategory category = new TaskCategory("cat", manager.getTaskList()); manager.getTaskList().addCategory(category); manager.getTaskList().moveToContainer(category, task); @@ -366,7 +345,7 @@ public class TaskListManagerTest extends TestCase { } public void testDelete() { - ITask task = new Task("handle", "label", true); + ITask task = new Task("task-1", "label", true); manager.getTaskList().addTask(task); manager.getTaskList().internalAddRootTask(task); manager.getTaskList().deleteTask(task); @@ -413,7 +392,7 @@ public class TaskListManagerTest extends TestCase { } public void testArchiveRepositoryTaskExternalization() { - BugzillaTask repositoryTask = new BugzillaTask("handle", "label", true); + BugzillaTask repositoryTask = new BugzillaTask("bug-1", "label", true); repositoryTask.setKind("kind"); manager.getTaskList().addTask(repositoryTask); assertEquals(1, manager.getTaskList().getArchiveContainer().getChildren().size()); @@ -427,7 +406,7 @@ public class TaskListManagerTest extends TestCase { } public void testRepositoryTaskExternalization() { - BugzillaTask repositoryTask = new BugzillaTask("handle", "label", true); + BugzillaTask repositoryTask = new BugzillaTask("bug-1", "label", true); repositoryTask.setKind("kind"); manager.getTaskList().moveToRoot(repositoryTask); manager.saveTaskList(); @@ -450,7 +429,7 @@ public class TaskListManagerTest extends TestCase { TaskCategory cat1 = new TaskCategory("Category 1", manager.getTaskList()); manager.getTaskList().addCategory(cat1); - BugzillaTask reportInCat1 = new BugzillaTask("123", "label 123", true); + BugzillaTask reportInCat1 = new BugzillaTask("task-123", "label 123", true); manager.getTaskList().moveToContainer(cat1, reportInCat1); assertEquals(cat1, reportInCat1.getContainer()); @@ -514,12 +493,12 @@ public class TaskListManagerTest extends TestCase { manager.getTaskList().moveToContainer(cat1, task4); cat1Contents.add(task4); - BugzillaTask reportInCat1 = new BugzillaTask("123", "label 123", true); + BugzillaTask reportInCat1 = new BugzillaTask("task-123", "label 123", true); manager.getTaskList().moveToContainer(cat1, reportInCat1); assertEquals(cat1, reportInCat1.getContainer()); cat1Contents.add(reportInCat1); - BugzillaTask reportInRoot = new BugzillaTask("124", "label 124", true); + BugzillaTask reportInRoot = new BugzillaTask("task-124", "label 124", true); manager.getTaskList().moveToRoot(reportInRoot); rootTasks.add(reportInRoot); @@ -587,13 +566,13 @@ public class TaskListManagerTest extends TestCase { public void testgetQueriesAndHitsForHandle() { - BugzillaQueryHit hit1 = new BugzillaQueryHit("description1", "P1", "repositoryURL", 1, null, "status"); - BugzillaQueryHit hit2 = new BugzillaQueryHit("description2", "P1", "repositoryURL", 2, null, "status"); - BugzillaQueryHit hit3 = new BugzillaQueryHit("description3", "P1", "repositoryURL", 3, null, "status"); + BugzillaQueryHit hit1 = new BugzillaQueryHit("description1", "P1", "repositoryURL", "1", null, "status"); + BugzillaQueryHit hit2 = new BugzillaQueryHit("description2", "P1", "repositoryURL", "2", null, "status"); + BugzillaQueryHit hit3 = new BugzillaQueryHit("description3", "P1", "repositoryURL", "3", null, "status"); - BugzillaQueryHit hit1twin = new BugzillaQueryHit("description1", "P1", "repositoryURL", 1, null, "status"); - BugzillaQueryHit hit2twin = new BugzillaQueryHit("description2", "P1", "repositoryURL", 2, null, "status"); - BugzillaQueryHit hit3twin = new BugzillaQueryHit("description3", "P1", "repositoryURL", 3, null, "status"); + BugzillaQueryHit hit1twin = new BugzillaQueryHit("description1", "P1", "repositoryURL", "1", null, "status"); + BugzillaQueryHit hit2twin = new BugzillaQueryHit("description2", "P1", "repositoryURL", "2", null, "status"); + BugzillaQueryHit hit3twin = new BugzillaQueryHit("description3", "P1", "repositoryURL", "3", null, "status"); BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery("url","url", "queryl", "10", manager.getTaskList()); @@ -632,13 +611,13 @@ public class TaskListManagerTest extends TestCase { public void testUpdateQueryHits() { - BugzillaQueryHit hit1 = new BugzillaQueryHit("description1", "P1", "repositoryURL", 1, null, "status"); - BugzillaQueryHit hit2 = new BugzillaQueryHit("description2", "P1", "repositoryURL", 2, null, "status"); - BugzillaQueryHit hit3 = new BugzillaQueryHit("description3", "P1", "repositoryURL", 3, null, "status"); + BugzillaQueryHit hit1 = new BugzillaQueryHit("description1", "P1", "repositoryURL", "1", null, "status"); + BugzillaQueryHit hit2 = new BugzillaQueryHit("description2", "P1", "repositoryURL", "2", null, "status"); + BugzillaQueryHit hit3 = new BugzillaQueryHit("description3", "P1", "repositoryURL", "3", null, "status"); - BugzillaQueryHit hit1twin = new BugzillaQueryHit("description1", "P1", "repositoryURL", 1, null, "status"); - BugzillaQueryHit hit2twin = new BugzillaQueryHit("description2", "P1", "repositoryURL", 2, null, "status"); - BugzillaQueryHit hit3twin = new BugzillaQueryHit("description3", "P1", "repositoryURL", 3, null, "status"); + BugzillaQueryHit hit1twin = new BugzillaQueryHit("description1", "P1", "repositoryURL", "1", null, "status"); + BugzillaQueryHit hit2twin = new BugzillaQueryHit("description2", "P1", "repositoryURL", "2", null, "status"); + BugzillaQueryHit hit3twin = new BugzillaQueryHit("description3", "P1", "repositoryURL", "3", null, "status"); BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery("url","url", "queryl", "10", manager.getTaskList()); diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListNotificationManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListNotificationManagerTest.java index e60902780..1b993700c 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListNotificationManagerTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListNotificationManagerTest.java @@ -95,7 +95,7 @@ public class TaskListNotificationManagerTest extends TestCase { } public void testTaskListNotificationQueryIncoming() { - BugzillaQueryHit hit = new BugzillaQueryHit("description", "priority", "https://bugs.eclipse.org/bugs", 1, + BugzillaQueryHit hit = new BugzillaQueryHit("description", "priority", "https://bugs.eclipse.org/bugs", "1", null, "status"); assertFalse(hit.isNotified()); BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl", diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskReportGeneratorTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskReportGeneratorTest.java index 2d8c75f82..5c95b9227 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskReportGeneratorTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskReportGeneratorTest.java @@ -175,7 +175,7 @@ public class TaskReportGeneratorTest extends TestCase { generator.run(new NullProgressMonitor()); assertEquals(0, generator.getAllCollectedTasks().size()); - bugQuery.addHit(new BugzillaQueryHit("task1description", "low", "repositoryURL", 1, task1, "FIXED")); + bugQuery.addHit(new BugzillaQueryHit("task1description", "low", "repositoryURL", "1", task1, "FIXED")); generator.run(new NullProgressMonitor()); assertEquals(0, generator.getAllCollectedTasks().size()); diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskRepositoryManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskRepositoryManagerTest.java index 56635de9a..6683579f7 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskRepositoryManagerTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskRepositoryManagerTest.java @@ -63,7 +63,7 @@ public class TaskRepositoryManagerTest extends TestCase { String handle = AbstractRepositoryTask.getHandle(url, id); assertEquals(url, AbstractRepositoryTask.getRepositoryUrl(handle)); assertEquals(id, AbstractRepositoryTask.getTaskId(handle)); - assertEquals(123, AbstractRepositoryTask.getTaskIdAsInt(handle)); +// assertEquals(123, AbstractRepositoryTask.getTaskIdAsInt(handle)); } public void testMultipleNotAdded() throws MalformedURLException { diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java index ece1106a8..68676b01f 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java @@ -65,7 +65,7 @@ public class TaskTestUtil { public static void setBugTaskCompleted(BugzillaTask bugzillaTask, boolean completed) { RepositoryTaskData report = new RepositoryTaskData(new BugzillaAttributeFactory(), - BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, 1); + BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, "1"); bugzillaTask.setTaskData(report); RepositoryTaskAttribute resolvedAttribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_STATUS .getKeyString()); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java index 16efbe28e..9592cab81 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java @@ -424,9 +424,9 @@ public class OfflineTaskManager { * @return The id that a new offline bug should use. The value changes each * time this method is called. */ - public int getNextOfflineBugId() { + public String getNextOfflineBugId() { latestNewBugId++; - return latestNewBugId; + return ""+latestNewBugId; } /** @@ -437,11 +437,11 @@ public class OfflineTaskManager { * @return The index of the bug in the array if it exists, else -1. Locally * created bugs are ignored. */ - public int find(String repositoryUrl, int id) { + public int find(String repositoryUrl, String id) { for (int i = 0; i < list.size(); i++) { RepositoryTaskData currBug = list.get(i); if (currBug != null && currBug.getRepositoryUrl() != null - && (currBug.getRepositoryUrl().equals(repositoryUrl) && currBug.getId() == id) + && (currBug.getRepositoryUrl().equals(repositoryUrl) && currBug.getId().equals(id)) && !currBug.isLocallyCreated()) return i; } @@ -449,8 +449,8 @@ public class OfflineTaskManager { } // TODO: move to plugin - public static RepositoryTaskData findBug(String repositoryUrl, int bugId) { - int location = MylarTaskListPlugin.getDefault().getOfflineReportsFile().find(repositoryUrl, bugId); + public static RepositoryTaskData findBug(String repositoryUrl, String taskId) { + int location = MylarTaskListPlugin.getDefault().getOfflineReportsFile().find(repositoryUrl, taskId); if (location != -1) { return MylarTaskListPlugin.getDefault().getOfflineReportsFile().elements().get(location); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskData.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskData.java index fa1a80c6e..6442fbbc4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskData.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskData.java @@ -34,7 +34,7 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab public static final String VAL_STATUS_NEW = "NEW"; - private int reportID; + private String reportID; private boolean hasChanges = false; @@ -85,7 +85,7 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab protected String repositoryKind; - public RepositoryTaskData(AbstractAttributeFactory factory, String repositoryKind, String repositoryURL, int id) { + public RepositoryTaskData(AbstractAttributeFactory factory, String repositoryKind, String repositoryURL, String id) { super(factory); this.reportID = id; this.repositoryKind = repositoryKind; @@ -352,7 +352,7 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab this.newAttachment = newAttachment; } - public int getId() { + public String getId() { return reportID; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractRepositoryTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractRepositoryTaskEditor.java index 40464a97f..40d0bb453 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractRepositoryTaskEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractRepositoryTaskEditor.java @@ -284,7 +284,7 @@ public abstract class AbstractRepositoryTaskEditor extends EditorPart { RepositoryTaskOutlineNode n = (RepositoryTaskOutlineNode) select; if (n != null && lastSelected != null - && OutlineTools.getHandle(n).equals(OutlineTools.getHandle(lastSelected))) { + && ContentOutlineTools.getHandle(n).equals(ContentOutlineTools.getHandle(lastSelected))) { // we don't need to set the selection if it is already // set return; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/OutlineTools.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ContentOutlineTools.java index ccabb2217..be09df056 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/OutlineTools.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ContentOutlineTools.java @@ -10,13 +10,12 @@ *******************************************************************************/ package org.eclipse.mylar.internal.tasklist.ui.editors; -import org.eclipse.mylar.internal.tasklist.RepositoryTaskData; /** * @author Rob Elves * @author Mik Kersten */ -public class OutlineTools { +public class ContentOutlineTools { /** The default string used for locally created bugs. */ public static final String OFFLINE_SERVER_DEFAULT = "[local]"; @@ -54,16 +53,16 @@ public class OutlineTools { return name; } - public static String getHandle(RepositoryTaskData taskData) { - return getHandle(taskData.getRepositoryUrl(), taskData.getId()); - } - - public static String getHandle(String server, int id) { - return server + ";" + id; - } +// public static String getHandle(RepositoryTaskData taskData) { +// return getHandle(taskData.getRepositoryUrl(), taskData.getId()); +// } +// +// public static String getHandle(String server, String id) { +// return server + ";" + id; +// } - public static String getName(RepositoryTaskData taskData) { - return taskData.getRepositoryUrl() + ": Bug#: " + taskData.getId() + ": " + taskData.getSummary(); - } +// public static String getName(RepositoryTaskData taskData) { +// return taskData.getRepositoryUrl() + ": Bug#: " + taskData.getId() + ": " + taskData.getSummary(); +// } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java index d3a2649ad..d8f0ccfbe 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java @@ -28,20 +28,20 @@ import org.eclipse.mylar.provisional.tasklist.TaskRepository; */ public class ExistingBugEditorInput extends AbstractBugEditorInput { - protected int bugId; + protected String id; protected AbstractRepositoryTask repositoryTask = null; // Called for existing report without a local task public ExistingBugEditorInput(TaskRepository repository, RepositoryTaskData taskData) { super(repository, taskData); - this.bugId = taskData.getId(); + this.id = taskData.getId(); } - public ExistingBugEditorInput(TaskRepository repository, RepositoryTaskData taskData, int bugId) + public ExistingBugEditorInput(TaskRepository repository, RepositoryTaskData taskData, String bugId) throws IOException, GeneralSecurityException { super(repository, taskData); - this.bugId = bugId; + this.id = bugId; // this.repository = repository; // this.repositoryTaskData = getOfflineTaskData(repository, // proxySettings, bugId); @@ -85,8 +85,8 @@ public class ExistingBugEditorInput extends AbstractBugEditorInput { /** * @return The id of the bug for this editor input. */ - public int getBugId() { - return bugId; + public String getId() { + return id; } /** @@ -95,9 +95,10 @@ public class ExistingBugEditorInput extends AbstractBugEditorInput { */ @Override public boolean equals(Object o) { + // XXX: will equate two tasks with identical ids from different repositories if (o instanceof ExistingBugEditorInput) { ExistingBugEditorInput input = (ExistingBugEditorInput) o; - return getBugId() == input.getBugId(); + return getId().equals(input.getId()); } return false; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskSelection.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskSelection.java index 7da69b639..f37839a32 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskSelection.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskSelection.java @@ -53,7 +53,7 @@ public interface IRepositoryTaskSelection extends ISelection { /** * @return The id of the Bugzilla object that the selection was on. */ - public int getId(); + public String getId(); /** * Sets the id of the Bugzilla object that the selection was on. @@ -61,7 +61,7 @@ public interface IRepositoryTaskSelection extends ISelection { * @param id * The id of the bug. */ - public void setId(int id); + public void setId(String id); /** * @return The server of the Bugzilla object that the selection was on, or diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java index b9f6405e2..d7fe1a98d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java @@ -29,7 +29,7 @@ public class RepositoryTaskOutlineComparer implements IElementComparer { // An IRepositoryTaskSelection is uniquely defined by its handle and // its contents - return ((OutlineTools.getHandle(s1).equals(OutlineTools.getHandle(s2))) && ((s1.getContents() == null) ? (s2 + return ((ContentOutlineTools.getHandle(s1).equals(ContentOutlineTools.getHandle(s2))) && ((s1.getContents() == null) ? (s2 .getContents() == null) : s1.getContents().equals(s2.getContents()))); } @@ -42,7 +42,7 @@ public class RepositoryTaskOutlineComparer implements IElementComparer { // An IRepositoryTaskSelection is uniquely defined by its handle and // its contents - return (OutlineTools.getHandle(sel) + sel.getContents()).hashCode(); + return (ContentOutlineTools.getHandle(sel) + sel.getContents()).hashCode(); } return element.hashCode(); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineNode.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineNode.java index 664e12311..8248e642e 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineNode.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineNode.java @@ -30,7 +30,7 @@ public class RepositoryTaskOutlineNode implements IRepositoryTaskSelection { static final String LABEL_NEW_COMMENT = "New Comment"; /** The id of the Bugzilla object that the selection was on. */ - protected int id; + protected String id; /** The server of the Bugzilla object that the selection was on. */ protected String server; @@ -70,7 +70,7 @@ public class RepositoryTaskOutlineNode implements IRepositoryTaskSelection { * @param parent * The parent of this node */ - public RepositoryTaskOutlineNode(int id, String server, String key, Object data, String summary) { + public RepositoryTaskOutlineNode(String id, String server, String key, Object data, String summary) { this.id = id; this.server = server; this.key = key; @@ -216,7 +216,7 @@ public class RepositoryTaskOutlineNode implements IRepositoryTaskSelection { */ protected static RepositoryTaskOutlineNode parseExistingBugReport(RepositoryTaskData bug) { - int bugId = bug.getId(); + String bugId = bug.getId(); String bugServer = bug.getRepositoryUrl(); RepositoryTaskOutlineNode topNode = new RepositoryTaskOutlineNode(bugId, bugServer, bug.getLabel(), bug, bug .getSummary()); @@ -277,11 +277,11 @@ public class RepositoryTaskOutlineNode implements IRepositoryTaskSelection { key = contents; } - public int getId() { + public String getId() { return id; } - public void setId(int id) { + public void setId(String id) { this.id = id; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlinePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlinePage.java index f1af97dc6..fcb7eaefa 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlinePage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlinePage.java @@ -40,7 +40,7 @@ public class RepositoryTaskOutlinePage extends ContentOutlinePage { .getFirstElement(); IRepositoryTaskSelection brs2 = ((IRepositoryTaskSelection) ((IStructuredSelection) selection) .getFirstElement()); - if (OutlineTools.getHandle(brs1).compareTo(OutlineTools.getHandle(brs2)) == 0) { + if (ContentOutlineTools.getHandle(brs1).compareTo(ContentOutlineTools.getHandle(brs2)) == 0) { // don't need to make a selection for the same // element return; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskSelection.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskSelection.java index a9d48f708..ddf9f54d5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskSelection.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskSelection.java @@ -21,7 +21,7 @@ public class RepositoryTaskSelection implements IRepositoryTaskSelection { /** * The id of the Bugzilla object that the selection was on. */ - protected int id; + protected String id; /** The server of the Bugzilla object that the selection was on. */ protected String server; @@ -46,7 +46,7 @@ public class RepositoryTaskSelection implements IRepositoryTaskSelection { * @param server * The server of the Bugzilla object that the selection was on. */ - public RepositoryTaskSelection(int id, String server, String summary) { + public RepositoryTaskSelection(String id, String server, String summary) { this(id, server, null, null, summary); } @@ -61,7 +61,7 @@ public class RepositoryTaskSelection implements IRepositoryTaskSelection { * @param contents * The contents of the selection. */ - public RepositoryTaskSelection(int id, String server, String contents, boolean isDescription, String summary) { + public RepositoryTaskSelection(String id, String server, String contents, boolean isDescription, String summary) { this(id, server, contents, null, summary); this.isDescription = isDescription; } @@ -79,7 +79,7 @@ public class RepositoryTaskSelection implements IRepositoryTaskSelection { * comment was not selected, then this should be * <code>null</code>. */ - public RepositoryTaskSelection(int id, String server, Comment comment, String summary) { + public RepositoryTaskSelection(String id, String server, Comment comment, String summary) { this(id, server, null, comment, summary); } @@ -97,7 +97,7 @@ public class RepositoryTaskSelection implements IRepositoryTaskSelection { * comment was not selected, then this should be * <code>null</code>. */ - public RepositoryTaskSelection(int id, String server, String contents, Comment comment, String summary) { + public RepositoryTaskSelection(String id, String server, String contents, Comment comment, String summary) { this.id = id; this.server = server; this.contents = contents; @@ -125,11 +125,11 @@ public class RepositoryTaskSelection implements IRepositoryTaskSelection { this.contents = contents; } - public int getId() { + public String getId() { return id; } - public void setId(int id) { + public void setId(String id) { this.id = id; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractQueryHit.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractQueryHit.java index 82663ba6a..69d760cf1 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractQueryHit.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractQueryHit.java @@ -21,11 +21,11 @@ public abstract class AbstractQueryHit implements ITaskListElement { protected String priority; - protected int id; + protected String id; protected boolean isNotified = false; - protected AbstractQueryHit(String repositoryUrl, String description, int id) { + protected AbstractQueryHit(String repositoryUrl, String description, String id) { this.repositoryUrl = repositoryUrl; this.description = description; this.id = id; @@ -54,7 +54,7 @@ public abstract class AbstractQueryHit implements ITaskListElement { return AbstractRepositoryTask.getHandle(repositoryUrl, id); } - public int getId() { + public String getId() { return id; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryTask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryTask.java index a1fda350f..b1d4d3732 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryTask.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryTask.java @@ -112,6 +112,15 @@ public abstract class AbstractRepositoryTask extends Task { return null; } +// public static int getTaskIdAsInt(String taskHandle) { +// String idString = getTaskId(taskHandle); +// if (idString != null) { +// return Integer.parseInt(idString); +// } else { +// return -1; +// } +// } + public static String getRepositoryUrl(String taskHandle) { int index = taskHandle.lastIndexOf(AbstractRepositoryTask.HANDLE_DELIM); String url = null; @@ -128,22 +137,11 @@ public abstract class AbstractRepositoryTask extends Task { return url; } - public static int getTaskIdAsInt(String taskHandle) { - String idString = getTaskId(taskHandle); - if (idString != null) { - return Integer.parseInt(idString); - } else { - return -1; - } - } - - /** - * @param taskId - * must be an integer - */ public static String getHandle(String repositoryUrl, String taskId) { if (repositoryUrl == null) { return TaskRepositoryManager.MISSING_REPOSITORY_HANDLE + taskId; + } else if (taskId.contains(MylarContextManager.CONTEXT_HANDLE_DELIM)) { + throw new RuntimeException("invalid handle for task, can not contain: " + MylarContextManager.CONTEXT_HANDLE_DELIM + ", was: " + taskId); } else { // MylarContextManager.CONTEXT_HANDLE_DELIM + taskId); return repositoryUrl + MylarContextManager.CONTEXT_HANDLE_DELIM + taskId; @@ -170,7 +168,7 @@ public abstract class AbstractRepositoryTask extends Task { this.taskData = taskData; // TODO: remove? if (taskData != null) { - setDescription(HtmlStreamTokenizer.unescape(AbstractRepositoryTask.getTaskIdAsInt(getHandleIdentifier()) + setDescription(HtmlStreamTokenizer.unescape(AbstractRepositoryTask.getTaskId(getHandleIdentifier()) + ": " + taskData.getSummary())); } } |