diff options
| author | Remy Suen | 2010-05-02 15:02:07 +0000 |
|---|---|---|
| committer | Remy Suen | 2010-05-02 15:02:07 +0000 |
| commit | 6460390d3e8f78f795e3b57850eeb1aaaafd7eda (patch) | |
| tree | 096d8b118921bba2ee335e3a52d667aacdccef65 | |
| parent | 373162511e9b12060fef0092359835f407441a90 (diff) | |
| download | egit-6460390d3e8f78f795e3b57850eeb1aaaafd7eda.tar.gz egit-6460390d3e8f78f795e3b57850eeb1aaaafd7eda.tar.xz egit-6460390d3e8f78f795e3b57850eeb1aaaafd7eda.zip | |
Fix broken 'Show In' feature for 'Git Repositories' view
Code was added to make the 'Git Repositories' view show up in the
'Show In' menu but no code was introduced in the view to actually
react to the request. As is, the view will simply be shown without
actually having anything selected. The fix is to implement the
IShowInTarget interface so that the request can be handled.
Change-Id: I64e11f856c25970c07e03dc3365e24f7e1733ede
| -rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java | 24 |
1 files changed, 23 insertions, 1 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 2882127e42..0ca151e4db 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 @@ -98,6 +98,8 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.ide.FileStoreEditorInput; import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.part.IShowInTarget; +import org.eclipse.ui.part.ShowInContext; import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.progress.IWorkbenchSiteProgressService; import org.eclipse.ui.views.properties.IPropertySheetPage; @@ -120,7 +122,8 @@ import org.osgi.service.prefs.BackingStoreException; * <li>Clarification whether to show projects, perhaps configurable switch</li> * */ -public class RepositoriesView extends ViewPart implements ISelectionProvider { +public class RepositoriesView extends ViewPart implements ISelectionProvider, + IShowInTarget { /** The view ID */ public static final String VIEW_ID = "org.eclipse.egit.ui.RepositoriesView"; //$NON-NLS-1$ @@ -1333,4 +1336,23 @@ public class RepositoriesView extends ViewPart implements ISelectionProvider { } + public boolean show(ShowInContext context) { + ISelection selection = context.getSelection(); + if (selection instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection) selection; + if (ss.size() == 1) { + Object element = ss.getFirstElement(); + if (element instanceof IAdaptable) { + IResource resource = (IResource) ((IAdaptable) element) + .getAdapter(IResource.class); + if (resource != null) { + showResource(resource); + return true; + } + } + } + } + return false; + } + } |
