Package org.openstreetmap.josm.gui.widgets

Examples of org.openstreetmap.josm.gui.widgets.JFileChooserManager


                    break;
                default:
                    Main.error("Unsupported source type: "+sourceType);
                    return;
                }
                JFileChooserManager fcm = new JFileChooserManager(true)
                        .createFileChooser(true, null, Arrays.asList(ff, FileFilterAllFiles.getInstance()), ff, JFileChooser.FILES_ONLY);
                prepareFileChooser(tfURL.getText(), fcm.getFileChooser());
                JFileChooser fc = fcm.openFileChooser(JOptionPane.getFrameForComponent(SourceEditor.this));
                if (fc != null) {
                    tfURL.setText(fc.getSelectedFile().toString());
                }
            }
View Full Code Here


                putValue(SHORT_DESCRIPTION, tr("Launch a file chooser to select a file"));
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                JFileChooserManager fcm = new JFileChooserManager(true).createFileChooser();
                if (!isFile) {
                    fcm.getFileChooser().setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                }
                prepareFileChooser(tfFileName.getText(), fcm.getFileChooser());
                JFileChooser fc = fcm.openFileChooser(JOptionPane.getFrameForComponent(SourceEditor.this));
                if (fc != null) {
                    tfFileName.setText(fc.getSelectedFile().toString());
                }
            }
View Full Code Here

     *        This property will then be updated to the new "last directory" chosen by the user. If null, the default property "lastDirectory" will be used.
     * @return The {@code JFileChooser}.
     * @since 5438
     */
    public static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title, String extension, int selectionMode, boolean allTypes, String lastDirProperty) {
        return new JFileChooserManager(open, lastDirProperty).createFileChooser(multiple, title, extension, allTypes, selectionMode).openFileChooser();
    }
View Full Code Here

     * @param lastDirProperty The name of the property used to setup the JFileChooser initial directory. This property will then be updated to the new "last directory" chosen by the user
     * @return The {@code JFileChooser}.
     * @since 5438
     */
    public static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title, FileFilter filter, int selectionMode, String lastDirProperty) {
        return new JFileChooserManager(open, lastDirProperty).createFileChooser(multiple, title, filter, selectionMode).openFileChooser();
    }
View Full Code Here

     * @return The {@code JFileChooser}.
     * @since 5438
     */
    public static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title,
            Collection<? extends FileFilter> filters, FileFilter defaultFilter, int selectionMode, String lastDirProperty) {
        return new JFileChooserManager(open, lastDirProperty).createFileChooser(multiple, title, filters, defaultFilter, selectionMode).openFileChooser();
    }
View Full Code Here

            int sel = tblStyles.getSelectionModel().getLeadSelectionIndex();
            if (sel < 0 || sel >= model.getRowCount())
                return;
            final StyleSource s = model.getRow(sel);

            JFileChooserManager fcm = new JFileChooserManager(false, "mappaint.clone-style.lastDirectory", System.getProperty("user.home"));
            String suggestion = fcm.getInitialDirectory() + File.separator + s.getFileNamePart();

            FileFilter ff;
            if (s instanceof MapCSSStyleSource) {
                ff = new ExtensionFileFilter("mapcss,css,zip", "mapcss", tr("Map paint style file (*.mapcss, *.zip)"));
            } else {
                ff = new ExtensionFileFilter("xml,zip", "xml", tr("Map paint style file (*.xml, *.zip)"));
            }
            fcm.createFileChooser(false, null, Arrays.asList(ff, FileFilterAllFiles.getInstance()), ff, JFileChooser.FILES_ONLY)
                    .getFileChooser().setSelectedFile(new File(suggestion));
            JFileChooser fc = fcm.openFileChooser();
            if (fc == null)
                return;
            Main.worker.submit(new SaveToFileTask(s, fc.getSelectedFile()));
        }
View Full Code Here

        if (layer.data.fromServer) {
            warnCantImportIntoServerLayer(layer);
            return;
        }
        JpgImporter importer = new JpgImporter(layer);
        JFileChooser fc = new JFileChooserManager(true, "geoimage.lastdirectory", Main.pref.get("lastDirectory")).createFileChooser(true, null, importer.filter, JFileChooser.FILES_AND_DIRECTORIES).openFileChooser();
        if (fc != null) {
            File[] sel = fc.getSelectedFiles();
            if (sel != null && sel.length > 0) {
                LinkedList<File> files = new LinkedList<>();
                addRecursiveFiles(files, sel);
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.widgets.JFileChooserManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.