diff options
author | Michael Valenta | 2006-12-14 17:51:53 +0000 |
---|---|---|
committer | Michael Valenta | 2006-12-14 17:51:53 +0000 |
commit | 70a03f90603fd37eb32b287decc7a3a5c2e136a6 (patch) | |
tree | 1df9a3f5e4704fc24a560f874d1d9cbaccd0a9c4 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs | |
parent | abca3876cb04e7fe7f023c8b5bf70d0704556ce2 (diff) | |
download | eclipse.platform.team-70a03f90603fd37eb32b287decc7a3a5c2e136a6.tar.gz eclipse.platform.team-70a03f90603fd37eb32b287decc7a3a5c2e136a6.tar.xz eclipse.platform.team-70a03f90603fd37eb32b287decc7a3a5c2e136a6.zip |
Bug 168078 NPE on Show Annotation for old revision
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs')
2 files changed, 21 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java index 7641e2175..79a48816f 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java @@ -50,6 +50,7 @@ import org.eclipse.team.internal.ccvs.core.client.Update; import org.eclipse.team.internal.ccvs.core.filehistory.*; import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.core.resources.RemoteFile; +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.actions.CVSAction; import org.eclipse.team.internal.ccvs.ui.actions.MoveRemoteTagAction; @@ -1780,7 +1781,19 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC if (path == null && previousPath == null) return true; - return (path != null && previousPath != null && path.equals(previousPath)); + return (path != null && previousPath != null && path.equals(previousPath) && isSameRepository(file.getParent(), previousFile.getParent())); + } + + + private boolean isSameRepository(ICVSFolder parent1, ICVSFolder parent2) { + try { + FolderSyncInfo info1 = parent1.getFolderSyncInfo(); + FolderSyncInfo info2 = parent2.getFolderSyncInfo(); + return (info1 != null && info2 != null && info1.getRemoteLocation().equals(info2.getRemoteLocation())); + } catch (CVSException e) { + // Ignore + } + return false; } private void updateFilterMode(int mode) { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java index f1a5271e5..8f7285f82 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java @@ -105,7 +105,7 @@ public class ShowAnnotationOperation extends CVSOperation { if (editor != null) { editor.showRevisionInformation(information, "org.eclipse.quickdiff.providers.CVSReferenceProvider"); //$NON-NLS-1$ final IWorkbenchPage page= getPart().getSite().getPage(); - showHistoryView(page); + showHistoryView(page, editor); } } catch (PartInitException e) { CVSException.wrapException(e); @@ -122,11 +122,15 @@ public class ShowAnnotationOperation extends CVSOperation { * Shows the history view, creating it if necessary, but does not give it focus. * * @param page the workbench page to operate in + * @param editor the editor that is showing the file * @return the history view * @throws PartInitException */ - private IHistoryView showHistoryView(IWorkbenchPage page) throws PartInitException { - IHistoryView historyView= TeamUI.showHistoryFor(page, fCVSResource.getIResource(), null); + private IHistoryView showHistoryView(IWorkbenchPage page, AbstractDecoratedTextEditor editor) throws PartInitException { + Object object = fCVSResource.getIResource(); + if (object == null) + object = editor.getEditorInput(); + IHistoryView historyView= TeamUI.showHistoryFor(page, object, null); IHistoryPage historyPage = historyView.getHistoryPage(); if (historyPage instanceof CVSHistoryPage){ CVSHistoryPage cvsHistoryPage = (CVSHistoryPage) historyPage; |