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

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


        String includePath = null;
        AntProjectHelper helper = getProjectHelper(project);

        if (helper != null) {
            EditableProperties properties = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);

            if (properties != null) {
                includePath = properties.getProperty(INCLUDE_PATH);
            }
        }

        return includePath;
    }
View Full Code Here


        assert project != null;

        AntProjectHelper helper = getProjectHelper(project);

        if (helper != null) {
            EditableProperties properties = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);

            if (properties != null) {
                String referencePath = createForeignFileReference(project, includePath);
                String referencePathProperty = "${" + referencePath + "}";
                String[] referencePathProperties = getIncludePathArray(project);

                if (!Utils.contains(referencePathProperties, referencePathProperty)) {
                    int length = referencePathProperties.length;
                    String[] newArray = new String[length + 1];
                    System.arraycopy(referencePathProperties, 0, newArray, 0, length);
                    newArray[length] = referencePathProperty;
                    referencePathProperties = newArray;
                }

                properties.setProperty(referencePath, includePath);
                properties.setProperty(INCLUDE_PATH, Utils.join(referencePathProperties, ":")); // NOI18N

                helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, properties);
            }
        }
    }
View Full Code Here

        if (excludes == null) {
            excludes = ""; // NOI18N
        }

        // CustomizerLibraries
        EditableProperties projectProperties = updateHelper.getProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH );

        JAVAC_CLASSPATH_MODEL = ClassPathUiSupport.createListModel(cs.itemsIterator(projectProperties.get(ProjectProperties.JAVAC_CLASSPATH)));
        JAVAC_TEST_CLASSPATH_MODEL = ClassPathUiSupport.createListModel(cs.itemsIterator(projectProperties.get(ProjectProperties.JAVAC_TEST_CLASSPATH)));
        RUN_CLASSPATH_MODEL = ClassPathUiSupport.createListModel(cs.itemsIterator(projectProperties.get(ProjectProperties.RUN_CLASSPATH)));
        RUN_TEST_CLASSPATH_MODEL = ClassPathUiSupport.createListModel(cs.itemsIterator(projectProperties.get(ProjectProperties.RUN_TEST_CLASSPATH)));
        PLATFORM_MODEL = PlatformUiSupport.createPlatformComboBoxModel (evaluator.getProperty(JAVA_PLATFORM));
        PLATFORM_LIST_RENDERER = PlatformUiSupport.createPlatformListCellRenderer();
        JAVAC_SOURCE_MODEL = PlatformUiSupport.createSourceLevelComboBoxModel (PLATFORM_MODEL, evaluator.getProperty(JAVAC_SOURCE), evaluator.getProperty(JAVAC_TARGET));
        JAVAC_SOURCE_RENDERER = PlatformUiSupport.createSourceLevelListCellRenderer ();
        SHARED_LIBRARIES_MODEL = new PlainDocument();
View Full Code Here

        // Store source roots
        storeRoots( project.getSourceRoots(), SOURCE_ROOTS_MODEL );
        storeRoots( project.getTestSourceRoots(), TEST_ROOTS_MODEL );

        // Store standard properties
        EditableProperties projectProperties = updateHelper.getProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH );
        EditableProperties privateProperties = updateHelper.getProperties( AntProjectHelper.PRIVATE_PROPERTIES_PATH );

        // Assure inegrity which can't shound not be assured in UI
        if ( !JAVADOC_NO_INDEX_MODEL.isSelected() ) {
            JAVADOC_SPLIT_INDEX_MODEL.setSelected( false ); // Can't split non existing index
        }

        // Standard store of the properties
        projectGroup.store( projectProperties );
        privateGroup.store( privateProperties );

        storeRunConfigs(RUN_CONFIGS, projectProperties, privateProperties);
        EditableProperties ep = updateHelper.getProperties("nbproject/private/config.properties");
        if (activeConfig == null) {
            ep.remove("config");
        } else {
            ep.setProperty("config", activeConfig);
        }
        updateHelper.putProperties("nbproject/private/config.properties", ep);

        //Hotfix of the issue #70058
        //Should use the StoreGroup when the StoreGroup SPI will be extended to allow false default value in ToggleButtonModel
View Full Code Here

     */
    private void resolveProjectDependencies() {

        // Create a set of old and new artifacts.
        Set<ClassPathSupport.Item> oldArtifacts = new HashSet<ClassPathSupport.Item>();
        EditableProperties projectProperties = updateHelper.getProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH );
        oldArtifacts.addAll( cs.itemsList( projectProperties.get( ProjectProperties.JAVAC_CLASSPATH ) ) );
        oldArtifacts.addAll( cs.itemsList( projectProperties.get( ProjectProperties.JAVAC_TEST_CLASSPATH ) ) );
        oldArtifacts.addAll( cs.itemsList( projectProperties.get( ProjectProperties.RUN_CLASSPATH ) ) );
        oldArtifacts.addAll( cs.itemsList( projectProperties.get( ProjectProperties.RUN_TEST_CLASSPATH ) ) );

        Set<ClassPathSupport.Item> newArtifacts = new HashSet<ClassPathSupport.Item>();
        newArtifacts.addAll( ClassPathUiSupport.getList( JAVAC_CLASSPATH_MODEL ) );
        newArtifacts.addAll( ClassPathUiSupport.getList( JAVAC_TEST_CLASSPATH_MODEL ) );
        newArtifacts.addAll( ClassPathUiSupport.getList( RUN_CLASSPATH_MODEL ) );
        newArtifacts.addAll( ClassPathUiSupport.getList( RUN_TEST_CLASSPATH_MODEL ) );

        // Create set of removed artifacts and remove them
        Set<ClassPathSupport.Item> removed = new HashSet<ClassPathSupport.Item>(oldArtifacts);
        removed.removeAll( newArtifacts );
        Set<ClassPathSupport.Item> added = new HashSet<ClassPathSupport.Item>(newArtifacts);
        added.removeAll(oldArtifacts);


        // 1. first remove all project references. The method will modify
        // project property files, so it must be done separately
        for (ClassPathSupport.Item item : removed) {
            if ( item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT ||
                    item.getType() == ClassPathSupport.Item.TYPE_JAR ) {
                refHelper.destroyReference(item.getReference());
                if (item.getType() == ClassPathSupport.Item.TYPE_JAR) {
                    item.removeSourceAndJavadoc(updateHelper);
                }
            }
        }

        boolean changed = false;
        // 2. now read project.properties and modify rest
        EditableProperties ep = updateHelper.getProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH );

        for (ClassPathSupport.Item item : removed) {
            if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) {
                // remove helper property pointing to library jar if there is any
                String prop = item.getReference();
                prop = CommonProjectUtils.getAntPropertyName(prop);
                ep.remove(prop);
                changed = true;
            }
        }
        if (changed) {
            updateHelper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
View Full Code Here

            EditableProperties projectProperties, EditableProperties privateProperties) throws IOException {
        //System.err.println("storeRunConfigs: " + configs);
        Map<String,String> def = configs.get(null);
        for (String prop : new String[] {MAIN_CLASS, APPLICATION_ARGS, RUN_JVM_ARGS, RUN_WORK_DIR}) {
            String v = def.get(prop);
            EditableProperties ep = (prop.equals(APPLICATION_ARGS) || prop.equals(RUN_WORK_DIR)) ?
                privateProperties : projectProperties;
            if (!Utilities.compareObjects(v, ep.getProperty(prop))) {
                if (v != null && v.length() > 0) {
                    ep.setProperty(prop, v);
                } else {
                    ep.remove(prop);
                }
            }
        }
        for (Map.Entry<String,Map<String,String>> entry : configs.entrySet()) {
            String config = entry.getKey();
            if (config == null) {
                continue;
            }
            String sharedPath = "nbproject/configs/" + config + ".properties"; // NOI18N
            String privatePath = "nbproject/private/configs/" + config + ".properties"; // NOI18N
            Map<String,String> c = entry.getValue();
            if (c == null) {
                updateHelper.putProperties(sharedPath, null);
                updateHelper.putProperties(privatePath, null);
                continue;
            }
            for (Map.Entry<String,String> entry2 : c.entrySet()) {
                String prop = entry2.getKey();
                String v = entry2.getValue();
                String path = (prop.equals(APPLICATION_ARGS) || prop.equals(RUN_WORK_DIR)) ?
                    privatePath : sharedPath;
                EditableProperties ep = updateHelper.getProperties(path);
                if (!Utilities.compareObjects(v, ep.getProperty(prop))) {
                    if (v != null && (v.length() > 0 || (def.get(prop) != null && def.get(prop).length() > 0))) {
                        ep.setProperty(prop, v);
                    } else {
                        ep.remove(prop);
                    }
                    updateHelper.putProperties(path, ep);
                }
            }
            // Make sure the definition file is always created, even if it is empty.
View Full Code Here

        return helper.getProperties(PROJECT_PROPERTIES_PATH);

    }

    private void loadPreferences() {
        EditableProperties properties = getEditableProperties();
        ivyEnabled = Utilities.getBoolean(properties.get(IVY_ENABLED_KEY), false);
        IvyOptions optionsLookup = Lookup.getDefault().lookup(IvyOptions.class);

        if (ivyEnabled) {
            Collection<String> propertiesFiles = Utilities.stringToCollection(properties.get(IVY_PROPERTIES_FILES_KEY));
            setIvySettingsFile(properties.get(IVY_SETTINGS_FILE_KEY));
            setIvyFile(properties.get(IVY_FILE_KEY));

            for (String propertyFile : propertiesFiles) {
                addPropertyFile(propertyFile);
            }

            globalRetrieveSettingsName = properties.get(IVY_GLOBAL_RETRIEVE_NAME_KEY);
            if (Utilities.isNotNullOrEmpty(globalRetrieveSettingsName)) {
                updateTemplateSettings(optionsLookup, properties);
            } else {
                projectRetrieveSettings = loadIvyRetrieveSettings(properties);
                useGlobalRetrieveSettings = false;
            }

            autoResolve = Utilities.getBoolean(properties.get(IVY_AUTO_RESOLVE_KEY), true);
            useCachePath = Utilities.getBoolean(properties.get(IVY_USE_CACHE_PATH_KEY), true);
            allConfsSelected = Utilities.getBoolean(properties.get(IVY_ALL_CONFS_SELECTED_KEY), true);
            if (!allConfsSelected){
                Collection<String> savedSelectedConfs = Utilities.stringToCollection(properties.get(IVY_SELECTED_CONFS_KEY));
                selectedConfs.addAll(savedSelectedConfs);
            }
        } else {
            String templateName = optionsLookup.getDefaultTemplateName();
            projectRetrieveSettings = optionsLookup.getIvyRetrieveSettingsTemplate(templateName);
View Full Code Here

        }
    }

    @Override
    public void saveProjectPreferences() {
        EditableProperties properties = getEditableProperties();
        validateSettings();
        if (ivyEnabled) {
            saveIvyProjectPreferences(properties);
            enableSharedLibrary();
            autoResolveProject();
View Full Code Here

    public void propertyChange(PropertyChangeEvent evt) {
        if (ivyEnabled) {
            if (IvyOptions.OPTIONS_CHANGE.equals(evt.getPropertyName())) {
            } else if (IvyOptions.OPTIONS_TEMPLATE_CHANGE.equals(evt.getPropertyName())) {
                if (useGlobalRetrieveSettings) {
                    EditableProperties properties = getEditableProperties();
                    IvyOptions optionsLookup = Lookup.getDefault().lookup(IvyOptions.class);
                    updateTemplateSettings(optionsLookup, properties);
                }
            }
        }
View Full Code Here

        case EXT:
            File[] sourceFolders = (File[])wiz.getProperty("sourceRoot");        //NOI18N
            File[] testFolders = (File[])wiz.getProperty("testRoot");            //NOI18N
            String buildScriptName = (String) wiz.getProperty("buildScriptName");//NOI18N
            AntProjectHelper h = J2SEProjectGenerator.createProject(dirF, name, sourceFolders, testFolders, MANIFEST_FILE, librariesDefinition);
            EditableProperties ep = h.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
            String includes = (String) wiz.getProperty(ProjectProperties.INCLUDES);
            if (includes == null) {
                includes = "**"; // NOI18N
            }
            ep.setProperty(ProjectProperties.INCLUDES, includes);
            String excludes = (String) wiz.getProperty(ProjectProperties.EXCLUDES);
            if (excludes == null) {
                excludes = ""; // NOI18N
            }
            ep.setProperty(ProjectProperties.EXCLUDES, excludes);
            h.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
            handle.progress (2);
            for (File f : sourceFolders) {
                FileObject srcFo = FileUtil.toFileObject(f);
                if (srcFo != null) {
View Full Code Here

TOP

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

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.