summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDaniel Megert2011-11-15 09:15:14 (EST)
committer Daniel Megert2011-11-15 09:15:14 (EST)
commit38b9927dc8ae60e921791e31e33ee02d19fd8090 (patch)
tree53af52834ac40eaf357e0b189a5fffdf04150446
parent2be0b0141f0d1f6d0fe4be04c1ba5d09097071bb (diff)
downloadegit-38b9927dc8ae60e921791e31e33ee02d19fd8090.zip
egit-38b9927dc8ae60e921791e31e33ee02d19fd8090.tar.gz
egit-38b9927dc8ae60e921791e31e33ee02d19fd8090.tar.bz2
Show the repository name in the Properties dialogrefs/changes/19/4619/1
Adds the missing name by providing a workbench adapter for repository nodes. Bug 363806 Change-Id: I09de00049663d9b84c2426461d04201b0cdc58a8 Signed-off-by: Daniel Megert <daniel_megert@ch.ibm.com>
-rw-r--r--org.eclipse.egit.ui/plugin.xml5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java19
2 files changed, 23 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml
index 057c22c..e4ecdae 100644
--- a/org.eclipse.egit.ui/plugin.xml
+++ b/org.eclipse.egit.ui/plugin.xml
@@ -358,6 +358,11 @@
<adapter type="org.eclipse.core.resources.mapping.ResourceMapping"/>
<adapter type="org.eclipse.core.resources.IResource"/>
</factory>
+ <factory
+ adaptableType="org.eclipse.egit.ui.internal.repository.tree.RepositoryNode"
+ class="org.eclipse.egit.ui.internal.factories.GitAdapterFactory">
+ <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
+ </factory>
</extension>
<extension point="org.eclipse.ui.preferencePages">
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java
index ab39f4e..d85ba10 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java
@@ -2,6 +2,7 @@
* Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Dariusz Luksza <dariusz@luksza.org>
+ * Copyright (C) 2011, IBM Corporation
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -16,14 +17,18 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.egit.ui.internal.history.GitHistoryPageSource;
+import org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider;
+import org.eclipse.egit.ui.internal.repository.tree.RepositoryNode;
import org.eclipse.egit.ui.internal.synchronize.mapping.GitModelWorkbenchAdapter;
import org.eclipse.egit.ui.internal.synchronize.mapping.GitObjectMapping;
import org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob;
import org.eclipse.egit.ui.internal.synchronize.model.GitModelObject;
import org.eclipse.egit.ui.internal.synchronize.model.GitModelTree;
+import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.team.ui.history.IHistoryPageSource;
import org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter;
import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.model.WorkbenchAdapter;
/**
* This class is an intelligent "cast" operation for getting
@@ -45,6 +50,9 @@ public class GitAdapterFactory implements IAdapterFactory {
}
if (IWorkbenchAdapter.class == adapterType) {
+ if (adaptableObject instanceof RepositoryNode)
+ return getRepsitoryNodeWorkbenchAdapter((RepositoryNode)adaptableObject);
+
if (gitModelWorkbenchAdapter == null)
gitModelWorkbenchAdapter = new GitModelWorkbenchAdapter();
return gitModelWorkbenchAdapter;
@@ -81,7 +89,16 @@ public class GitAdapterFactory implements IAdapterFactory {
public Class[] getAdapterList() {
return new Class[] { IHistoryPageSource.class,
ISynchronizationCompareAdapter.class, ResourceMapping.class,
- IResource.class };
+ IResource.class, IWorkbenchAdapter.class };
}
+ private static IWorkbenchAdapter getRepsitoryNodeWorkbenchAdapter(final RepositoryNode node) {
+ return new WorkbenchAdapter() {
+ @Override
+ public String getLabel(Object object) {
+ ILabelProvider labelProvider= new RepositoriesViewLabelProvider();
+ return labelProvider.getText(node);
+ }
+ };
+ }
}