/** Displays the filters setup dialog to allow customizing file filters in detail. */
  public void optionsSetupFileFiltersMenuItemActionPerformed() {
    FiltersCustomizer dlg =
        new FiltersCustomizer(
            mainWindow,
            false,
            FilterMaster.createDefaultFiltersConfig(),
            FilterMaster.loadConfig(StaticUtils.getConfigDir()),
            null);
    dlg.setVisible(true);
    if (dlg.getReturnStatus() == FiltersCustomizer.RET_OK) {
      // saving config
      FilterMaster.saveConfig(dlg.result, StaticUtils.getConfigDir());

      if (Core.getProject().isProjectLoaded()) {
        if (FilterMaster.loadConfig(Core.getProject().getProjectProperties().getProjectInternal())
            != null) {
          // project specific filters are in place. No need to reload project when
          // non-project-specific filters are changed
          return;
        }
        // asking to reload a project
        int res =
            JOptionPane.showConfirmDialog(
                mainWindow,
                OStrings.getString("MW_REOPEN_QUESTION"),
                OStrings.getString("MW_REOPEN_TITLE"),
                JOptionPane.YES_NO_OPTION);
        if (res == JOptionPane.YES_OPTION) ProjectUICommands.projectReload();
      }
    }
  }
  /** Create translated documents. */
  public void projectCompileMenuItemActionPerformed() {
    if (Preferences.isPreference(Preferences.TAGS_VALID_REQUIRED)) {
      List<ErrorReport> stes = Core.getTagValidation().listInvalidTags();
      if (stes != null) {
        Core.getTagValidation()
            .displayTagValidationErrors(stes, OStrings.getString("TF_MESSAGE_COMPILE"));
        return;
      }
    }

    ProjectUICommands.projectCompile();
  }
  /** Displays the external TMX dialog to allow customizing the external TMX options. */
  public void optionsExtTMXMenuItemActionPerformed() {

    ExternalTMXMatchesDialog externalTMXOptions = new ExternalTMXMatchesDialog(mainWindow);
    externalTMXOptions.setVisible(true);

    if (externalTMXOptions.getReturnStatus() == ExternalTMXMatchesDialog.RET_OK
        && Core.getProject().isProjectLoaded()) {
      // asking to reload a project
      int res =
          JOptionPane.showConfirmDialog(
              mainWindow,
              OStrings.getString("MW_REOPEN_QUESTION"),
              OStrings.getString("MW_REOPEN_TITLE"),
              JOptionPane.YES_NO_OPTION);
      if (res == JOptionPane.YES_OPTION) ProjectUICommands.projectReload();
    }
  }
  /** Create current translated document. */
  public void projectSingleCompileMenuItemActionPerformed() {
    String midName = Core.getEditor().getCurrentFile();
    if (StringUtil.isEmpty(midName)) {
      return;
    }

    String sourcePattern = StaticUtils.escapeNonRegex(midName);
    if (Preferences.isPreference(Preferences.TAGS_VALID_REQUIRED)) {
      List<ErrorReport> stes = Core.getTagValidation().listInvalidTags(sourcePattern);
      if (stes != null) {
        Core.getTagValidation()
            .displayTagValidationErrors(stes, OStrings.getString("TF_MESSAGE_COMPILE"));
        return;
      }
    }

    ProjectUICommands.projectSingleCompile(sourcePattern);
  }
  /**
   * Displays the segmentation setup dialog to allow customizing the segmentation rules in detail.
   */
  public void optionsSentsegMenuItemActionPerformed() {
    SegmentationCustomizer segment_window =
        new SegmentationCustomizer(mainWindow, false, SRX.getDefault(), Preferences.getSRX(), null);
    segment_window.setVisible(true);

    if (segment_window.getReturnStatus() == SegmentationCustomizer.RET_OK) {
      Preferences.setSRX(segment_window.getSRX());
      if (Core.getProject().isProjectLoaded()
          && Core.getProject().getProjectProperties().getProjectSRX() == null) {
        // asking to reload a project
        int res =
            JOptionPane.showConfirmDialog(
                mainWindow,
                OStrings.getString("MW_REOPEN_QUESTION"),
                OStrings.getString("MW_REOPEN_TITLE"),
                JOptionPane.YES_NO_OPTION);
        if (res == JOptionPane.YES_OPTION) ProjectUICommands.projectReload();
      }
    }
  }
  /**
   * Displays the tag validation setup dialog to allow customizing the diverse tag validation
   * options.
   */
  public void optionsTagValidationMenuItemActionPerformed() {
    TagProcessingOptionsDialog tagProcessingOptionsDialog =
        new TagProcessingOptionsDialog(mainWindow);
    tagProcessingOptionsDialog.setVisible(true);

    if (tagProcessingOptionsDialog.getReturnStatus() == TagProcessingOptionsDialog.RET_OK
        && Core.getProject().isProjectLoaded()) {
      // Redisplay according to new view settings
      Core.getEditor().getSettings().updateTagValidationPreferences();

      // asking to reload a project
      int res =
          JOptionPane.showConfirmDialog(
              mainWindow,
              OStrings.getString("MW_REOPEN_QUESTION"),
              OStrings.getString("MW_REOPEN_TITLE"),
              JOptionPane.YES_NO_OPTION);
      if (res == JOptionPane.YES_OPTION) {
        ProjectUICommands.projectReload();
      }
    }
  }
 /** Edits project's properties */
 public void projectEditMenuItemActionPerformed() {
   ProjectUICommands.projectEditProperties();
 }
 /** Save project. */
 public void projectSaveMenuItemActionPerformed() {
   ProjectUICommands.projectSave();
 }
 public void projectReloadMenuItemActionPerformed() {
   ProjectUICommands.projectReload();
 }
Example #10
0
 /** Open project. */
 public void projectOpenMenuItemActionPerformed() {
   ProjectUICommands.projectOpen(null);
 }
Example #11
0
 /** Create new team project. */
 public void projectTeamNewMenuItemActionPerformed() {
   ProjectUICommands.projectTeamCreate();
 }