public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Open Layout"); chooser.setFileFilter(new ExtensionFileFilter( new String[] { "xml" })); int retVal = chooser.showOpenDialog(basePane); if (retVal == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (file != null) { try { openLayout(file.toURI().toURL().openStream()); } catch (IOException ex) { logger.error("Error saving default layout", ex); } } } } }
public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Save perspective"); chooser.setFileFilter(new ExtensionFileFilter( new String[] { "xml" })); int retVal = chooser.showSaveDialog(basePane); if (retVal == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (file != null) { PrintWriter out; try { out = new PrintWriter(new FileWriter(file)); Element element = basePane.getElement(); XMLOutputter xo = new XMLOutputter(Format .getPrettyFormat()); out.print(xo.outputString(element)); out.flush(); out.close(); } catch (IOException ex) { logger.error("IOException saving layout", ex); JOptionPane.showMessageDialog(basePane, "Error saving layout file: " + ex.getMessage()); } } } } }
public void createCustomizedConfigurePanel( net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider.CustomizedConfigureCallBack<ApiConsumerServiceProviderConfig> callBack) { JFileChooser fc = new JFileChooser(); Preferences prefs = Preferences.userNodeForPackage(getClass()); String curDir = prefs .get("currentDir", System.getProperty("user.home")); fc.setDialogTitle("Select API consumer definition file"); fc.resetChoosableFileFilters(); fc.setFileFilter(new ExtensionFileFilter(new String[] { "xml" })); fc.setCurrentDirectory(new File(curDir)); int returnVal = fc.showOpenDialog(MainWindow.getMainWindow()); if (returnVal == JFileChooser.APPROVE_OPTION) { prefs.put("currentDir", fc.getCurrentDirectory().toString()); File file = fc.getSelectedFile(); callBack.newProviderConfiguration(new ApiConsumerServiceProviderConfig(file.getAbsolutePath())); JOptionPane .showMessageDialog( null, "Make sure you also copy the API jar,\nand any jars it depends on, to\n" + ApiConsumerActivity.libDir + "\n\n" + "and configure any API consumer services\nto select those jars", "Information message", JOptionPane.INFORMATION_MESSAGE); } }
fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setFileFilter(new ExtensionFileFilter(new String[] { EXTENSION }));
String curDir = prefs.get("currentDir", System.getProperty("user.home")); fc.resetChoosableFileFilters(); fc.setFileFilter(new ExtensionFileFilter(new String[]{"xml"})); fc.setCurrentDirectory(new File(curDir)); fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setFileFilter(new ExtensionFileFilter(new String[] { extension })); if (suggestedFileName.equals("")) {
fc.setFileFilter(new ExtensionFileFilter(new String[] { extension })); if (suggestedFileName.equals("")) {
fc.resetChoosableFileFilters(); if (getFilter() != null) { fc.setFileFilter(new ExtensionFileFilter(new String[]{getFilter()}));
String curDir = prefs.get("currentDir", System.getProperty("user.home")); fc.resetChoosableFileFilters(); FileFilter ff = new ExtensionFileFilter(new String[] { "txt" }); fc.setFileFilter(ff); fc.setCurrentDirectory(new File(curDir));
fc.setFileFilter(new ExtensionFileFilter(new String[] { fileExtension })); String curDir = prefs.get("currentDir", System.getProperty("user.home")); fc.resetChoosableFileFilters(); fc.setFileFilter(new ExtensionFileFilter(new String[] { "txt" })); fc.setCurrentDirectory(new File(curDir));