예제 #1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getSource().equals(this.browseButton)) {
     openFileChooser();
   } else if (e.getSource().equals(this.startExtractionButton)) {
     startExtraction();
   } else if (e.getSource().equals(this.openRootDirectoryButton)) {
     Desktop desktop = Desktop.getDesktop();
     try {
       desktop.open(EmojiTools.getRootDirectory());
     } catch (IOException e1) {
       EmojiTools.submitError(Thread.currentThread(), e1);
     }
   }
 }
예제 #2
0
  private void openFileChooser() {
    this.fileNameField.setText(defaultFileNameFieldText);

    JFileChooser fileChooser = new JFileChooser(EmojiTools.getRootDirectory());
    FileNameExtensionFilter filter = new FileNameExtensionFilter("Emoji Font File (*.ttf)", "ttf");
    fileChooser.setFileFilter(filter);
    int returnVal = fileChooser.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      this.fileNameField.setText(fileChooser.getSelectedFile().getName());
      this.fontFile = fileChooser.getSelectedFile();
    }
    updateStartButton();
  }
예제 #3
0
  private void startExtraction() {
    this.cancelled = false;

    if (!this.fontFile.exists()) {
      this.fontFile = null;
      this.fileNameField.setText(defaultFileNameFieldText);
      this.updateStartButton();
      return;
    }

    File extractionDirectory =
        new File(EmojiTools.getRootDirectory(), this.extractionDirectoryField.getText());
    if (extractionDirectory.exists()) {
      OverwriteWarningDialog overwriteWarningDialog =
          new OverwriteWarningDialog(this, extractionDirectory);
      overwriteWarningDialog.setVisible(true);
      if (cancelled) {
        this.cancelled = false;
        return;
      } else {
        DeletionDialog deletionDialog = new DeletionDialog(this);
        this.currentOperationManager =
            new DeletionManager(extractionDirectory, this.gui, deletionDialog);
        currentOperationManager.start();
        deletionDialog.setVisible(true);
      }
    }

    if (!cancelled) {
      ExtractionDialog extractionDialog = new ExtractionDialog(this);
      this.currentOperationManager =
          new ExtractionManager(this.fontFile, extractionDirectory, this.gui, extractionDialog);
      currentOperationManager.start();
      extractionDialog.setVisible(true);
    } else {
      this.cancelled = false;
      return;
    }

    if (this.renameRadioButton2.isSelected() && !cancelled) {
      RenamingDialog renamingDialog = new RenamingDialog(this);
      this.currentOperationManager =
          new RenamingManager(
              extractionDirectory,
              this.gui,
              renamingDialog,
              new boolean[] {false, true, false, false},
              new boolean[] {true, false, false, false});
      currentOperationManager.start();
      renamingDialog.setVisible(true);
    }

    if (this.convertRadioButton2.isSelected() && !cancelled) {
      ConversionDialog conversionDialog = new ConversionDialog(this);
      this.currentOperationManager =
          new ConversionManager(extractionDirectory, this.gui, conversionDialog, true);
      currentOperationManager.start();
      conversionDialog.setVisible(true);
    }

    new FinishedDialog(
            this.gui,
            "Emoji Extraction Complete!",
            "Your Extracted Emojis can be found in:",
            extractionDirectory)
        .setVisible(true);
  }