Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2008-04-22 22:43:38 +0000
committerrelves2008-04-22 22:43:38 +0000
commitc5914aceac1292afdca3fef1d15f517c2fc7b082 (patch)
tree1317f2f1500250227612c9a743b36683aa6c5a13 /org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor
parentbbb1a9964f7bb7032a9b2179ba950a552ea742ae (diff)
downloadorg.eclipse.mylyn.tasks-c5914aceac1292afdca3fef1d15f517c2fc7b082.tar.gz
org.eclipse.mylyn.tasks-c5914aceac1292afdca3fef1d15f517c2fc7b082.tar.xz
org.eclipse.mylyn.tasks-c5914aceac1292afdca3fef1d15f517c2fc7b082.zip
REOPENED - bug 228094: [api] move duplicate detection into bugzilla.core
https://bugs.eclipse.org/bugs/show_bug.cgi?id=228094
Diffstat (limited to 'org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor')
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java33
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracDuplicateDetector.java46
2 files changed, 49 insertions, 30 deletions
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
index 2c3cad1c7..462e7471d 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
@@ -11,15 +11,9 @@ package org.eclipse.mylyn.internal.trac.ui.editor;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.mylyn.internal.trac.core.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryQuery;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter.CompareOperator;
+import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.editors.AbstractNewRepositoryTaskEditor;
-import org.eclipse.mylyn.tasks.ui.search.SearchHitCollector;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -40,29 +34,8 @@ public class NewTracTaskEditor extends AbstractNewRepositoryTaskEditor {
}
@Override
- public SearchHitCollector getDuplicateSearchCollector(String name) {
- TracSearchFilter filter = new TracSearchFilter("description");
- filter.setOperator(CompareOperator.CONTAINS);
-
- String searchString = AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(taskData.getDescription());
-
- filter.addValue(searchString);
-
- TracSearch search = new TracSearch();
- search.addFilter(filter);
-
- // TODO copied from TracCustomQueryPage.getQueryUrl()
- StringBuilder sb = new StringBuilder();
- sb.append(repository.getRepositoryUrl());
- sb.append(ITracClient.QUERY_URL);
- sb.append(search.toUrl());
-
- TracRepositoryQuery query = new TracRepositoryQuery(repository.getRepositoryUrl(), sb.toString(),
- "<Duplicate Search>");
-
- SearchHitCollector collector = new SearchHitCollector(TasksUi.getTaskListManager().getTaskList(), repository,
- query);
- return collector;
+ public AbstractDuplicateDetector getDuplicateDetector(String name) {
+ return new TracDuplicateDetector();
}
@Override
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracDuplicateDetector.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracDuplicateDetector.java
new file mode 100644
index 000000000..4e9e0f8a1
--- /dev/null
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracDuplicateDetector.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project 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.mylyn.internal.trac.ui.editor;
+
+import org.eclipse.mylyn.internal.trac.core.ITracClient;
+import org.eclipse.mylyn.internal.trac.core.TracRepositoryQuery;
+import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
+import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter;
+import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter.CompareOperator;
+import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
+import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
+public class TracDuplicateDetector extends AbstractDuplicateDetector {
+
+ @Override
+ public AbstractRepositoryQuery getDiplicatesQuery(TaskRepository repository, RepositoryTaskData taskData) {
+ TracSearchFilter filter = new TracSearchFilter("description");
+ filter.setOperator(CompareOperator.CONTAINS);
+
+ String searchString = AbstractDuplicateDetector.getStackTraceFromDescription(taskData.getDescription());
+
+ filter.addValue(searchString);
+
+ TracSearch search = new TracSearch();
+ search.addFilter(filter);
+
+ // TODO copied from TracCustomQueryPage.getQueryUrl()
+ StringBuilder sb = new StringBuilder();
+ sb.append(repository.getRepositoryUrl());
+ sb.append(ITracClient.QUERY_URL);
+ sb.append(search.toUrl());
+
+ TracRepositoryQuery query = new TracRepositoryQuery(repository.getRepositoryUrl(), sb.toString(),
+ "<Duplicate Search>");
+ return query;
+ }
+
+}

Back to the top