Skip to content

Commit 74de315

Browse files
committed
GH-394 LogRecordDecorator removed
1 parent d8e8fa1 commit 74de315

File tree

1 file changed

+0
-73
lines changed
  • visualvm/libs.profiler/profiler.snaptracer/src/org/graalvm/visualvm/lib/profiler/snaptracer/impl

1 file changed

+0
-73
lines changed

visualvm/libs.profiler/profiler.snaptracer/src/org/graalvm/visualvm/lib/profiler/snaptracer/impl/IdeSnapshot.java

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
package org.graalvm.visualvm.lib.profiler.snaptracer.impl;
2626

2727
import java.io.IOException;
28-
import java.lang.reflect.InvocationHandler;
29-
import java.lang.reflect.InvocationTargetException;
30-
import java.lang.reflect.Method;
31-
import java.lang.reflect.Proxy;
3228
import java.util.HashMap;
3329
import java.util.List;
3430
import java.util.Map;
@@ -39,9 +35,6 @@
3935
import org.graalvm.visualvm.lib.profiler.SampledCPUSnapshot;
4036
import org.graalvm.visualvm.lib.profiler.snaptracer.logs.LogReader;
4137
import org.openide.filesystems.FileObject;
42-
import org.openide.util.Exceptions;
43-
import org.openide.util.ImageUtilities;
44-
import org.openide.util.Lookup;
4538

4639
/** Reads xml log and npss snapshot from file.
4740
*
@@ -111,7 +104,6 @@ public LogRecordInfo getLogInfoForValue(long loggerValue) {
111104

112105
assert rec != null : "Null record for value "+index; // NOI18N
113106
info = new LogRecordInfo(rec);
114-
LogRecordDecorator.decorate(info);
115107
infosMap.put(index, info);
116108
}
117109
return info;
@@ -212,69 +204,4 @@ public Icon getIcon() {
212204
return icon;
213205
}
214206
}
215-
216-
private static final class LogRecordDecorator implements InvocationHandler {
217-
218-
private static final String DECORATIONS_CLASS = "org.netbeans.lib.uihandler.Decorations"; // NOI18N
219-
private static final String DECORABLE_CLASS = "org.netbeans.lib.uihandler.Decorable"; // NOI18N
220-
private static final String DECORATE_METHOD = "decorate"; // NOI18N
221-
private static final String DECORABLE_SETNAME_METHOD = "setName"; // NOI18N
222-
private static final String DECORABLE_SETDISPLAYNAME_METHOD = "setDisplayName"; // NOI18N
223-
private static final String DECORABLE_SETICONBASE_METHOD = "setIconBaseWithExtension"; // NOI18N
224-
private static final String DECORABLE_SETSHORTDESCRIPTOR_METHOD = "setShortDescription"; // NOI18N
225-
private LogRecordInfo recInfo;
226-
private LogRecord rec;
227-
228-
LogRecordDecorator(LogRecordInfo info) {
229-
recInfo = info;
230-
rec = info.record;
231-
}
232-
233-
private void decorateRecord() {
234-
try {
235-
ClassLoader c = Lookup.getDefault().lookup(ClassLoader.class);
236-
Class decorationClass = Class.forName(DECORATIONS_CLASS, true, c);
237-
Class decorableClass = Class.forName(DECORABLE_CLASS, true, c);
238-
Object decorable = Proxy.newProxyInstance(c, new Class[]{decorableClass}, this);
239-
Method decorate = decorationClass.getDeclaredMethod(DECORATE_METHOD, LogRecord.class, decorableClass);
240-
decorate.setAccessible(true);
241-
decorate.invoke(null, rec, decorable);
242-
} catch (IllegalAccessException ex) {
243-
Exceptions.printStackTrace(ex);
244-
} catch (IllegalArgumentException ex) {
245-
Exceptions.printStackTrace(ex);
246-
} catch (InvocationTargetException ex) {
247-
Exceptions.printStackTrace(ex);
248-
} catch (NoSuchMethodException ex) {
249-
Exceptions.printStackTrace(ex);
250-
} catch (SecurityException ex) {
251-
Exceptions.printStackTrace(ex);
252-
} catch (ClassNotFoundException ex) {
253-
Exceptions.printStackTrace(ex);
254-
}
255-
}
256-
257-
@Override
258-
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
259-
String methodName = method.getName();
260-
if (DECORABLE_SETNAME_METHOD.equals(methodName)) {
261-
recInfo.setName((String) args[0]);
262-
}
263-
if (DECORABLE_SETDISPLAYNAME_METHOD.equals(methodName)) {
264-
recInfo.setDisplayName((String) args[0]);
265-
}
266-
if (DECORABLE_SETSHORTDESCRIPTOR_METHOD.equals(methodName)) {
267-
recInfo.setToolTip((String) args[0]);
268-
}
269-
if (DECORABLE_SETICONBASE_METHOD.equals(methodName)) {
270-
String iconBase = (String) args[0];
271-
recInfo.setIcon(ImageUtilities.loadImageIcon(iconBase, true));
272-
}
273-
return null;
274-
}
275-
276-
static void decorate(LogRecordInfo info) {
277-
new LogRecordDecorator(info).decorateRecord();
278-
}
279-
}
280207
}

0 commit comments

Comments
 (0)