Examples of OverwriteWarningJasonFileChooser


Examples of eu.ha3.matmos.editor.filechooser.OverwriteWarningJasonFileChooser

    this.mntmFSaveAs = new JMenuItem("Save as...");
    this.mntmFSaveAs.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e)
      {
        JFileChooser fc = new OverwriteWarningJasonFileChooser(EditorWindow.this.model.getExpansionDirectory());
        int returnValue = fc.showSaveDialog(EditorWindow.this);
        if (returnValue != JFileChooser.APPROVE_OPTION)
          return;
       
        File file = fc.getSelectedFile();
        if (file == null || file.isDirectory())
        {
          if (file.isDirectory())
          {
            showErrorPopup("Unexpected error: The file is a directory.");
          }
          else
          {
            showErrorPopup("Unexpected error: No file pointer.");
          }
          return;
        }
       
        boolean success = EditorWindow.this.model.longSave(file, true);
        if (!success)
        {
          actionPerformed(e);
        }
      }
    });
    mnFile.add(this.mntmFSaveAs);
   
    JMenuItem mntmFSaveACopy = new JMenuItem("Save a backup copy...");
    mntmFSaveACopy.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e)
      {
        JFileChooser fc = new OverwriteWarningJasonFileChooser(EditorWindow.this.model.getExpansionDirectory());
        int returnValue = fc.showSaveDialog(EditorWindow.this);
        if (returnValue != JFileChooser.APPROVE_OPTION)
          return;
       
        File file = fc.getSelectedFile();
        if (file == null || file.isDirectory())
        {
          if (file.isDirectory())
          {
            showErrorPopup("Unexpected error: The file is a directory.");
          }
          else
          {
            showErrorPopup("Unexpected error: No file pointer.");
          }
          return;
        }
       
        boolean success = EditorWindow.this.model.longSave(file, false);
        if (!success)
        {
          actionPerformed(e);
        }
      }
    });
    mntmFSaveACopy
      .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK | InputEvent.ALT_MASK));
    mnFile.add(mntmFSaveACopy);
   
    JSeparator separator_2 = new JSeparator();
    mnFile.add(separator_2);
   
    this.mntmReplaceCurrentFile = new JMenuItem("Replace current file with backup... (NOT IMPLEMENTED)");
    mnFile.add(this.mntmReplaceCurrentFile);
   
    this.mntmFDiscardChanges = new JMenuItem("Discard changes and reload (NOT IMPLEMENTED)");
    mnFile.add(this.mntmFDiscardChanges);
   
    JSeparator separator_7 = new JSeparator();
    mnFile.add(separator_7);
   
    JMenuItem mntmMergeAnotherFile = new JMenuItem("Merge another file in...");
    mntmMergeAnotherFile.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0)
      {
        if (!continueUnsavedChangesWarningIfNecessary())
          return;
       
        JFileChooser fc = new JasonFileChooser(EditorWindow.this.model.getExpansionDirectory());
        int returnValue = fc.showOpenDialog(EditorWindow.this);
        if (returnValue != JFileChooser.APPROVE_OPTION)
          return;
       
        File file = fc.getSelectedFile();
        if (file == null || !file.exists() || file.isDirectory())
        {
          if (file.isDirectory())
          {
            showErrorPopup("Unexpected error: The file is a directory.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.