Package de.yaams.extensions.basemap.tiled.mapeditor.util

Examples of de.yaams.extensions.basemap.tiled.mapeditor.util.ConfirmingFileChooser


  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[] names = ImageIO.getWriterFormatNames();
    for (String name : names) {
      if (name.matches("[A-Z].*")) {
        chooser.addChoosableFileFilter(new BasicFileFilter(name, name.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


    // Start at the location of the most recently loaded map file
    String startLocation = TiledConfiguration.node("recent").get("file0", null);

    TiledFileFilter byExtensionFilter = new TiledFileFilter(TiledFileFilter.FILTER_EXT);

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

    MapHelper.addExtension(chooser);

    chooser.setFileFilter(byExtensionFilter);

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

      } catch (LayerLockedException e) {
        JOptionPane.showMessageDialog(this, Resources.getString("action.tileset.remove.error.layer-locked.message"),
            Resources.getString("action.tileset.remove.error.title"), JOptionPane.ERROR_MESSAGE);
      }
    } else if (command.equals(SAVE_AS_BUTTON)) {
      JFileChooser ch = new ConfirmingFileChooser(map.getFilename());
      MapHelper.addExtension(ch);

      int ret = ch.showSaveDialog(this);
      if (ret == JFileChooser.APPROVE_OPTION) {
        String filename = ch.getSelectedFile().getAbsolutePath();
        try {
          MapHelper.saveTileset(set, filename);
          set.setSource(filename);
          embedButton.setEnabled(true);
          saveButton.setEnabled(true);
View Full Code Here

    rbEmbedInTiles.setEnabled(embedImages);
    rbEmbedInSet.setEnabled(embedImages);
  }

  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 de.yaams.extensions.basemap.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.