Source:
private void createReport(Case currentCase, String reportName) throws IOException { Path reportFolderPath = Paths.get(currentCase.getReportDirectory(), reportName, Bundle.VisualizationPane_reportName()); BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, graph.getView().getScale(), Color.WHITE, true, null); Path reportPath = (new CommSnapShotReportWriter(currentCase, reportFolderPath, reportName, new Date(), image, currentFilter)).writeReport(); String message = Bundle.VisualizationPane_Report_Success(reportPath.toAbsolutePath()); String[] buttons = {Bundle.VisualizationPane_Report_OK_Button(), Bundle.VisualizationPane_Open_Report()}; int result = JOptionPane.showOptionDialog(graphComponent, message, Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, buttons, buttons[1]); if (result == JOptionPane.NO_OPTION) { try { Desktop.getDesktop().open(reportPath.toFile()); } catch (IOException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_NoAssociatedEditorMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (UnsupportedOperationException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_NoOpenInEditorSupportMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (IllegalArgumentException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_MissingReportFileMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (SecurityException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_ReportFileOpenPermissionDeniedMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } } }

Target:
private void createReport(Case currentCase, String reportName) throws IOException { Path reportFolderPath = Paths.get(currentCase.getReportDirectory(), reportName, Bundle.VisualizationPane_reportName()); BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, graph.getView().getScale(), Color.WHITE, true, null); Path reportPath = new CommSnapShotReportWriter(currentCase, reportFolderPath, reportName, new Date(), image, currentFilter).writeReport(); String message = Bundle.VisualizationPane_Report_Success(reportPath.toAbsolutePath()); String[] buttons = {Bundle.VisualizationPane_Open_Report(), Bundle.VisualizationPane_Report_OK_Button()}; int result = JOptionPane.showOptionDialog(graphComponent, message, Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, buttons, buttons[1]); if (result == JOptionPane.YES_NO_OPTION) { try { Desktop.getDesktop().open(reportPath.toFile()); } catch (IOException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_NoAssociatedEditorMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (UnsupportedOperationException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_NoOpenInEditorSupportMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (IllegalArgumentException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_MissingReportFileMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (SecurityException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.VisualizationPane_ReportFileOpenPermissionDeniedMessage(), Bundle.VisualizationPane_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } } }