/** * Asks user for a location to save logs by poping up a file chooser. and archiving logs and * saving them on the specified location. */ private void collectLogs() { ResourceManagementService resources = LoggingUtilsActivator.getResourceService(); SipCommFileChooser fileChooser = GenericFileDialog.create( null, resources.getI18NString("plugin.loggingutils.ARCHIVE_FILECHOOSE_TITLE"), SipCommFileChooser.SAVE_FILE_OPERATION); fileChooser.setSelectionMode(SipCommFileChooser.SAVE_FILE_OPERATION); String defaultDir = ""; try { defaultDir = LoggingUtilsActivator.getFileAccessService() .getDefaultDownloadDirectory() .getAbsolutePath() + File.separator; } catch (IOException ex) { } fileChooser.setStartPath(defaultDir + LogsCollector.getDefaultFileName()); File dest = fileChooser.getFileFromDialog(); if (dest == null) return; dest = LogsCollector.collectLogs(dest, null); NotificationService notificationService = LoggingUtilsActivator.getNotificationService(); if (notificationService != null) { String bodyMsgKey = (dest == null) ? "plugin.loggingutils.ARCHIVE_MESSAGE_NOTOK" : "plugin.loggingutils.ARCHIVE_MESSAGE_OK"; notificationService.fireNotification( LOGFILES_ARCHIVED, resources.getI18NString("plugin.loggingutils.ARCHIVE_BUTTON"), resources.getI18NString(bodyMsgKey, new String[] {dest.getAbsolutePath()}), null); } }