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 46907 Details for
Bug 143567
support automatic duplicate detection before submitting reports
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]
Move dup detection to editor from wizard
duplicate-detection-in-editor.txt (text/plain), 47.24 KB, created by
Jeff Pound
on 2006-07-27 16:14:29 EDT
(
hide
)
Description:
Move dup detection to editor from wizard
Filename:
MIME Type:
Creator:
Jeff Pound
Created:
2006-07-27 16:14:29 EDT
Size:
47.24 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.tasks.ui >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/AbstractDuplicateDetectingReportWizard.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/tasks/ui/wizards/AbstractDuplicateDetectingReportWizard.java >diff -N src/org/eclipse/mylar/internal/tasks/ui/wizards/AbstractDuplicateDetectingReportWizard.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/AbstractDuplicateDetectingReportWizard.java 26 Jul 2006 05:16:43 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,62 +0,0 @@ >-/******************************************************************************* >- * 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.tasks.ui.wizards; >- >-import java.util.Iterator; >-import java.util.LinkedList; >-import java.util.List; >-import java.util.Queue; >- >-import org.eclipse.jface.wizard.IWizardPage; >-import org.eclipse.jface.wizard.Wizard; >-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; >- >-/** >- * >- * @author Jeff Pound >- */ >-public abstract class AbstractDuplicateDetectingReportWizard extends Wizard { >- >- private Queue<IWizardPage> queue = new LinkedList<IWizardPage>(); >- >- public AbstractDuplicateDetectingReportWizard() { >- setNeedsProgressMonitor(true); >- } >- >- public void queuePage(IWizardPage page) { >- queue.add(page); >- } >- >- public void addQueuedPages() { >- Iterator<IWizardPage> iter = queue.iterator(); >- while (iter.hasNext()) { >- addPage(iter.next()); >- } >- } >- >- public boolean canFinish() { >- IWizardPage findDups = getPage(FindRelatedReportsPage.PAGE_NAME); >- if (findDups == null) { >- return super.canFinish(); >- } >- >- return !findDups.equals(getContainer().getCurrentPage()) && super.canFinish(); >- } >- >- public List<AbstractRepositoryTask> getSelectedDuplicates() { >- DisplayRelatedReportsPage displayDups = (DisplayRelatedReportsPage) getPage(DisplayRelatedReportsPage.PAGE_NAME); >- if (displayDups == null) { >- return null; >- } >- >- return displayDups.getSelectedReports(); >- } >- >- public abstract List<AbstractRepositoryTask> searchForDuplicates(DuplicateDetectionData data); >-} >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/DisplayRelatedReportsPage.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/tasks/ui/wizards/DisplayRelatedReportsPage.java >diff -N src/org/eclipse/mylar/internal/tasks/ui/wizards/DisplayRelatedReportsPage.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/DisplayRelatedReportsPage.java 26 Jul 2006 05:16:43 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,358 +0,0 @@ >-/******************************************************************************* >- * 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.tasks.ui.wizards; >- >-import java.util.Iterator; >-import java.util.LinkedList; >-import java.util.List; >-import java.util.StringTokenizer; >- >-import org.eclipse.jface.wizard.WizardPage; >-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; >-import org.eclipse.mylar.tasks.core.RepositoryTaskData; >-import org.eclipse.mylar.tasks.ui.TasksUiPlugin; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.events.SelectionListener; >-import org.eclipse.swt.events.TreeEvent; >-import org.eclipse.swt.events.TreeListener; >-import org.eclipse.swt.graphics.GC; >-import org.eclipse.swt.graphics.Point; >-import org.eclipse.swt.graphics.Rectangle; >-import org.eclipse.swt.layout.FillLayout; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.layout.RowLayout; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Display; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.swt.widgets.Label; >-import org.eclipse.swt.widgets.Listener; >-import org.eclipse.swt.widgets.Shell; >-import org.eclipse.swt.widgets.TableItem; >-import org.eclipse.swt.widgets.Tree; >-import org.eclipse.swt.widgets.TreeColumn; >-import org.eclipse.swt.widgets.TreeItem; >- >-/** >- * >- * @author Jeff Pound >- */ >-public class DisplayRelatedReportsPage extends WizardPage { >- >- private static final String PAGE_DESCRIPTION = "Select duplicate report candidates to open and comment on them. Otherwise press finish to create new one."; >- >- static final String PAGE_NAME = "DisplayRelatedReportsPage"; >- >- private static final String PAGE_TITLE = "Related Reports"; >- >- private static final int LINES_PER_ITEM = 3; >- >- private List<AbstractRepositoryTask> relatedTasks; >- >- private String[] columnHeaders = { "Related Reports" }; >- >- private Tree duplicatesTree; >- >- private int[] columnWidths = { 550 }; >- >- protected DisplayRelatedReportsPage() { >- super(PAGE_NAME); >- setTitle(PAGE_TITLE); >- setDescription(PAGE_DESCRIPTION); >- // Description doesn't show up without an image present TODO: proper >- // image. >- setImageDescriptor(TasksUiPlugin.imageDescriptorFromPlugin("org.eclipse.mylar.bugzilla.ui", >- "icons/wizban/bug-wizard.gif")); >- } >- >- public void createControl(Composite parent) { >- Composite composite = new Composite(parent, SWT.NONE); >- composite.setLayout(new GridLayout()); >- setControl(composite); >- >- duplicatesTree = new Tree(composite, SWT.MULTI | SWT.CHECK | SWT.FULL_SELECTION); >- duplicatesTree.setLayoutData(new GridData(GridData.FILL_BOTH)); >- >- RowLayout gl = new RowLayout(); >- gl.spacing = 30; >- duplicatesTree.setLayout(gl); >- >- duplicatesTree.setHeaderVisible(true); >- duplicatesTree.setLinesVisible(true); >- >- for (int i = 0; i < columnHeaders.length; i++) { >- TreeColumn column = new TreeColumn(duplicatesTree, SWT.NONE); >- column.setText(columnHeaders[i]); >- } >- >- /* >- * Adapted from snippet 227 >- * http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet227.java?rev=HEAD&content-type=text/vnd.viewcvs-markup >- */ >- Listener paintListener = new Listener() { >- public void handleEvent(Event event) { >- switch (event.type) { >- case SWT.MeasureItem: { >- String text = ((TreeItem) event.item).getText(); >- Point size = event.gc.textExtent(text); >- event.width = size.x; >- event.height = Math.max(event.height, size.y); >- break; >- } >- case SWT.PaintItem: { >- String text = ((TreeItem) event.item).getText(); >- Point size = event.gc.textExtent(text); >- int offset2 = event.index == 0 ? Math.max(0, (event.height - size.y) / 2) : 0; >- event.gc.drawText(text, event.x, event.y + offset2, true); >- break; >- } >- case SWT.EraseItem: { >- event.detail &= ~SWT.FOREGROUND; >- break; >- } >- } >- } >- }; >- duplicatesTree.addListener(SWT.MeasureItem, paintListener); >- duplicatesTree.addListener(SWT.PaintItem, paintListener); >- duplicatesTree.addListener(SWT.EraseItem, paintListener); >- duplicatesTree.addTreeListener(new TreeListener() { >- public void treeCollapsed(TreeEvent arg0) { >- // packTable(); >- } >- >- public void treeExpanded(TreeEvent arg0) { >- // packTable(); >- } >- }); >- >- registerToolTipListeners(); >- } >- >- /* >- * Adapted from SWT snippet 125 >- * http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java?rev=HEAD&content-type=text/vnd.viewcvs-markup >- */ >- private void registerToolTipListeners() { >- final Shell shell = duplicatesTree.getShell(); >- final Display display = duplicatesTree.getDisplay(); >- >- // Disable native tooltip >- duplicatesTree.setToolTipText(""); >- >- // Implement a "fake" tooltip >- final Listener labelListener = new Listener() { >- public void handleEvent(Event event) { >- Label label = (Label) event.widget; >- Shell shell = label.getShell(); >- switch (event.type) { >- case SWT.MouseDown: >- Event e = new Event(); >- e.item = (TableItem) label.getData("_TABLEITEM"); >- // Assuming table is single select, set the selection as if >- // the mouse down event went through to the table >- duplicatesTree.setSelection(new TreeItem[] { (TreeItem) e.item }); >- duplicatesTree.notifyListeners(SWT.Selection, e); >- // fall through >- case SWT.MouseExit: >- shell.dispose(); >- break; >- } >- } >- }; >- >- Listener tableListener = new Listener() { >- Shell tip = null; >- >- Label label = null; >- >- public void handleEvent(Event event) { >- switch (event.type) { >- case SWT.Dispose: >- case SWT.KeyDown: >- case SWT.MouseMove: { >- if (tip == null) >- break; >- tip.dispose(); >- tip = null; >- label = null; >- break; >- } >- case SWT.MouseHover: { >- TreeItem item = duplicatesTree.getItem(new Point(event.x, event.y)); >- if (item != null) { >- if (tip != null && !tip.isDisposed()) >- tip.dispose(); >- tip = new Shell(shell, SWT.ON_TOP | SWT.TOOL); >- tip.setLayout(new FillLayout()); >- label = new Label(tip, SWT.NONE); >- label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); >- label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); >- label.setData("_TABLEITEM", item); >- label.setText((String) item.getData()); >- label.addListener(SWT.MouseExit, labelListener); >- label.addListener(SWT.MouseDown, labelListener); >- Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT); >- Rectangle rect = item.getBounds(0); >- Point pt = duplicatesTree.toDisplay(rect.x, rect.y); >- tip.setBounds(pt.x, pt.y, size.x, size.y); >- tip.setVisible(true); >- } >- } >- } >- } >- }; >- duplicatesTree.addListener(SWT.Dispose, tableListener); >- duplicatesTree.addListener(SWT.KeyDown, tableListener); >- duplicatesTree.addListener(SWT.MouseMove, tableListener); >- duplicatesTree.addListener(SWT.MouseHover, tableListener); >- >- } >- >- private void packTable() { >- for (int i = 0; i < columnHeaders.length; i++) { >- // duplicatesTree.getColumn(i).pack(); >- duplicatesTree.getColumn(i).setWidth(columnWidths[i]); >- } >- duplicatesTree.redraw(); >- } >- >- public List<AbstractRepositoryTask> getRelatedTasks() { >- return relatedTasks; >- } >- >- public void setRelatedTasks(List<AbstractRepositoryTask> relatedTasks) { >- duplicatesTree.removeAll(); >- this.relatedTasks = relatedTasks; >- if (duplicatesTree == null || this.relatedTasks == null) { >- return; >- } >- >- SelectionListener selectAllListener = new SelectionListener() { >- public void widgetDefaultSelected(SelectionEvent arg0) { >- // ignore >- } >- >- public void widgetSelected(SelectionEvent event) { >- TreeItem item = (TreeItem) event.item; >- if (item.getParentItem() != null) { >- item.getParentItem().setChecked(item.getChecked()); >- } >- if (item.getItems() != null && item.getItems().length > 0) { >- item.getItems()[0].setChecked(item.getChecked()); >- } >- } >- }; >- duplicatesTree.addSelectionListener(selectAllListener); >- >- // update the table >- Iterator<AbstractRepositoryTask> iter = this.relatedTasks.iterator(); >- while (iter.hasNext()) { >- AbstractRepositoryTask task = iter.next(); >- RepositoryTaskData taskData = task.getTaskData(); >- if (taskData == null) { >- iter.remove(); >- continue; >- } >- TreeItem item = new TreeItem(duplicatesTree, SWT.NONE); >- item.setText(new String[] { formatTreeText(taskData.getSummary(), LINES_PER_ITEM - 1) }); >- TreeItem descItem = new TreeItem(item, SWT.NONE); >- descItem.setText(formatTreeText(taskData.getDescription())); >- descItem.setGrayed(true); >- >- String toolTip = "Report Id: " + taskData.getId() + "\nCreated on: " + taskData.getCreated() >- + "\nCreated by: " + taskData.getReporter() + "\nAssigned to: " + taskData.getAssignedTo(); >- item.setData(toolTip); >- descItem.setData(toolTip); >- } >- packTable(); >- } >- >- private String formatTreeText(String text) { >- return formatTreeText(text, LINES_PER_ITEM); >- } >- >- private String formatTreeText(String text, int maxLines) { >- GC gc = new GC(duplicatesTree); >- int avgCharWidth = gc.getFontMetrics().getAverageCharWidth(); >- gc.dispose(); >- >- text = text.replace("\n", " "); >- StringTokenizer strtok = new StringTokenizer(text); >- StringBuffer formatText = new StringBuffer(); >- int charsPerLine = columnWidths[0] / avgCharWidth; >- int lines = 0; >- >- // character wrap >- // while (strtok.hasMoreTokens() && lines < maxLines) { >- // String line = strtok.nextToken(); >- // while (line.length() > charsPerLine && lines < maxLines) { >- // String trimmedLine = line.substring(0, charsPerLine); >- // formatText.append(trimmedLine + "\n"); >- // lines++; >- // line = line.substring(charsPerLine); >- // } >- // formatText.append(line + "\n"); >- // lines++; >- // } >- >- // word wrap >- StringBuffer line = new StringBuffer(); >- while (strtok.hasMoreTokens() && lines < maxLines) { >- String word = strtok.nextToken(); >- while (strtok.hasMoreTokens() && line.length() + word.length() < charsPerLine) { >- line.append(word + ((line.length() + word.length() + 1 > charsPerLine) ? "" : " ")); >- word = strtok.nextToken(); >- } >- if (!strtok.hasMoreTokens()) { >- line.append(word); >- } >- formatText.append(((formatText.length() == 0) ? "" : "\n") + line.toString()); >- lines++; >- line.delete(0, line.length()); >- line.append(word + " "); >- } >- >- // pad elements to ensure no weird repaint artifacts >- // this also centres text in the element (aligned with tree arrow) >- if (lines < LINES_PER_ITEM) { >- int diff = LINES_PER_ITEM - lines; >- for (int i = 0; i < diff / 2; i++) { >- formatText.append("\n "); >- lines++; >- } >- while (lines < LINES_PER_ITEM) { >- formatText.insert(0, " \n"); >- lines++; >- } >- lines++; >- } >- >- // add "..." if we're cutting off the text >- if (strtok.hasMoreTokens()) { >- formatText.replace(formatText.length() - 4, formatText.length(), "..."); >- } >- >- return formatText.toString(); >- } >- >- public List<AbstractRepositoryTask> getSelectedReports() { >- List<AbstractRepositoryTask> selected = new LinkedList<AbstractRepositoryTask>(); >- TreeItem[] items = duplicatesTree.getItems(); >- >- for (int i = 0; i < items.length; i++) { >- if (items[i].getChecked()) { >- selected.add(relatedTasks.get(i)); >- } >- } >- >- return selected; >- } >-} >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/DuplicateDetectionData.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/tasks/ui/wizards/DuplicateDetectionData.java >diff -N src/org/eclipse/mylar/internal/tasks/ui/wizards/DuplicateDetectionData.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/DuplicateDetectionData.java 26 Jul 2006 05:16:43 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,27 +0,0 @@ >-/******************************************************************************* >- * 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.tasks.ui.wizards; >- >-/** >- * >- * @author Jeff Pound >- */ >-public class DuplicateDetectionData { >- >- // TODO add more fields to detect duplicates against >- private String stackTrace = ""; >- >- public String getStackTrace() { >- return stackTrace; >- } >- >- public void setStackTrace(String stackTrace) { >- this.stackTrace = stackTrace; >- } >-} >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskWizard.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskWizard.java,v >retrieving revision 1.2 >diff -u -r1.2 NewRepositoryTaskWizard.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskWizard.java 26 Jul 2006 05:16:43 -0000 1.2 >+++ src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskWizard.java 27 Jul 2006 20:13:50 -0000 >@@ -45,9 +45,4 @@ > } > return connectorKinds; > } >- >- public void setDuplicateData(DuplicateDetectionData duplicateData) { >- ((NewRepositoryTaskPage)getSelectRepositoryPage()).setDuplicateData(duplicateData); >- ((NewRepositoryTaskPage)getSelectRepositoryPage()).setUseStackTrace(true); >- } > } >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/FindRelatedReportsPage.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/tasks/ui/wizards/FindRelatedReportsPage.java >diff -N src/org/eclipse/mylar/internal/tasks/ui/wizards/FindRelatedReportsPage.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/FindRelatedReportsPage.java 26 Jul 2006 05:16:43 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,112 +0,0 @@ >-/******************************************************************************* >- * 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.tasks.ui.wizards; >- >-import org.eclipse.jface.wizard.IWizardPage; >-import org.eclipse.jface.wizard.WizardPage; >-import org.eclipse.mylar.tasks.ui.TasksUiPlugin; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.ModifyEvent; >-import org.eclipse.swt.events.ModifyListener; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Label; >-import org.eclipse.swt.widgets.Text; >- >-/** >- * >- * @author Jeff Pound >- */ >-public class FindRelatedReportsPage extends WizardPage implements IWizardPage { >- >- private static final String PAGE_DESCRIPTION = "Enter the stack trace to search for, you can trim the stack trace to make your search more general"; >- >- private static final String PAGE_TITLE = "Find Related Reports"; >- >- static final String PAGE_NAME = "FindRelatedReportsPage"; >- >- private Text stackTraceBox; >- >- private Text searchTermsText; >- >- private DuplicateDetectionData duplicateData; >- >- public FindRelatedReportsPage(DuplicateDetectionData duplicateData) { >- super(PAGE_NAME); >- setTitle(PAGE_TITLE); >- setDescription(PAGE_DESCRIPTION); >- >- // Description doesn't show up without an image present TODO: proper image. >- setImageDescriptor(TasksUiPlugin.imageDescriptorFromPlugin("org.eclipse.mylar.bugzilla.ui", >- "icons/wizban/bug-wizard.gif")); >- this.duplicateData = duplicateData; >- if (this.duplicateData == null) { >- this.duplicateData = new DuplicateDetectionData(); >- } >- } >- >- public void createControl(Composite parent) { >- Composite composite = new Composite(parent, SWT.NONE); >- composite.setLayout(new GridLayout(2, false)); >- setControl(composite); >- >- Label searchLabel = new Label(composite, SWT.LEFT); >- searchLabel.setText("Search Terms "); >- searchTermsText = new Text(composite, SWT.SINGLE); >- searchTermsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >- searchTermsText.setText(""); >- searchTermsText.setEnabled(false); >- >- Label stackLabel = new Label(composite, SWT.LEFT); >- stackLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1)); >- stackLabel.setText("Stack trace"); >- stackTraceBox = new Text(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); >- stackTraceBox.setText(duplicateData.getStackTrace()); >- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); >- // prevent the box from oversizing the wizard dialog >- if (!"".equals(duplicateData.getStackTrace())) { >- gd.heightHint = 200; >- gd.widthHint = 600; >- } >- stackTraceBox.setLayoutData(gd); >- stackTraceBox.addModifyListener(new ModifyListener() { >- public void modifyText(ModifyEvent arg0) { >- if ("".equals(stackTraceBox.getText().trim())) { >- setPageComplete(false); >- } else { >- setPageComplete(true); >- } >- } >- }); >- } >- >- public DuplicateDetectionData getDuplicateData() { >- if (stackTraceBox != null) { >- // in case stack trace is user modified >- duplicateData.setStackTrace(stackTraceBox.getText()); >- } >- return duplicateData; >- } >- >- public IWizardPage getNextPage() { >- DisplayRelatedReportsPage nextPage = (DisplayRelatedReportsPage) super.getNextPage(); >- nextPage.setRelatedTasks(((AbstractDuplicateDetectingReportWizard) getWizard()) >- .searchForDuplicates(getDuplicateData())); >- >- return super.getNextPage(); >- } >- >- public boolean canFlipToNextPage() { >- return !"".equals(stackTraceBox.getText()); >- } >-} >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskPage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskPage.java,v >retrieving revision 1.2 >diff -u -r1.2 NewRepositoryTaskPage.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskPage.java 26 Jul 2006 05:16:43 -0000 1.2 >+++ src/org/eclipse/mylar/internal/tasks/ui/wizards/NewRepositoryTaskPage.java 27 Jul 2006 20:13:50 -0000 >@@ -14,18 +14,13 @@ > import java.util.List; > > import org.eclipse.jface.wizard.IWizard; >-import org.eclipse.jface.wizard.IWizardPage; > import org.eclipse.mylar.tasks.core.TaskRepository; > import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnector; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; > import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Link; > > /** > * @author Mik Kersten >@@ -33,16 +28,6 @@ > */ > public class NewRepositoryTaskPage extends SelectRepositoryPage { > >- private Button searchForDuplicatesButton; >- >- private DuplicateDetectionData duplicateData; >- >- private boolean initUseStackTrace = false; >- >- private IWizard newWizard; >- >- private boolean dupPagesAdded = false; >- > public NewRepositoryTaskPage(List<String> kinds) { > super(kinds); > } >@@ -51,75 +36,29 @@ > protected IWizard createWizard(TaskRepository taskRepository) { > AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector( > taskRepository.getKind()); >- newWizard = connector.getNewTaskWizard(taskRepository, getSelection()); >- if (newWizard instanceof AbstractDuplicateDetectingReportWizard && getUseStackTrace()) { >- AbstractDuplicateDetectingReportWizard dupWizard = (AbstractDuplicateDetectingReportWizard) newWizard; >- // queue the duplicate detection pages to be added to the >- // wizard when it gets created >- dupWizard.queuePage(new FindRelatedReportsPage(duplicateData)); >- dupWizard.queuePage(new DisplayRelatedReportsPage()); >- dupPagesAdded = true; >- } >- return newWizard; >- } >- >- public IWizardPage getNextPage() { >- // ensure the dup pages are added (in the case of going "back" in the >- // wizard) >- if (!dupPagesAdded && newWizard instanceof AbstractDuplicateDetectingReportWizard && getUseStackTrace()) { >- AbstractDuplicateDetectingReportWizard dupWizard = (AbstractDuplicateDetectingReportWizard) newWizard; >- dupWizard.addPage(new FindRelatedReportsPage(duplicateData)); >- dupWizard.addPage(new DisplayRelatedReportsPage()); >- dupPagesAdded = true; >- } >- return super.getNextPage(); >+ return connector.getNewTaskWizard(taskRepository, getSelection()); > } > > public void createControl(Composite parent) { > Composite container = new Composite(parent, SWT.NONE); > container.setLayout(new GridLayout()); >- // super.createControl(container); >- createTableViewer(container).setLayoutData(new GridData(GridData.FILL_BOTH)); > >- searchForDuplicatesButton = new Button(container, SWT.CHECK); >- searchForDuplicatesButton.setText("Search for related stack traces before creating"); >- searchForDuplicatesButton.setSelection(initUseStackTrace); >- >- Link link = new Link(container, SWT.NONE); >- link.setText("<A>Close wizard and search for related reports before continuing</A>"); >- final IWizardPage thisPage = this; >- link.addSelectionListener(new SelectionListener() { >- public void widgetDefaultSelected(SelectionEvent arg0) { >- // ignore >- } >- >- public void widgetSelected(SelectionEvent arg0) { >- thisPage.getWizard().performCancel(); >- } >- }); >+// Link link = new Link(container, SWT.NONE); >+// link.setText("<A>Close wizard and search for related reports before continuing</A>"); >+// link.addSelectionListener(new SelectionListener() { >+// public void widgetDefaultSelected(SelectionEvent arg0) { >+// // ignore >+// } >+// >+// public void widgetSelected(SelectionEvent arg0) { >+// getWizard().performCancel(); >+// getWizard().getContainer().getShell().dispose(); >+// NewSearchUI.openSearchDialog(NewSearchUI.getSearchResultView().getSite().getWorkbenchWindow(), ""); >+// >+// } >+// }); > >+ createTableViewer(container).setLayoutData(new GridData(GridData.FILL_BOTH)); > setControl(container); > } >- >- public DuplicateDetectionData getDuplicateData() { >- return duplicateData; >- } >- >- public void setDuplicateData(DuplicateDetectionData duplicateData) { >- this.duplicateData = duplicateData; >- } >- >- public void setUseStackTrace(boolean use) { >- if (searchForDuplicatesButton != null) { >- searchForDuplicatesButton.setSelection(use); >- } >- initUseStackTrace = use; >- } >- >- public boolean getUseStackTrace() { >- if (searchForDuplicatesButton != null) { >- return searchForDuplicatesButton.getSelection(); >- } >- return initUseStackTrace; >- } > } >\ No newline at end of file >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java,v >retrieving revision 1.2 >diff -u -r1.2 MultiRepositoryAwareWizard.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java 26 Jul 2006 05:16:43 -0000 1.2 >+++ src/org/eclipse/mylar/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java 27 Jul 2006 20:13:50 -0000 >@@ -52,8 +52,4 @@ > // Can't finish on the first page > return false; > } >- >- public SelectRepositoryPage getSelectRepositoryPage() { >- return selectRepositoryPage; >- } > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.198 >diff -u -r1.198 MANIFEST.MF >--- META-INF/MANIFEST.MF 26 Jul 2006 16:07:22 -0000 1.198 >+++ META-INF/MANIFEST.MF 27 Jul 2006 20:13:49 -0000 >@@ -19,7 +19,8 @@ > org.eclipse.mylar.tasks.core, > org.eclipse.mylar.monitor, > org.eclipse.core.resources, >- org.eclipse.ui.ide >+ org.eclipse.ui.ide, >+ org.eclipse.search > Eclipse-AutoStart: true > Bundle-Vendor: Eclipse.org > Export-Package: org.eclipse.mylar.internal.tasks.ui, >Index: src/org/eclipse/mylar/internal/tasks/ui/actions/NewTaskFromErrorAction.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/internal/tasks/ui/actions/NewTaskFromErrorAction.java,v >retrieving revision 1.2 >diff -u -r1.2 NewTaskFromErrorAction.java >--- src/org/eclipse/mylar/internal/tasks/ui/actions/NewTaskFromErrorAction.java 26 Jul 2006 05:16:43 -0000 1.2 >+++ src/org/eclipse/mylar/internal/tasks/ui/actions/NewTaskFromErrorAction.java 27 Jul 2006 20:13:49 -0000 >@@ -20,7 +20,6 @@ > import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.mylar.internal.tasks.ui.editors.AbstractRepositoryTaskEditor; > import org.eclipse.mylar.internal.tasks.ui.editors.ExistingBugEditorInput; >-import org.eclipse.mylar.internal.tasks.ui.wizards.DuplicateDetectionData; > import org.eclipse.mylar.internal.tasks.ui.wizards.NewRepositoryTaskWizard; > import org.eclipse.pde.internal.runtime.logview.LogEntry; > import org.eclipse.swt.widgets.Shell; >@@ -57,13 +56,6 @@ > } > > NewRepositoryTaskWizard wizard = new NewRepositoryTaskWizard(); >- if (selection != null) { >- DuplicateDetectionData dup = new DuplicateDetectionData(); >- dup.setStackTrace(((selection.getStack() == null) ? "no stack trace available" : selection.getStack())); >- // getSummaryString(selection); >- >- wizard.setDuplicateData(dup); >- } > > Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); > if (wizard != null && shell != null && !shell.isDisposed()) { >#P org.eclipse.mylar.bugzilla.tests >Index: src/org/eclipse/mylar/bugzilla/tests/headless/BugzillaDuplicateDetectionTest.java >=================================================================== >RCS file: src/org/eclipse/mylar/bugzilla/tests/headless/BugzillaDuplicateDetectionTest.java >diff -N src/org/eclipse/mylar/bugzilla/tests/headless/BugzillaDuplicateDetectionTest.java >--- src/org/eclipse/mylar/bugzilla/tests/headless/BugzillaDuplicateDetectionTest.java 26 Jul 2006 05:16:55 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,57 +0,0 @@ >-/******************************************************************************* >- * 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.bugzilla.tests.headless; >- >-import java.util.List; >- >-import junit.framework.TestCase; >- >-import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin; >-import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; >-import org.eclipse.mylar.internal.bugzilla.ui.wizard.NewBugzillaReportWizard; >-import org.eclipse.mylar.internal.tasks.ui.wizards.DuplicateDetectionData; >-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; >-import org.eclipse.mylar.tasks.core.TaskRepository; >- >-/** >- * >- * @author Jeff Pound >- */ >-public class BugzillaDuplicateDetectionTest extends TestCase { >- >- private TaskRepository repository; >- >- @Override >- protected void setUp() throws Exception { >- super.setUp(); >- repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL); >- } >- >- public void testDuplicateDetection() throws Exception { >- String stackTrace = "java.lang.NullPointerException\njeff.testing.stack.trace.functionality"; >- String fakeStackTrace = "thisisnotreallyastacktrace"; >- int numMatches = 2; >- >- NewBugzillaReportWizard wizard = new NewBugzillaReportWizard(repository, null); >- DuplicateDetectionData dupData = new DuplicateDetectionData(); >- dupData.setStackTrace(stackTrace); >- >- List<AbstractRepositoryTask> tasks = wizard.searchForDuplicates(dupData); >- assertNotNull(tasks); >- assertEquals(numMatches, tasks.size()); >- >- dupData.setStackTrace(fakeStackTrace); >- tasks = wizard.searchForDuplicates(dupData); >- assertNotNull(tasks); >- assertEquals(0, tasks.size()); >- } >-} >#P org.eclipse.mylar.bugzilla.ui >Index: src/org/eclipse/mylar/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java,v >retrieving revision 1.43 >diff -u -r1.43 NewBugzillaReportWizard.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java 26 Jul 2006 05:16:49 -0000 1.43 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java 27 Jul 2006 20:13:56 -0000 >@@ -10,31 +10,15 @@ > *******************************************************************************/ > package org.eclipse.mylar.internal.bugzilla.ui.wizard; > >-import java.io.UnsupportedEncodingException; >-import java.net.URLEncoder; >-import java.util.Iterator; >-import java.util.LinkedList; >-import java.util.List; >- > import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.MultiStatus; >-import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.Status; > import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin; >+import org.eclipse.jface.wizard.Wizard; > import org.eclipse.mylar.internal.bugzilla.core.NewBugzillaReport; > import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin; > import org.eclipse.mylar.internal.bugzilla.ui.editor.NewBugEditorInput; >-import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaRepositoryQuery; > import org.eclipse.mylar.internal.tasks.ui.TaskUiUtil; >-import org.eclipse.mylar.internal.tasks.ui.editors.AbstractBugEditorInput; >-import org.eclipse.mylar.internal.tasks.ui.editors.ExistingBugEditorInput; >-import org.eclipse.mylar.internal.tasks.ui.wizards.AbstractDuplicateDetectingReportWizard; >-import org.eclipse.mylar.internal.tasks.ui.wizards.DuplicateDetectionData; >-import org.eclipse.mylar.tasks.core.AbstractQueryHit; >-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; > import org.eclipse.mylar.tasks.core.TaskRepository; >-import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnector; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; > import org.eclipse.ui.INewWizard; > import org.eclipse.ui.IWorkbench; >@@ -45,7 +29,7 @@ > * @author Mik Kersten > * @author Rob Elves > */ >-public class NewBugzillaReportWizard extends AbstractDuplicateDetectingReportWizard implements INewWizard { >+public class NewBugzillaReportWizard extends Wizard implements INewWizard { > > private static final String TITLE = "New Bugzilla Task"; > >@@ -91,28 +75,16 @@ > super.addPages(); > addPage(productPage); > >- super.addQueuedPages(); > } > > @Override > public boolean canFinish() { >- return completed && super.canFinish(); >+ return completed; > } > > @Override > public boolean performFinish() { >- List<AbstractRepositoryTask> dups = getSelectedDuplicates(); >- if (dups != null && !dups.isEmpty()) { >- Iterator<AbstractRepositoryTask> iter = dups.iterator(); >- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >- while (iter.hasNext()) { >- AbstractRepositoryTask task = iter.next(); >- AbstractBugEditorInput editorInput = new ExistingBugEditorInput(TasksUiPlugin.getRepositoryManager() >- .getRepository(task.getRepositoryKind(), task.getRepositoryUrl()), task.getTaskData()); >- TaskUiUtil.openEditor(editorInput, BugzillaUiPlugin.EXISTING_BUG_EDITOR_ID, page); >- } >- return true; >- } >+ > try { > productPage.saveDataToModel(); > NewBugEditorInput editorInput = new NewBugEditorInput(repository, model); >@@ -126,49 +98,6 @@ > return false; > } > >- /** >- * Perform a query using the given duplicate detection criteria and return a >- * list of tasks which match. >- */ >- @Override >- public List<AbstractRepositoryTask> searchForDuplicates(DuplicateDetectionData data) { >- // RepositoryQueryResultsFactory factory = new >- // RepositoryQueryResultsFactory(); >- // IBugzillaSearchResultCollector collector = new >- // BugzillaSearchResultCollector(); >- // factory.performQuery(repository.getUrl(), collector, queryUrl, >- // proxySettings, 20, BugzillaPlugin.ENCODING_UTF_8); >- >- String[] products = productPage.getSelectedProducts(); >- >- // TODO: Is there a class that can create this string? >- String queryUrl; >- try { >- queryUrl = repository.getUrl() + "/buglist.cgi?long_desc_type=allwordssubstr&long_desc=" >- + URLEncoder.encode("Stack Trace:\n" + data.getStackTrace(), BugzillaPlugin.ENCODING_UTF_8); >- } catch (UnsupportedEncodingException e) { >- // This should never happen >- return null; >- } >- >- for (int i = 0; i < products.length; i++) { >- queryUrl += "&product=" + products[i]; >- } >- >- List<AbstractRepositoryTask> tasks = new LinkedList<AbstractRepositoryTask>(); >- BugzillaRepositoryQuery repositoryQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, >- "DUPLICATE_DETECTION_QUERY", "20", TasksUiPlugin.getTaskListManager().getTaskList()); >- AbstractRepositoryConnector connector = (AbstractRepositoryConnector) TasksUiPlugin.getRepositoryManager() >- .getRepositoryConnector(BugzillaPlugin.REPOSITORY_KIND); >- List<AbstractQueryHit> hits = connector.performQuery(repositoryQuery, new NullProgressMonitor(), >- new MultiStatus(TasksUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", null)); >- Iterator<AbstractQueryHit> iterator = hits.iterator(); >- while (iterator.hasNext()) { >- tasks.add(iterator.next().getOrCreateCorrespondingTask()); >- } >- >- return tasks; >- } > } > > // @Override >@@ -231,4 +160,4 @@ > // MylarTaskListPlugin.getSynchronizationManager().synchNow(0); > // > // return true; >-// } >\ No newline at end of file >+// } >Index: src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java,v >retrieving revision 1.35 >diff -u -r1.35 BugzillaProductPage.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java 26 Jul 2006 05:16:49 -0000 1.35 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java 27 Jul 2006 20:13:55 -0000 >@@ -287,7 +287,7 @@ > listBox.setFocus(); > } > >- protected String[] getSelectedProducts() { >+ private String[] getSelectedProducts() { > ArrayList<String> products = new ArrayList<String>(); > if (selection == null) { > return products.toArray(new String[0]); >@@ -513,4 +513,4 @@ > // return super.getNextPage(); > // } > >-} >\ No newline at end of file >+} >Index: src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java,v >retrieving revision 1.78 >diff -u -r1.78 ExistingBugEditor.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java 26 Jul 2006 05:16:49 -0000 1.78 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java 27 Jul 2006 20:13:53 -0000 >@@ -261,10 +261,6 @@ > FormToolkit toolkit = new FormToolkit(composite.getDisplay()); > RepositoryTaskAttribute owner = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED); > >- if (repository.getUserName() == null) { >- return; >- } >- > if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) { > return; > } >Index: src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugEditor.java,v >retrieving revision 1.37 >diff -u -r1.37 NewBugEditor.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugEditor.java 26 Jul 2006 21:19:30 -0000 1.37 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/editor/NewBugEditor.java 27 Jul 2006 20:13:54 -0000 >@@ -12,6 +12,7 @@ > > import java.io.UnsupportedEncodingException; > import java.net.Proxy; >+import java.net.URLEncoder; > import java.util.Calendar; > import java.util.GregorianCalendar; > >@@ -26,6 +27,11 @@ > import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportSubmitForm; > import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; > import org.eclipse.mylar.internal.bugzilla.ui.WebBrowserDialog; >+import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchOperation; >+import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchQuery; >+import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchResultCollector; >+import org.eclipse.mylar.internal.bugzilla.ui.search.IBugzillaSearchOperation; >+import org.eclipse.mylar.internal.bugzilla.ui.search.IBugzillaSearchResultCollector; > import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaRepositoryConnector; > import org.eclipse.mylar.internal.tasks.ui.TaskUiUtil; > import org.eclipse.mylar.internal.tasks.ui.editors.AbstractRepositoryTaskEditor; >@@ -38,9 +44,11 @@ > import org.eclipse.mylar.tasks.core.RepositoryTaskData; > import org.eclipse.mylar.tasks.core.TaskCategory; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; >+import org.eclipse.search.ui.NewSearchUI; > import org.eclipse.swt.SWT; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Listener; >@@ -61,12 +69,18 @@ > */ > public class NewBugEditor extends AbstractRepositoryTaskEditor { > >+ 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"; > >+ private static final String LABEL_BUTTON_SEARCH_DUPS = "Search for Duplicates"; >+ > protected RepositoryTaskData taskData; > > protected String newSummary = ""; > >+ private Button searchDuplicatesButton; >+ > @Override > public void init(IEditorSite site, IEditorInput input) throws PartInitException { > if (!(input instanceof NewBugEditorInput)) >@@ -172,6 +186,45 @@ > return taskData.getLabel(); > } > >+ protected void searchForDuplicates() { >+ >+ String stackTrace = getStackTraceFromDescription(); >+ if (stackTrace == null) { >+ MessageDialog.openWarning(null, "No Stack Trace Found", NO_STACK_MESSAGE); >+ return; >+ } >+ >+ String queryUrl = ""; >+ try { >+ queryUrl = repository.getUrl() + "/buglist.cgi?long_desc_type=allwordssubstr&long_desc=" >+ + URLEncoder.encode("Stack Trace:\n" + stackTrace, BugzillaPlugin.ENCODING_UTF_8); >+ } catch (UnsupportedEncodingException e) { >+ // This should never happen >+ } >+ >+ queryUrl += "&product=" + getRepositoryTaskData().getProduct(); >+ >+ IBugzillaSearchResultCollector resultCollector = new BugzillaSearchResultCollector(); >+ IBugzillaSearchOperation operation = new BugzillaSearchOperation(repository, queryUrl, TasksUiPlugin >+ .getDefault().getProxySettings(), resultCollector, "100"); >+ BugzillaSearchQuery query = new BugzillaSearchQuery(operation); >+ >+ NewSearchUI.runQueryInBackground(query); >+ } >+ >+ private String getStackTraceFromDescription() { >+ String description = newDescriptionTextViewer.getTextWidget().getText().trim(); >+ // TODO: improve stack trace detection >+ int index; >+ String stackIdentifier = "Stack Trace:\n"; >+ if (description == null || (index = description.indexOf(stackIdentifier)) < 0) { >+ return null; >+ } >+ >+ description = description.substring(index + stackIdentifier.length()); >+ return description; >+ } >+ > @Override > protected void submitBug() { > submitButton.setEnabled(false); >@@ -237,7 +290,7 @@ > Calendar reminderCalendar = GregorianCalendar.getInstance(); > TasksUiPlugin.getTaskListManager().setScheduledToday(reminderCalendar); > TasksUiPlugin.getTaskListManager().setReminder(newTask, reminderCalendar.getTime()); >- >+ > TaskUiUtil.refreshAndOpenTaskListElement(newTask); > } > return; >@@ -344,6 +397,15 @@ > > protected void addActionButtons(Composite buttonComposite) { > FormToolkit toolkit = new FormToolkit(buttonComposite.getDisplay()); >+ searchDuplicatesButton = toolkit.createButton(buttonComposite, LABEL_BUTTON_SEARCH_DUPS, SWT.NONE); >+ GridData searchDuplicatesButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); >+ searchDuplicatesButton.setLayoutData(searchDuplicatesButtonData); >+ searchDuplicatesButton.addListener(SWT.Selection, new Listener() { >+ public void handleEvent(Event e) { >+ searchForDuplicates(); >+ } >+ }); >+ > submitButton = toolkit.createButton(buttonComposite, "Create", SWT.NONE); > GridData submitButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); > submitButton.setLayoutData(submitButtonData); >@@ -354,5 +416,5 @@ > }); > submitButton.addListener(SWT.FocusIn, new GenericListener()); > } >- >+ > } >Index: .refactorings/2006/7/30/refactorings.history >=================================================================== >RCS file: .refactorings/2006/7/30/refactorings.history >diff -N .refactorings/2006/7/30/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2006/7/30/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="Extract local variable 'stackIdentifier' from expression '"Stack Trace:"' - Variable name: 'stackIdentifier' - Destination method: 'org.eclipse.mylar.internal.bugzilla.ui.editor.NewBugEditor.getStackTraceFromDescription()' - Variable expression: '"Stack Trace:"' - Replace occurrences of expression with variable" description="Extract local variable 'stackIdentifier'" final="false" id="org.eclipse.jdt.ui.extract.temp" input="/src<org.eclipse.mylar.internal.bugzilla.ui.editor{NewBugEditor.java" name="stackIdentifier" replace="true" selection="8464 14" stamp="1154025692191" version="1.0"/> >+<refactoring comment="Extract constant 'org.eclipse.mylar.internal.bugzilla.ui.editor.NewBugEditor.NO_STACK_MESSAGE' from expression '"Unable to locate a stack trace in the description text.\nDuplicate search currently only supports stack trace matching."' - Constant name: 'NO_STACK_MESSAGE' - Constant expression: '"Unable to locate a stack trace in the description text.\nDuplicate search currently only supports stack trace matching."' - Declared visibility: 'private' - Replace occurrences of expression with constant" description="Extract constant 'NO_STACK_MESSAGE'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src<org.eclipse.mylar.internal.bugzilla.ui.editor{NewBugEditor.java" name="NO_STACK_MESSAGE" qualify="false" replace="true" selection="7580 0" stamp="1154026840382" version="1.0" visibility="2"/> >+</session> >Index: .refactorings/2006/7/30/refactorings.index >=================================================================== >RCS file: .refactorings/2006/7/30/refactorings.index >diff -N .refactorings/2006/7/30/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2006/7/30/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+1154025692191 Extract local variable 'stackIdentifier' >+1154026840382 Extract constant 'NO_STACK_MESSAGE'
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 143567
:
46617
|
46618
|
46620
|
46621
|
46646
|
46850
|
46851
| 46907 |
46929
|
47016
|
47017
|
47021
|
47025