use of com.android.tools.perflib.heap.memoryanalyzer.HprofBitmapProvider in project android by JetBrains.
the class ViewBitmapAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
ClassInstance selectedClassInstance = e.getData(InstancesTreeView.SELECTED_CLASS_INSTANCE);
if (selectedClassInstance == null) {
return;
}
try {
BufferedImage img = BitmapDecoder.getBitmap(new HprofBitmapProvider(selectedClassInstance));
final JComponent comp;
if (img != null) {
comp = ImageEditorManagerImpl.createImageEditorUI(img);
} else {
String errorMessage = AndroidBundle.message("android.profiler.hprof.actions.view.bitmap.fail");
comp = new JLabel(errorMessage, Messages.getErrorIcon(), SwingConstants.CENTER);
}
Project project = e.getData(CommonDataKeys.PROJECT);
JBPopup popup = DebuggerUIUtil.createValuePopup(project, comp, null);
JFrame frame = WindowManager.getInstance().getFrame(project);
Dimension frameSize = frame.getSize();
Dimension size = new Dimension(frameSize.width / 2, frameSize.height / 2);
popup.setSize(size);
popup.show(new RelativePoint(frame, new Point(size.width / 2, size.height / 2)));
} catch (Exception ignored) {
}
}
Aggregations