Skip to content

Commit

Permalink
Navigation History Entry - Issue eclipse-platform#339
Browse files Browse the repository at this point in the history
Changes the implementation of the mergeInto method of the class
NavigationHistoryEntry. This is to fix the reported github issue eclipse-platform#339,
where a user has multiple different editors whose EditorInputs are both
FileEditorInputs with the same underlying file. Thus the editorInputs of
the multiple editors were considered the same, and when navigating
between the editors, the navigation history entries were being merged,
incorrectly.

The supplied change checks both if the editor inputs and editorIDs of
two navigation history entries are the same before merging the two
navigation history entries.
  • Loading branch information
Greglar4 authored and merks committed Sep 30, 2023
1 parent e7c8146 commit 0847f8e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.eclipse.ui.internal;

import java.util.ArrayList;
import java.util.Objects;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.INavigationLocation;
Expand Down Expand Up @@ -165,7 +166,8 @@ void dispose() {
* possible otherwise returns false.
*/
boolean mergeInto(NavigationHistoryEntry currentEntry) {
if (editorInfo.editorInput != null && editorInfo.editorInput.equals(currentEntry.editorInfo.editorInput)) {
if (Objects.equals(editorInfo.editorInput, currentEntry.editorInfo.editorInput)
&& Objects.equals(editorInfo.editorID, currentEntry.editorInfo.editorID)) {
if (location != null) {
if (currentEntry.location == null) {
currentEntry.location = location;
Expand Down

0 comments on commit 0847f8e

Please sign in to comment.