public void actionPerformed(ActionEvent event) {
   Logger log = Logger.getLogger(DebugShowLogFile.class);
   String logFile = Logging.getLogFile();
   if (logFile == null) {
     log.error("No file logger configured");
     JOptionPane.showMessageDialog(
         MainGUI.getMainGUI(),
         I18nUtils.localizedStringForKey("msg_no_log_file_config"),
         I18nUtils.localizedStringForKey("Error"),
         JOptionPane.ERROR_MESSAGE);
     return;
   }
   File f = new File(logFile);
   if (!f.isFile()) {
     log.error("Log file does not exists: " + f.getAbsolutePath());
     JOptionPane.showMessageDialog(
         MainGUI.getMainGUI(),
         String.format(I18nUtils.localizedStringForKey("msg_no_log_file"), f.getAbsolutePath()),
         I18nUtils.localizedStringForKey("Error"),
         JOptionPane.ERROR_MESSAGE);
     return;
   }
   try {
     Desktop.getDesktop().open(f);
   } catch (IOException e) {
     GUIExceptionHandler.processException(e);
   }
 }
  public JProfilesPanel(JAtlasTree atlasTree) {
    super(I18nUtils.localizedStringForKey("lp_atlas_profile_title"), new GridBagLayout());

    if (atlasTree == null) throw new NullPointerException();

    // profiles combo box
    profilesCombo = new JProfilesComboBox();
    profilesCombo.setToolTipText(I18nUtils.localizedStringForKey("lp_atlas_profile_combo_tips"));
    profilesCombo.addActionListener(new ProfileListListener());

    // delete profile button
    deleteButton =
        new JButton(I18nUtils.localizedStringForKey("lp_atlas_profile_delete_btn_title"));
    deleteButton.addActionListener(new DeleteProfileListener());
    deleteButton.setToolTipText(
        I18nUtils.localizedStringForKey("lp_atlas_profile_delete_btn_tips"));

    // save as profile button
    saveAsButton = new JButton(I18nUtils.localizedStringForKey("lp_atlas_profile_save_btn_title"));
    saveAsButton.setToolTipText(I18nUtils.localizedStringForKey("lp_atlas_profile_save_btn_tips"));
    saveAsButton.addActionListener(new SaveAsProfileListener(atlasTree));

    loadButton = new JButton(I18nUtils.localizedStringForKey("lp_atlas_profile_load_btn_title"));
    loadButton.setToolTipText(I18nUtils.localizedStringForKey("lp_atlas_profile_load_btn_tips"));

    GBC gbc = GBC.eol().fill().insets(5, 5, 5, 5);
    reloadButton = new JButton(Utilities.loadResourceImageIcon("refresh.png"));
    reloadButton.setToolTipText(
        I18nUtils.localizedStringForKey("lp_atlas_profile_refresh_btn_tips"));
    reloadButton.addActionListener(new ReloadListener());
    reloadButton.setPreferredSize(new Dimension(24, 0));

    JPanel p = new JPanel(new BorderLayout());
    p.add(profilesCombo, BorderLayout.CENTER);
    p.add(reloadButton, BorderLayout.EAST);

    contentContainer.add(p, gbc);
    contentContainer.add(deleteButton, gbc.toggleEol());
    contentContainer.add(saveAsButton, gbc);
    contentContainer.add(loadButton, gbc.toggleEol());

    saveAsButton.setEnabled(false);
    deleteButton.setEnabled(false);
    loadButton.setEnabled(false);
  }
Exemple #3
0
  public void actionPerformed(ActionEvent event) {
    MainGUI mg = MainGUI.getMainGUI();
    JPanel panel = new JPanel();
    BorderLayout layout = new BorderLayout();
    layout.setVgap(4);
    panel.setLayout(layout);

    JPanel formatPanel = new JPanel(new BorderLayout());

    formatPanel.setPreferredSize(new Dimension(250, 300));

    formatPanel.add(
        new JLabel(I18nUtils.localizedStringForKey("dlg_new_atlas_select_format_title")),
        BorderLayout.NORTH);
    JList atlasFormatList = new JList(AtlasOutputFormat.getFormatsAsVector());
    atlasFormatList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane scroller = new JScrollPane(atlasFormatList);
    scroller.setPreferredSize(new Dimension(100, 200));
    formatPanel.add(scroller, BorderLayout.CENTER);

    panel.add(formatPanel, BorderLayout.CENTER);
    AtlasOutputFormat currentAOF = null;
    try {
      currentAOF = mg.getAtlas().getOutputFormat();
    } catch (Exception e) {
    }
    if (currentAOF != null) atlasFormatList.setSelectedValue(currentAOF, true);
    else atlasFormatList.setSelectedIndex(1);
    int result =
        JOptionPane.showConfirmDialog(
            MainGUI.getMainGUI(),
            panel,
            I18nUtils.localizedStringForKey("msg_convert_atlas_format"),
            JOptionPane.OK_CANCEL_OPTION);
    if (result != JOptionPane.OK_OPTION) return;

    AtlasOutputFormat format = (AtlasOutputFormat) atlasFormatList.getSelectedValue();
    mg.jAtlasTree.convertAtlas(format);
    mg.getParametersPanel().atlasFormatChanged(format);
  }
    public void actionPerformed(ActionEvent e) {
      if (!jAtlasTree.testAtlasContentValid()) return;
      Object selObject = profilesCombo.getEditor().getItem();
      String profileName = null;
      Profile profile = null;
      if (selObject instanceof Profile) {
        profile = (Profile) selObject;
        profileName = profile.getName();
      } else profileName = (String) selObject;

      if (profileName.length() == 0) {
        JOptionPane.showMessageDialog(
            null,
            I18nUtils.localizedStringForKey("lp_atlas_profile_msg_ask_name"),
            I18nUtils.localizedStringForKey("Error"),
            JOptionPane.ERROR_MESSAGE);
        return;
      }

      profile = new Profile(profileName);

      if (profile.exists()) {
        int response =
            JOptionPane.showConfirmDialog(
                null,
                String.format(
                    I18nUtils.localizedStringForKey("lp_atlas_profile_msg_overwrite_confirm"),
                    profileName),
                I18nUtils.localizedStringForKey("lp_atlas_profile_msg_overwrite_confirm_title"),
                JOptionPane.YES_NO_OPTION);
        if (response != JOptionPane.YES_OPTION) return;
      }

      if (jAtlasTree.save(profile)) {
        reloadProfileList();
        profilesCombo.setSelectedItem(profile);
      }
    }