コード例 #1
0
  private void performEditAction() {
    final Configuration configuration = (Configuration) myTemplatesList.getSelectedValue();
    if (configuration == null) return;

    SearchDialog dialog =
        createDialog(
            new SearchDialogFactory() {
              public SearchDialog createDialog(SearchContext searchContext) {
                if (configuration instanceof SearchConfiguration) {
                  return new SearchDialog(searchContext, false, false) {
                    public Configuration createConfiguration() {
                      SearchConfiguration newConfiguration = new SearchConfiguration();
                      copyConfiguration(configuration, newConfiguration);
                      return newConfiguration;
                    }
                  };
                } else {
                  return new ReplaceDialog(searchContext, false, false) {
                    public Configuration createConfiguration() {
                      ReplaceConfiguration newConfiguration = new ReplaceConfiguration();
                      copyConfiguration(configuration, newConfiguration);
                      return newConfiguration;
                    }
                  };
                }
              }
            });
    dialog.setValuesFromConfig(configuration);
    dialog.setUseLastConfiguration(true);
    dialog.show();
    if (!dialog.isOK()) return;
    Configuration newConfiguration = dialog.getConfiguration();
    copyConfiguration(newConfiguration, configuration);
    configurationsChanged(dialog.getSearchContext());
  }
コード例 #2
0
  private void addTemplate(SearchDialogFactory searchDialogFactory) {
    SearchDialog dialog = createDialog(searchDialogFactory);
    dialog.show();
    if (!dialog.isOK()) return;
    Configuration configuration = dialog.getConfiguration();

    if (configuration.getName() == null
        || configuration.getName().equals(SearchDialog.USER_DEFINED)) {
      String name = dialog.showSaveTemplateAsDialog();

      if (name != null) {
        name =
            ConfigurationManager.findAppropriateName(myConfigurations, name, dialog.getProject());
      }
      if (name == null) return;
      configuration.setName(name);
    }
    myConfigurations.add(configuration);

    configurationsChanged(dialog.getSearchContext());
  }
コード例 #3
0
  public void show() {
    replaceCriteriaEdit.putUserData(
        SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, model.getConfig());

    super.show();
  }