diff options
author | Dani Megert | 2012-08-21 13:55:13 +0000 |
---|---|---|
committer | Dani Megert | 2012-08-21 13:55:13 +0000 |
commit | efc52e6cf13f3c68ed65404ca6cd0b2e0c6b1f8e (patch) | |
tree | f556fcdd8336ea730f9e910288b164f6d85b63ae | |
parent | c81184a954a8f0428e641e6d0c469b3787d732c1 (diff) | |
download | eclipse.platform.team-efc52e6cf13f3c68ed65404ca6cd0b2e0c6b1f8e.tar.gz eclipse.platform.team-efc52e6cf13f3c68ed65404ca6cd0b2e0c6b1f8e.tar.xz eclipse.platform.team-efc52e6cf13f3c68ed65404ca6cd0b2e0c6b1f8e.zip |
Fixed bug 186993: [History View] Show In > History does not work fromv20120821-135513
Java editor
3 files changed, 35 insertions, 6 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java index 42d3d86aa..814696620 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,9 +39,11 @@ import org.eclipse.ui.IWorkbenchPage; */ public class EditionHistoryPage extends LocalHistoryPage { - private final IFile file; - private final Object element; - private final LocalResourceTypedElement localFileElement; + private IFile file; + + private Object element; + + private LocalResourceTypedElement localFileElement; private IStructureCreator structureCreator; private Map editions = new HashMap(); private ITypedElement localEdition; @@ -160,6 +162,10 @@ public class EditionHistoryPage extends LocalHistoryPage { public EditionHistoryPage(IFile file, Object element) { super(ON | ALWAYS); + setInput(file, element); + } + + void setInput(IFile file, Object element) { Assert.isNotNull(file); Assert.isNotNull(element); this.file = file; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java index 51f002011..1a2109575 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java @@ -551,7 +551,15 @@ public class GenericHistoryView extends PageBookView implements IHistoryView, IP if (part instanceof HistoryPageSourceWorkbenchPart) { HistoryPageSourceWorkbenchPart p = (HistoryPageSourceWorkbenchPart)part; IHistoryPage historyPage = (IHistoryPage) rec.page; - historyPage.setInput(p.getObject()); + Object newInput= p.getObject(); + if (!historyPage.isValidInput(newInput)) { + if (historyPage instanceof EditionHistoryPage) + ((EditionHistoryPage)historyPage).setInput(((ElementLocalHistoryPageSource)p.getSource()).internalGetFile(newInput), newInput); + else + return null; // Create a new page + } else + historyPage.setInput(newInput); + ((HistoryPage)historyPage).setHistoryView(this); setContentDescription(historyPage.getName()); } @@ -672,6 +680,7 @@ public class GenericHistoryView extends PageBookView implements IHistoryView, IP if (page != null) { initPage(page); IHistoryPage historyPage = (IHistoryPage) page; + historyPage.addPropertyChangeListener(this); historyPage.setSite(new WorkbenchHistoryPageSite(this, page.getSite())); page.createControl(getPageBook()); historyPage.setInput(p.getObject()); @@ -684,6 +693,8 @@ public class GenericHistoryView extends PageBookView implements IHistoryView, IP protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) { IPage page = pageRecord.page; + if (page instanceof IHistoryPage) + ((IHistoryPage)page).removePropertyChangeListener(this); page.dispose(); pageRecord.dispose(); } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/ElementLocalHistoryPageSource.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/ElementLocalHistoryPageSource.java index fc7619711..0ed7040d6 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/ElementLocalHistoryPageSource.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/ElementLocalHistoryPageSource.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -62,5 +62,17 @@ public abstract class ElementLocalHistoryPageSource extends HistoryPageSource { * @return the file that contains the given element of <code>null</code> */ protected abstract IFile getFile(Object element); + + /** + * Return the file that contains the given element of <code>null</code> if this page source can + * not show history for the given element. + * + * @param element the element + * @return the file that contains the given element of <code>null</code> + * @noreference This method is not intended to be referenced by clients. + */ + final public IFile internalGetFile(Object element) { + return getFile(element); + } } |