Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    *
    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    *
    * The contents of this file are subject to the terms of either the GNU
    * General Public License Version 2 only ("GPL") or the Common
    * Development and Distribution License("CDDL") (collectively, the
    * "License"). You may not use this file except in compliance with the
   * License. You can obtain a copy of the License at
   * http://www.netbeans.org/cddl-gplv2.html
   * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   * specific language governing permissions and limitations under the
   * License.  When distributing the software, include this License Header
   * Notice in each file and include the License file at
   * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   * particular file as subject to the "Classpath" exception as provided
   * by Sun in the GPL Version 2 section of the License file that
   * accompanied this code. If applicable, add the following below the
   * License Header, with the fields enclosed by brackets [] replaced by
   * your own identifying information:
   * "Portions Copyrighted [year] [name of copyright owner]"
   *
   * Contributor(s):
   *
   * The Original Software is NetBeans. The Initial Developer of the Original
   * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   * Microsystems, Inc. All Rights Reserved.
   *
   * If you wish your version of this file to be governed by only the CDDL
   * or only the GPL Version 2, indicate your decision by adding
   * "[Contributor] elects to include this software in this distribution
   * under the [CDDL or GPL Version 2] license." If you do not indicate a
   * single choice of license, a recipient has the option to distribute
   * your version of this file under either the CDDL, the GPL Version 2 or
   * to extend the choice of license to its licensees as provided above.
   * However, if you add GPL Version 2 code and therefore, elected the GPL
   * Version 2 license, then the option applies only if the new code is
   * made subject to such option by the copyright holder.
   */
  package org.netbeans.modules.cnd.makeproject.api.configurations;
  
  import java.io.File;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Set;
  import java.util.Vector;
  import javax.swing.Icon;
  import org.w3c.dom.Node;
  
  public class MakeConfigurationDescriptor extends ConfigurationDescriptor implements ChangeListener {
  
      public static final String EXTERNAL_FILES_FOLDER = "ExternalFiles"// NOI18N
     public static final String SOURCE_FILES_FOLDER = "SourceFiles"// NOI18N
     public static final String HEADER_FILES_FOLDER = "HeaderFiles"// NOI18N
     public static final String RESOURCE_FILES_FOLDER = "ResourceFiles"// NOI18N
     public static final String ICONBASE = "org/netbeans/modules/cnd/makeproject/ui/resources/makeProject"// NOI18N
     public static final String ICON = "org/netbeans/modules/cnd/makeproject/ui/resources/makeProject.gif"// NOI18N
     public static final Icon MAKEFILE_ICON = ImageUtilities.loadImageIcon(false); // NOI18N
     public static final String DEFAULT_IGNORE_FOLDERS_PATTERN = "^(nbproject|build|test)$"// NOI18N
     public static final String DEFAULT_NO_IGNORE_FOLDERS_PATTERN = "^$"// NOI18N
     private Project project = null;
     private String baseDir;
     private boolean modified = false;
     private Folder externalFileItems = null;
     private Folder rootFolder = null;
     private HashMap<StringItemprojectItems = null;
     private final List<StringsourceRoots = new ArrayList<String>();
     private NativeProject nativeProject = null;
     public static final String DEFAULT_PROJECT_MAKFILE_NAME = "Makefile"// NOI18N
     private Task initTask = null;
     private CndVisibilityQuery folderVisibilityQuery = null;
 
     public MakeConfigurationDescriptor(String baseDir) {
         super();
         this. = baseDir;
          = new Folder(thisnull"root""root"true); // NOI18N
          = new HashMap<StringItem>();
         setModified(true);
         ToolsPanel.addCompilerSetModifiedListener(this);
     }
 
     /*
      * Called when project is being closed
      */
     public void closed() {
         ToolsPanel.removeCompilerSetModifiedListener(this);
         for (Item item : getProjectItems()) {
             DataObject dao = item.getDataObject();
             if (dao != null) {
                 dao.removePropertyChangeListener(item);
             }
         }
         closed();
     }
 
     private void closed(Folder folder) {
         if (folder != null) {
             for (Folder f : folder.getAllFolders(false)) {
                 f.detachListener();
             }
             folder.detachListener();
         }
     }
 
     public void clean() {
         Configurations confs = getConfs();
         if (confs != null) {
             for (Configuration conf : confs.getConfs()) {
                 if (conf != null) {
                     conf.setAuxObjects(Collections.<ConfigurationAuxObject>emptyList());
                 }
             }
         }
         .clear();
          = null;
     }
 
         if (pdp != null) {
             MakeConfigurationDescriptor makeConfigurationDescriptor = pdp.getConfigurationDescriptor();
             return makeConfigurationDescriptor;
         } else {
             return null;
         }
     }

    
NPE-safe method for getting active configuration
 
         Configurations confs = getConfs();
         if (confs != null) {
             MakeConfiguration conf = (MakeConfigurationconfs.getActive();
             if (conf == null) {
                 if (.){
                     new Exception("There are no active configuration in the project descriptor MakeConfigurationDescriptor@"+System.identityHashCode(this)+" for project "+getBaseDir()).printStackTrace(); // NOI18N
                 }
             }
             return conf;
         } else {
             if (.){
                 new Exception("There are no configurations in the project descriptor MakeConfigurationDescriptor@"+System.identityHashCode(this)+" for project "+getBaseDir()).printStackTrace(); // NOI18N
             }
         }
         return null;
     }
 
     /*
      * One of the compiler sets have changed.
      * Mark project modified. This will trigger all makefiles to be regenerated.
      */
     public void stateChanged(ChangeEvent e) {
         setModified();
     }
 
     public Project getProject() {
         if ( == null) {
             String location = FilePathAdaptor.mapToLocal(getBaseDir()); // PC path
             try {
                 // convert base path into file object
                 // we can't use canonical path here, because descriptor created with path like
                 // /set/ide/mars/... will be changed by canonization into
                 // /net/endif/export/home1/deimos/dev/...
                 // and using the canonical path based FileObject in the ProjectManager.getDefault().findProject(fo);
                 // will cause creating new MakeProject project
                 // because there are no opened /net/endif/export/home1/deimos/dev/... project in system
                 // there is only /set/ide/mars/... project in system
                 //
                 // in fact ProjectManager should solve such problems in more general way
                 // because even for java it's possible to open the same project from two different
                 // locations /set/ide/mars/... and /net/endif/export/home1/deimos/dev/...
                 FileObject fo = FileUtil.toFileObject(new File(location));
                  = ProjectManager.getDefault().findProject(fo);
             } catch (Exception e) {
                 // Should not happen
                 ..println("Cannot find project in '" + location + "' " + e); // FIXUP // NOI18N
             }
         }
         return ;
     }
 
     public void init(Configuration def) {
         super.init(new Configuration[]{def}, 0);
         setModified(true);
     }
 
     public void setInitTask(Task task) {
          = task;
     }
 
     /*package-local*/ synchronized void waitInitTask() {
         if ( == null) {
             return;
         }
         .waitFinished();
          = null;
     }
 
     public void initLogicalFolders(Iterator<SourceFolderInfosourceFileFoldersboolean createLogicalFoldersIterator<StringimportantItemsString mainFilePath) {
         if (createLogicalFolders) {
             .addNewFolder(getString("SourceFilesTxt"), true);
             .addNewFolder(getString("HeaderFilesTxt"), true);
             .addNewFolder(getString("ResourceFilesTxt"), true);
         }
          = .addNewFolder(getString("ImportantFilesTxt"), false);
 //        if (sourceFileFolders != null)
 //            setExternalFileItems(sourceFileFolders); // From makefile wrapper wizard
         .addItem(new Item(getProjectMakefileName())); // NOI18N
         if (importantItems != null) {
             while (importantItems.hasNext()) {
                 .addItem(new Item(importantItems.next()));
             }
         }
 //        addSourceFilesFromFolders(sourceFileFolders, false, false, true
         // Add main file
         if (mainFilePath != null) {
             if (srcFolder != null) {
                 srcFolder.addItem(new Item(mainFilePath));
             }
         }
         // Handle source root folders
         if (sourceFileFolders != null) {
             while (sourceFileFolders.hasNext()) {
                 SourceFolderInfo sourceFolderInfo = sourceFileFolders.next();
                 addSourceFilesFromRoot(getLogicalFolders(), sourceFolderInfo.getFile(), falsetrue);
             }
         }
         setModified(true);
     }
 
     public String getProjectMakefileName() {
         return ;
     }
 
     public void setProjectMakefileName(String projectMakefileName) {
         this. = projectMakefileName;
     }

    

Deprecated.:
Use org.netbeans.modules.cnd.api.project.NativeProject interface instead.
 
     public void addProjectItemsChangeListener(ChangeListener cl) {
         synchronized () {
             .add(cl);
         }
     }

    

Deprecated.:
Use org.netbeans.modules.cnd.api.project.NativeProject interface instead.
 
     public void removeProjectItemsChangeListener(ChangeListener cl) {
         synchronized () {
             .remove(cl);
         }
     }
 
     public void fireProjectItemsChangeEvent(Item itemint action) {
         Iterator it;
 
         synchronized () {
             it = new HashSet<ChangeListener>().iterator();
         }
         ChangeEvent ev = new ProjectItemChangeEvent(thisitemaction);
         while (it.hasNext()) {
             ((ChangeListenerit.next()).stateChanged(ev);
         }
     }
 
         synchronized () {
             return new HashSet<ChangeListener>();
         }
     }
 
     public void setProjectItemsChangeListeners(Set<ChangeListenernewChangeListeners) {
         synchronized (this.) {
             this..clear();
             this..addAll(newChangeListeners);
         }
     }
 
     public String getBaseDir() {
         return ;
     }
 
     public void setBaseDir(String baseDir) {
         this. = baseDir;
     }
 
     public HashMap<StringItemgetProjectItemsMap() {
         return ;
     }
 
     public void setProjectItemsMap(HashMap<StringItemprojectItems) {
         this. = projectItems;
     }
 
     public void init(Configuration[] confs) {
         super.init(confs, 0);
     }
 
     public Icon getIcon() {
         return ;
     }
 
     public Configuration defaultConf(String nameint type) {
         MakeConfiguration c = new MakeConfiguration(thisnametype);
         Item[] items = getProjectItems();
         for (int i = 0; i < items.lengthi++) {
             c.addAuxObject(new ItemConfiguration(citems[i]));
         }
         return c;
     }
 
     // External File Items
     public void setExternalFileItems(Vector items) {
         .reset();
         for (Enumeration e = items.elements(); e.hasMoreElements();) {
             .addItem(new Item((Stringe.nextElement()));
         }
     }
 
     public void setExternalFileItems(Folder folder) {
          = folder;
     }
 
     public Folder getExternalFileItems() {
         return ;
     }
 
     public Item[] getExternalFileItemsAsArray() {
         return .getItemsAsArray();
     }
 
     public Folder getExternalItemFolder() {
         return ;
     }
 
     // Logical Folders
     public Folder getLogicalFolders() {
         return ;
     }
 
     public void setLogicalFolders(Folder logicalFolders) {
         this. = logicalFolders;
     }
 
     // Project Files
     public Item[] getProjectItems() {
         Collection<Itemcollection = .values();
         return collection.toArray(new Item[collection.size()]);
     }
 
     public Item findItemByFile(File file) {
         Collection<Itemcoll = .values();
         Iterator<Itemit = coll.iterator();
         Item canonicalItem = null;
         while (it.hasNext()) {
             Item item = it.next();
             File itemFile = item.getNormalizedFile();
             if (itemFile == file || itemFile.getPath().equals(file.getPath())) {
                 return item;
             }
             if (canonicalItem == null) {
                 File canonicalItemFile = item.getCanonicalFile();
                 if (canonicalItemFile == file || canonicalItemFile.getPath().equals(file.getPath())) {
                     canonicalItem = item;
                 }
             }
         }
         return canonicalItem;
     }
 
     public Item findProjectItemByPath(String path) {
         // Try first as-is
         path = FilePathAdaptor.normalize(path);
         Item item = .get(path);
         if (item == null) {
             // Then try absolute if relative or relative if absolute
             String newPath;
             if (IpeUtils.isPathAbsolute(path)) {
                 newPath = IpeUtils.toRelativePath(getBaseDir(), FilePathAdaptor.naturalize(path));
             } else {
                 newPath = IpeUtils.toAbsolutePath(getBaseDir(), path);
             }
             newPath = FilePathAdaptor.normalize(newPath);
             item = .get(newPath);
         }
         return item;
     }
 
     public Item findExternalItemByPath(String path) {
         // Try first as-is
         if ( == null) {
             return null;
         }
         path = FilePathAdaptor.normalize(path);
         Item item = .findItemByPath(path);
         if (item == null) {
             // Then try absolute if relative or relative if absolute
             String newPath;
             if (IpeUtils.isPathAbsolute(path)) {
                 newPath = IpeUtils.toRelativePath(getBaseDir(), FilePathAdaptor.naturalize(path));
             } else {
                 newPath = IpeUtils.toAbsolutePath(getBaseDir(), path);
             }
             newPath = FilePathAdaptor.normalize(newPath);
             item = .findItemByPath(newPath);
         }
         return item;
     }
 
     public Folder findFolderByPath(String path) {
         return getLogicalFolders().findFolderByPath(path);
     }
 
     public void addProjectItem(Item item) {
         .put(item.getPath(), item);
         //getNativeProject().fireFileAdded(item);
         setModified(true);
     }
 
     public void fireFilesAdded(List<NativeFileItemfileItems) {
         getNativeProject().fireFilesAdded(fileItems);
     }
 
     public void removeProjectItem(Item item) {
         .remove(item.getPath());
         //getNativeProject().fireFileRemoved(item);
         setModified(true);
     }
 
     public void fireFilesRemoved(List<NativeFileItemfileItems) {
         if (getNativeProject() != null) {
             getNativeProject().fireFilesRemoved(fileItems);
         }
     }
 
     public void fireFileRenamed(String oldPathNativeFileItem newFileItem) {
         getNativeProject().fireFileRenamed(oldPathnewFileItem);
     }
 
     public void checkForChangedItems(Project projectFolder folderItem item) {
         getNativeProject().checkForChangedItems(folderitem);
         MakeLogicalViewProvider.checkForChangedItems(projectfolderitem);
     }
 
     public void copyFromProjectDescriptor(ConfigurationDescriptor copyProjectDescriptor) {
         MakeConfigurationDescriptor copyExtProjectDescriptor = (MakeConfigurationDescriptorcopyProjectDescriptor;
         setConfs(copyExtProjectDescriptor.getConfs());
         setBaseDir(copyProjectDescriptor.getBaseDir());
         setProjectMakefileName(copyExtProjectDescriptor.getProjectMakefileName());
         setExternalFileItems(copyExtProjectDescriptor.getExternalFileItems());
         setLogicalFolders(copyExtProjectDescriptor.getLogicalFolders());
         setProjectItemsMap(((MakeConfigurationDescriptorcopyProjectDescriptor).getProjectItemsMap());
         setSourceRoots(((MakeConfigurationDescriptorcopyProjectDescriptor).getSourceRootsRaw());
     }
 
     public void assign(ConfigurationDescriptor clonedConfigurationDescriptor) {
         Configuration[] clonedConfs = clonedConfigurationDescriptor.getConfs().getConfs();
         Configuration[] newConfs = new Configuration[clonedConfs.length];
         setBaseDir(clonedConfigurationDescriptor.getBaseDir());
 
         for (int i = 0; i < clonedConfs.lengthi++) {
             if (clonedConfs[i].getCloneOf() != null) {
                 clonedConfs[i].getCloneOf().assign(clonedConfs[i]);
                 newConfs[i] = clonedConfs[i].getCloneOf();
             } else {
                 newConfs[i] = clonedConfs[i];
             }
         }
         init(newConfsclonedConfigurationDescriptor.getConfs().getActiveAsIndex());
         setProjectMakefileName(((MakeConfigurationDescriptorclonedConfigurationDescriptor).getProjectMakefileName());
         setExternalFileItems(((MakeConfigurationDescriptorclonedConfigurationDescriptor).getExternalFileItems());
         setLogicalFolders(((MakeConfigurationDescriptorclonedConfigurationDescriptor).getLogicalFolders());
         setProjectItemsMap(((MakeConfigurationDescriptorclonedConfigurationDescriptor).getProjectItemsMap());
         setSourceRoots(((MakeConfigurationDescriptorclonedConfigurationDescriptor).getSourceRootsRaw());
         setFolderVisibilityQuery(((MakeConfigurationDescriptorclonedConfigurationDescriptor).getFolderVisibilityQuery().getRegEx());
     }
 
         super.cloneProjectDescriptor(clone);
         clone.setExternalFileItems(getExternalFileItems());
         clone.setLogicalFolders(getLogicalFolders());
         clone.setProjectItemsMap(getProjectItemsMap());
         clone.setSourceRoots(getSourceRootsRaw());
         return clone;
     }
 
     public boolean getModified() {
         return ;
     }
 
     public void setModified() {
         setModified(true);
     }
 
     public void setModified(boolean modified) {
         //System.out.println("setModified - " + modified);
         this. = modified;
         if (modified && getConfs() != null) {
             Configuration[] confs = getConfs().getConfs();
             for (int i = 0; i < confs.lengthi++) {
                 ((MakeConfigurationconfs[i]).setRequiredLanguagesDirty(true);
             }
         }
     }
 
     public void refreshRequiredLanguages() {
         if (getConfs() != null) {
             Configuration[] confs = getConfs().getConfs();
             for (int i = 0; i < confs.lengthi++) {
                 ((MakeConfigurationconfs[i]).reCountLanguages(this);
             }
         }
     }
 
     public boolean save() {
         return save(null);
     }
 
     public boolean save(final String extraMessage) {
         SaveRunnable saveRunnable = new SaveRunnable(extraMessage);
         RequestProcessor.Task task = RequestProcessor.getDefault().post(saveRunnable);
         task.waitFinished();
         return saveRunnable.ret;
     }

    
Check needed header extensions and store list in the NB/project properties.

Parameters:
needAdd list of needed extensions of header files.
 
     public void addAdditionalHeaderExtensions(Collection<StringneedAdd) {
         ((MakeProjectgetProject()).addAdditionalHeaderExtensions(needAdd);
     }
 
         if ( == null) {
         }
         return ;
 
     }
 
     public void setFolderVisibilityQuery(String regex) {
         if ( == null) {
              = new CndVisibilityQuery(regex);
         } else {
             .setPattern(regex);
         }
     }
 
     private class SaveRunnable implements Runnable {
 
         public boolean ret = false;
         private String extraMessage;
 
         public SaveRunnable(String extraMessage) {
             this. = extraMessage;
         }
 
         public void run() {
              = saveWorker();
         }
     }
 
     private boolean saveWorker(String extraMessage) {
 
         // Prevent project files corruption.
         if (getState() != .) {
             return false;
         }
 
         // First check all configurations aux objects if they have changed
         Configuration[] configurations = getConfs().getConfs();
         for (int i = 0; i < configurations.lengthi++) {
             Configuration conf = configurations[i];
             ConfigurationAuxObject[] auxObjects = conf.getAuxObjects();
             for (int j = 0; j < auxObjects.lengthj++) {
                 if (auxObjects[j].hasChanged()) {
                     setModified(true);
                 }
                 auxObjects[j].clearChanged();
             }
         }
 
         updateExtensionList();
         if (!getModified()) {
             return true;
         }
 
         // Check metadata files are writable
         Vector<StringmetadataFiles = new Vector<String>();
         Vector<StringnotOkFiles = new Vector<String>();
         metadataFiles.add(getBaseDir() + . + "nbproject" + . + "project.xml"); // NOI18N
         metadataFiles.add(getBaseDir() + . + "nbproject" + . + "configurations.xml"); // NOI18N
         metadataFiles.add(getBaseDir() + . + "nbproject" + . + "Makefile-impl.mk"); // NOI18N
         Configuration[] confs = getConfs().getConfs();
         for (int i = 0; i < confs.lengthi++) {
             metadataFiles.add(getBaseDir() + . + "nbproject" + . + "Makefile-" + confs[i].getName() + ".mk"); // NOI18N
         } // NOI18N
         boolean allOk = true;
         for (int i = 0; i < metadataFiles.size(); i++) {
             File file = new File(metadataFiles.elementAt(i));
             if (!file.exists()) {
                 continue;
             }
             if (!file.canWrite()) {
                 allOk = false;
                 notOkFiles.add(metadataFiles.elementAt(i));
             }
         }
         if (!allOk) {
             String projectName = IpeUtils.getBaseName(getBaseDir());
             StringBuilder text = new StringBuilder();
             text.append(getString("CannotSaveTxt"projectName)); // NOI18N
             for (int i = 0; i < notOkFiles.size(); i++) {
                 text.append("\n").append(notOkFiles.elementAt(i)); // NOI18N
             }
             if (extraMessage != null) {
                 text.append("\n\n").append(extraMessage); // NOI18N
             }
             NotifyDescriptor d = new NotifyDescriptor.Message(text.);
             DialogDisplayer.getDefault().notify(d);
             return allOk;
         }
 
         // ALl OK
         FileObject fo = null;
         fo = FileUtil.toFileObject(new File(getBaseDir()));
         if (fo != null) {
             if (.){
                 ..println("Start of writting project descriptor MakeConfigurationDescriptor@"+System.identityHashCode(this)+" for project "+fo.getName()+" @"+System.identityHashCode(this)); // NOI18N
             }
             new ConfigurationXMLWriter(fothis).write();
             new ConfigurationMakefileWriter(this).write();
             ConfigurationProjectXMLWriter();
             if (.){
                 ..println("End of writting project descriptor MakeConfigurationDescriptor@"+System.identityHashCode(this)+" for project "+fo.getName()+" @"+System.identityHashCode(this)); // NOI18N
             }
         }
 
         // Clear flag
         setModified(false);
 
         return allOk;
     }
 
     private void ConfigurationProjectXMLWriter() {
         // And save the project
         try {
             AntProjectHelper helper = ((MakeProjectgetProject()).getAntProjectHelper();
             Element data = helper.getPrimaryConfigurationData(true);
             Document doc = data.getOwnerDocument();
 
             // Remove old project dependency node
             NodeList nodeList = data.getElementsByTagName(.);
             if (nodeList != null && nodeList.getLength() > 0) {
                 for (int i = 0; i < nodeList.getLength(); i++) {
                     Node node = nodeList.item(i);
                     data.removeChild(node);
                 }
             }
             // Create new project dependency node
             Set<StringsubprojectLocations = getSubprojectLocations();
             for (String loc : subprojectLocations) {
                 Node n1;
                 n1 = doc.createElement(.);
                 n1.appendChild(doc.createTextNode(loc));
                 element.appendChild(n1);
             }
             data.appendChild(element);
             helper.putPrimaryConfigurationData(datatrue);
             // Create source encoding node
             nodeList = data.getElementsByTagName(.);
             if (nodeList != null && nodeList.getLength() > 0) {
                 // Node already there
                 Node node = nodeList.item(0);
                 node.setTextContent(((MakeProjectgetProject()).getSourceEncoding());
             } else {
                 // Create node
                 Element nativeProjectType = doc.createElementNS(..); // NOI18N
                 nativeProjectType.appendChild(doc.createTextNode(((MakeProjectgetProject()).getSourceEncoding()));
                 data.appendChild(nativeProjectType);
             }
             helper.putPrimaryConfigurationData(datatrue);
 
             ProjectManager.getDefault().saveProject();
         } catch (IOException ex) {
             ErrorManager.getDefault().notify(ex);
         }
     }
 
     private void updateExtensionList() {
         Set<Stringh = MakeProject.createExtensionSet();
         Set<Stringc = MakeProject.createExtensionSet();
         Set<Stringcpp = MakeProject.createExtensionSet();
         for (Item item : getProjectItems()) {
             String path = item.getPath();
             String ext = FileUtil.getExtension(path);
             if (ext.length() > 0) {
                 if (!h.contains(ext) && !c.contains(ext) && !cpp.contains(ext)) {
                     if (MIMEExtensions.isRegistered(.ext)) {
                         h.add(ext);
                     } else if (MIMEExtensions.isRegistered(.ext)) {
                         c.add(ext);
                     } else if (MIMEExtensions.isRegistered(.ext)) {
                         cpp.add(ext);
                     }
                 }
             }
         }
         MakeProject makeProject = (MakeProjectgetProject();
         if (makeProject != null) {
             makeProject.updateExtensions(ccpph);
         }
     }

    
Returns project locations (rel or abs) or all subprojects in all configurations.
 
     public Set<StringgetSubprojectLocations() {
         Set<StringsubProjects = new HashSet<String>();
 
         Configuration[] confs = getConfs().getConfs();
         for (int i = 0; i < confs.lengthi++) {
             MakeConfiguration makeConfiguration = (MakeConfigurationconfs[i];
             LibrariesConfiguration librariesConfiguration = null;
 
             if (((MakeConfigurationconfs[i]).isLinkerConfiguration()) {
                 librariesConfiguration = makeConfiguration.getLinkerConfiguration().getLibrariesConfiguration();
                 for (LibraryItem item : librariesConfiguration.getValue()) {
                     if (item instanceof LibraryItem.ProjectItem) {
                         LibraryItem.ProjectItem projectItem = (LibraryItem.ProjectItemitem;
                         subProjects.add(projectItem.getMakeArtifact().getProjectLocation());
                     }
                 }
             }
 
             for (LibraryItem.ProjectItem item : makeConfiguration.getRequiredProjectsConfiguration().getValue()) {
                 subProjects.add(item.getMakeArtifact().getProjectLocation());
             }
         }
 
         return subProjects;
     }
 
     public void addSourceRootRaw(String path) {
         synchronized () {
             .add(path);
         }
     }
 
     /*
      * Add a new root.
      * Don't add if root inside project
      * Don't add if root is subdir of existing root
      */
     private void addSourceRoot(String path) {
         String absPath = IpeUtils.toAbsolutePath(getBaseDir(), path);
         String canonicalPath = null;
         try {
             canonicalPath = new File(absPath).getCanonicalPath();
         } catch (IOException ioe) {
             canonicalPath = null;
         }
         String relPath = FilePathAdaptor.normalize(IpeUtils.toRelativePath(getBaseDir(), path));
         boolean addPath = true;
         ArrayList<StringtoBeRemoved = new ArrayList<String>();
 
         //if (IpeUtils.isPathAbsolute(relPath) || relPath.startsWith("..") || relPath.startsWith(".")) { // NOI18N
         synchronized () {
             if (canonicalPath != null) {
                 int canonicalPathLength = canonicalPath.length();
                 for (String sourceRoot : ) {
                     String absSourceRoot = IpeUtils.toAbsolutePath(getBaseDir(), sourceRoot);
                     String canonicalSourceRoot = null;
                     try {
                         canonicalSourceRoot = new File(absSourceRoot).getCanonicalPath();
                     } catch (IOException ioe) {
                         canonicalSourceRoot = null;
                     }
                     if (canonicalSourceRoot != null) {
                         int canonicalSourceRootLength = canonicalSourceRoot.length();
                         if (canonicalSourceRoot.equals(canonicalPath)) {
                             // Identical - don't add
                             addPath = false;
                             break;
                         }
                         if (canonicalSourceRoot.startsWith(canonicalPath) && canonicalSourceRoot.charAt(canonicalPathLength) == .) {
                             // Existing root sub dir of new path - remove existing path
                             toBeRemoved.add(sourceRoot);
                             continue;
                         }
                         if (canonicalPath.startsWith(canonicalSourceRoot) && canonicalPath.charAt(canonicalSourceRootLength) == .) {
                             // Sub dir of existing root - don't add
                             addPath = false;
                             break;
                         }
                     }
                 }
             }
             if (toBeRemoved.size() > 0) {
                 for (String toRemove : toBeRemoved) {
                     .remove(toRemove);
                 }
             }
             if (addPath) {
                 String usePath;
                 if (PathPanel.getMode() == .) {
                     usePath = FilePathAdaptor.normalize(IpeUtils.toAbsoluteOrRelativePath(getBaseDir(), path));
                 } else if (PathPanel.getMode() == .) {
                     usePath = relPath;
                 } else {
                     usePath = absPath;
                 }
 
                 .add(usePath);
                 setModified();
             }
         }
     //}
     }
 
     /*
      * Return real list
      */
     private List<StringgetSourceRootsRaw() {
         return ;
     }
 
     public void setSourceRoots(List<Stringlist) {
         synchronized () {
             .clear();
             .addAll(list);
         }
     }
 
 //    public void setSourceRootsList(List<String> list) {
 //        synchronized (sourceRoots) {
 //            sourceRoots.clear();
 //            for (String l : list) {
 //                addSourceRoot(l);
 //            }
 //        }
 //        MakeSources makeSources = getProject().getLookup().lookup(MakeSources.class);
 //        if (makeSources != null) {
 //            makeSources.sourceRootsChanged();
 //        }
 //    }
     private boolean inList(List<StringlistString s) {
         for (String l : list) {
             if (l.equals(s)) {
                 return true;
             }
         }
         return false;
     }
 
     public void checkForChangedSourceRoots(List<StringoldListList<StringnewList) {
 
         synchronized () {
             .clear();
             for (String l : newList) {
                 addSourceRoot(l);
             }
 
             MakeConfiguration active = (MakeConfigurationgetConfs().getActive(); // FIXUP: need better check
             if (!active.isMakefileConfiguration()) {
                 MakeSources makeSources = getProject().getLookup().lookup(MakeSources.class);
                 if (makeSources != null) {
                     makeSources.sourceRootsChanged();
                 }
                 return;
             }
 
             List<StringtoBeAdded = new ArrayList<String>();
             for (String s : ) {
                 if (!inList(oldLists)) {
                     toBeAdded.add(s);
                 }
             }
             List<StringtoBeRemoved = new ArrayList<String>();
             for (String s : oldList) {
                 if (!inList(s)) {
                     toBeRemoved.add(s);
                 }
             }
 
             if (toBeAdded.size() > 0) {
                 for (String root : toBeAdded) {
                     String absSourceRoot = IpeUtils.toAbsolutePath(getBaseDir(), root);
                     File absSourceRootFile = new File(absSourceRoot);