diff options
author | Matthias Sohn | 2013-11-27 21:42:49 +0000 |
---|---|---|
committer | Robin Stocker | 2013-11-29 15:14:03 +0000 |
commit | 3531bb58dde7c65069c3103073ef219f67a00e5d (patch) | |
tree | f6fa527baf1f6af1ad2d3426572583bf03bcf8c3 | |
parent | 88b7aae8bd42cc909ce14008fdb01dc16ea6c22d (diff) | |
download | egit-3531bb58dde7c65069c3103073ef219f67a00e5d.tar.gz egit-3531bb58dde7c65069c3103073ef219f67a00e5d.tar.xz egit-3531bb58dde7c65069c3103073ef219f67a00e5d.zip |
[historyView] Enable to run commands when input is in a closed project
The team framework doesn't allow to lookup the RepositoryMapping for
resources located in a closed project. Hence we need to handle this
using path comparisons of working tree path of all known repositories
with the input's resource path.
Bug: 422716
Change-Id: I1d6e089cafbf5757877e149c0488f5ff12e99a2e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java index 7098729576..48db80b9b6 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java @@ -26,6 +26,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.egit.core.Activator; import org.eclipse.egit.core.AdapterUtils; import org.eclipse.egit.core.project.RepositoryMapping; import org.eclipse.egit.ui.internal.UIText; @@ -78,10 +79,16 @@ abstract class AbstractHistoryCommandHandler extends AbstractHandler { if (input instanceof RepositoryTreeNode) return ((RepositoryTreeNode) input).getRepository(); if (input instanceof IResource) { - RepositoryMapping mapping = RepositoryMapping - .getMapping((IResource) input); + IResource resource = (IResource) input; + RepositoryMapping mapping = RepositoryMapping.getMapping(resource); if (mapping != null) return mapping.getRepository(); + // for closed projects team framework doesn't allow to get mapping + // so try again using a path based approach + Repository repository = Activator.getDefault().getRepositoryCache() + .getRepository(resource); + if (repository != null) + return repository; } if (input instanceof IAdaptable) { IResource resource = (IResource) ((IAdaptable) input) |