summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRemy Suen2010-04-25 09:08:01 (EDT)
committer Remy Suen2010-04-25 09:08:01 (EDT)
commit59b6c95492a13e818b6eb90d4427211586803700 (patch)
tree0ea2e1108a8c4bc42552216809541b4aeb43a58e
parentb83aa3d33b581b2d92f043a92b953f1f329ad289 (diff)
downloadegit-59b6c95492a13e818b6eb90d4427211586803700.zip
egit-59b6c95492a13e818b6eb90d4427211586803700.tar.gz
egit-59b6c95492a13e818b6eb90d4427211586803700.tar.bz2
'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
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java18
2 files changed, 6 insertions, 14 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
index e23e2eb..3762f74 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
@@ -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);
addContextMenu();
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java
index bbbee21..a485116 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java
@@ -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.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
-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) {
viewer.setLabelProvider(this);
- 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()) {