Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-11 10:17:49 -0400
committerJean Michel-Lemieux2002-04-11 10:17:49 -0400
commita7a8a42a0e2cc8d39d4d07773b95daec5ff582cd (patch)
tree1c891abda30064e07565b62f81b480e43b09f6e5
parent55ce3148e544784962ccbf3a09d358dc201f7a62 (diff)
downloadeclipse.platform.team-a7a8a42a0e2cc8d39d4d07773b95daec5ff582cd.tar.gz
eclipse.platform.team-a7a8a42a0e2cc8d39d4d07773b95daec5ff582cd.tar.xz
eclipse.platform.team-a7a8a42a0e2cc8d39d4d07773b95daec5ff582cd.zip
Bug 13030: NPE in sync view showing history
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java29
3 files changed, 45 insertions, 25 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
index f462d0d96..c3573030d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
@@ -214,21 +214,26 @@ public class HistoryView extends ViewPart implements ISelectionListener {
}
});
- getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
- try {
- if(confirmOverwrite()) {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(file.getProject());
- CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
- provider.update(new IResource[] {file}, new Command.LocalOption[] {Command.UPDATE.IGNORE_LOCAL_CHANGES},
- revisionTag, true /*create backups*/, monitor);
- }
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
- }
- });
+
+// This code will add an action that allows getting a sticky revision of a file.
+// It has been left removed until we can support removing the stickiness of
+// the file.
+// getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), new IWorkspaceRunnable() {
+// public void run(IProgressMonitor monitor) throws CoreException {
+// ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
+// try {
+// if(confirmOverwrite()) {
+// CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(file.getProject());
+// CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
+// provider.update(new IResource[] {file}, new Command.LocalOption[] {Command.UPDATE.IGNORE_LOCAL_CHANGES},
+// revisionTag, true /*create backups*/, monitor);
+// }
+// } catch (TeamException e) {
+// throw new CoreException(e.getStatus());
+// }
+// }
+// });
+
// Toggle text visible action
@@ -578,7 +583,7 @@ public class HistoryView extends ViewPart implements ISelectionListener {
if (!sel.isEmpty()) {
if (sel instanceof IStructuredSelection) {
if (((IStructuredSelection)sel).size() == 1) {
- manager.add(getRevisionAction);
+ //manager.add(getRevisionAction);
manager.add(getContentsAction);
}
}
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 e7936fa2e..1f0e966f1 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
@@ -275,7 +275,7 @@ HistoryFilterDialog.comment = &Comment containing:
HistoryFilterDialog.fromDate = &From date (M/D/Y) :
HistoryFilterDialog.toDate = &To date (M/D/Y) :
-HistoryView.addToWorkspace=&Get
+HistoryView.getContentsAction=&Get Contents
HistoryView.copy=&Copy
HistoryView.revision=Revision
HistoryView.tags=Tags
@@ -288,6 +288,8 @@ HistoryView.showComment=Show Comment Viewer
HistoryView.showTags=Show Tag Viewer
HistoryView.title=CVS Resource History
HistoryView.titleWithArgument=CVS Resource History - {0}
+HistoryView.overwriteTitle=Overwrite local changes?
+HistoryView.overwriteMsg=You have local changes. Do you want to overwrite them?
IgnoreAction.ignore=Error Ignoring Resource
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
index 7c382849b..4f20b9fb1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
@@ -98,17 +98,24 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
super(label);
}
public void run() {
- if (selection.isEmpty()) return;
+ if (selection.isEmpty()) {
+ return;
+ }
HistoryView view = HistoryView.openInActivePerspective();
- if (view == null) return;
+ if (view == null) {
+ return;
+ }
ITeamNode node = (ITeamNode)selection.getFirstElement();
IRemoteSyncElement remoteSyncElement = ((TeamFile)node).getMergeResource().getSyncElement();
- IResource resource = remoteSyncElement.getLocal();
- if (resource.exists()) {
- view.showHistory(resource);
- } else {
- ICVSRemoteFile remoteFile = (ICVSRemoteFile)remoteSyncElement.getRemote();
+ ICVSRemoteFile remoteFile = (ICVSRemoteFile)remoteSyncElement.getRemote();
+ IResource local = remoteSyncElement.getLocal();
+ ICVSRemoteFile baseFile = (ICVSRemoteFile)remoteSyncElement.getBase();
+
+ // can only show history if remote exists or local has a base.
+ if(remoteFile!=null) {
view.showHistory(remoteFile);
+ } else if(baseFile!=null) {
+ view.showHistory(baseFile);
}
}
public void selectionChanged(SelectionChangedEvent event) {
@@ -124,8 +131,14 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
}
ITeamNode first = (ITeamNode)ss.getFirstElement();
if (first instanceof TeamFile) {
+ // can only show history on elements that have a remote file
this.selection = ss;
- setEnabled(true);
+ IRemoteSyncElement remoteSyncElement = ((TeamFile)first).getMergeResource().getSyncElement();
+ if(remoteSyncElement.getRemote() != null || remoteSyncElement.getBase() != null) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
} else {
this.selection = null;
setEnabled(false);

Back to the top