Skip to content

Commit e735f37

Browse files
committed
Code cleanup
1 parent c029250 commit e735f37

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

visualvm/heapviewer/src/org/graalvm/visualvm/heapviewer/java/impl/JavaPreviewPlugin.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -61,33 +61,28 @@ class JavaPreviewPlugin extends HeapViewPlugin {
6161

6262
private final Heap heap;
6363

64-
private InstanceScrollPane component;
64+
private InstanceScrollPane component;
6565

6666

6767
public JavaPreviewPlugin(HeapContext context) {
6868
super(Bundle.JavaPreviewPlugin_Name(), Bundle.JavaPreviewPlugin_Description(), Icons.getIcon(HeapWalkerIcons.PROPERTIES));
6969
heap = context.getFragment().getHeap();
7070
}
7171

72-
protected JComponent createComponent() {
73-
if (component == null) init();
74-
return component;
75-
}
76-
7772

7873
@Override
7974
protected void closed() {
8075
// TODO: should cancel the preview
8176
}
8277

83-
8478
protected void nodeSelected(HeapViewerNode node, boolean adjusting) {
8579
component.showInstance(node == null ? null : HeapViewerNode.getValue(node, DataType.INSTANCE, heap));
8680
}
8781

8882

89-
private void init() {
90-
component = new InstanceScrollPane();
83+
protected JComponent createComponent() {
84+
if (component == null) component = new InstanceScrollPane();
85+
return component;
9186
}
9287

9388

0 commit comments

Comments
 (0)