Skip to content

Commit

Permalink
7463: JfrEditor instances are kept in memory by NavigationHistory
Browse files Browse the repository at this point in the history
Reviewed-by: hirt
  • Loading branch information
Jean-Philippe Bempel committed Dec 2, 2021
1 parent d4449ce commit 8b8aa7c
Showing 1 changed file with 17 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -34,41 +34,41 @@

import org.eclipse.ui.IMemento;
import org.eclipse.ui.INavigationLocation;
import org.eclipse.ui.NavigationLocation;

class JfrNavigationLocation implements INavigationLocation {

private final JfrEditor m_editor;
private final DataPageDescriptor m_page;

class JfrNavigationLocation extends NavigationLocation {
private JfrEditor jfrEditor;
private DataPageDescriptor page;
private boolean m_disposed;

public JfrNavigationLocation(JfrEditor editor, DataPageDescriptor page) {
m_editor = editor;
m_page = page;
}
super(editor);
this.jfrEditor = editor;
this.page = page;

@Override
public void dispose() {
m_disposed = true;
}

@Override
public void releaseState() {
public void saveState(IMemento memento) {
}

@Override
public void saveState(IMemento memento) {
public void restoreState(IMemento memento) {

}

@Override
public void restoreState(IMemento memento) {
public void releaseState() {
super.releaseState();
jfrEditor = null;
page = null;
m_disposed = true;
}

@Override
public void restoreLocation() {
if (!m_disposed) {
m_editor.navigateTo(m_page);
jfrEditor.navigateTo(page);
}
}

Expand All @@ -79,33 +79,13 @@ public boolean mergeInto(INavigationLocation currentLocation) {
}
if (currentLocation instanceof JfrNavigationLocation) {
JfrNavigationLocation that = (JfrNavigationLocation) currentLocation;
return that.m_editor == m_editor && that.m_page == m_page;
return that.getInput() == this.getInput() && that.page == page;

}
return false;
}

@Override
public Object getInput() {
return null;
}

@Override
public String getText() {
return m_page.getName() + " [" + m_editor.getPartName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}

@Override
public String toString() {
return super.toString() + '[' + getText() + ']';
}

@Override
public void setInput(Object input) {
}

@Override
public void update() {
}

}

0 comments on commit 8b8aa7c

Please sign in to comment.