Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-03-04 16:48:13 -0500
committerjames2002-03-04 16:48:13 -0500
commit38655ffa5e35b603d09dd60634b88b2573bd2751 (patch)
treeae644f90f6d17b1cad8d7a85084c8e2987d51c52
parent9c120088257376ca0d289020e6a187825331a863 (diff)
downloadeclipse.platform.team-38655ffa5e35b603d09dd60634b88b2573bd2751.tar.gz
eclipse.platform.team-38655ffa5e35b603d09dd60634b88b2573bd2751.tar.xz
eclipse.platform.team-38655ffa5e35b603d09dd60634b88b2573bd2751.zip
7533: Synchronize: 'Show in Navigator' enabled for new files
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java
index 7ec91f5dd..adcaffb7e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java
@@ -42,6 +42,7 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.views.navigator.ResourceNavigator;
+import org.eclipse.ui.views.navigator.ShowInNavigatorAction;
/**
* This viewer adds a custom filter and some merge actions.
@@ -51,6 +52,26 @@ import org.eclipse.ui.views.navigator.ResourceNavigator;
*/
public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISelectionChangedListener {
+ class ShowInNavigatorAction extends Action implements ISelectionChangedListener {
+ IViewSite viewSite;
+ public ShowInNavigatorAction(IViewSite viewSite, String title) {
+ super(title, null);
+ this.viewSite = viewSite;
+ }
+ public void run() {
+ showSelectionInNavigator(viewSite);
+ }
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ if (selection.size() != 1) {
+ setEnabled(false);
+ return;
+ }
+ ITeamNode node = (ITeamNode)selection.getFirstElement();
+ setEnabled(node.getResource().isAccessible());
+ }
+ };
+
/**
* This filter hides all empty categories tree nodes.
*/
@@ -119,7 +140,7 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
private FilterAction showOnlyConflicts;
private Action refresh;
private Action expandAll;
- private Action showInNavigator;
+ private ShowInNavigatorAction showInNavigator;
private Action ignoreWhiteSpace;
// Property constant for diff mode kind
@@ -225,11 +246,8 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
// Show in navigator
if (diffModel.getViewSite() != null) {
- showInNavigator = new Action(Policy.bind("CatchupReleaseViewer.showInNavigator"), null) {
- public void run() {
- showSelectionInNavigator(diffModel.getViewSite());
- }
- };
+ showInNavigator = new ShowInNavigatorAction(diffModel.getViewSite(), Policy.bind("CatchupReleaseViewer.showInNavigator"));
+ addSelectionChangedListener(showInNavigator);
}
// Ignore white space

Back to the top