@Override
  public void actionPerformed(ActionEvent e) {
    final ComboBoxDialog d =
        new ComboBoxDialog(
            0,
            "Clone Translation",
            "Choose the Language you want to clone",
            owner.getTranslations().toArray(new TLocale[] {}),
            PRE == null ? 0 : owner.getTranslations().indexOf(PRE),
            new AbstractIcon(IconKey.ICON_LANGUAGE, 32),
            null,
            null,
            null);

    int ret;
    try {
      ret = Dialog.getInstance().showDialog(d);

      if (ret >= 0) {
        TLocale sel = owner.getTranslations().get(ret);
        PRE = sel;

        owner.setTranslation(selection, sel);
      }
    } catch (DialogClosedException e1) {
      e1.printStackTrace();
    } catch (DialogCanceledException e1) {
      e1.printStackTrace();
    }
  }
Beispiel #2
0
  /** Close Order: A B */
  private static void test2() {
    final InputDialog dialog =
        new InputDialog(0, "title", "message", "defaultMessage", null, null, null);

    dialog.setLeftActions(
        new AbstractAction("CLICK HERE!!!") {

          private static final long serialVersionUID = 3916626551625222343L;

          public void actionPerformed(final ActionEvent e) {

            Dialog.getInstance().showMessageDialog("INTERNAL");

            System.out.println("Closed A");
          }
        });
    try {
      Dialog.getInstance().showDialog(dialog);
    } catch (final DialogClosedException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    } catch (final DialogCanceledException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
    System.out.println("Closed B");
  }
    @Override
    public void actionPerformed() {

        ExtFileChooserDialog d = new ExtFileChooserDialog(0, _GUI._.ExportAllMenusAdvancedAction_actionPerformed(), null, null);
        d.setFileFilter(new FileFilter() {

            @Override
            public String getDescription() {

                return _GUI._.lit_directory();
            }

            @Override
            public boolean accept(File f) {
                return f.isDirectory();
            }
        });

        d.setFileSelectionMode(FileChooserSelectionMode.DIRECTORIES_ONLY);
        d.setMultiSelection(false);

        d.setStorageID("menus");
        d.setType(FileChooserType.SAVE_DIALOG);
        try {
            Dialog.getInstance().showDialog(d);

            File saveTo = d.getSelectedFile();
            File file = null;
            int i = 0;
            while (file == null || file.exists()) {

                file = new File(saveTo, "JDownloader Menustructure " + i);

                i++;
            }
            file.mkdirs();
            MenuManagerDownloadTabBottomBar.getInstance().exportTo(file);
            MenuManagerDownloadTableContext.getInstance().exportTo(file);
            MenuManagerLinkgrabberTabBottombar.getInstance().exportTo(file);
            MenuManagerLinkgrabberTableContext.getInstance().exportTo(file);
            MenuManagerMainToolbar.getInstance().exportTo(file);
            MenuManagerTrayIcon.getInstance().exportTo(file);
            MenuManagerMainmenu.getInstance().exportTo(file);
            CrossSystem.openFile(file);

        } catch (DialogClosedException e1) {
            e1.printStackTrace();
        } catch (DialogCanceledException e1) {
            e1.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            Dialog.getInstance().showExceptionDialog(_GUI._.lit_error_occured(), e1.getMessage(), e1);
        } catch (IOException e1) {
            Dialog.getInstance().showExceptionDialog(_GUI._.lit_error_occured(), e1.getMessage(), e1);
        }
    }
 public static void main(String[] args) {
   try {
     Dialog.getInstance()
         .showConfirmDialog(
             0,
             _GUI.T.AutoDetectAction_actionPerformed_dooptimization_title(),
             _GUI.T.AutoDetectAction_actionPerformed_dooptimization_msg(1, "ff", "ggf"),
             new AbstractIcon(IconKey.ICON_OK, 32),
             _GUI.T.AutoDetectAction_run_optimization(),
             _GUI.T.AutoDetectAction_skip_optimization());
   } catch (DialogClosedException e) {
     e.printStackTrace();
   } catch (DialogCanceledException e) {
     e.printStackTrace();
   }
 }
Beispiel #5
0
  /** @return */
  public File doFileChooser() {

    final ExtFileChooserDialog d = new ExtFileChooserDialog(0, this.getDialogTitle(), null, null);
    d.setStorageID(this.getID());
    d.setFileSelectionMode(this.getSelectionMode());
    d.setFileFilter(this.getFileFilter());
    d.setType(this.getType());
    d.setMultiSelection(false);
    d.setPreSelection(this.getFile());
    try {
      Dialog.I().showDialog(d);
    } catch (final DialogClosedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (final DialogCanceledException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return d.getSelectedFile();
  }