Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
index 61d753670..74b1f6363 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
@@ -36,7 +36,10 @@ import org.eclipse.team.internal.core.target.TargetProvider;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionDelegate;
/**
@@ -60,6 +63,8 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
public final static int PROGRESS_DIALOG = 1;
public final static int PROGRESS_BUSYCURSOR = 2;
+ private IWorkbenchPart targetPart;
+
/**
* Returns the selected projects.
*
@@ -220,6 +225,7 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
this.shell = targetPart.getSite().getShell();
+ this.targetPart = targetPart;
}
/**
* Shows the given errors to the user.
@@ -348,4 +354,34 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
}
return result;
}
+
+ /**
+ * @return IWorkbenchPart
+ */
+ protected IWorkbenchPart getTargetPart() {
+ return targetPart;
+ }
+
+ /**
+ * Return the path that was active when the menu item was selected.
+ * @return IWorkbenchPage
+ */
+ protected IWorkbenchPage getTargetPage() {
+ return getTargetPart().getSite().getPage();
+ }
+
+ /**
+ * Show the view with the given ID in the perspective from which the action
+ * was executed. Returns null if the view is not registered.
+ *
+ * @param viewId
+ * @return IViewPart
+ */
+ protected IViewPart showView(String viewId) {
+ try {
+ return getTargetPage().showView(viewId);
+ } catch (PartInitException pe) {
+ return null;
+ }
+ }
} \ No newline at end of file

Back to the top