Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2016-04-01 03:05:07 +0000
committerSergey Prigogin2016-04-01 03:05:07 +0000
commitfa16c6c112b16f922d600e1c89b148cdfb43d852 (patch)
treea8c0dff39d8937ab199fe09a508fa355db9fa75a
parentc2ddef86459fa7c27108248a6b5b0daa33c9ae75 (diff)
downloadeclipse.platform.team-fa16c6c112b16f922d600e1c89b148cdfb43d852.tar.gz
eclipse.platform.team-fa16c6c112b16f922d600e1c89b148cdfb43d852.tar.xz
eclipse.platform.team-fa16c6c112b16f922d600e1c89b148cdfb43d852.zip
Bug 490835 - [History View] Local history page is sticky
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java15
1 files changed, 12 insertions, 3 deletions
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 802b2cb76..ee8b7f604 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2016 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Sergey Prigogin (Google) - [490835] Local history page is sticky
*******************************************************************************/
package org.eclipse.team.internal.ui.history;
@@ -44,18 +45,26 @@ public class GenericHistoryView extends PageBookView implements IHistoryView, IP
private static final int MAX_NAVIGATION_HISTORY_ENTRIES = 15;
static boolean sameSource(IHistoryPageSource source1, IHistoryPageSource source2) {
- return source1 == source2 || (source1 != null && source2 != null && source1.equals(source2));
+ return Objects.equals(source1, source2);
}
private boolean matches(IPage page, Object object, IHistoryPageSource pageSource) {
if (page instanceof IHistoryPage) {
Object input = ((IHistoryPage)page).getInput();
if (input != null)
- return input.equals(object) && sameSource(getPageSourceFor(object, pageSource), getPageSourceFor(input, null));
+ return input.equals(object) && sameSource(getPageSourceFor(object, pageSource), getCurrentPageSource());
}
return false;
}
+ private IHistoryPageSource getCurrentPageSource() {
+ IWorkbenchPart part = getCurrentContributingPart();
+ if (part instanceof HistoryPageSourceWorkbenchPart) {
+ return ((HistoryPageSourceWorkbenchPart) part).getSource();
+ }
+ return null;
+ }
+
/*
* The navigation history for this view.
* The history adds the MRU to the end so basic navigation goes backwards.

Back to the top