Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 70530 Details for
Bug 187602
Provide extension point for specifying duplicate detectors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
extension point for duplicate detectors
bug187602Patch.txt (text/plain), 57.36 KB, created by
meghan
on 2007-06-07 13:16:57 EDT
(
hide
)
Description:
extension point for duplicate detectors
Filename:
MIME Type:
Creator:
meghan
Created:
2007-06-07 13:16:57 EDT
Size:
57.36 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.tasks.ui >Index: src/org/eclipse/mylar/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java,v >retrieving revision 1.21 >diff -u -r1.21 AbstractNewRepositoryTaskEditor.java >--- src/org/eclipse/mylar/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java 28 May 2007 22:45:19 -0000 1.21 >+++ src/org/eclipse/mylar/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java 7 Jun 2007 17:11:53 -0000 >@@ -35,6 +35,7 @@ > import org.eclipse.mylar.tasks.core.TaskCategory; > import org.eclipse.mylar.tasks.core.TaskList; > import org.eclipse.mylar.tasks.core.UncategorizedCategory; >+import org.eclipse.mylar.tasks.ui.AbstractDuplicateDetector; > import org.eclipse.mylar.tasks.ui.DatePicker; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; > import org.eclipse.mylar.tasks.ui.search.SearchHitCollector; >@@ -78,12 +79,16 @@ > > private static final String LABEL_SEARCH_DUPS = "Search for Duplicates"; > >- private static final String ERROR_CREATING_BUG_REPORT = "Error creating bug report"; >+ private static final String LABEL_SELECT_DETECTOR = "Select duplicate detector:"; > >- private static final String NO_STACK_MESSAGE = "Unable to locate a stack trace in the description text.\nDuplicate search currently only supports stack trace matching."; >+ private static final String ERROR_CREATING_BUG_REPORT = "Error creating bug report"; > > protected Button searchForDuplicates; > >+ protected CCombo duplicateDetectorChooser; >+ >+ protected Label duplicateDetectorLabel; >+ > protected DatePicker scheduledForDate; > > protected Spinner estimatedTime; >@@ -110,7 +115,7 @@ > newSummary = taskData.getSummary(); > repository = editorInput.getRepository(); > connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repository.getKind()); >- isDirty = false; >+ isDirty = false; > } > > @Override >@@ -265,52 +270,6 @@ > // ignore > } > >- public String getStackTraceFromDescription() { >- String description = descriptionTextViewer.getTextWidget().getText().trim(); >- String stackTrace = null; >- >- if (description == null) { >- return null; >- } >- >- String punct = "!\"#$%&'\\(\\)*+,-./:;\\<=\\>?@\\[\\]^_`\\{|\\}~\n"; >- String lineRegex = " *at\\s+[\\w" + punct + "]+ ?\\(.*\\) *\n?"; >- Pattern tracePattern = Pattern.compile(lineRegex); >- Matcher match = tracePattern.matcher(description); >- >- if (match.find()) { >- // record the index of the first stack trace line >- int start = match.start(); >- int lastEnd = match.end(); >- >- // find the last stack trace line >- while (match.find()) { >- lastEnd = match.end(); >- } >- >- // make sure there's still room to find the exception >- if (start <= 0) { >- return null; >- } >- >- // count back to the line before the stack trace to find the >- // exception >- int stackStart = 0; >- int index = start - 1; >- while (index > 1 && description.charAt(index) == ' ') { >- index--; >- } >- >- // locate the exception line index >- stackStart = description.substring(0, index - 1).lastIndexOf("\n"); >- stackStart = (stackStart == -1) ? 0 : stackStart + 1; >- >- stackTrace = description.substring(stackStart, lastEnd); >- } >- >- return stackTrace; >- } >- > @Override > protected void updateTask() { > taskData.setSummary(newSummary); >@@ -324,8 +283,8 @@ > protected class DescriptionListener implements Listener { > public void handleEvent(Event event) { > fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection( >- new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(), taskData.getRepositoryKind(), "New Description", >- false, taskData.getSummary())))); >+ new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(), taskData >+ .getRepositoryKind(), "New Description", false, taskData.getSummary())))); > } > } > >@@ -432,8 +391,34 @@ > protected void addActionButtons(Composite buttonComposite) { > FormToolkit toolkit = new FormToolkit(buttonComposite.getDisplay()); > >- SearchHitCollector collector = getDuplicateSearchCollector(""); >- if (collector != null) { >+ List<AbstractDuplicateDetector> allCollectors = getDuplicateSearchCollectorsList(); >+ if (allCollectors != null) { >+ duplicateDetectorLabel = new Label(buttonComposite, SWT.LEFT); >+ duplicateDetectorLabel.setText(LABEL_SELECT_DETECTOR); >+ >+ duplicateDetectorChooser = new CCombo(buttonComposite, SWT.FLAT | SWT.READ_ONLY | SWT.BORDER); >+ >+ duplicateDetectorChooser.setLayoutData(GridDataFactory.swtDefaults().hint(150, SWT.DEFAULT).create()); >+ duplicateDetectorChooser.setFont(TEXT_FONT); >+ >+ Collections.sort(allCollectors, new Comparator<AbstractDuplicateDetector>() { >+ >+ public int compare(AbstractDuplicateDetector c1, AbstractDuplicateDetector c2) { >+ return c1.getName().compareToIgnoreCase(c2.getName()); >+ } >+ >+ }); >+ >+ for (AbstractDuplicateDetector detector : allCollectors) { >+ duplicateDetectorChooser.add(detector.getName()); >+ } >+ >+ duplicateDetectorChooser.select(0); >+ duplicateDetectorChooser.setEnabled(true); >+ duplicateDetectorChooser.setData(allCollectors); >+ } >+ >+ if (allCollectors != null && allCollectors.size() > 0) { > > searchForDuplicates = toolkit.createButton(buttonComposite, LABEL_SEARCH_DUPS, SWT.NONE); > GridData searchDuplicatesButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); >@@ -444,7 +429,10 @@ > } > }); > } >- >+ >+ Label spacer = new Label(buttonComposite, SWT.NULL); >+ spacer.setText(""); >+ > submitButton = toolkit.createButton(buttonComposite, LABEL_CREATE, SWT.NONE); > GridData submitButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); > submitButton.setLayoutData(submitButtonData); >@@ -491,12 +479,13 @@ > > public boolean searchForDuplicates() { > >- String stackTrace = getStackTraceFromDescription(); >- if (stackTrace == null) { >- MessageDialog.openWarning(null, "No Stack Trace Found", NO_STACK_MESSAGE); >- return false; >- } >- SearchHitCollector collector = getDuplicateSearchCollector(stackTrace); >+ String duplicateDetectorName = duplicateDetectorChooser.getItem(duplicateDetectorChooser.getSelectionIndex()); >+ >+ // updatetask() needs to be called so that the description text is save before we >+ // search for duplicates >+ this.updateTask(); >+ >+ SearchHitCollector collector = getDuplicateSearchCollector(duplicateDetectorName); > if (collector != null) { > NewSearchUI.runQueryInBackground(collector); > return true; >@@ -541,12 +530,63 @@ > return newTask; > } > >- protected abstract SearchHitCollector getDuplicateSearchCollector(String description); >+ protected abstract SearchHitCollector getDuplicateSearchCollector(String name); >+ >+ protected List<AbstractDuplicateDetector> getDuplicateSearchCollectorsList() { >+ return TasksUiPlugin.getDefault().getDuplicateSearchCollectorsList(); >+ } > > @Override > public void doSave(IProgressMonitor monitor) { >- new MessageDialog(null, "Operation not supported", null, "Save of un-submitted new tasks is not currently supported.\nPlease submit all new tasks.", MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0).open(); >+ new MessageDialog(null, "Operation not supported", null, >+ "Save of un-submitted new tasks is not currently supported.\nPlease submit all new tasks.", >+ MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0).open(); > monitor.setCanceled(true); > return; > } >+ >+ public static String getStackTraceFromDescription(String description) { >+ String stackTrace = null; >+ >+ if (description == null) { >+ return null; >+ } >+ >+ String punct = "!\"#$%&'\\(\\)*+,-./:;\\<=\\>?@\\[\\]^_`\\{|\\}~\n"; >+ String lineRegex = " *at\\s+[\\w" + punct + "]+ ?\\(.*\\) *\n?"; >+ Pattern tracePattern = Pattern.compile(lineRegex); >+ Matcher match = tracePattern.matcher(description); >+ >+ if (match.find()) { >+ // record the index of the first stack trace line >+ int start = match.start(); >+ int lastEnd = match.end(); >+ >+ // find the last stack trace line >+ while (match.find()) { >+ lastEnd = match.end(); >+ } >+ >+ // make sure there's still room to find the exception >+ if (start <= 0) { >+ return null; >+ } >+ >+ // count back to the line before the stack trace to find the >+ // exception >+ int stackStart = 0; >+ int index = start - 1; >+ while (index > 1 && description.charAt(index) == ' ') { >+ index--; >+ } >+ >+ // locate the exception line index >+ stackStart = description.substring(0, index - 1).lastIndexOf("\n"); >+ stackStart = (stackStart == -1) ? 0 : stackStart + 1; >+ >+ stackTrace = description.substring(stackStart, lastEnd); >+ } >+ >+ return stackTrace; >+ } > } >Index: .refactorings/2007/5/21/refactorings.history >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/.refactorings/2007/5/21/refactorings.history,v >retrieving revision 1.3 >diff -u -r1.3 refactorings.history >--- .refactorings/2007/5/21/refactorings.history 24 May 2007 20:31:51 -0000 1.3 >+++ .refactorings/2007/5/21/refactorings.history 7 Jun 2007 17:11:52 -0000 >@@ -1,9 +1,14 @@ >-<?xml version="1.0" encoding="utf-8" standalone="no"?> >+<?xml version="1.0" encoding="utf-8"?> > <session version="1.0"> > <refactoring comment="Rename field 'DELAY_REFRESH' in 'org.eclipse.mylar.internal.tasks.ui.views.AdaptiveRefreshPolicy' to 'refreshDelay' - Original project: 'org.eclipse.mylar.tasks.ui' - Original element: 'org.eclipse.mylar.internal.tasks.ui.views.AdaptiveRefreshPolicy.DELAY_REFRESH' - Renamed element: 'org.eclipse.mylar.internal.tasks.ui.views.AdaptiveRefreshPolicy.refreshDelay' - Update references to refactored element - Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'DELAY_REFRESH'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src<org.eclipse.mylar.internal.tasks.ui.views{AdaptiveRefreshPolicy.java[AdaptiveRefreshPolicy^DELAY_REFRESH" name="refreshDelay" references="true" setter="false" stamp="1179777278867" textual="false" version="1.0"/> > <refactoring comment="Rename field 'refreshDelay' in 'org.eclipse.mylar.internal.tasks.ui.views.AdaptiveRefreshPolicy' to 'refreshThreshold' - Original project: 'org.eclipse.mylar.tasks.ui' - Original element: 'org.eclipse.mylar.internal.tasks.ui.views.AdaptiveRefreshPolicy.refreshDelay' - Renamed element: 'org.eclipse.mylar.internal.tasks.ui.views.AdaptiveRefreshPolicy.refreshThreshold' - Update references to refactored element - Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'refreshDelay'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src<org.eclipse.mylar.internal.tasks.ui.views{AdaptiveRefreshPolicy.java[AdaptiveRefreshPolicy^refreshDelay" name="refreshThreshold" references="true" setter="false" stamp="1179777303961" textual="false" version="1.0"/> >+<<<<<<< refactorings.history >+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.tasks.ui' - Original project: 'org.eclipse.mylar.tasks.ui' - Original element: 'duplicateDetectors.exsd'" description="Delete element" element1="schema/duplicateDetectors.exsd" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="1" stamp="1179853414515" subPackages="false" version="1.0"/> >+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.tasks.ui' - Original project: 'org.eclipse.mylar.tasks.ui' - Original element: 'org.eclipse.mylar.tasks.ui.IMylarDuplicateDetector.java'" description="Delete element" element1="/src<org.eclipse.mylar.tasks.ui{IMylarDuplicateDetector.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1180119748828" subPackages="false" version="1.0"/> >+======= > <refactoring comment="Move 1 elements(s) to 'ovr16' - Original project: 'org.eclipse.mylar.tasks.ui' - Destination element: 'ovr16' - Original element: 'overlay-warning.gif'" description="Move file" element1="icons/eview16/overlay-warning.gif" files="1" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1179936680240" target="/org.eclipse.mylar.tasks.ui/icons/ovr16" units="0" version="1.0"/> > <refactoring comment="Rename type 'org.eclipse.mylar.internal.tasks.ui.views.TaskListTableLabelProvider' to 'TaskTableLabelProvider' - Original project: 'org.eclipse.mylar.tasks.ui' - Original element: 'org.eclipse.mylar.internal.tasks.ui.views.TaskListTableLabelProvider' - Renamed element: 'org.eclipse.mylar.internal.tasks.ui.views.TaskTableLabelProvider' - Update references to refactored element - Update fully qualified names in '*.xml, *.properties, *.exsd' files - Update textual occurrences in comments and strings" description="Rename type 'TaskListTableLabelProvider'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylar.internal.tasks.ui.views{TaskListTableLabelProvider.java[TaskListTableLabelProvider" matchStrategy="1" name="TaskTableLabelProvider" patterns="*.xml, *.properties, *.exsd" qualified="true" references="true" similarDeclarations="false" stamp="1179936811208" textual="false" version="1.0"/> > <refactoring comment="Rename method 'org.eclipse.mylar.tasks.ui.SynchronizeQueryJob.setSynchTasks(...)' to 'setSynchChangedTasks' - Original project: 'org.eclipse.mylar.tasks.ui' - Original element: 'org.eclipse.mylar.tasks.ui.SynchronizeQueryJob.setSynchTasks(...)' - Renamed element: 'org.eclipse.mylar.tasks.ui.SynchronizeQueryJob.setSynchChangedTasks(...)' - Update references to refactored element" delegate="false" deprecate="false" description="Rename method 'setSynchTasks'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src<org.eclipse.mylar.tasks.ui{SynchronizeQueryJob.java[SynchronizeQueryJob~setSynchTasks~Z" name="setSynchChangedTasks" references="true" stamp="1180029019703" version="1.0"/> > <refactoring comment="Extract method 'private void addHitsToPrime(TaskRepository repository,List<AbstractQueryHit> hits)' from 'org.eclipse.mylar.tasks.ui.SynchronizeQueryJob.run()' to 'org.eclipse.mylar.tasks.ui.SynchronizeQueryJob' - Original project: 'org.eclipse.mylar.tasks.ui' - Method name: 'addHitsToPrime' - Destination type: 'org.eclipse.mylar.tasks.ui.SynchronizeQueryJob' - Declared visibility: 'private'" comments="false" description="Extract method 'addHitsToPrime'" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src<org.eclipse.mylar.tasks.ui{SynchronizeQueryJob.java" name="addHitsToPrime" replace="false" selection="4879 607" stamp="1180029977125" version="1.0" visibility="2"/> >+>>>>>>> 1.3 > </session> >Index: .refactorings/2007/5/21/refactorings.index >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/.refactorings/2007/5/21/refactorings.index,v >retrieving revision 1.3 >diff -u -r1.3 refactorings.index >--- .refactorings/2007/5/21/refactorings.index 24 May 2007 20:31:51 -0000 1.3 >+++ .refactorings/2007/5/21/refactorings.index 7 Jun 2007 17:11:52 -0000 >@@ -1,6 +1,11 @@ > 1179777278867 Rename field 'DELAY_REFRESH' > 1179777303961 Rename field 'refreshDelay' >+<<<<<<< refactorings.index >+1179853414515 Delete element >+1180119748828 Delete element >+======= > 1179936680240 Move file > 1179936811208 Rename type 'TaskListTableLabelProvider' > 1180029019703 Rename method 'setSynchTasks' > 1180029977125 Extract method 'addHitsToPrime' >+>>>>>>> 1.3 >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/plugin.xml,v >retrieving revision 1.216 >diff -u -r1.216 plugin.xml >--- plugin.xml 4 Jun 2007 23:38:55 -0000 1.216 >+++ plugin.xml 7 Jun 2007 17:11:52 -0000 >@@ -5,6 +5,7 @@ > <extension-point id="repositories" name="Task Repositories" schema="schema/repositories.exsd"/> > <extension-point id="editors" name="Task Editors" schema="schema/editors.exsd"/> > <extension-point id="projectLinkProviders" name="Linking Provider from Project to the Task Repository" schema="schema/projectLinkProviders.exsd"/> >+ <extension-point id="duplicateDetectors" name="duplicateDetectors" schema="schema/duplicateDetectors.exsd"/> > > <!-- > <extension >@@ -840,8 +841,7 @@ > class="org.eclipse.mylar.internal.tasks.ui.workingset.TaskElementFactory" > id="org.eclipse.mylar.tasks.ui.elementFactory"> > </factory> >- </extension> >- >+</extension> > </plugin> > > <!-- >Index: src/org/eclipse/mylar/tasks/ui/search/SearchHitCollector.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/tasks/ui/search/SearchHitCollector.java,v >retrieving revision 1.9 >diff -u -r1.9 SearchHitCollector.java >--- src/org/eclipse/mylar/tasks/ui/search/SearchHitCollector.java 5 Jun 2007 22:23:55 -0000 1.9 >+++ src/org/eclipse/mylar/tasks/ui/search/SearchHitCollector.java 7 Jun 2007 17:11:53 -0000 >@@ -43,6 +43,8 @@ > public class SearchHitCollector extends QueryHitCollector implements ISearchQuery { > > private static final String QUERYING_REPOSITORY = "Querying Repository..."; >+ >+ private String type; > > private TaskRepository repository; > >@@ -118,7 +120,15 @@ > public String getLabel() { > return QUERYING_REPOSITORY; > } >+ >+ public String getTypeLabel() { >+ return type; >+ } > >+ public void setTypeLabel(String type) { >+ this.type = type; >+ } >+ > public boolean canRerun() { > return true; > } >Index: src/org/eclipse/mylar/internal/tasks/ui/util/TasksUiExtensionReader.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/internal/tasks/ui/util/TasksUiExtensionReader.java,v >retrieving revision 1.21 >diff -u -r1.21 TasksUiExtensionReader.java >--- src/org/eclipse/mylar/internal/tasks/ui/util/TasksUiExtensionReader.java 30 Mar 2007 14:19:43 -0000 1.21 >+++ src/org/eclipse/mylar/internal/tasks/ui/util/TasksUiExtensionReader.java 7 Jun 2007 17:11:52 -0000 >@@ -27,6 +27,7 @@ > import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylar.tasks.core.ITaskListExternalizer; > import org.eclipse.mylar.tasks.core.RepositoryTemplate; >+import org.eclipse.mylar.tasks.ui.AbstractDuplicateDetector; > import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi; > import org.eclipse.mylar.tasks.ui.AbstractTaskRepositoryLinkProvider; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; >@@ -53,7 +54,7 @@ > public static final String ELMNT_TMPL_URLREPOSITORY = "urlRepository"; > > public static final String ELMNT_TMPL_REPOSITORYKIND = "repositoryKind"; >- >+ > public static final String ELMNT_TMPL_CHARACTERENCODING = "characterEncoding"; > > public static final String ELMNT_TMPL_ANONYMOUS = "anonymous"; >@@ -71,15 +72,15 @@ > public static final String ELMNT_TMPL_ADDAUTO = "addAutomatically"; > > public static final String ELMNT_REPOSITORY_CONNECTOR = "connectorCore"; >- >+ > public static final String ATTR_USER_MANAGED = "userManaged"; >- >+ > public static final String ATTR_CUSTOM_NOTIFICATIONS = "customNotifications"; > > public static final String ELMNT_REPOSITORY_LINK_PROVIDER = "linkProvider"; >- >- public static final String ELMNT_REPOSITORY_UI= "connectorUi"; >- >+ >+ public static final String ELMNT_REPOSITORY_UI = "connectorUi"; >+ > public static final String ELMNT_EXTERNALIZER = "externalizer"; > > public static final String ATTR_BRANDING_ICON = "brandingIcon"; >@@ -101,7 +102,7 @@ > public static final String ATTR_CLASS = "class"; > > public static final String ATTR_MENU_PATH = "menuPath"; >- >+ > public static final String EXTENSION_EDITORS = "org.eclipse.mylar.tasks.ui.editors"; > > public static final String ELMNT_EDITOR_FACTORY = "editorFactory"; >@@ -110,6 +111,14 @@ > > public static final String ELMNT_HYPERLINK_DETECTOR = "hyperlinkDetector"; > >+ public static final String EXTENSION_DUPLICATE_DETECTORS = "org.eclipse.mylar.tasks.ui.duplicateDetectors"; >+ >+ public static final String ELMNT_DUPLICATE_DETECTOR = "detector"; >+ >+ public static final String ATTR_NAME = "name"; >+ >+ public static final String ATTR_KIND = "kind"; >+ > private static boolean coreExtensionsRead = false; > > public static void initStartupExtensions(TaskListWriter delegatingExternalizer) { >@@ -180,7 +189,7 @@ > for (int j = 0; j < elements.length; j++) { > if (elements[j].getName().equals(ELMNT_REPOSITORY_UI)) { > readRepositoryConnectorUi(elements[j]); >- } >+ } > } > } > >@@ -191,20 +200,48 @@ > for (int j = 0; j < elements.length; j++) { > if (elements[j].getName().equals(ELMNT_REPOSITORY_LINK_PROVIDER)) { > readLinkProvider(elements[j]); >- } >+ } >+ } >+ } >+ >+ IExtensionPoint duplicateDetectorsExtensionPoint = registry.getExtensionPoint(EXTENSION_DUPLICATE_DETECTORS); >+ IExtension[] dulicateDetectorsExtensions = duplicateDetectorsExtensionPoint.getExtensions(); >+ for (int i = 0; i < dulicateDetectorsExtensions.length; i++) { >+ IConfigurationElement[] elements = dulicateDetectorsExtensions[i].getConfigurationElements(); >+ for (int j = 0; j < elements.length; j++) { >+ if (elements[j].getName().equals(ELMNT_DUPLICATE_DETECTOR)) { >+ readDuplicateDetector(elements[j]); >+ } > } > } >- >+ >+ } >+ >+ private static void readDuplicateDetector(IConfigurationElement element) { >+ try { >+ Object obj = element.createExecutableExtension(ATTR_CLASS); >+ if (obj instanceof AbstractDuplicateDetector) { >+ AbstractDuplicateDetector duplicateDetector = (AbstractDuplicateDetector) obj; >+ duplicateDetector.setName(element.getAttribute(ATTR_NAME)); >+ duplicateDetector.setKind(element.getAttribute(ATTR_KIND)); >+ TasksUiPlugin.getDefault().addDuplicateDetector((AbstractDuplicateDetector) duplicateDetector); >+ } else { >+ MylarStatusHandler.log("Could not load duplicate detector: " + obj.getClass().getCanonicalName(), null); >+ } >+ } catch (CoreException e) { >+ MylarStatusHandler.log(e, "Could not load duplicate detector extension"); >+ } > } >- >+ > private static void readLinkProvider(IConfigurationElement element) { > try { > Object repositoryLinkProvider = element.createExecutableExtension(ATTR_CLASS); > if (repositoryLinkProvider instanceof AbstractTaskRepositoryLinkProvider) { >- TasksUiPlugin.getDefault().addRepositoryLinkProvider((AbstractTaskRepositoryLinkProvider) repositoryLinkProvider); >+ TasksUiPlugin.getDefault().addRepositoryLinkProvider( >+ (AbstractTaskRepositoryLinkProvider) repositoryLinkProvider); > } else { >- MylarStatusHandler.log("Could not load repository link provider: " + repositoryLinkProvider.getClass().getCanonicalName(), >- null); >+ MylarStatusHandler.log("Could not load repository link provider: " >+ + repositoryLinkProvider.getClass().getCanonicalName(), null); > } > } catch (CoreException e) { > MylarStatusHandler.log(e, "Could not load repository link provider extension"); >@@ -246,12 +283,12 @@ > if (connectorCore instanceof AbstractRepositoryConnector && type != null) { > AbstractRepositoryConnector repositoryConnector = (AbstractRepositoryConnector) connectorCore; > TasksUiPlugin.getRepositoryManager().addRepositoryConnector(repositoryConnector); >- >+ > String userManagedString = element.getAttribute(ATTR_USER_MANAGED); >- if(userManagedString != null){ >+ if (userManagedString != null) { > boolean userManaged = Boolean.parseBoolean(userManagedString); >- repositoryConnector.setUserManaged(userManaged); >- } >+ repositoryConnector.setUserManaged(userManaged); >+ } > } else { > MylarStatusHandler.log("could not not load connector core: " + connectorCore, null); > } >@@ -265,21 +302,22 @@ > try { > Object connectorUiObject = element.createExecutableExtension(ATTR_CLASS); > if (connectorUiObject instanceof AbstractRepositoryConnectorUi) { >- AbstractRepositoryConnectorUi connectorUi = (AbstractRepositoryConnectorUi)connectorUiObject; >+ AbstractRepositoryConnectorUi connectorUi = (AbstractRepositoryConnectorUi) connectorUiObject; > TasksUiPlugin.addRepositoryConnectorUi((AbstractRepositoryConnectorUi) connectorUi); > > String customNotificationsString = element.getAttribute(ATTR_CUSTOM_NOTIFICATIONS); >- if(customNotificationsString != null){ >+ if (customNotificationsString != null) { > boolean customNotifications = Boolean.parseBoolean(customNotificationsString); >- connectorUi.setCustomNotificationHandling(customNotifications); >+ connectorUi.setCustomNotificationHandling(customNotifications); > } >- >+ > String iconPath = element.getAttribute(ATTR_BRANDING_ICON); > if (iconPath != null) { > ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor() > .getName(), iconPath); > if (descriptor != null) { >- TasksUiPlugin.getDefault().addBrandingIcon(((AbstractRepositoryConnectorUi)connectorUi).getRepositoryType(), >+ TasksUiPlugin.getDefault().addBrandingIcon( >+ ((AbstractRepositoryConnectorUi) connectorUi).getRepositoryType(), > TasksUiImages.getImage(descriptor)); > } > } >@@ -288,8 +326,8 @@ > ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor() > .getName(), overlayIconPath); > if (descriptor != null) { >- TasksUiPlugin.getDefault().addOverlayIcon(((AbstractRepositoryConnectorUi)connectorUi).getRepositoryType(), >- descriptor); >+ TasksUiPlugin.getDefault().addOverlayIcon( >+ ((AbstractRepositoryConnectorUi) connectorUi).getRepositoryType(), descriptor); > } > } > } else { >@@ -300,7 +338,7 @@ > MylarStatusHandler.log(e, "Could not load tasklist listener extension"); > } > } >- >+ > private static void readRepositoryTemplate(IConfigurationElement element) { > > boolean anonymous = false; >@@ -322,18 +360,18 @@ > && TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repKind) != null) { > AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() > .getRepositoryConnector(repKind); >- RepositoryTemplate template = new RepositoryTemplate(label, serverUrl, encoding, version, newTaskUrl, taskPrefix, >- taskQueryUrl, newAccountUrl, anonymous, addAuto); >+ RepositoryTemplate template = new RepositoryTemplate(label, serverUrl, encoding, version, newTaskUrl, >+ taskPrefix, taskQueryUrl, newAccountUrl, anonymous, addAuto); > connector.addTemplate(template); >- >+ > for (IConfigurationElement configElement : element.getChildren()) { > String name = configElement.getAttribute("name"); > String value = configElement.getAttribute("value"); >- if(name != null && !name.equals("") && value != null) { >+ if (name != null && !name.equals("") && value != null) { > template.addAttribute(name, value); > } > } >- >+ > } else { > MylarStatusHandler.log("Could not load repository template extension " + element.getName(), > TasksUiExtensionReader.class); >Index: src/org/eclipse/mylar/tasks/ui/TasksUiPlugin.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/tasks/ui/TasksUiPlugin.java,v >retrieving revision 1.97 >diff -u -r1.97 TasksUiPlugin.java >--- src/org/eclipse/mylar/tasks/ui/TasksUiPlugin.java 5 Jun 2007 02:55:40 -0000 1.97 >+++ src/org/eclipse/mylar/tasks/ui/TasksUiPlugin.java 7 Jun 2007 17:11:52 -0000 >@@ -132,6 +132,8 @@ > private TreeSet<AbstractTaskRepositoryLinkProvider> repositoryLinkProviders = new TreeSet<AbstractTaskRepositoryLinkProvider>( > new OrderComparator()); > >+ private List<AbstractDuplicateDetector> duplicateDetectors = new ArrayList<AbstractDuplicateDetector>(); >+ > private TaskListWriter taskListWriter; > > private ITaskHighlighter highlighter; >@@ -407,7 +409,7 @@ > taskListManager.addActivityListener(CONTEXT_TASK_ACTIVITY_LISTENER); > taskListManager.readExistingOrCreateNewList(); > initialized = true; >- >+ > saveParticipant = new ISaveParticipant() { > > public void doneSaving(ISaveContext context) { >@@ -491,8 +493,8 @@ > MylarStatusHandler.fail(t, "Could not finish Tasks UI initialization", false); > } > } >- }); >- >+ }); >+ > Bundle bundle = Platform.getBundle("org.eclipse.ui.workbench"); > if (bundle.getLocation().contains("_3.3.")) { > eclipse_3_3_workbench = true; >@@ -764,31 +766,38 @@ > private void readOfflineReports() { > IPath offlineReportsPath = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); > >-// try { >- taskDataManager = new TaskDataManager(taskRepositoryManager, offlineReportsPath);//, true); >-// } catch (Throwable t) { >-// MylarStatusHandler.log("Recreating offline task cache due to format update.", this); >-// boolean deleted = offlineReportsPath.toFile().delete(); >-// if (!deleted) { >-// MylarStatusHandler.log(t, "could not delete offline repository tasks file"); >-// } >-// try { >-// taskDataManager = new TaskDataManager(taskRepositoryManager, offlineReportsPath, false); >-// } catch (Exception e1) { >-// MylarStatusHandler.log(e1, "could not reset offline repository tasks file"); >-// } >-// } >- } >- >-// /** >-// * Returns the path to the file caching the offline bug reports. PUBLIC FOR >-// * TESTING >-// */ >-// public IPath getOfflineReportsFilePath() { >-// IPath stateLocation = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); >-// IPath configFile = stateLocation.append("offlineReports"); >-// return configFile; >-// } >+ // try { >+ taskDataManager = new TaskDataManager(taskRepositoryManager, offlineReportsPath);// , >+ // true); >+ // } catch (Throwable t) { >+ // MylarStatusHandler.log("Recreating offline task cache due to format >+ // update.", this); >+ // boolean deleted = offlineReportsPath.toFile().delete(); >+ // if (!deleted) { >+ // MylarStatusHandler.log(t, "could not delete offline repository tasks >+ // file"); >+ // } >+ // try { >+ // taskDataManager = new TaskDataManager(taskRepositoryManager, >+ // offlineReportsPath, false); >+ // } catch (Exception e1) { >+ // MylarStatusHandler.log(e1, "could not reset offline repository tasks >+ // file"); >+ // } >+ // } >+ } >+ >+ // /** >+ // * Returns the path to the file caching the offline bug reports. PUBLIC >+ // FOR >+ // * TESTING >+ // */ >+ // public IPath getOfflineReportsFilePath() { >+ // IPath stateLocation = >+ // Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); >+ // IPath configFile = stateLocation.append("offlineReports"); >+ // return configFile; >+ // } > > public TaskDataManager getTaskDataManager() { > if (taskDataManager == null) { >@@ -909,7 +918,7 @@ > > public static TaskListNotificationIncoming getIncommingNotification(AbstractRepositoryConnector connector, > AbstractRepositoryTask repositoryTask) { >- >+ > TaskListNotificationIncoming notification = new TaskListNotificationIncoming(repositoryTask); > > RepositoryTaskData newTaskData = getDefault().getTaskDataManager().getNewTaskData( >@@ -918,14 +927,13 @@ > RepositoryTaskData oldTaskData = getDefault().getTaskDataManager().getOldTaskData( > repositoryTask.getHandleIdentifier()); > >- > if (newTaskData != null && oldTaskData != null) { >- >+ > String descriptionText = getChangedDescription(newTaskData, oldTaskData); >- if(descriptionText != null){ >+ if (descriptionText != null) { > notification.setDescription(descriptionText); > } >- >+ > if (connector != null) { > ITaskDataHandler offlineHandler = connector.getTaskDataHandler(); > if (offlineHandler != null && newTaskData.getLastModified() != null) { >@@ -940,12 +948,12 @@ > } > return notification; > } >- >- private static String getChangedDescription(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData){ >- >+ >+ private static String getChangedDescription(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData) { >+ > String descriptionText = ""; >- >- if(newTaskData.getComments().size() > oldTaskData.getComments().size()){ >+ >+ if (newTaskData.getComments().size() > oldTaskData.getComments().size()) { > List<TaskComment> taskComments = newTaskData.getComments(); > if (taskComments != null && taskComments.size() > 0) { > TaskComment lastComment = taskComments.get(taskComments.size() - 1); >@@ -959,12 +967,12 @@ > } > } > } >- >+ > boolean attributeChanged = false; >- >- for(RepositoryTaskAttribute newAttribute: newTaskData.getAttributes()){ >+ >+ for (RepositoryTaskAttribute newAttribute : newTaskData.getAttributes()) { > RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getID()); >- if (oldAttribute == null){ >+ if (oldAttribute == null) { > attributeChanged = true; > break; > } >@@ -976,20 +984,30 @@ > break; > } > } >- >- if(attributeChanged){ >- if (descriptionText.equals("")){ >+ >+ if (attributeChanged) { >+ if (descriptionText.equals("")) { > descriptionText += "Attributes changed"; >- } >+ } > } >-// else { >-// String description = taskData.getDescription(); >-// if (description != null) { >-// notification.setDescription(description); >-// } >-// } >- >+ // else { >+ // String description = taskData.getDescription(); >+ // if (description != null) { >+ // notification.setDescription(description); >+ // } >+ // } >+ > return descriptionText; > } > >+ public void addDuplicateDetector(AbstractDuplicateDetector duplicateDetector) { >+ if (duplicateDetector != null) { >+ duplicateDetectors.add(duplicateDetector); >+ } >+ } >+ >+ public List<AbstractDuplicateDetector> getDuplicateSearchCollectorsList() { >+ return duplicateDetectors; >+ } >+ > } >Index: .refactorings/2007/6/23/refactorings.history >=================================================================== >RCS file: .refactorings/2007/6/23/refactorings.history >diff -N .refactorings/2007/6/23/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/6/23/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+<?xml version="1.0" encoding="utf-8"?> >+<session version="1.0"> >+<refactoring comment="Rename local variable 'kind' in 'org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor.getDuplicateSearchCollector(...)' to 'name' - Original project: 'org.eclipse.mylar.tasks.ui' - Original element: 'org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor.getDuplicateSearchCollector(String, String).kind' - Renamed element: 'org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor.getDuplicateSearchCollector(String, String).name' - Update references to refactored element" description="Rename local variable 'kind'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src<org.eclipse.mylar.tasks.ui.editors{AbstractNewRepositoryTaskEditor.java" name="name" references="true" selection="21506 4" stamp="1181108866015" version="1.0"/> >+<refactoring comment="Move 1 elements(s) to 'org.eclipse.mylar.bugzilla.ui/src/org.eclipse.mylar.internal.bugzilla.ui.search' - Original project: 'org.eclipse.mylar.tasks.ui' - Destination element: 'org.eclipse.mylar.bugzilla.ui/src/org.eclipse.mylar.internal.bugzilla.ui.search' - Original element: 'org.eclipse.mylar.internal.tasks.ui.search.StackTraceDuplicateDetector.java' - Update references to refactored element" description="Move compilation unit" destination="/src<org.eclipse.mylar.internal.bugzilla.ui.search" element1="/src<org.eclipse.mylar.internal.tasks.ui.search{StackTraceDuplicateDetector.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1181144506125" units="1" version="1.0"/> >+</session> >Index: schema/duplicateDetectors.exsd >=================================================================== >RCS file: schema/duplicateDetectors.exsd >diff -N schema/duplicateDetectors.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/duplicateDetectors.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,116 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.mylar.tasks.ui"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.mylar.tasks.ui" id="duplicateDetectors" name="duplicateDetectors"/> >+ </appInfo> >+ <documentation> >+ [Enter description of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="detector"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="detector"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="kind" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+</schema> >Index: src/org/eclipse/mylar/tasks/ui/AbstractDuplicateDetector.java >=================================================================== >RCS file: src/org/eclipse/mylar/tasks/ui/AbstractDuplicateDetector.java >diff -N src/org/eclipse/mylar/tasks/ui/AbstractDuplicateDetector.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/tasks/ui/AbstractDuplicateDetector.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************************* >+ * 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.tasks.ui; >+ >+import org.eclipse.mylar.tasks.core.RepositoryTaskData; >+import org.eclipse.mylar.tasks.core.TaskRepository; >+import org.eclipse.mylar.tasks.ui.search.SearchHitCollector; >+ >+public abstract class AbstractDuplicateDetector { >+ >+ protected String name; >+ >+ protected String kind; >+ >+ public abstract SearchHitCollector getSearchHitCollector(TaskRepository repository, RepositoryTaskData taskData); >+ >+ public void setName(String name) { >+ this.name = name; >+ } >+ >+ public void setKind(String kind) { >+ this.kind = kind; >+ } >+ >+ public String getName() { >+ return this.name; >+ } >+ >+ public String getKind() { >+ return this.kind; >+ } >+ >+} >Index: .refactorings/2007/6/23/refactorings.index >=================================================================== >RCS file: .refactorings/2007/6/23/refactorings.index >diff -N .refactorings/2007/6/23/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/6/23/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+1181108866015 Rename local variable 'kind' >+1181144506125 Move compilation unit >#P org.eclipse.mylar.jira.ui >Index: src/org/eclipse/mylar/internal/jira/ui/editor/NewJiraTaskEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.jira.ui/src/org/eclipse/mylar/internal/jira/ui/editor/NewJiraTaskEditor.java,v >retrieving revision 1.4 >diff -u -r1.4 NewJiraTaskEditor.java >--- src/org/eclipse/mylar/internal/jira/ui/editor/NewJiraTaskEditor.java 5 Jun 2007 02:55:19 -0000 1.4 >+++ src/org/eclipse/mylar/internal/jira/ui/editor/NewJiraTaskEditor.java 7 Jun 2007 17:12:00 -0000 >@@ -27,7 +27,8 @@ > } > > @Override >- public SearchHitCollector getDuplicateSearchCollector(String searchString) { >+ public SearchHitCollector getDuplicateSearchCollector(String name) { >+ String searchString = AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(taskData.getDescription()); > ContentFilter contentFilter = new ContentFilter(searchString, false, true, false, true); > > FilterDefinition filter = new FilterDefinition(); >#P org.eclipse.mylar.bugzilla.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/plugin.xml,v >retrieving revision 1.82 >diff -u -r1.82 plugin.xml >--- plugin.xml 1 May 2007 02:53:58 -0000 1.82 >+++ plugin.xml 7 Jun 2007 17:12:04 -0000 >@@ -38,4 +38,15 @@ > <newWizardShortcut id="org.eclipse.mylar.bugzilla.bugWizard"/> > </perspectiveExtension> > </extension> >+ >+ >+ >+ <extension >+ point="org.eclipse.mylar.tasks.ui.duplicateDetectors"> >+ <detector class="org.eclipse.mylar.internal.bugzilla.ui.search.StackTraceDuplicateDetector" >+ name="Stack Trace"> >+ </detector> >+ >+ </extension> >+ > </plugin> >Index: src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java,v >retrieving revision 1.31 >diff -u -r1.31 NewBugzillaTaskEditor.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java 5 Jun 2007 02:55:58 -0000 1.31 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java 7 Jun 2007 17:12:04 -0000 >@@ -10,17 +10,14 @@ > *******************************************************************************/ > package org.eclipse.mylar.internal.bugzilla.ui.editor; > >-import java.io.UnsupportedEncodingException; >-import java.net.URLEncoder; >+import java.util.List; > > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.fieldassist.ContentProposalAdapter; > import org.eclipse.jface.layout.GridDataFactory; > import org.eclipse.jface.viewers.ILabelProvider; >-import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery; > import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute; >-import org.eclipse.mylar.tasks.ui.TaskFactory; >+import org.eclipse.mylar.tasks.ui.AbstractDuplicateDetector; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; > import org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor; > import org.eclipse.mylar.tasks.ui.search.SearchHitCollector; >@@ -102,24 +99,21 @@ > } > > @Override >- public SearchHitCollector getDuplicateSearchCollector(String searchString) { >- String queryUrl = ""; >- try { >- queryUrl = repository.getUrl() + "/buglist.cgi?long_desc_type=allwordssubstr&long_desc=" >- + URLEncoder.encode(searchString, repository.getCharacterEncoding()); >- } catch (UnsupportedEncodingException e) { >- MylarStatusHandler.log(e, "Error during duplicate detection"); >- return null; >+ public SearchHitCollector getDuplicateSearchCollector(String name) { >+ String duplicateDetectorName = name.equals("default") ? "Stack Trace" : name; >+ List<AbstractDuplicateDetector> allDetectors = getDuplicateSearchCollectorsList(); >+ >+ for (AbstractDuplicateDetector detector : allDetectors) { >+ if (detector.getName().equals(duplicateDetectorName)) { >+ return detector.getSearchHitCollector(repository, taskData); >+ } > } >+ // didn't find it >+ return null; >+ } > >- queryUrl += "&product=" + taskData.getProduct(); >- >- BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search", >- TasksUiPlugin.getTaskListManager().getTaskList()); >- >- SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(), >- repository, bugzillaQuery, new TaskFactory(repository)); >- return collector; >+ protected List<AbstractDuplicateDetector> getDuplicateSearchCollectorsList() { >+ return TasksUiPlugin.getDefault().getDuplicateSearchCollectorsList(); > } > > @Override >@@ -177,4 +171,5 @@ > return newText; > } > } >+ > } >Index: src/org/eclipse/mylar/internal/bugzilla/ui/search/StackTraceDuplicateDetector.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/bugzilla/ui/search/StackTraceDuplicateDetector.java >diff -N src/org/eclipse/mylar/internal/bugzilla/ui/search/StackTraceDuplicateDetector.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/search/StackTraceDuplicateDetector.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,57 @@ >+/******************************************************************************* >+ * 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.internal.bugzilla.ui.search; >+ >+import java.io.UnsupportedEncodingException; >+import java.net.URLEncoder; >+ >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.mylar.core.MylarStatusHandler; >+import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery; >+import org.eclipse.mylar.tasks.core.RepositoryTaskData; >+import org.eclipse.mylar.tasks.core.TaskRepository; >+import org.eclipse.mylar.tasks.ui.AbstractDuplicateDetector; >+import org.eclipse.mylar.tasks.ui.TaskFactory; >+import org.eclipse.mylar.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor; >+import org.eclipse.mylar.tasks.ui.search.SearchHitCollector; >+ >+public class StackTraceDuplicateDetector extends AbstractDuplicateDetector { >+ >+ private static final String NO_STACK_MESSAGE = "Unable to locate a stack trace in the description text."; >+ >+ @Override >+ public SearchHitCollector getSearchHitCollector(TaskRepository repository, RepositoryTaskData taskData) { >+ String queryUrl = ""; >+ String searchString = AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(taskData.getDescription()); >+ >+ if (searchString == null) { >+ MessageDialog.openWarning(null, "No Stack Trace Found", NO_STACK_MESSAGE); >+ return null; >+ } >+ >+ try { >+ queryUrl = repository.getUrl() + "/buglist.cgi?long_desc_type=allwordssubstr&long_desc=" >+ + URLEncoder.encode(searchString, repository.getCharacterEncoding()); >+ } catch (UnsupportedEncodingException e) { >+ MylarStatusHandler.log(e, "Error during duplicate detection"); >+ return null; >+ } >+ >+ queryUrl += "&product=" + taskData.getProduct(); >+ >+ BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search", >+ TasksUiPlugin.getTaskListManager().getTaskList()); >+ >+ SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(), >+ repository, bugzillaQuery, new TaskFactory(repository)); >+ return collector; >+ } >+ >+} >Index: src/org/eclipse/mylar/internal/bugzilla/ui/editor/DummySearchHitProvider.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/bugzilla/ui/editor/DummySearchHitProvider.java >diff -N src/org/eclipse/mylar/internal/bugzilla/ui/editor/DummySearchHitProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/editor/DummySearchHitProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 University Of British Columbia and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * University Of British Columbia - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylar.internal.bugzilla.ui.editor; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; >+import org.eclipse.mylar.tasks.core.ITaskFactory; >+import org.eclipse.mylar.tasks.core.QueryHitCollector; >+import org.eclipse.mylar.tasks.core.RepositoryTaskData; >+import org.eclipse.mylar.tasks.core.TaskList; >+ >+public class DummySearchHitProvider extends QueryHitCollector { >+ >+ public DummySearchHitProvider(TaskList tasklist) { >+ super(tasklist, new ITaskFactory() { >+ >+ public AbstractRepositoryTask createTask(RepositoryTaskData taskData, boolean synchData, >+ boolean forced, IProgressMonitor monitor) throws CoreException { >+ return null; >+ } >+ }); >+ // ignore >+ } >+ >+ >+} >#P org.eclipse.mylar.bugzilla.tests >Index: src/org/eclipse/mylar/bugzilla/tests/DuplicateDetetionTest.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.tests/src/org/eclipse/mylar/bugzilla/tests/DuplicateDetetionTest.java,v >retrieving revision 1.18 >diff -u -r1.18 DuplicateDetetionTest.java >--- src/org/eclipse/mylar/bugzilla/tests/DuplicateDetetionTest.java 20 Apr 2007 17:48:52 -0000 1.18 >+++ src/org/eclipse/mylar/bugzilla/tests/DuplicateDetetionTest.java 7 Jun 2007 17:12:06 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.mylar.tasks.core.TaskRepository; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; > import org.eclipse.mylar.tasks.ui.TasksUiUtil; >+import org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor; > import org.eclipse.mylar.tasks.ui.editors.NewTaskEditorInput; > import org.eclipse.mylar.tasks.ui.editors.TaskEditor; > import org.eclipse.ui.IWorkbenchPage; >@@ -74,7 +75,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertNull(editor.getStackTraceFromDescription()); >+ assertNull(AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription())); > > editor.markDirty(false); > editor.close(); >@@ -96,7 +97,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertEquals(stackTrace, editor.getStackTraceFromDescription().trim()); >+ assertEquals(stackTrace, AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription()).trim()); > > editor.markDirty(false); > editor.close(); >@@ -126,7 +127,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertEquals(stackTrace, editor.getStackTraceFromDescription().trim()); >+ assertEquals(stackTrace, AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription()).trim()); > > editor.markDirty(false); > editor.close(); >@@ -155,7 +156,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertEquals(stackTrace, editor.getStackTraceFromDescription().trim()); >+ assertEquals(stackTrace, AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription()).trim()); > > editor.markDirty(false); > editor.close(); >@@ -180,7 +181,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertEquals(stackTrace, editor.getStackTraceFromDescription().trim()); >+ assertEquals(stackTrace, AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription()).trim()); > > editor.markDirty(false); > editor.close(); >@@ -204,7 +205,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertEquals(stackTrace, editor.getStackTraceFromDescription().trim()); >+ assertEquals(stackTrace, AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription()).trim()); > > editor.markDirty(false); > editor.close(); >@@ -230,7 +231,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertEquals(stackTrace, editor.getStackTraceFromDescription().trim()); >+ assertEquals(stackTrace, AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription()).trim()); > > editor.markDirty(false); > editor.close(); >@@ -255,7 +256,7 @@ > > TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); > NewBugzillaTaskEditor editor = (NewBugzillaTaskEditor) taskEditor.getActivePageInstance(); >- assertEquals(stackTrace, editor.getStackTraceFromDescription().trim()); >+ assertEquals(stackTrace, AbstractNewRepositoryTaskEditor.getStackTraceFromDescription(model.getDescription()).trim()); > > editor.markDirty(false); > editor.close(); >#P org.eclipse.mylar.trac.ui >Index: src/org/eclipse/mylar/internal/trac/ui/editor/NewTracTaskEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.trac.ui/src/org/eclipse/mylar/internal/trac/ui/editor/NewTracTaskEditor.java,v >retrieving revision 1.19 >diff -u -r1.19 NewTracTaskEditor.java >--- src/org/eclipse/mylar/internal/trac/ui/editor/NewTracTaskEditor.java 5 Jun 2007 02:55:14 -0000 1.19 >+++ src/org/eclipse/mylar/internal/trac/ui/editor/NewTracTaskEditor.java 7 Jun 2007 17:12:07 -0000 >@@ -29,9 +29,12 @@ > } > > @Override >- public SearchHitCollector getDuplicateSearchCollector(String searchString) { >+ 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();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 187602
:
67716
| 70530 |
70531