Source Code Cross Referenced for BasicCompilerConfiguration.java in  » IDE-Netbeans » cnd » org » netbeans » modules » cnd » makeproject » api » configurations » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » cnd » org.netbeans.modules.cnd.makeproject.api.configurations 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.api.remote.FilePathAdaptor;
045:        import org.netbeans.modules.cnd.makeproject.configurations.ConfigurationMakefileWriter;
046:        import org.netbeans.modules.cnd.makeproject.configurations.ui.BooleanNodeProp;
047:        import org.netbeans.modules.cnd.makeproject.configurations.ui.IntNodeProp;
048:        import org.netbeans.modules.cnd.makeproject.configurations.ui.StringNodeProp;
049:        import org.netbeans.modules.cnd.api.utils.IpeUtils;
050:        import org.netbeans.modules.cnd.makeproject.api.compilers.BasicCompiler;
051:        import org.openide.nodes.Sheet;
052:        import org.openide.util.NbBundle;
053:
054:        public class BasicCompilerConfiguration {
055:            private String baseDir;
056:            private BasicCompilerConfiguration master;
057:
058:            public static int DEVELOPMENT_MODE_FAST = 0;
059:            public static int DEVELOPMENT_MODE_DEBUG = 1;
060:            public static int DEVELOPMENT_MODE_DEBUG_PERF = 2;
061:            public static int DEVELOPMENT_MODE_TEST = 3;
062:            public static int DEVELOPMENT_MODE_RELEASE_DIAG = 4;
063:            public static int DEVELOPMENT_MODE_RELEASE = 5;
064:            public static int DEVELOPMENT_MODE_RELEASE_PERF = 6;
065:            private static final String[] DEVELOPMENT_MODE_NAMES = {
066:                    getString("FastBuildTxt"), getString("DebugTxt"),
067:                    getString("PerformanceDebugTxt"),
068:                    getString("TestCoverageTxt"),
069:                    getString("DiagnosableReleaseTxt"),
070:                    getString("ReleaseTxt"),
071:                    getString("PerformanceReleaseTxt"), };
072:            private IntConfiguration developmentMode;
073:
074:            public static int WARNING_LEVEL_NO = 0;
075:            public static int WARNING_LEVEL_DEFAULT = 1;
076:            public static int WARNING_LEVEL_MORE = 2;
077:            public static int WARNING_LEVEL_TAGS = 3;
078:            public static int WARNING_LEVEL_CONVERT = 4;
079:            public static int WARNING_LEVEL_32_64 = 5;
080:            private static final String[] WARNING_LEVEL_NAMES = {
081:                    getString("NoWarningsTxt"), getString("SomeWarningsTxt"),
082:                    getString("MoreWarningsTxt"),
083:                    getString("ConvertWarningsTxt"), };
084:            private IntConfiguration warningLevel;
085:
086:            public static int BITS_DEFAULT = 0;
087:            public static int BITS_32 = 1;
088:            public static int BITS_64 = 2;
089:            private static final String[] BITS_NAMES = {
090:                    getString("BITS_DEFAULT"), getString("BITS_32"),
091:                    getString("BITS_64"), };
092:            private IntConfiguration sixtyfourBits;
093:            private BooleanConfiguration strip;
094:            private StringConfiguration additionalDependencies;
095:            private StringConfiguration tool;
096:            private OptionsConfiguration commandLineConfiguration;
097:
098:            // Constructors
099:            public BasicCompilerConfiguration(String baseDir,
100:                    BasicCompilerConfiguration master) {
101:                this .baseDir = baseDir;
102:                this .master = master;
103:                developmentMode = new IntConfiguration(master != null ? master
104:                        .getDevelopmentMode() : null, DEVELOPMENT_MODE_DEBUG,
105:                        DEVELOPMENT_MODE_NAMES, null);
106:                warningLevel = new IntConfiguration(master != null ? master
107:                        .getWarningLevel() : null, WARNING_LEVEL_DEFAULT,
108:                        WARNING_LEVEL_NAMES, null);
109:                sixtyfourBits = new IntConfiguration(master != null ? master
110:                        .getSixtyfourBits() : null, BITS_DEFAULT, BITS_NAMES,
111:                        null);
112:                strip = new BooleanConfiguration(master != null ? master
113:                        .getStrip() : null, false, "", ""); // NOI18N
114:                additionalDependencies = new StringConfiguration(
115:                        master != null ? master.getAdditionalDependencies()
116:                                : null, ""); // NOI18N
117:                tool = new StringConfiguration(master != null ? master
118:                        .getTool() : null, ""); // NOI18N
119:                commandLineConfiguration = new OptionsConfiguration();
120:            }
121:
122:            public boolean getModified() {
123:                return developmentMode.getModified()
124:                        || warningLevel.getModified()
125:                        || sixtyfourBits.getModified() || strip.getModified()
126:                        || additionalDependencies.getModified()
127:                        || tool.getModified()
128:                        || commandLineConfiguration.getModified();
129:            }
130:
131:            // baseDir
132:            public void setBaseDir(String baseDir) {
133:                this .baseDir = baseDir;
134:            }
135:
136:            public String getBaseDir() {
137:                return baseDir;
138:            }
139:
140:            // To be overridden
141:            public String getOptions(BasicCompiler compiler) {
142:                return "OVERRIDE"; // NOI18N
143:            }
144:
145:            // Master
146:            public void setMaster(BasicCompilerConfiguration master) {
147:                this .master = master;
148:            }
149:
150:            public BasicCompilerConfiguration getMaster() {
151:                return master;
152:            }
153:
154:            // Development Mode
155:            public void setDevelopmentMode(IntConfiguration developmentMode) {
156:                this .developmentMode = developmentMode;
157:            }
158:
159:            public IntConfiguration getDevelopmentMode() {
160:                return developmentMode;
161:            }
162:
163:            // Warning Level
164:            public void setWarningLevel(IntConfiguration warningLevel) {
165:                this .warningLevel = warningLevel;
166:            }
167:
168:            public IntConfiguration getWarningLevel() {
169:                return warningLevel;
170:            }
171:
172:            // SixtyfourBits
173:            public void setSixtyfourBits(IntConfiguration sixtyfourBits) {
174:                this .sixtyfourBits = sixtyfourBits;
175:            }
176:
177:            public IntConfiguration getSixtyfourBits() {
178:                return sixtyfourBits;
179:            }
180:
181:            // Strip
182:            public void setStrip(BooleanConfiguration strip) {
183:                this .strip = strip;
184:            }
185:
186:            public BooleanConfiguration getStrip() {
187:                return strip;
188:            }
189:
190:            public void setAdditionalDependencies(
191:                    StringConfiguration additionalDependencies) {
192:                this .additionalDependencies = additionalDependencies;
193:            }
194:
195:            public StringConfiguration getAdditionalDependencies() {
196:                return additionalDependencies;
197:            }
198:
199:            // Tool
200:            public void setTool(StringConfiguration tool) {
201:                this .tool = tool;
202:            }
203:
204:            public StringConfiguration getTool() {
205:                return tool;
206:            }
207:
208:            // CommandLine
209:            public OptionsConfiguration getCommandLineConfiguration() {
210:                return commandLineConfiguration;
211:            }
212:
213:            public void setCommandLineConfiguration(
214:                    OptionsConfiguration commandLineConfiguration) {
215:                this .commandLineConfiguration = commandLineConfiguration;
216:            }
217:
218:            public String getOutputFile(String filePath,
219:                    MakeConfiguration conf, boolean expanded) {
220:                String fileName = filePath;
221:                int i = fileName.lastIndexOf("."); // NOI18N
222:                if (i >= 0)
223:                    fileName = fileName.substring(0, i) + ".o"; // NOI18N
224:                else
225:                    fileName = fileName + ".o"; // NOI18N
226:
227:                String dirName;
228:                if (expanded)
229:                    dirName = ConfigurationMakefileWriter.getObjectDir(conf);
230:                else
231:                    dirName = MakeConfiguration.OBJECTDIR_MACRO;
232:
233:                if (IpeUtils.isPathAbsolute(fileName)) {
234:                    String absPath = fileName;
235:                    if (absPath.charAt(0) != '/')
236:                        absPath = '/' + absPath;
237:                    absPath = dirName + '/' + MakeConfiguration.EXT_FOLDER
238:                            + absPath; // UNIX path
239:                    absPath = IpeUtils.replaceOddCharacters(absPath, '_');
240:                    return absPath;
241:                } else if (filePath.startsWith("..")) { // NOI18N
242:                    String absPath = IpeUtils.toAbsolutePath(getBaseDir(),
243:                            fileName);
244:                    absPath = FilePathAdaptor.normalize(absPath);
245:                    absPath = IpeUtils.replaceOddCharacters(absPath, '_');
246:                    if (absPath.charAt(0) != '/')
247:                        absPath = '/' + absPath;
248:                    return dirName + '/' + MakeConfiguration.EXT_FOLDER
249:                            + absPath; // UNIX path
250:                } else
251:                    return dirName + '/' + fileName; // UNIX path
252:            }
253:
254:            // Assigning & Cloning
255:            public void assign(BasicCompilerConfiguration conf) {
256:                setBaseDir(conf.getBaseDir());
257:                getDevelopmentMode().assign(conf.getDevelopmentMode());
258:                getWarningLevel().assign(conf.getWarningLevel());
259:                getSixtyfourBits().assign(conf.getSixtyfourBits());
260:                getStrip().assign(conf.getStrip());
261:                getAdditionalDependencies().assign(
262:                        conf.getAdditionalDependencies());
263:                getTool().assign(conf.getTool());
264:                getCommandLineConfiguration().assign(
265:                        conf.getCommandLineConfiguration());
266:            }
267:
268:            public Object clone() {
269:                BasicCompilerConfiguration clone = new BasicCompilerConfiguration(
270:                        getBaseDir(), getMaster());
271:                clone
272:                        .setDevelopmentMode((IntConfiguration) getDevelopmentMode()
273:                                .clone());
274:                clone.setWarningLevel((IntConfiguration) getWarningLevel()
275:                        .clone());
276:                clone.setSixtyfourBits((IntConfiguration) getSixtyfourBits()
277:                        .clone());
278:                clone.setStrip((BooleanConfiguration) getStrip().clone());
279:                clone
280:                        .setAdditionalDependencies((StringConfiguration) getAdditionalDependencies()
281:                                .clone());
282:                clone.setTool((StringConfiguration) getTool().clone());
283:                clone
284:                        .setCommandLineConfiguration((OptionsConfiguration) getCommandLineConfiguration()
285:                                .clone());
286:                return clone;
287:            }
288:
289:            // Sheets
290:            public Sheet.Set getBasicSet() {
291:                Sheet.Set set = new Sheet.Set();
292:                set.setName("BasicOptions"); // NOI18N
293:                set.setDisplayName(getString("BasicOptionsTxt"));
294:                set.setShortDescription(getString("BasicOptionsHint"));
295:                set.put(new IntNodeProp(getDevelopmentMode(), true,
296:                        "DevelopmentMode", getString("DevelopmentModeTxt"),
297:                        getString("DevelopmentModeHint"))); // NOI18N
298:                set.put(new IntNodeProp(getWarningLevel(), true,
299:                        "WarningLevel", getString("WarningLevelTxt"),
300:                        getString("WarningLevelHint"))); // NOI18N
301:                set.put(new IntNodeProp(getSixtyfourBits(), true,
302:                        "64BitArchitecture", getString("64BitArchitectureTxt"),
303:                        getString("64BitArchitectureHint"))); // NOI18N
304:                set.put(new BooleanNodeProp(getStrip(), true, "StripSymbols",
305:                        getString("StripSymbolsTxt"),
306:                        getString("StripSymbolsHint"))); // NOI18N
307:                return set;
308:            }
309:
310:            public Sheet.Set getInputSet() {
311:                Sheet.Set set = new Sheet.Set();
312:                set.setName("Input"); // NOI18N
313:                set.setDisplayName(getString("InputTxt"));
314:                set.setShortDescription(getString("InputHint"));
315:                set.put(new StringNodeProp(getAdditionalDependencies(),
316:                        "AdditionalDependencies",
317:                        getString("AdditionalDependenciesTxt1"),
318:                        getString("AdditionalDependenciesHint"))); // NOI18N
319:                return set;
320:            }
321:
322:            /** Look up i18n strings here */
323:            private static String getString(String s) {
324:                return NbBundle.getMessage(BasicCompilerConfiguration.class, s);
325:            }
326:        }
www_.___j_a___v___a__2_s.___c__o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.