@Override public void actionPerformed(ActionEvent e) { log.trace("Obtaining a file chooser"); FileChooser chooser = chooserFactory.getFileChooser(DesktopPlugIn.FILE_OPEN_PREFERENCESKEY); log.trace("Setting the recently used file menu on the chooser"); StringMenu<File> menu = menuFactory.getCachedMenu(File.class, DesktopPlugIn.FILE_RECENT_PREFERENCESKEY); chooser.setMenu(menu); log.trace("Requesting the file chooser to open a file"); File file = chooser.openFile(); log.trace("File chooser selected file: " + file); if (file != null) { try { fileOpener.openFile(file); } catch (ResourceNotFoundException resourceNotFoundException) { // TODO: Log error } } }
@Override public void actionPerformed(ActionEvent e) { log.trace("Obtaining a file chooser"); FileChooser chooser; try { chooser = preferences.getFilechooser(); log.trace("Setting the recently used file menu on the chooser"); StringMenu<File> menu = menuFactory.getMenu(File.class, DesktopPlugIn.RECENT_FILES_MENU_KEY); chooser.setMenu(menu); log.trace("Requesting the file chooser to open a file"); File file = chooser.openFile(); log.trace("File chooser selected file: " + file); if (file != null) { fileOpener.openFile(file); } } catch (ResourceNotFoundException resourceNotFoundException) { errorReporter.reportError(resourceNotFoundException); } catch (InvalidDataTypeException exc) { errorReporter.reportError(exc); } catch (BackendException exc) { errorReporter.reportError(exc); } }
public void importManager() throws ResourceNotFoundException, IOException, InvalidDataTypeException, BackendException { final FileChooser fileChooser = preferences .getConfiguratonFilechooser(); File openFile = fileChooser.openFile(); if (openFile != null) { StyleRulesManager importFrom = readManager(openFile); if (importFrom != null) { // workbench.startWorkIndicator(); this.manager.importManager(importFrom); workbench.getStatusbar().setMessage( messages.format("nu.zoom.catonine.import.from", openFile.getPath())); // workbench.stopWorkIndicator(); } } }
public void importManager() { if (this.manager == null) { openManager(); } else { final FileChooser fileChooser = fileChooserFactory.getFileChooser(PreferencesUtil.MANAGER_FILECHOOSER_PREFS_KEY); File openFile = fileChooser.openFile(); if (openFile != null) { StyleRulesManager importFrom = readManager(openFile); if (importFrom != null) { workbench.startWorkIndicator(); this.manager.importManager(importFrom); workbench.stopWorkIndicator(); } } } }
public boolean openManager() { final FileChooser fileChooser = fileChooserFactory.getFileChooser(PreferencesUtil.MANAGER_FILECHOOSER_PREFS_KEY); File openFile = fileChooser.openFile(); if (openFile != null) { try { final boolean success = loadManager(openFile.getCanonicalPath()); if (success) { fireStyleRulesManagerChanged(); } return success; } catch (IOException ex) { try { String message = localizedResources.getMessage("nu.zoom.catonine.configurations.load.failed"); workbench.getErrorReporter().reportError(message, ex); } catch (ResourceNotFoundException ex1) { workbench.getErrorReporter().reportError("Unable to load resource", ex); } } } return false; }