From f8c5aa5fb0f5fbd6d256025ca796df28307eb72f Mon Sep 17 00:00:00 2001 From: Chris Aniszczyk Date: Mon, 24 May 2010 11:09:15 -0500 Subject: [PATCH] Use a FilteredTree in BranchSelectionDialog To improve the usability of the branch selection dialog, we will add a filtered tree to help users navigate things. Bug: 314132 Change-Id: If1b9e2ab3a69c1d47d212eb089b644b4af269715 Signed-off-by: Chris Aniszczyk --- .../egit/ui/internal/dialogs/BranchSelectionDialog.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java index 032cc3b7..9a1f8eb0 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java @@ -1,8 +1,8 @@ /******************************************************************************* * Copyright (C) 2007, Dave Watson - * Copyright (C) 2007, Robin Rosenberg * Copyright (C) 2007, Robin Rosenberg * Copyright (C) 2008, Shawn O. Pearce + * Copyright (C) 2010, Chris Aniszczyk * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -41,8 +41,8 @@ import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RefRename; import org.eclipse.jgit.lib.RefUpdate; -import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.RefUpdate.Result; +import org.eclipse.jgit.lib.Repository; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -52,10 +52,11 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.FilteredTree; +import org.eclipse.ui.dialogs.PatternFilter; /** * The branch and reset selection dialog - * */ public class BranchSelectionDialog extends Dialog { @@ -102,12 +103,14 @@ public class BranchSelectionDialog extends Dialog { parent.setLayout(GridLayoutFactory.swtDefaults().create()); new Label(parent, SWT.NONE).setText(getRefsLabel()); - branchTree = new TreeViewer(parent, SWT.SINGLE | SWT.BORDER); + // TODO deprecated constructor for now + FilteredTree tree = new FilteredTree(parent, SWT.SINGLE | SWT.BORDER, new PatternFilter()); + branchTree = tree.getViewer(); new RepositoriesViewLabelProvider(branchTree); branchTree.setContentProvider(new RepositoriesViewContentProvider()); GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo( - branchTree.getTree()); + tree); branchTree.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { -- 2.11.4.GIT