protected void setValuesToConfig(Configuration config) { super.setValuesToConfig(config); final ReplaceConfiguration replaceConfiguration = (ReplaceConfiguration) config; final ReplaceOptions options = replaceConfiguration.getOptions(); options.setMatchOptions(replaceConfiguration.getMatchOptions()); options.setReplacement(replaceCriteriaEdit.getDocument().getText()); options.setToShortenFQN(shortenFQN.isSelected()); options.setToReformatAccordingToStyle(formatAccordingToStyle.isSelected()); options.setToUseStaticImport(useStaticImport.isSelected()); }
public void setValuesFromConfig(Configuration configuration) { // replaceCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, // configuration); if (configuration instanceof ReplaceConfiguration) { final ReplaceConfiguration config = (ReplaceConfiguration) configuration; final ReplaceOptions options = config.getOptions(); super.setValuesFromConfig(config); UIUtil.setContent( replaceCriteriaEdit, config.getOptions().getReplacement(), 0, replaceCriteriaEdit.getDocument().getTextLength(), searchContext.getProject()); shortenFQN.setSelected(options.isToShortenFQN()); formatAccordingToStyle.setSelected(options.isToReformatAccordingToStyle()); useStaticImport.setSelected(options.isToUseStaticImport()); ReplaceOptions newReplaceOptions = ((ReplaceConfiguration) model.getConfig()).getOptions(); newReplaceOptions.clearVariableDefinitions(); for (ReplacementVariableDefinition def : options.getReplacementVariableDefinitions()) { newReplaceOptions.addVariableDefinition((ReplacementVariableDefinition) def.clone()); } } else { super.setValuesFromConfig(configuration); UIUtil.setContent( replaceCriteriaEdit, configuration.getMatchOptions().getSearchPattern(), 0, replaceCriteriaEdit.getDocument().getTextLength(), searchContext.getProject()); } }
public Configuration createConfiguration() { ReplaceConfiguration configuration = new ReplaceConfiguration(); configuration.setName(USER_DEFINED); return configuration; }