diff options
authorRemy Suen2010-04-25 09:08:01 (EDT)
committer Remy Suen2010-04-25 09:08:01 (EDT)
commit59b6c95492a13e818b6eb90d4427211586803700 (patch)
parentb83aa3d33b581b2d92f043a92b953f1f329ad289 (diff)
'Repositories' view should not show scroll bars unless it has torefs/changes/97/597/1
The view's code was arbitrarily introducing a TreeColumn to the view's tree which had a width of 700. This meant that when the view's width became less than 700, it would have to show scroll bars to accomodate for this. However, it should actually only be showing scroll bars if it has to and not because of some arbitrary value has been surpassed. The worst part is that using columns means that the text can only go as far as what is dictated by its width. Since the view does not have any column headers displayed, the user actually has no way of resizing the column to view all of the content. The fix is to just not use any columns and to let the tree itself determine whether it needs to show scroll bars or not based on whether it is currently displaying content that exceeds its own width. Change-Id: Ib1da786859e0368816e229f03d9d6d1d30ec962b
2 files changed, 6 insertions, 14 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
index e23e2eb..3762f74 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
@@ -246,8 +246,6 @@ public class RepositoriesView extends ViewPart implements ISelectionProvider {
- // make the tree rather wide to accommodate long directory names
- tv.getTree().getColumn(0).setWidth(700);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
index bbbee21..a485116 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
@@ -21,23 +21,18 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.egit.ui.UIIcons;
import org.eclipse.egit.ui.UIText;
import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
* Label Provider for the Git Repositories View
-public class RepositoriesViewLabelProvider extends BaseLabelProvider implements
- ITableLabelProvider {
+public class RepositoriesViewLabelProvider extends LabelProvider {
* A map of regular images to their decorated counterpart.
@@ -53,9 +48,6 @@ public class RepositoriesViewLabelProvider extends BaseLabelProvider implements
RepositoriesViewLabelProvider(final TreeViewer viewer) {
- Tree tree = viewer.getTree();
- TreeColumn col = new TreeColumn(tree, SWT.NONE);
- col.setWidth(400);
// we could implement some hover here to display additional information
// viewer.getTree().addMouseTrackListener(new MouseTrackAdapter() {
@@ -138,12 +130,14 @@ public class RepositoriesViewLabelProvider extends BaseLabelProvider implements
- public Image getColumnImage(Object element, int columnIndex) {
+ @Override
+ public Image getImage(Object element) {
return decorateImage(
((RepositoryTreeNode) element).getType().getIcon(), element);
- public String getColumnText(Object element, int columnIndex) {
+ @Override
+ public String getText(Object element) {
RepositoryTreeNode node = (RepositoryTreeNode) element;
switch (node.getType()) {