Skip to content

Commit 8b8aa7c

Browse files
author
Jean-Philippe Bempel
committedDec 2, 2021
7463: JfrEditor instances are kept in memory by NavigationHistory
Reviewed-by: hirt
1 parent d4449ce commit 8b8aa7c

File tree

1 file changed

+17
-37
lines changed

1 file changed

+17
-37
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
33
*
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -34,41 +34,41 @@
3434

3535
import org.eclipse.ui.IMemento;
3636
import org.eclipse.ui.INavigationLocation;
37+
import org.eclipse.ui.NavigationLocation;
3738

38-
class JfrNavigationLocation implements INavigationLocation {
39-
40-
private final JfrEditor m_editor;
41-
private final DataPageDescriptor m_page;
42-
39+
class JfrNavigationLocation extends NavigationLocation {
40+
private JfrEditor jfrEditor;
41+
private DataPageDescriptor page;
4342
private boolean m_disposed;
4443

4544
public JfrNavigationLocation(JfrEditor editor, DataPageDescriptor page) {
46-
m_editor = editor;
47-
m_page = page;
48-
}
45+
super(editor);
46+
this.jfrEditor = editor;
47+
this.page = page;
4948

50-
@Override
51-
public void dispose() {
52-
m_disposed = true;
5349
}
5450

5551
@Override
56-
public void releaseState() {
52+
public void saveState(IMemento memento) {
5753
}
5854

5955
@Override
60-
public void saveState(IMemento memento) {
56+
public void restoreState(IMemento memento) {
57+
6158
}
6259

6360
@Override
64-
public void restoreState(IMemento memento) {
61+
public void releaseState() {
62+
super.releaseState();
63+
jfrEditor = null;
64+
page = null;
6565
m_disposed = true;
6666
}
6767

6868
@Override
6969
public void restoreLocation() {
7070
if (!m_disposed) {
71-
m_editor.navigateTo(m_page);
71+
jfrEditor.navigateTo(page);
7272
}
7373
}
7474

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

8484
}
8585
return false;
8686
}
8787

88-
@Override
89-
public Object getInput() {
90-
return null;
91-
}
92-
93-
@Override
94-
public String getText() {
95-
return m_page.getName() + " [" + m_editor.getPartName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
96-
}
97-
98-
@Override
99-
public String toString() {
100-
return super.toString() + '[' + getText() + ']';
101-
}
102-
103-
@Override
104-
public void setInput(Object input) {
105-
}
106-
10788
@Override
10889
public void update() {
10990
}
110-
11191
}

0 commit comments

Comments
 (0)
Please sign in to comment.