Package tiled.mapeditor.util

Examples of tiled.mapeditor.util.ConfirmingFileChooser


        TiledFileFilter byExtensionFilter =
                new TiledFileFilter(TiledFileFilter.FILTER_EXT);
        TiledFileFilter tmxFilter =
                new TiledFileFilter(TiledFileFilter.FILTER_TMX);

        JFileChooser chooser = new ConfirmingFileChooser(startLocation);
        chooser.setAcceptAllFileFilterUsed(false);
        chooser.addChoosableFileFilter(byExtensionFilter);
        chooser.addChoosableFileFilter(tmxFilter);

        MapWriter[] writers = editor.getPluginLoader().getWriters();
        for (int i = 0; i < writers.length; i++) {
            try {
                chooser.addChoosableFileFilter(new TiledFileFilter(writers[i]));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        chooser.setFileFilter(byExtensionFilter);

        int result = chooser.showSaveDialog(editor.getAppFrame());
        if (result == JFileChooser.APPROVE_OPTION)
        {
            savingCancelled = false;
            TiledFileFilter saver = (TiledFileFilter) chooser.getFileFilter();
            String selectedFile = chooser.getSelectedFile().getAbsolutePath();
            saveFile(saver, selectedFile);
        }
        else {
            savingCancelled = true;
        }
View Full Code Here


    public void actionPerformed(ActionEvent event) {
        if (editor.getCurrentMap() == null)
            return;

        JFileChooser chooser = new ConfirmingFileChooser();
        chooser.setDialogTitle(DIALOG_TITLE);
        final FileFilter defaultFilter = chooser.getFileFilter();

        final String[] list = ImageIO.getWriterFormatNames();
        for (int i = 0; i < list.length; i++) {
            if (list[i].matches("[A-Z].*"))
                chooser.addChoosableFileFilter(
                        new BasicFileFilter(list[i], list[i].toLowerCase()));
        }

        // Make sure the "All Files" filter is selected by default
        chooser.setFileFilter(defaultFilter);

        if (chooser.showSaveDialog(appFrame) ==
                JFileChooser.APPROVE_OPTION) {
            saveMapImage(chooser.getSelectedFile().getAbsolutePath());
        }
    }
View Full Code Here

        rbEmbedInSet.setEnabled(embedImages);
        tfScriptsLocation.setText(lomPrefs.get("lomScriptsLocation", ""));
    }

    private void doExport() {
        JFileChooser chooser = new ConfirmingFileChooser(null);
        chooser.addChoosableFileFilter(xmlFileFilter);
        int result = chooser.showSaveDialog(this);

        if (result == JFileChooser.APPROVE_OPTION)
        {
            File configFile = chooser.getSelectedFile();

            try {
                FileOutputStream outputStream = null;
                try {
                    outputStream = new FileOutputStream(configFile);
View Full Code Here

TOP

Related Classes of tiled.mapeditor.util.ConfirmingFileChooser

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.