diff options
author | sminto | 2005-06-29 15:54:45 +0000 |
---|---|---|
committer | sminto | 2005-06-29 15:54:45 +0000 |
commit | 56b56a4c5ba9262a6fe53b876c8801436efa683a (patch) | |
tree | f20a539bd959c84e346c316076ec19b88654a1d8 /org.eclipse.mylyn.bugzilla.core/src/org/eclipse | |
parent | 5071c39992b158b46d823486bbac183c3ed3d8a9 (diff) | |
download | org.eclipse.mylyn.tasks-56b56a4c5ba9262a6fe53b876c8801436efa683a.tar.gz org.eclipse.mylyn.tasks-56b56a4c5ba9262a6fe53b876c8801436efa683a.tar.xz org.eclipse.mylyn.tasks-56b56a4c5ba9262a6fe53b876c8801436efa683a.zip |
updated so that we don't make a selection if it is was the last selection. This will prevent recursive editor activations
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core/src/org/eclipse')
2 files changed, 21 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java index b06aa3b5f..b7d653a8f 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java @@ -49,6 +49,8 @@ import org.eclipse.mylar.bugzilla.ui.OfflineView; import org.eclipse.mylar.bugzilla.ui.outline.BugzillaOutlineNode; import org.eclipse.mylar.bugzilla.ui.outline.BugzillaOutlinePage; import org.eclipse.mylar.bugzilla.ui.outline.BugzillaReportSelection; +import org.eclipse.mylar.bugzilla.ui.outline.BugzillaTools; +import org.eclipse.mylar.bugzilla.ui.outline.IBugzillaReportSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.custom.ScrolledComposite; @@ -209,12 +211,21 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener { protected HashMap<Combo, String> comboListenerMap = new HashMap<Combo, String>(); + private IBugzillaReportSelection lastSelected = null; + protected final ISelectionListener selectionListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { if ((part instanceof ContentOutline) && (selection instanceof StructuredSelection)) { Object select = ((StructuredSelection)selection).getFirstElement(); if(select instanceof BugzillaOutlineNode){ - BugzillaOutlineNode n = (BugzillaOutlineNode) select; + BugzillaOutlineNode n = (BugzillaOutlineNode) select; + + if (n != null && lastSelected != null && BugzillaTools.getHandle(n).equals(BugzillaTools.getHandle(lastSelected))){ + // we don't need to set the selection if it is alredy set + return; + } + lastSelected = n; + Object data = n.getData(); boolean highlight = true; if(n.getKey().toLowerCase().equals("comments")){ diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java index 79812d605..3bdc665c7 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java @@ -35,7 +35,15 @@ public class BugzillaOutlinePage extends ContentOutlinePage{ public void selectionChanged(IWorkbenchPart part, ISelection selection) { if ((part instanceof AbstractBugEditor) && (selection instanceof IStructuredSelection)) { if (((IStructuredSelection)selection).getFirstElement() instanceof IBugzillaReportSelection) { - getTreeViewer().setSelection(selection, true); + if(((IStructuredSelection)getSelection()).getFirstElement() instanceof IBugzillaReportSelection){ + IBugzillaReportSelection brs1 = (IBugzillaReportSelection)((IStructuredSelection)getSelection()).getFirstElement(); + IBugzillaReportSelection brs2 = ((IBugzillaReportSelection)((IStructuredSelection)selection).getFirstElement()); + if(BugzillaTools.getHandle(brs1).compareTo(BugzillaTools.getHandle(brs2)) == 0){ + // don't need to make a selection for the same element + return; + } + } + getTreeViewer().setSelection(selection, true); } } } |