Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-10-06 16:49:20 +0000
committerJean Michel-Lemieux2003-10-06 16:49:20 +0000
commit6022bc85e4811729c2791981df99ade321ca98db (patch)
tree6200bf7c4c394885c43238f5df7071653557a0c4
parent94b6253b247c576a5cbd255bed9fc5bdeb2bc4a7 (diff)
downloadeclipse.platform.team-6022bc85e4811729c2791981df99ade321ca98db.tar.gz
eclipse.platform.team-6022bc85e4811729c2791981df99ade321ca98db.tar.xz
eclipse.platform.team-6022bc85e4811729c2791981df99ade321ca98db.zip
Bug 44226 NPE showing annotation on incoming addition
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java23
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties1
3 files changed, 20 insertions, 9 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index e245bd325..218e268b5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -48,6 +48,7 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
+import org.eclipse.team.ui.sync.ISynchronizeViewNode;
import org.eclipse.ui.PlatformUI;
/**
@@ -288,6 +289,10 @@ abstract public class CVSAction extends TeamAction {
Iterator elements = ((IStructuredSelection) selection).iterator();
while (elements.hasNext()) {
Object next = elements.next();
+ if(next instanceof ISynchronizeViewNode) {
+ resources.add(((ISynchronizeViewNode)next).getSyncInfo().getRemote());
+ continue;
+ }
if (next instanceof ICVSResource) {
resources.add(next);
continue;
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 8ef0d318d..a456be8b7 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
@@ -34,6 +34,7 @@ import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.AnnotateView;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.ui.IWorkbenchWindow;
@@ -62,6 +63,11 @@ public class ShowAnnotationAction extends CVSAction {
// Get the selected revision
final String revision;
try {
+ ResourceSyncInfo info = cvsResource.getSyncInfo();
+ if(info == null) {
+ handle(new CVSException(Policy.bind("ShowAnnotationAction.noSyncInfo", cvsResource.getName())));
+ return;
+ }
revision = cvsResource.getSyncInfo().getRevision();
} catch (CVSException e) {
throw new InvocationTargetException(e);
@@ -161,15 +167,6 @@ public class ShowAnnotationAction extends CVSAction {
* @return ICVSResource
*/
protected ICVSResource getSingleSelectedCVSResource() {
-
- // Selected from a Resource Navigator
- IResource[] resources = getSelectedResources();
- if (resources.length == 1) {
- IContainer parent = resources[0].getParent();
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
- return CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
- }
-
// Selected from a CVS Resource Navigator
ICVSResource[] cvsResources = getSelectedCVSResources();
if (cvsResources.length == 1) {
@@ -183,6 +180,14 @@ public class ShowAnnotationAction extends CVSAction {
ICVSRemoteFile cvsRemoteFile = aLogEntry.getRemoteFile();
return cvsRemoteFile;
}
+
+ // Selected from a Resource Navigator
+ IResource[] resources = getSelectedResources();
+ if (resources.length == 1) {
+ IContainer parent = resources[0].getParent();
+ ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
+ return CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
+ }
return null;
}
}
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 1a9bc76bf..6186b8bcf 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
@@ -78,6 +78,7 @@ CVSAction.mixingTags=You are mixing tags within a project. Beware that synchroni
CVSAnnotateView.showFileAnnotation=CVS Annotate - {0}
CVSAnnotateView.viewInstructions=This view shows annotations for a file in CVS. Select a file and then choose \"Team->Show Annotation\" from the context menu.
+ShowAnnotationAction.noSyncInfo=Cannot display annotation for {0} because it doesn't have an remote revision.
CVSCatchupReleaseViewer.commit=&Commit...
CVSCatchupReleaseViewer.update=&Update from Repository

Back to the top