summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDaniel Megert2011-11-21 05:50:16 (EST)
committer Jens Baumgart2011-11-30 04:58:55 (EST)
commit25a7f1ce9436bdabe2eb82c4f6fd4370404083e0 (patch)
treea942460d29e316105ef759b357bea5665b91eb47
parent67f237ca0658dcd6ec2eef95dfe294578b2598ce (diff)
downloadegit-25a7f1ce9436bdabe2eb82c4f6fd4370404083e0.zip
egit-25a7f1ce9436bdabe2eb82c4f6fd4370404083e0.tar.gz
egit-25a7f1ce9436bdabe2eb82c4f6fd4370404083e0.tar.bz2
Only check out on double-clickrefs/changes/40/4640/3
Makes sure that check out is always done on double-click and that the open listener is used for opening files from the working directory. Bug 356183 Change-Id: I893777e519d73f557e65cedad2c2f107a58270f5 Signed-off-by: Daniel Megert <daniel_megert@ch.ibm.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java41
1 files changed, 28 insertions, 13 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 adf16ce..e23d0bb 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
@@ -8,6 +8,7 @@
* Contributors:
* Mathias Kinzler (SAP AG) - initial implementation
* Dariusz Luksza <dariusz@luksza.org> - add synchronization feature
+ * Daniel Megert <daniel_megert@ch.ibm.com> - Only check out on double-click
*******************************************************************************/
package org.eclipse.egit.ui.internal.repository;
@@ -50,6 +51,8 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.JFaceColors;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -358,24 +361,25 @@ public class RepositoriesView extends CommonNavigator {
protected CommonViewer createCommonViewer(Composite aParent) {
ConfigurationChecker.checkConfiguration();
CommonViewer viewer = super.createCommonViewer(aParent);
- // handle the double-click event
+ // handle the double-click event for tags and branches
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ TreeSelection sel = (TreeSelection) event.getSelection();
+ RepositoryTreeNode element = (RepositoryTreeNode) sel
+ .getFirstElement();
+ if (element instanceof RefNode || element instanceof TagNode) {
+ executeOpenCommand();
+ }
+ }
+ });
+ // handle open event for the working directory
viewer.addOpenListener(new IOpenListener() {
-
public void open(OpenEvent event) {
TreeSelection sel = (TreeSelection) event.getSelection();
RepositoryTreeNode element = (RepositoryTreeNode) sel
.getFirstElement();
-
- if (element instanceof RefNode || element instanceof FileNode
- || element instanceof TagNode) {
- IHandlerService srv = (IHandlerService) getViewSite()
- .getService(IHandlerService.class);
-
- try {
- srv.executeCommand("org.eclipse.egit.ui.RepositoriesViewOpen", null); //$NON-NLS-1$
- } catch (Exception e) {
- Activator.handleError(e.getMessage(), e, false);
- }
+ if (element instanceof FileNode) {
+ executeOpenCommand();
}
}
});
@@ -398,6 +402,17 @@ public class RepositoriesView extends CommonNavigator {
return viewer;
}
+ private void executeOpenCommand() {
+ IHandlerService srv = (IHandlerService) getViewSite()
+ .getService(IHandlerService.class);
+
+ try {
+ srv.executeCommand("org.eclipse.egit.ui.RepositoriesViewOpen", null); //$NON-NLS-1$
+ } catch (Exception e) {
+ Activator.handleError(e.getMessage(), e, false);
+ }
+ }
+
private void activateContextService() {
IContextService contextService = (IContextService) getSite()
.getService(IContextService.class);