Source Code Cross Referenced for MakeConfiguration.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:        package org.netbeans.modules.cnd.makeproject.api.configurations;
042:
043:        import java.util.ArrayList;
044:        import java.util.HashSet;
045:        import java.util.List;
046:        import java.util.Set;
047:        import java.util.Vector;
048:        import org.netbeans.api.project.Project;
049:        import org.netbeans.modules.cnd.api.compilers.CompilerSetManager;
050:        import org.netbeans.modules.cnd.api.compilers.CompilerSet;
051:        import org.netbeans.modules.cnd.api.compilers.Tool;
052:        import org.netbeans.modules.cnd.api.utils.IpeUtils;
053:        import org.netbeans.modules.cnd.makeproject.MakeOptions;
054:        import org.netbeans.modules.cnd.makeproject.api.remote.FilePathAdaptor;
055:        import org.netbeans.modules.cnd.makeproject.configurations.ui.IntNodeProp;
056:        import org.netbeans.modules.cnd.makeproject.api.platforms.Platforms;
057:        import org.netbeans.modules.cnd.makeproject.configurations.ui.BooleanNodeProp;
058:        import org.netbeans.modules.cnd.makeproject.configurations.ui.CompilerSetNodeProp;
059:        import org.netbeans.modules.cnd.makeproject.configurations.ui.RequiredProjectsNodeProp;
060:        import org.netbeans.modules.cnd.settings.CppSettings;
061:        import org.openide.nodes.Sheet;
062:        import org.openide.util.NbBundle;
063:
064:        public class MakeConfiguration extends Configuration {
065:
066:            public static final String MAKEFILE_IMPL = "Makefile-impl.mk"; // NOI18N
067:            public static final String BUILD_FOLDER = "build"; // NOI18N
068:            public static final String DIST_FOLDER = "dist"; // NOI18N
069:            public static final String EXT_FOLDER = "_ext"; // NOI18N
070:            public static final String OBJECTDIR_MACRO_NAME = "OBJECTDIR"; // NOI18N
071:            public static final String OBJECTDIR_MACRO = "${"
072:                    + OBJECTDIR_MACRO_NAME + "}"; // NOI18N
073:            // Project Types
074:            private static String[] TYPE_NAMES = { getString("MakefileName"),
075:                    getString("ApplicationName"),
076:                    getString("DynamicLibraryName"),
077:                    getString("StaticLibraryName"), };
078:            public static final int TYPE_MAKEFILE = 0;
079:            public static final int TYPE_APPLICATION = 1;
080:            public static final int TYPE_DYNAMIC_LIB = 2;
081:            public static final int TYPE_STATIC_LIB = 3;
082:            // Configurations
083:            private IntConfiguration configurationType;
084:            private MakefileConfiguration makefileConfiguration;
085:            private CompilerSet2Configuration compilerSet;
086:            private LanguageBooleanConfiguration cRequired;
087:            private LanguageBooleanConfiguration cppRequired;
088:            private LanguageBooleanConfiguration fortranRequired;
089:            private IntConfiguration platform;
090:            private BooleanConfiguration dependencyChecking;
091:            private CCompilerConfiguration cCompilerConfiguration;
092:            private CCCompilerConfiguration ccCompilerConfiguration;
093:            private FortranCompilerConfiguration fortranCompilerConfiguration;
094:            private LinkerConfiguration linkerConfiguration;
095:            private ArchiverConfiguration archiverConfiguration;
096:            private RequiredProjectsConfiguration requiredProjectsConfiguration;
097:            private boolean languagesDirty = true;
098:
099:            // Constructors
100:            public MakeConfiguration(
101:                    MakeConfigurationDescriptor makeConfigurationDescriptor,
102:                    String name, int configurationTypeValue) {
103:                this (makeConfigurationDescriptor.getBaseDir(), name,
104:                        configurationTypeValue);
105:            }
106:
107:            public MakeConfiguration(String baseDir, String name,
108:                    int configurationTypeValue) {
109:                super (baseDir, name);
110:                configurationType = new IntConfiguration(null,
111:                        configurationTypeValue, TYPE_NAMES, null);
112:                compilerSet = new CompilerSet2Configuration(this , null);
113:                cRequired = new LanguageBooleanConfiguration();
114:                cppRequired = new LanguageBooleanConfiguration();
115:                fortranRequired = new LanguageBooleanConfiguration();
116:                platform = new IntConfiguration(null, MakeOptions.getInstance()
117:                        .getPlatform(), Platforms.getPlatformDisplayNames(),
118:                        null);
119:                makefileConfiguration = new MakefileConfiguration(this );
120:                dependencyChecking = new BooleanConfiguration(null,
121:                        isMakefileConfiguration() ? false : MakeOptions
122:                                .getInstance().getDepencyChecking());
123:                cCompilerConfiguration = new CCompilerConfiguration(baseDir,
124:                        null);
125:                ccCompilerConfiguration = new CCCompilerConfiguration(baseDir,
126:                        null);
127:                fortranCompilerConfiguration = new FortranCompilerConfiguration(
128:                        baseDir, null);
129:                linkerConfiguration = new LinkerConfiguration(this );
130:                archiverConfiguration = new ArchiverConfiguration(this );
131:                requiredProjectsConfiguration = new RequiredProjectsConfiguration();
132:            }
133:
134:            public void setMakefileConfiguration(
135:                    MakefileConfiguration makefileConfiguration) {
136:                this .makefileConfiguration = makefileConfiguration;
137:            }
138:
139:            public MakefileConfiguration getMakefileConfiguration() {
140:                return makefileConfiguration;
141:            }
142:
143:            public IntConfiguration getConfigurationType() {
144:                return configurationType;
145:            }
146:
147:            public void setConfigurationType(IntConfiguration configurationType) {
148:                this .configurationType = configurationType;
149:            }
150:
151:            public BooleanConfiguration getDependencyChecking() {
152:                return dependencyChecking;
153:            }
154:
155:            public void setDependencyChecking(
156:                    BooleanConfiguration dependencyChecking) {
157:                this .dependencyChecking = dependencyChecking;
158:            }
159:
160:            public CompilerSet2Configuration getCompilerSet() {
161:                return compilerSet;
162:            }
163:
164:            public void setCompilerSet(CompilerSet2Configuration compilerSet) {
165:                this .compilerSet = compilerSet;
166:            }
167:
168:            public LanguageBooleanConfiguration getCRequired() {
169:                return cRequired;
170:            }
171:
172:            public LanguageBooleanConfiguration getCppRequired() {
173:                return cppRequired;
174:            }
175:
176:            public LanguageBooleanConfiguration getFortranRequired() {
177:                return fortranRequired;
178:            }
179:
180:            public void setCRequired(LanguageBooleanConfiguration cRequired) {
181:                this .cRequired = cRequired;
182:            }
183:
184:            public void setCppRequired(LanguageBooleanConfiguration cppRequired) {
185:                this .cppRequired = cppRequired;
186:            }
187:
188:            public void setFortranRequired(
189:                    LanguageBooleanConfiguration fortranRequired) {
190:                this .fortranRequired = fortranRequired;
191:            }
192:
193:            public IntConfiguration getPlatform() {
194:                return platform;
195:            }
196:
197:            public void setPlatform(IntConfiguration platform) {
198:                this .platform = platform;
199:            }
200:
201:            public boolean isApplicationConfiguration() {
202:                return getConfigurationType().getValue() == TYPE_APPLICATION;
203:            }
204:
205:            public boolean isCompileConfiguration() {
206:                return getConfigurationType().getValue() == TYPE_APPLICATION
207:                        || getConfigurationType().getValue() == TYPE_DYNAMIC_LIB
208:                        || getConfigurationType().getValue() == TYPE_STATIC_LIB;
209:            }
210:
211:            public boolean isLibraryConfiguration() {
212:                return getConfigurationType().getValue() == TYPE_DYNAMIC_LIB
213:                        || getConfigurationType().getValue() == TYPE_STATIC_LIB;
214:            }
215:
216:            public boolean isLinkerConfiguration() {
217:                return getConfigurationType().getValue() == TYPE_APPLICATION
218:                        || getConfigurationType().getValue() == TYPE_DYNAMIC_LIB;
219:            }
220:
221:            public boolean isMakefileConfiguration() {
222:                return getConfigurationType().getValue() == TYPE_MAKEFILE;
223:            }
224:
225:            public boolean isDynamicLibraryConfiguration() {
226:                return getConfigurationType().getValue() == TYPE_DYNAMIC_LIB;
227:            }
228:
229:            public boolean isArchiverConfiguration() {
230:                return getConfigurationType().getValue() == TYPE_STATIC_LIB;
231:            }
232:
233:            public void setCCompilerConfiguration(
234:                    CCompilerConfiguration cCompilerConfiguration) {
235:                this .cCompilerConfiguration = cCompilerConfiguration;
236:            }
237:
238:            public CCompilerConfiguration getCCompilerConfiguration() {
239:                return cCompilerConfiguration;
240:            }
241:
242:            public void setCCCompilerConfiguration(
243:                    CCCompilerConfiguration ccCompilerConfiguration) {
244:                this .ccCompilerConfiguration = ccCompilerConfiguration;
245:            }
246:
247:            public CCCompilerConfiguration getCCCompilerConfiguration() {
248:                return ccCompilerConfiguration;
249:            }
250:
251:            public void setFortranCompilerConfiguration(
252:                    FortranCompilerConfiguration fortranCompilerConfiguration) {
253:                this .fortranCompilerConfiguration = fortranCompilerConfiguration;
254:            }
255:
256:            public FortranCompilerConfiguration getFortranCompilerConfiguration() {
257:                return fortranCompilerConfiguration;
258:            }
259:
260:            public void setLinkerConfiguration(
261:                    LinkerConfiguration linkerConfiguration) {
262:                this .linkerConfiguration = linkerConfiguration;
263:            }
264:
265:            public LinkerConfiguration getLinkerConfiguration() {
266:                return linkerConfiguration;
267:            }
268:
269:            public void setArchiverConfiguration(
270:                    ArchiverConfiguration archiverConfiguration) {
271:                this .archiverConfiguration = archiverConfiguration;
272:            }
273:
274:            public ArchiverConfiguration getArchiverConfiguration() {
275:                return archiverConfiguration;
276:            }
277:
278:            // LibrariesConfiguration
279:            public RequiredProjectsConfiguration getRequiredProjectsConfiguration() {
280:                return requiredProjectsConfiguration;
281:            }
282:
283:            public void setRequiredProjectsConfiguration(
284:                    RequiredProjectsConfiguration requiredProjectsConfiguration) {
285:                this .requiredProjectsConfiguration = requiredProjectsConfiguration;
286:            }
287:
288:            public void assign(Configuration conf) {
289:                MakeConfiguration makeConf = (MakeConfiguration) conf;
290:                setName(makeConf.getName());
291:                setBaseDir(makeConf.getBaseDir());
292:                getConfigurationType().assign(makeConf.getConfigurationType());
293:                getCompilerSet().assign(makeConf.getCompilerSet());
294:                getCRequired().assign(makeConf.getCRequired());
295:                getCppRequired().assign(makeConf.getCppRequired());
296:                getFortranRequired().assign(makeConf.getFortranRequired());
297:                getPlatform().assign(makeConf.getPlatform());
298:                getDependencyChecking()
299:                        .assign(makeConf.getDependencyChecking());
300:
301:                getMakefileConfiguration().assign(
302:                        makeConf.getMakefileConfiguration());
303:                getCCompilerConfiguration().assign(
304:                        makeConf.getCCompilerConfiguration());
305:                getCCCompilerConfiguration().assign(
306:                        makeConf.getCCCompilerConfiguration());
307:                getFortranCompilerConfiguration().assign(
308:                        makeConf.getFortranCompilerConfiguration());
309:                getLinkerConfiguration().assign(
310:                        makeConf.getLinkerConfiguration());
311:                getArchiverConfiguration().assign(
312:                        makeConf.getArchiverConfiguration());
313:                getRequiredProjectsConfiguration().assign(
314:                        makeConf.getRequiredProjectsConfiguration());
315:
316:                // do assign on all aux objects
317:                ConfigurationAuxObject[] auxs = getAuxObjects(); // from this profile
318:                //ConfigurationAuxObject[] p_auxs = conf.getAuxObjects(); // from the 'other' profile
319:                for (int i = 0; i < auxs.length; i++) {
320:                    // unsafe using! suppose same set of objects and same object order
321:                    String id = auxs[i].getId();
322:                    ConfigurationAuxObject object = conf.getAuxObject(id);
323:                    if (object != null) {
324:                        // safe using
325:                        auxs[i].assign(object);
326:                    } else {
327:                        System.err.println("Configuration - assign: Object ID "
328:                                + id + " do not found"); // NOI18N
329:                    }
330:                }
331:            }
332:
333:            public Configuration cloneConf() {
334:                return (Configuration) clone();
335:            }
336:
337:            public Configuration copy() {
338:                MakeConfiguration copy = new MakeConfiguration(getBaseDir(),
339:                        getName(), getConfigurationType().getValue());
340:                copy.assign(this );
341:                // copy aux objects
342:                ConfigurationAuxObject[] auxs = getAuxObjects();
343:                Vector copiedAuxs = new Vector();
344:                for (int i = 0; i < auxs.length; i++) {
345:                    if (auxs[i] instanceof  ItemConfiguration) {
346:                        copiedAuxs
347:                                .add(((ItemConfiguration) auxs[i]).copy(copy));
348:                    } else {
349:                        copiedAuxs.add(auxs[i]);
350:                    }
351:                }
352:                copy.setAuxObjects(copiedAuxs);
353:                return copy;
354:            }
355:
356:            // Cloning
357:            @Override
358:            public Object clone() {
359:                MakeConfiguration clone = new MakeConfiguration(getBaseDir(),
360:                        getName(), getConfigurationType().getValue());
361:                super .cloneConf(clone);
362:                clone.setCloneOf(this );
363:
364:                clone
365:                        .setCompilerSet((CompilerSet2Configuration) getCompilerSet()
366:                                .clone());
367:                clone
368:                        .setCRequired((LanguageBooleanConfiguration) getCRequired()
369:                                .clone());
370:                clone
371:                        .setCppRequired((LanguageBooleanConfiguration) getCppRequired()
372:                                .clone());
373:                clone
374:                        .setFortranRequired((LanguageBooleanConfiguration) getFortranRequired()
375:                                .clone());
376:                clone.setPlatform((IntConfiguration) getPlatform().clone());
377:                clone
378:                        .setMakefileConfiguration((MakefileConfiguration) getMakefileConfiguration()
379:                                .clone());
380:                clone
381:                        .setDependencyChecking((BooleanConfiguration) getDependencyChecking()
382:                                .clone());
383:                clone
384:                        .setCCompilerConfiguration((CCompilerConfiguration) getCCompilerConfiguration()
385:                                .clone());
386:                clone
387:                        .setCCCompilerConfiguration((CCCompilerConfiguration) getCCCompilerConfiguration()
388:                                .clone());
389:                clone
390:                        .setFortranCompilerConfiguration((FortranCompilerConfiguration) getFortranCompilerConfiguration()
391:                                .clone());
392:                clone
393:                        .setLinkerConfiguration((LinkerConfiguration) getLinkerConfiguration()
394:                                .clone());
395:                clone
396:                        .setArchiverConfiguration((ArchiverConfiguration) getArchiverConfiguration()
397:                                .clone());
398:                clone
399:                        .setRequiredProjectsConfiguration((RequiredProjectsConfiguration) getRequiredProjectsConfiguration()
400:                                .clone());
401:
402:                // Clone all the aux objects
403:                //Vector clonedAuxObjects = new Vector();
404:                //for (Enumeration e = auxObjects.elements() ; e.hasMoreElements() ;) {
405:                //    ConfigurationAuxObject o = (ConfigurationAuxObject)e.nextElement();
406:                //    ConfigurationAuxObject clone2 = (ConfigurationAuxObject)o.clone();
407:                //    clonedAuxObjects.add(clone2);
408:                //}
409:                ConfigurationAuxObject[] objects = getAuxObjects();
410:                List<ConfigurationAuxObject> clonedAuxObjects = new ArrayList<ConfigurationAuxObject>();
411:                for (int i = 0; i < objects.length; i++) {
412:                    clonedAuxObjects.add((ConfigurationAuxObject) objects[i]
413:                            .clone());
414:                }
415:                clone.setAuxObjects(clonedAuxObjects);
416:                return clone;
417:            }
418:
419:            public Sheet getGeneralSheet(Project project) {
420:                Sheet sheet = new Sheet();
421:
422:                Sheet.Set set = new Sheet.Set();
423:                set.setName("ProjectDefaults"); // NOI18N
424:                set.setDisplayName(getString("ProjectDefaultsTxt"));
425:                set.setShortDescription(getString("ProjectDefaultsHint"));
426:                //set.put(new IntNodeProp(getCompilerSet2(), true, "CompilerSCollection", getString("CompilerCollectionTxt"), getString("CompilerCollectionHint"))); // NOI18N
427:                set.put(new CompilerSetNodeProp(getCompilerSet(), true,
428:                        "CompilerSCollection2",
429:                        getString("CompilerCollectionTxt"),
430:                        getString("CompilerCollectionHint"))); // NOI18N
431:                set.put(new BooleanNodeProp(getCRequired(), true, "cRequired",
432:                        getString("CRequiredTxt"), getString("CRequiredHint"))); // NOI18N
433:                set.put(new BooleanNodeProp(getCppRequired(), true,
434:                        "cppRequired", getString("CppRequiredTxt"),
435:                        getString("CppRequiredHint"))); // NOI18N
436:                if (CppSettings.getDefault().isFortranEnabled()) {
437:                    set.put(new BooleanNodeProp(getFortranRequired(), true,
438:                            "fortranRequired", getString("FortranRequiredTxt"),
439:                            getString("FortranRequiredHint"))); // NOI18N
440:                }
441:                set.put(new IntNodeProp(getPlatform(), true, "Platform",
442:                        getString("PlatformTxt"), getString("PlatformHint"))); // NOI18N
443:                set.put(new IntNodeProp(getConfigurationType(), true,
444:                        "ConfigurationType", getString("ConfigurationTypeTxt"),
445:                        getString("ConfigurationTypeHint"))); // NOI18N
446:                sheet.put(set);
447:
448:                if (isCompileConfiguration()) {
449:                    set = Sheet.createExpertSet();
450:                    set.put(new BooleanNodeProp(getDependencyChecking(), true,
451:                            "DependencyChecking",
452:                            getString("DependencyCheckingTxt"),
453:                            getString("DependencyCheckingHint"))); // NOI18N
454:                    sheet.put(set);
455:                }
456:
457:                return sheet;
458:            }
459:
460:            public Sheet getRequiredProjectsSheet(Project project,
461:                    MakeConfiguration conf) {
462:                Sheet sheet = new Sheet();
463:                String[] texts = new String[] { getString("ProjectsTxt1"),
464:                        getString("ProjectsHint"), getString("ProjectsTxt2"),
465:                        getString("AllOptionsTxt2") };
466:
467:                Sheet.Set set2 = new Sheet.Set();
468:                set2.setName("Projects"); // NOI18N
469:                set2.setDisplayName(getString("ProjectsTxt1"));
470:                set2.setShortDescription(getString("ProjectsHint"));
471:                set2.put(new RequiredProjectsNodeProp(
472:                        getRequiredProjectsConfiguration(), project, conf,
473:                        getBaseDir(), texts));
474:                sheet.put(set2);
475:
476:                return sheet;
477:            }
478:
479:            public void setRequiredLanguagesDirty(boolean b) {
480:                languagesDirty = b;
481:            }
482:
483:            public boolean getRequiredLanguagesDirty() {
484:                return languagesDirty;
485:            }
486:
487:            public boolean hasCFiles(
488:                    MakeConfigurationDescriptor configurationDescriptor) {
489:                reCountLanguages(configurationDescriptor);
490:                return cRequired.getValue();
491:            }
492:
493:            public boolean hasCPPFiles(
494:                    MakeConfigurationDescriptor configurationDescriptor) {
495:                reCountLanguages(configurationDescriptor);
496:                return cppRequired.getValue();
497:            }
498:
499:            public boolean hasFortranFiles(
500:                    MakeConfigurationDescriptor configurationDescriptor) {
501:                reCountLanguages(configurationDescriptor);
502:                return fortranRequired.getValue();
503:            }
504:
505:            //    public boolean hasAsmFiles(MakeConfigurationDescriptor configurationDescriptor) {
506:            //        if (getLanguagesDirty())
507:            //            reCountLanguages(configurationDescriptor);
508:            //        return asmRequired.getValue();
509:            //    }
510:            public void reCountLanguages(
511:                    MakeConfigurationDescriptor configurationDescriptor) {
512:                boolean hasCFiles = false;
513:                boolean hasCPPFiles = false;
514:                boolean hasFortranFiles = false;
515:                //boolean hasCAsmFiles = false;
516:
517:                if (!getRequiredLanguagesDirty()) {
518:                    return;
519:                }
520:
521:                Item[] items = configurationDescriptor.getProjectItems();
522:                if (items.length == 0 && isMakefileConfiguration()) {
523:                    // This may not be true but is our best guess. No way to know since no files have been added to project.
524:                    hasCFiles = true;
525:                    hasCPPFiles = true;
526:                } else {
527:                    // Base it on actual files added to project
528:                    for (int x = 0; x < items.length; x++) {
529:                        ItemConfiguration itemConfiguration = items[x]
530:                                .getItemConfiguration(this );
531:                        if (itemConfiguration.getExcluded().getValue()) {
532:                            continue;
533:                        }
534:                        if (itemConfiguration.getTool() == Tool.CCompiler) {
535:                            hasCFiles = true;
536:                        }
537:                        if (itemConfiguration.getTool() == Tool.CCCompiler) {
538:                            hasCPPFiles = true;
539:                        }
540:                        if (itemConfiguration.getTool() == Tool.FortranCompiler) {
541:                            hasFortranFiles = true;
542:                        }
543:                        //            if (itemConfiguration.getTool() == Tool.AsmCompiler) {
544:                        //                hasCAsmFiles = false;
545:                        //            }
546:                    }
547:                }
548:                cRequired.setDefault(hasCFiles);
549:                cppRequired.setDefault(hasCPPFiles);
550:                fortranRequired.setDefault(hasFortranFiles);
551:                //asmRequired.setValueDef(hasCAsmFiles);
552:
553:                languagesDirty = false;
554:            }
555:
556:            public class LanguageBooleanConfiguration extends
557:                    BooleanConfiguration {
558:
559:                private boolean notYetSet = true;
560:
561:                LanguageBooleanConfiguration() {
562:                    super (null, false);
563:                }
564:
565:                @Override
566:                public void setValue(boolean b) {
567:                    if (notYetSet) {
568:                        setValue(b, b);
569:                    } else {
570:                        super .setValue(b);
571:                    }
572:                    notYetSet = false;
573:                }
574:
575:                @Override
576:                public void setDefault(boolean b) {
577:                    if (getValue() == getDefault()) {
578:                        setValue(b, b);
579:                    } else {
580:                        super .setDefault(b);
581:                    }
582:                    notYetSet = false;
583:                }
584:
585:                public void setValue(boolean v, boolean d) {
586:                    super .setValue(v);
587:                    super .setDefault(d);
588:                    notYetSet = false;
589:                }
590:
591:                @Override
592:                public Object clone() {
593:                    LanguageBooleanConfiguration clone = new LanguageBooleanConfiguration();
594:                    clone.setValue(getValue(), getDefault());
595:                    clone.setModified(getModified());
596:                    return clone;
597:                }
598:
599:                public void assign(LanguageBooleanConfiguration conf) {
600:                    setValue(conf.getValue(), conf.getDefault());
601:                    setModified(conf.getModified());
602:                }
603:            }
604:
605:            public String getVariant() {
606:                String ret = "";
607:                ret += CompilerSetManager.getDefault().getCompilerSet(
608:                        getCompilerSet().getValue()).getName()
609:                        + "-"; // NOI18N
610:                ret += Platforms.getPlatform(getPlatform().getValue())
611:                        .getName();
612:                return ret;
613:            }
614:
615:            public Set/*<Project>*/getSubProjects() {
616:                Set subProjects = new HashSet();
617:                LibrariesConfiguration librariesConfiguration = getLinkerConfiguration()
618:                        .getLibrariesConfiguration();
619:                LibraryItem[] libraryItems = librariesConfiguration
620:                        .getLibraryItemsAsArray();
621:                for (int j = 0; j < libraryItems.length; j++) {
622:                    if (libraryItems[j] instanceof  LibraryItem.ProjectItem) {
623:                        LibraryItem.ProjectItem projectItem = (LibraryItem.ProjectItem) libraryItems[j];
624:                        Project project = projectItem.getProject(getBaseDir());
625:                        if (project != null) {
626:                            subProjects.add(project);
627:                        } else {
628:                            // FIXUP ERROR
629:                        }
630:                    }
631:                }
632:                for (LibraryItem.ProjectItem libProject : getRequiredProjectsConfiguration()
633:                        .getRequiredProjectItemsAsArray()) {
634:                    Project project = libProject.getProject(getBaseDir());
635:                    if (project != null) {
636:                        subProjects.add(project);
637:                    }
638:                }
639:                return subProjects;
640:            }
641:
642:            public Set/*<String>*/getSubProjectLocations() {
643:                Set subProjectLocations = new HashSet();
644:                LibrariesConfiguration librariesConfiguration = getLinkerConfiguration()
645:                        .getLibrariesConfiguration();
646:                LibraryItem[] libraryItems = librariesConfiguration
647:                        .getLibraryItemsAsArray();
648:                for (int j = 0; j < libraryItems.length; j++) {
649:                    if (libraryItems[j] instanceof  LibraryItem.ProjectItem) {
650:                        LibraryItem.ProjectItem projectItem = (LibraryItem.ProjectItem) libraryItems[j];
651:                        subProjectLocations.add(projectItem.getMakeArtifact()
652:                                .getProjectLocation());
653:                    }
654:                }
655:                return subProjectLocations;
656:            }
657:
658:            public Set/*<String>*/getSubProjectOutputLocations() {
659:                Set subProjectOutputLocations = new HashSet();
660:                LibrariesConfiguration librariesConfiguration = getLinkerConfiguration()
661:                        .getLibrariesConfiguration();
662:                LibraryItem[] libraryItems = librariesConfiguration
663:                        .getLibraryItemsAsArray();
664:                for (int j = 0; j < libraryItems.length; j++) {
665:                    if (libraryItems[j] instanceof  LibraryItem.ProjectItem) {
666:                        LibraryItem.ProjectItem projectItem = (LibraryItem.ProjectItem) libraryItems[j];
667:                        String outputLocation = IpeUtils.getDirName(projectItem
668:                                .getMakeArtifact().getOutput());
669:                        if (IpeUtils.isPathAbsolute(outputLocation)) {
670:                            subProjectOutputLocations.add(outputLocation);
671:                        } else {
672:                            subProjectOutputLocations.add(projectItem
673:                                    .getMakeArtifact().getProjectLocation()
674:                                    + "/" + outputLocation);
675:                        } // NOI18N
676:                    }
677:                }
678:                return subProjectOutputLocations;
679:            }
680:
681:            public String getAbsoluteOutputValue() {
682:                String output;
683:                if (isLinkerConfiguration()) {
684:                    output = getLinkerConfiguration().getOutputValue();
685:                } else if (isArchiverConfiguration()) {
686:                    output = getArchiverConfiguration().getOutputValue();
687:                } else if (isMakefileConfiguration()) {
688:                    output = getMakefileConfiguration().getOutput().getValue();
689:                } else {
690:                    output = null;
691:                }
692:
693:                if (output == null || IpeUtils.isPathAbsolute(output)) {
694:                    return output;
695:                } else {
696:                    output = getBaseDir() + "/" + output; // NOI18N
697:                    output = FilePathAdaptor.normalize(output);
698:                    return output;
699:                }
700:            }
701:
702:            private String[] getCompilerSetDisplayNames() {
703:                ArrayList<String> names = new ArrayList();
704:                for (CompilerSet cs : CompilerSetManager.getDefault()
705:                        .getCompilerSets()) {
706:                    names.add(cs.getDisplayName());
707:                }
708:                return names.toArray(new String[0]);
709:            }
710:
711:            private String[] getCompilerSetNames() {
712:                ArrayList<String> names = new ArrayList();
713:                for (CompilerSet cs : CompilerSetManager.getDefault()
714:                        .getCompilerSets()) {
715:                    names.add(cs.getName());
716:                }
717:                return names.toArray(new String[0]);
718:            }
719:
720:            private int getDefaultCompilerSetIndex() {
721:                String name = CppSettings.getDefault().getCompilerSetName();
722:                int i = 0;
723:                for (CompilerSet cs : CompilerSetManager.getDefault()
724:                        .getCompilerSets()) {
725:                    if (name.equals(cs.getName())) {
726:                        return i;
727:                    }
728:                    i++;
729:                }
730:                return 0; // shouldn't happen
731:            }
732:
733:            /** Look up i18n strings here */
734:            private static String getString(String s) {
735:                return NbBundle.getMessage(MakeConfiguration.class, s);
736:            }
737:        }
w__ww___.j__a___v__a_2_s_.co__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.