001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.cnd.makeproject.api.configurations;
043:
044: import org.netbeans.modules.cnd.makeproject.configurations.ui.StringNodeProp;
045: import org.openide.nodes.Sheet;
046: import org.openide.util.NbBundle;
047:
048: public class CustomToolConfiguration {
049: // Custom tool
050: private StringConfiguration commandLine;
051: private StringConfiguration description;
052: private StringConfiguration outputs;
053: private StringConfiguration additionalDependencies;
054:
055: public CustomToolConfiguration() {
056: // Custom Tool
057: commandLine = new StringConfiguration(null, ""); // NOI18N
058: description = new StringConfiguration(null,
059: getString("PerformingStepTxt"));
060: outputs = new StringConfiguration(null, ""); // NOI18N
061: additionalDependencies = new StringConfiguration(null, ""); // NOI18N
062: }
063:
064: public boolean getModified() {
065: return commandLine.getModified() || description.getModified()
066: || outputs.getModified()
067: || additionalDependencies.getModified();
068: }
069:
070: public void setCommandLine(StringConfiguration commandLine) {
071: this .commandLine = commandLine;
072: }
073:
074: public StringConfiguration getCommandLine() {
075: return commandLine;
076: }
077:
078: public void setDescription(StringConfiguration description) {
079: this .description = description;
080: }
081:
082: public StringConfiguration getDescription() {
083: return description;
084: }
085:
086: public void setOutputs(StringConfiguration outputs) {
087: this .outputs = outputs;
088: }
089:
090: public StringConfiguration getOutputs() {
091: return outputs;
092: }
093:
094: public void setAdditionalDependencies(
095: StringConfiguration additionalDependencies) {
096: this .additionalDependencies = additionalDependencies;
097: }
098:
099: public StringConfiguration getAdditionalDependencies() {
100: return additionalDependencies;
101: }
102:
103: public void assign(CustomToolConfiguration conf) {
104: getCommandLine().assign(conf.getCommandLine());
105: getDescription().assign(conf.getDescription());
106: getOutputs().assign(conf.getOutputs());
107: getAdditionalDependencies().assign(
108: conf.getAdditionalDependencies());
109: }
110:
111: public Object clone() {
112: CustomToolConfiguration i = new CustomToolConfiguration();
113:
114: i
115: .setCommandLine((StringConfiguration) getCommandLine()
116: .clone());
117: i
118: .setDescription((StringConfiguration) getDescription()
119: .clone());
120: i.setOutputs((StringConfiguration) getOutputs().clone());
121: i
122: .setAdditionalDependencies((StringConfiguration) getAdditionalDependencies()
123: .clone());
124:
125: return i;
126: }
127:
128: public Sheet getSheet() {
129: Sheet sheet = new Sheet();
130:
131: Sheet.Set set = new Sheet.Set();
132: set.setName("CustomBuild"); // NOI18N
133: set.setDisplayName(getString("CustomBuildTxt"));
134: set.setShortDescription(getString("CustomBuildHint"));
135: set.put(new StringNodeProp(getCommandLine(), "Command Line",
136: getString("CommandLineTxt2"),
137: getString("CommandLineHint2"))); // NOI18N
138: set.put(new StringNodeProp(getDescription(), "Description",
139: getString("DescriptionTxt"),
140: getString("DescriptionHint"))); // NOI18N
141: set.put(new StringNodeProp(getOutputs(), "Outputs",
142: getString("OutputsTxt"), getString("OutputsNint"))); // NOI18N
143: set.put(new StringNodeProp(getAdditionalDependencies(),
144: "AdditionalDependencies",
145: getString("AdditionalDependenciesTxt1"),
146: getString("AdditionalDependenciesHint"))); // NOI18N
147: sheet.put(set);
148:
149: return sheet;
150: }
151:
152: /** Look up i18n strings here */
153: private static String getString(String s) {
154: return NbBundle.getMessage(CustomToolConfiguration.class, s);
155: }
156: }
|