Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-07-31 11:19:23 -0400
committerJean Michel-Lemieux2003-07-31 11:19:23 -0400
commit6ac98a83662222d0f081cd4d3b038ee082592615 (patch)
tree323443123d304802f87ba8168bddb77994cc81e0
parentf8eafc37da18446d6d093b44d7879a93104c1fc4 (diff)
downloadeclipse.platform.team-6ac98a83662222d0f081cd4d3b038ee082592615.tar.gz
eclipse.platform.team-6ac98a83662222d0f081cd4d3b038ee082592615.tar.xz
eclipse.platform.team-6ac98a83662222d0f081cd4d3b038ee082592615.zip
Bug 40757 : Annotate View should force switch to CVS perspective
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties1
3 files changed, 23 insertions, 14 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java
index 0856db87a..aabc68028 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java
@@ -169,12 +169,8 @@ public class AnnotateView extends ViewPart implements ISelectionChangedListener
* isn't a view registered <code>null</code> is returned.
* Otherwise the opened view part is returned.
*/
- public static AnnotateView openInActivePerspective() {
- try {
- return (AnnotateView) CVSUIPlugin.getActivePage().showView(VIEW_ID);
- } catch (PartInitException pe) {
- return null;
- }
+ public static AnnotateView openInActivePerspective() throws PartInitException {
+ return (AnnotateView) CVSUIPlugin.getActivePage().showView(VIEW_ID);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
index d40d616c2..a6a0eb624 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
@@ -37,6 +37,10 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.ui.AnnotateView;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchException;
public class ShowAnnotationAction extends CVSAction {
@@ -71,18 +75,26 @@ public class ShowAnnotationAction extends CVSAction {
}
}, true, PROGRESS_DIALOG);
+
+ if (listener.hasError()) {
+ throw new InvocationTargetException(new CVSException(Policy.bind("ShowAnnotationAction.1", listener.getError()))); //$NON-NLS-1$
+ }
+
// Open the view
- AnnotateView view = AnnotateView.openInActivePerspective();
- if (view == null) {
- return;
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window != null) {
+ try {
+ PlatformUI.getWorkbench().showPerspective("org.eclipse.team.cvs.ui.cvsPerspective", window); //$NON-NLS-1$
+ } catch (WorkbenchException e1) {
+ // If this does not work we will just open the view in the curren perspective.
+ }
}
-
- // Populate the view.
- if (listener.hasError()) {
- throw new InvocationTargetException(new CVSException("Unexpected response from CVS Server: " + listener.getError()));
- } else {
+ try {
+ AnnotateView view = AnnotateView.openInActivePerspective();
view.showAnnotations(cvsResource, listener.getCvsAnnotateBlocks(), listener.getContents());
+ } catch (PartInitException e1) {
+ handle(e1);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index a40e94e41..58382dfda 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -1011,3 +1011,4 @@ UpdateDialog.overwriteMessage=All mergable resources have been updated. However,
ReplaceOperation.taskName=Replacing...
Error.unableToShowSyncView=Error opening Synchronize View. Please ensure that the Team plugin is installed correctly.
+ShowAnnotationAction.1=Unexpected response from CVS Server: {0}

Back to the top