diff options
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java')
-rw-r--r-- | codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java new file mode 100644 index 00000000000..37d8a748d5e --- /dev/null +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2012 Google, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alex Ruiz - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.internal.core.externaltool; + +import static org.eclipse.cdt.codan.core.param.IProblemPreferenceDescriptor.PreferenceType.TYPE_STRING; +import static org.eclipse.cdt.codan.internal.core.externaltool.Messages.ConfigurationSettings_args_format; + +import org.eclipse.cdt.codan.core.externaltool.SingleConfigurationSetting; +import org.eclipse.cdt.codan.core.param.BasicProblemPreference; +import org.eclipse.cdt.codan.core.param.IProblemPreferenceDescriptor; + +/** + * User-configurable setting that specifies the arguments to pass when invoking the external tool. + * The arguments are stored in a single {@code String}. + * + * @author alruiz@google.com (Alex Ruiz) + * + * @since 2.1 + */ +public class ArgsSetting extends SingleConfigurationSetting<String> { + private static final String KEY = "externalToolArgs"; //$NON-NLS-1$ + + /** + * Constructor. + * @param externalToolName the name of the external tool, to be displayed to the user. + * @param defaultValue the default value of the setting. + */ + public ArgsSetting(String externalToolName, String defaultValue) { + super(newPreferenceDescriptor(externalToolName), defaultValue, String.class); + } + + private static IProblemPreferenceDescriptor newPreferenceDescriptor(String externalToolName) { + String label = String.format(ConfigurationSettings_args_format, externalToolName); + return new BasicProblemPreference(KEY, label, TYPE_STRING); + } +} |