Package org.netbeans.spi.project.support.ant

Examples of org.netbeans.spi.project.support.ant.ReferenceHelper


        dirFO.getFileSystem().runAtomicAction(new FileSystem.AtomicAction() {
            public void run() throws IOException {
                h[0] = createProject(dirFO, name, "src", "test", mainClass, manifestFile, manifestFile == null, librariesDefinition); //NOI18N
                final J2SEProject p = (J2SEProject) ProjectManager.getDefault().findProject(dirFO);
                ProjectManager.getDefault().saveProject(p);
                final ReferenceHelper refHelper = p.getReferenceHelper();
                try {
                    ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
                        public Void run() throws Exception {
                            copyRequiredLibraries(h[0], refHelper);
                            return null;
View Full Code Here


        // this constructor creates only java application type
        dirFO.getFileSystem().runAtomicAction(new FileSystem.AtomicAction() {
            public void run () throws IOException {
                h[0] = createProject(dirFO, name, null, null, null, manifestFile, false, librariesDefinition);
                final J2SEProject p = (J2SEProject) ProjectManager.getDefault().findProject(dirFO);
                final ReferenceHelper refHelper = p.getReferenceHelper();
                try {
                    ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
                    public Void run() throws Exception {
                        Element data = h[0].getPrimaryConfigurationData(true);
                        Document doc = data.getOwnerDocument();
                        NodeList nl = data.getElementsByTagNameNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots");
                        assert nl.getLength() == 1;
                        Element sourceRoots = (Element) nl.item(0);
                        nl = data.getElementsByTagNameNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"test-roots")//NOI18N
                        assert nl.getLength() == 1;
                        Element testRoots = (Element) nl.item(0);
                        for (int i=0; i<sourceFolders.length; i++) {
                            String propName;
                            if (i == 0) {
                                //Name the first src root src.dir to be compatible with NB 4.0
                                propName = "src.dir";       //NOI18N
                            }
                            else {
                                String name = sourceFolders[i].getName();
                                propName = name + ".dir";    //NOI18N
                            }

                            int rootIndex = 1;
                            EditableProperties props = h[0].getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
                            while (props.containsKey(propName)) {
                                rootIndex++;
                                propName = name + rootIndex + ".dir";   //NOI18N
                            }
                            String srcReference = refHelper.createForeignFileReference(sourceFolders[i], JavaProjectConstants.SOURCES_TYPE_JAVA);
                            Element root = doc.createElementNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root");   //NOI18N
                            root.setAttribute ("id",propName);   //NOI18N
                            sourceRoots.appendChild(root);
                            props = h[0].getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
                            props.put(propName,srcReference);
                            h[0].putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props); // #47609
                        }                
                        for (int i = 0; i < testFolders.length; i++) {
                            if (!testFolders[i].exists()) {
                                testFolders[i].mkdirs();
                            }
                            String propName;
                            if (i == 0) {
                                //Name the first test root test.src.dir to be compatible with NB 4.0
                                propName = "test.src.dir"//NOI18N
                            }
                            else {
                                String name = testFolders[i].getName();
                                propName = "test." + name + ".dir"; // NOI18N
                            }                   
                            int rootIndex = 1;
                            EditableProperties props = h[0].getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
                            while (props.containsKey(propName)) {
                                rootIndex++;
                                propName = "test." + name + rootIndex + ".dir"; // NOI18N
                            }
                            String testReference = refHelper.createForeignFileReference(testFolders[i], JavaProjectConstants.SOURCES_TYPE_JAVA);
                            Element root = doc.createElementNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "root"); // NOI18N
                            root.setAttribute("id", propName); // NOI18N
                            testRoots.appendChild(root);
                            props = h[0].getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); // #47609
                            props.put(propName, testReference);
View Full Code Here

            if (aux.getConfigurationFragment("data", "http://www.netbeans.org/ns/scala-project/" + v, true) != null) { // NOI18N
                throw Exceptions.attachLocalizedMessage(new IOException("too new"), // NOI18N
                        NbBundle.getMessage(J2SEProject.class, "ScalaProject.too_new", FileUtil.getFileDisplayName(helper.getProjectDirectory())));
            }
        }
        refHelper = new ReferenceHelper(helper, aux, eval);
        buildExtender = AntBuildExtenderFactory.createAntExtender(new J2SEExtenderImplementation(), refHelper);
        /// TODO replace this GeneratedFilesHelper with the default one when fixing #101710
        genFilesHelper = new GeneratedFilesHelper(helper, buildExtender);
        UpdateImplementation updateProject = new UpdateProjectImpl(this, helper, aux);
        this.updateHelper = new UpdateHelper(updateProject, helper);
View Full Code Here

TOP

Related Classes of org.netbeans.spi.project.support.ant.ReferenceHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.