private void constructor(boolean projectSpecific, SRX defaultSRX, SRX userSRX, SRX projectSRX) {
    this.isProjectSpecific = projectSpecific;
    this.defaultSRX = defaultSRX;
    this.userSRX = userSRX;
    this.projectSRX = projectSRX;
    this.editableSRX =
        isProjectSpecific && projectSRX != null ? projectSRX.clone() : userSRX.clone();

    StaticUIUtils.setEscapeAction(
        this,
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            cancelButtonActionPerformed(null);
          }
        });

    initComponents();

    getRootPane().setDefaultButton(okButton);

    mapTable.getSelectionModel().addListSelectionListener(this);
    ruleTable.getSelectionModel().addListSelectionListener(this);

    MappingRulesModel model = (MappingRulesModel) mapTable.getModel();
    model.addExceptionListener(
        new ExceptionListener() {
          @Override
          public void exceptionThrown(Exception e) {
            mapErrorsLabel.setText(e.getLocalizedMessage());
          }
        });

    if (isProjectSpecific) {
      setTitle(OStrings.getString("GUI_SEGMENTATION_TITLE_PROJECTSPECIFIC")); // NOI18N
    } else {
      projectSpecificCB.setVisible(false);
    }
    if (projectSpecific && projectSRX == null) {
      mapTable.setEnabled(false);
      mapTable.setFocusable(false);
      mapInsertButton.setEnabled(false);
      toDefaultsButton.setEnabled(false);
    } else {
      if (projectSpecific) projectSpecificCB.setSelected(true);
      mapTable.setEnabled(true);
      mapTable.setFocusable(true);
      mapInsertButton.setEnabled(true);
      toDefaultsButton.setEnabled(true);
    }

    pack();
    setSize(getWidth() * 5 / 4, getHeight() * 5 / 4);
    DockingUI.displayCentered(this);
  }
Ejemplo n.º 2
0
 private void grandInit() {
   initComponents();
   icon.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
   DockingUI.displayCentered(this);
   StaticUIUtils.setEscapeAction(
       this,
       new AbstractAction() {
         @Override
         public void actionPerformed(ActionEvent e) {
           cancelButtonActionPerformed(null);
         }
       });
 }
Ejemplo n.º 3
0
  public ScriptingWindow() {
    setTitle(OStrings.getString("SCW_TITLE"));

    OmegaTIcons.setIconImages(this);

    StaticUIUtils.setEscapeClosable(this);

    setScriptsDirectory(
        Preferences.getPreferenceDefault(Preferences.SCRIPTS_DIRECTORY, DEFAULT_SCRIPTS_DIR));
    addScriptCommandToOmegaT();
    addRunShortcutToOmegaT();

    initWindowLayout();

    monitor = new ScriptsMonitor(this, m_scriptList, getAvailableScriptExtensions());
    if (m_scriptsDirectory != null) {
      monitor.start(m_scriptsDirectory);
    }

    logResult(listScriptEngine().toString());
  }
  public static List<String> show(List<String> excludes) {
    result = null;
    data = new ArrayList<String>(excludes);
    final FilenamePatternsEditor dialog =
        new FilenamePatternsEditor(Core.getMainWindow().getApplicationFrame(), true);

    final AbstractTableModel model =
        new AbstractTableModel() {
          public int getColumnCount() {
            return 1;
          }

          public String getColumnName(int column) {
            return OStrings.getString("FILENAMEPATTERNS_MASK");
          }

          public int getRowCount() {
            return data.size();
          }

          public Object getValueAt(int row, int col) {
            return data.get(row);
          }

          @Override
          public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
            data.set(rowIndex, aValue.toString());
          }

          public boolean isCellEditable(int row, int col) {
            return true;
          }
        };
    dialog.table.setModel(model);

    dialog.btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            result = data;
            dialog.dispose();
          }
        });
    dialog.btnCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dialog.dispose();
          }
        });
    dialog.btnAdd.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            data.add("");
            model.fireTableDataChanged();
            dialog.table.changeSelection(data.size() - 1, 0, false, false);
            dialog.table.editCellAt(data.size() - 1, 0);
            dialog.table.transferFocus();
          }
        });
    dialog.btnRemove.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (dialog.table.getSelectedRow() >= 0 && dialog.table.getSelectedRow() < data.size()) {
              data.remove(dialog.table.getSelectedRow());
            }
            model.fireTableDataChanged();
          }
        });
    DockingUI.displayCentered(dialog);
    StaticUIUtils.setEscapeClosable(dialog);
    dialog.setVisible(true);

    return result;
  }