|
|
|
@ -12,9 +12,6 @@
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
package org.eclipse.cdt.core.model;
|
|
|
|
|
|
|
|
|
|
import java.net.URI;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.eclipse.cdt.core.CCProjectNature;
|
|
|
|
|
import org.eclipse.cdt.core.CCorePlugin;
|
|
|
|
|
import org.eclipse.cdt.core.CProjectNature;
|
|
|
|
@ -62,6 +59,9 @@ import org.eclipse.core.runtime.Plugin;
|
|
|
|
|
import org.eclipse.core.runtime.content.IContentType;
|
|
|
|
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
|
|
|
|
|
|
|
|
|
import java.net.URI;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @noextend This class is not intended to be subclassed by clients.
|
|
|
|
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
|
|
|
@ -72,9 +72,6 @@ public class CoreModel {
|
|
|
|
|
private static PathEntryManager pathEntryManager = PathEntryManager.getDefault();
|
|
|
|
|
private static CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
|
|
|
|
|
|
|
|
|
// private static String FILE_EXT_PATTERN = "*."; //$NON-NLS-1$
|
|
|
|
|
// private static int FILE_EXT_PATTERN_LENGTH = FILE_EXT_PATTERN.length();
|
|
|
|
|
|
|
|
|
|
public final static String CORE_MODEL_ID = CCorePlugin.PLUGIN_ID + ".coremodel"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -101,8 +98,8 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the C model element corresponding to the given handle identifier
|
|
|
|
|
* generated by <code>ICElement.getHandleIdentifier()</code>, or
|
|
|
|
|
* <code>null</code> if unable to create the associated element.
|
|
|
|
|
* generated by {@code ICElement.getHandleIdentifier()}, or
|
|
|
|
|
* {@code null} if unable to create the associated element.
|
|
|
|
|
*
|
|
|
|
|
* @param handleIdentifier the given handle identifier
|
|
|
|
|
* @return the C element corresponding to the handle identifier
|
|
|
|
@ -153,7 +150,7 @@ public class CoreModel {
|
|
|
|
|
* Returns the C model.
|
|
|
|
|
*
|
|
|
|
|
* @param root the given root
|
|
|
|
|
* @return the C model, or <code>null</code> if the root is null
|
|
|
|
|
* @return the C model, or {@code null} if the root is null
|
|
|
|
|
*/
|
|
|
|
|
public static ICModel create(IWorkspaceRoot root) {
|
|
|
|
|
if (root == null) {
|
|
|
|
@ -161,6 +158,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
return manager.getCModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the default ICModel.
|
|
|
|
|
*/
|
|
|
|
@ -279,8 +277,9 @@ public class CoreModel {
|
|
|
|
|
if (contentType != null) {
|
|
|
|
|
String id = contentType.getId();
|
|
|
|
|
if (CCorePlugin.CONTENT_TYPE_CHEADER.equals(id)
|
|
|
|
|
|| CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(id))
|
|
|
|
|
|| CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(id)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CCorePlugin.CONTENT_TYPE_CSOURCE.equals(id)
|
|
|
|
|
|| CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(id)
|
|
|
|
@ -384,34 +383,26 @@ public class CoreModel {
|
|
|
|
|
* Return true if project has C nature.
|
|
|
|
|
*/
|
|
|
|
|
public static boolean hasCNature(IProject project) {
|
|
|
|
|
boolean ok = false;
|
|
|
|
|
try {
|
|
|
|
|
ok = (project.isOpen() && project.hasNature(CProjectNature.C_NATURE_ID));
|
|
|
|
|
return project.isOpen() && project.hasNature(CProjectNature.C_NATURE_ID);
|
|
|
|
|
} catch (CoreException e) {
|
|
|
|
|
//throws exception if the project is not open.
|
|
|
|
|
//System.out.println (e);
|
|
|
|
|
//e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return true if project has C++ nature.
|
|
|
|
|
*/
|
|
|
|
|
public static boolean hasCCNature(IProject project) {
|
|
|
|
|
boolean ok = false;
|
|
|
|
|
try {
|
|
|
|
|
ok = (project.isOpen() && project.hasNature(CCProjectNature.CC_NATURE_ID));
|
|
|
|
|
return project.isOpen() && project.hasNature(CCProjectNature.CC_NATURE_ID);
|
|
|
|
|
} catch (CoreException e) {
|
|
|
|
|
//throws exception if the project is not open.
|
|
|
|
|
//System.out.println (e);
|
|
|
|
|
//e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new non-exported entry of kind <code>CDT_PROJECT</code>
|
|
|
|
|
* Creates and returns a new non-exported entry of kind {@code CDT_PROJECT}
|
|
|
|
|
* for the project identified by the given absolute path.
|
|
|
|
|
* <p>
|
|
|
|
|
* A project entry is used to denote a prerequisite project. The
|
|
|
|
@ -421,7 +412,7 @@ public class CoreModel {
|
|
|
|
|
* to the workspace root.
|
|
|
|
|
* <p>
|
|
|
|
|
* The resulting entry is not exported to dependent projects. This method
|
|
|
|
|
* is equivalent to <code>newProjectEntry(path,false)</code>.
|
|
|
|
|
* is equivalent to {@code newProjectEntry(path, false)}.
|
|
|
|
|
* <p>
|
|
|
|
|
*
|
|
|
|
|
* @param projectPath
|
|
|
|
@ -435,7 +426,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_PROJECT</code> for
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_PROJECT} for
|
|
|
|
|
* the project identified by the given workspace-relative path.
|
|
|
|
|
* <p>
|
|
|
|
|
* A project entry is used to denote a prerequisite project. All the
|
|
|
|
@ -456,13 +447,13 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_CONTAINER</code> for
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_CONTAINER} for
|
|
|
|
|
* the given path. The path of the container will be used during resolution
|
|
|
|
|
* so as to map this container entry to a set of other entries the
|
|
|
|
|
* container is acting for.
|
|
|
|
|
* <p>
|
|
|
|
|
* The resulting entry is not exported to dependent projects. This method
|
|
|
|
|
* is equivalent to <code>newContainerEntry(path,false)</code>.
|
|
|
|
|
* is equivalent to {@code newContainerEntry(path, false)}.
|
|
|
|
|
* <p>
|
|
|
|
|
*
|
|
|
|
|
* @param id the id of the container
|
|
|
|
@ -474,13 +465,13 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_CONTAINER</code> for
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_CONTAINER} for
|
|
|
|
|
* the given path. The path of the container will be used during resolution
|
|
|
|
|
* so as to map this container entry to a set of other entries the
|
|
|
|
|
* container is acting for.
|
|
|
|
|
* <p>
|
|
|
|
|
* The resulting entry is not exported to dependent projects. This method
|
|
|
|
|
* is equivalent to <code>newContainerEntry(path,false)</code>.
|
|
|
|
|
* is equivalent to {@code newContainerEntry(path,false)}.
|
|
|
|
|
* <p>
|
|
|
|
|
*/
|
|
|
|
|
public static IContainerEntry newContainerEntry(IPath id, boolean isExported) {
|
|
|
|
@ -488,7 +479,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_LIBRARY</code>
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_LIBRARY}
|
|
|
|
|
* for the archive or folder identified by the given absolute path.
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
@ -506,7 +497,7 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_LIBRARY</code>
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_LIBRARY}
|
|
|
|
|
* for the archive or folder identified by the given absolute path.
|
|
|
|
|
*
|
|
|
|
|
* Note that this operation does not attempt to validate or access the
|
|
|
|
@ -521,12 +512,12 @@ public class CoreModel {
|
|
|
|
|
* the path of the library
|
|
|
|
|
* @param sourceAttachmentPath
|
|
|
|
|
* the project-relative path of the corresponding source archive or
|
|
|
|
|
* folder, or <code>null</code> if none.
|
|
|
|
|
* folder, or {@code null} if none.
|
|
|
|
|
* @param sourceAttachmentRootPath
|
|
|
|
|
* the location of the root within the source archive or folder
|
|
|
|
|
* or <code>null</code>.
|
|
|
|
|
* or {@code null}.
|
|
|
|
|
* @param sourceAttachmentPrefixMapping
|
|
|
|
|
* prefix mapping or <code>null</code>.
|
|
|
|
|
* prefix mapping or {@code null}.
|
|
|
|
|
* @param isExported
|
|
|
|
|
* whether the entry is exported
|
|
|
|
|
* @return a new library entry
|
|
|
|
@ -538,7 +529,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_OUTPUT</code> for
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_OUTPUT} for
|
|
|
|
|
* the project's output folder
|
|
|
|
|
* <p>
|
|
|
|
|
*
|
|
|
|
@ -552,7 +543,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_OUPUT</code> for
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_OUPUT} for
|
|
|
|
|
* the project
|
|
|
|
|
*
|
|
|
|
|
* @param outputPath
|
|
|
|
@ -567,20 +558,20 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_SOURCE</code> for
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_SOURCE} for
|
|
|
|
|
* the project's source folder identified by the given absolute
|
|
|
|
|
* workspace-relative path.
|
|
|
|
|
* <p>
|
|
|
|
|
* The source folder is referred to using an absolute path relative to the
|
|
|
|
|
* workspace root, e.g. <code>/Project/src</code>. A project's source
|
|
|
|
|
* workspace root, e.g. {@code /Project/src}. A project's source
|
|
|
|
|
* folders are located with that project. That is, a source entry
|
|
|
|
|
* specifying the path <code>/P1/src</code> is only usable for project
|
|
|
|
|
* <code>P1</code>.
|
|
|
|
|
* specifying the path {@code /P1/src} is only usable for project
|
|
|
|
|
* {@code P1}.
|
|
|
|
|
* </p>
|
|
|
|
|
* </p>
|
|
|
|
|
* <p>
|
|
|
|
|
* Note that all sources/binaries inside a project are contributed as a
|
|
|
|
|
* whole through a project entry (see <code>newProjectEntry</code>).
|
|
|
|
|
* whole through a project entry (see {@code newProjectEntry}).
|
|
|
|
|
* Particular source entries cannot be selectively exported.
|
|
|
|
|
* </p>
|
|
|
|
|
*
|
|
|
|
@ -594,17 +585,17 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_SOURCE</code> for
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_SOURCE} for
|
|
|
|
|
* the project's source folder identified by the given absolute
|
|
|
|
|
* workspace-relative path but excluding all source files with paths
|
|
|
|
|
* matching any of the given patterns. This specifies that all package
|
|
|
|
|
* fragments within the root will have children of type <code>ICompilationUnit</code>.
|
|
|
|
|
* fragments within the root will have children of type {@code ICompilationUnit}.
|
|
|
|
|
* <p>
|
|
|
|
|
* The source folder is referred to using an absolute path relative to the
|
|
|
|
|
* workspace root, e.g. <code>/Project/src</code>. A project's source
|
|
|
|
|
* workspace root, e.g. {@code /Project/src}. A project's source
|
|
|
|
|
* folders are located with that project. That is, a source entry
|
|
|
|
|
* specifying the path <code>/P1/src</code> is only usable for project
|
|
|
|
|
* <code>P1</code>.
|
|
|
|
|
* specifying the path {@code /P1/src} is only usable for project
|
|
|
|
|
* {@code P1}.
|
|
|
|
|
* </p>
|
|
|
|
|
*
|
|
|
|
|
* @param sourcePath
|
|
|
|
@ -619,7 +610,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_INCLUDE}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -634,7 +625,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* * Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
|
|
|
|
* * Creates and returns a new entry of kind {@code CDT_INCLUDE}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -651,7 +642,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_INCLUDE}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -671,7 +662,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_INCLUDE}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -694,7 +685,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_INCLUDE}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -709,14 +700,14 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new entry of kind <code>CDT_INCLUDE_FILE</code>
|
|
|
|
|
* Creates a new entry of kind {@code CDT_INCLUDE_FILE}
|
|
|
|
|
*/
|
|
|
|
|
public static IIncludeFileEntry newIncludeFileEntry(IPath resourcePath, IPath includeFile) {
|
|
|
|
|
return newIncludeFileEntry(resourcePath, null, null, includeFile, null, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE_FILE</code>
|
|
|
|
|
* Creates and returns a new entry of kind {@code CDT_INCLUDE_FILE}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -736,7 +727,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
|
|
|
|
* Creates and returns an entry kind {@code CDT_MACRO}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -751,7 +742,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
|
|
|
|
* Creates and returns an entry kind {@code CDT_MACRO}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected project-relative resource path
|
|
|
|
@ -767,7 +758,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
|
|
|
|
* Creates and returns an entry kind {@code CDT_MACRO}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected workspace-relative resource path
|
|
|
|
@ -783,7 +774,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
|
|
|
|
* Creates and returns an entry kind {@code CDT_MACRO}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected workspace-relative resource path
|
|
|
|
@ -797,14 +788,14 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an entry kind <code>CDT_MACRO_FILE</code>
|
|
|
|
|
* Creates an entry kind {@code CDT_MACRO_FILE}
|
|
|
|
|
*/
|
|
|
|
|
public static IMacroFileEntry newMacroFileEntry(IPath resourcePath, IPath macroFile) {
|
|
|
|
|
return newMacroFileEntry(resourcePath, null, null, macroFile, null, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns an entry kind <code>CDT_MACRO_FILE</code>
|
|
|
|
|
* Creates and returns an entry kind {@code CDT_MACRO_FILE}
|
|
|
|
|
*
|
|
|
|
|
* @param resourcePath
|
|
|
|
|
* the affected workspace-relative resource path
|
|
|
|
@ -822,20 +813,20 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Answers the project specific value for a given container. In case this
|
|
|
|
|
* container path could not be resolved, then will answer <code>null</code>.
|
|
|
|
|
* container path could not be resolved, then will answer {@code null}.
|
|
|
|
|
* Both the container path and the project context are supposed to be
|
|
|
|
|
* non-null.
|
|
|
|
|
* <p>
|
|
|
|
|
* The containerPath is a formed by a first ID segment followed with extra
|
|
|
|
|
* segments, which can be used as additional hints for resolution. If no
|
|
|
|
|
* container was ever recorded for this container path onto this project
|
|
|
|
|
* (using <code>setPathEntryContainer</code>, then a <code>PathEntryContainerInitializer</code>
|
|
|
|
|
* (using {@code setPathEntryContainer}, then a {@code PathEntryContainerInitializer}
|
|
|
|
|
* will be activated if any was registered for this container ID onto the
|
|
|
|
|
* extension point "org.eclipse.cdt.core.PathEntryContainerInitializer".
|
|
|
|
|
* <p>
|
|
|
|
|
* PathEntry container values are persisted locally to the workspace, but
|
|
|
|
|
* are not preserved from a session to another. It is thus highly
|
|
|
|
|
* recommended to register a <code>PathEntryContainerInitializer</code>
|
|
|
|
|
* recommended to register a {@code PathEntryContainerInitializer}
|
|
|
|
|
* for each referenced container (through the extension point
|
|
|
|
|
* "org.eclipse.cdt.core.PathEntryContainerInitializer").
|
|
|
|
|
* <p>
|
|
|
|
@ -844,7 +835,7 @@ public class CoreModel {
|
|
|
|
|
* the name of the container, which needs to be resolved
|
|
|
|
|
* @param project
|
|
|
|
|
* a specific project in which the container is being resolved
|
|
|
|
|
* @return the corresponding container or <code>null</code> if unable to
|
|
|
|
|
* @return the corresponding container or {@code null} if unable to
|
|
|
|
|
* find one.
|
|
|
|
|
*
|
|
|
|
|
* @exception CModelException
|
|
|
|
@ -861,7 +852,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bind a container reference path to some actual containers (<code>IPathEntryContainer</code>).
|
|
|
|
|
* Bind a container reference path to some actual containers ({@code IPathEntryContainer}).
|
|
|
|
|
* This API must be invoked whenever changes in container need to be
|
|
|
|
|
* reflected onto the CModel.
|
|
|
|
|
* <p>
|
|
|
|
@ -872,11 +863,11 @@ public class CoreModel {
|
|
|
|
|
* <p>
|
|
|
|
|
* PathEntry container values are persisted locally to the workspace, but
|
|
|
|
|
* are not preserved from a session to another. It is thus highly
|
|
|
|
|
* recommended to register a <code>PathEntryContainerInitializer</code>
|
|
|
|
|
* recommended to register a {@code PathEntryContainerInitializer}
|
|
|
|
|
* for each referenced container (through the extension point
|
|
|
|
|
* "org.eclipse.cdt.core.PathEntryContainerInitializer").
|
|
|
|
|
* <p>
|
|
|
|
|
* Note: setting a container to <code>null</code> will cause it to be
|
|
|
|
|
* Note: setting a container to {@code null} will cause it to be
|
|
|
|
|
* lazily resolved again whenever its value is required. In particular,
|
|
|
|
|
* this will cause a registered initializer to be invoked again.
|
|
|
|
|
* <p>
|
|
|
|
@ -898,9 +889,9 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Helper method use by a pathentry container implementing <code>IPathEntryContainerExtension</code>
|
|
|
|
|
* Helper method use by a path entry container implementing {@code IPathEntryContainerExtension}
|
|
|
|
|
* It notify the model of changes.
|
|
|
|
|
* Note: the paths in the <code>PathEntryContainerChanged[]</code> array must be on
|
|
|
|
|
* Note: the paths in the {@code PathEntryContainerChanged[]} array must be on
|
|
|
|
|
* source that the container was set too. If not the changes will be silently ignore.
|
|
|
|
|
*
|
|
|
|
|
* @param container
|
|
|
|
@ -914,7 +905,7 @@ public class CoreModel {
|
|
|
|
|
/**
|
|
|
|
|
* Sets the pathentries of this project using a list of entries.
|
|
|
|
|
* <p>
|
|
|
|
|
* Setting the pathentries to <code>null</code> specifies a default
|
|
|
|
|
* Setting the pathentries to {@code null} specifies a default
|
|
|
|
|
* classpath (the project root). Setting the pathentry to an empty array
|
|
|
|
|
* specifies an empty pathentry.
|
|
|
|
|
* <p>
|
|
|
|
@ -932,7 +923,7 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the raw pathentries for the project. This corresponds to the
|
|
|
|
|
* exact set of entries which were assigned using <code>setRawPathEntries</code>
|
|
|
|
|
* exact set of entries which were assigned using {@code setRawPathEntries}
|
|
|
|
|
* <p>
|
|
|
|
|
*
|
|
|
|
|
* @return the raw entires for the project
|
|
|
|
@ -1038,7 +1029,7 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Helper method finding the pathentry container initializer registered for
|
|
|
|
|
* a given container ID or <code>null</code> if none was found while
|
|
|
|
|
* a given container ID or {@code null} if none was found while
|
|
|
|
|
* iterating over the contributions to extension point to the extension
|
|
|
|
|
* point "org.eclipse.cdt.core.PathEntryContainerInitializer".
|
|
|
|
|
* <p>
|
|
|
|
@ -1049,7 +1040,7 @@ public class CoreModel {
|
|
|
|
|
* @param containerID -
|
|
|
|
|
* a containerID identifying a registered initializer
|
|
|
|
|
* @return ClasspathContainerInitializer - the registered classpath
|
|
|
|
|
* container initializer or <code>null</code> if none was found.
|
|
|
|
|
* container initializer or {@code null} if none was found.
|
|
|
|
|
*/
|
|
|
|
|
public static PathEntryContainerInitializer getPathEntryContainerInitializer(String containerID) {
|
|
|
|
|
return pathEntryManager.getPathEntryContainerInitializer(containerID);
|
|
|
|
@ -1077,28 +1068,37 @@ public class CoreModel {
|
|
|
|
|
* Validate a given path entries for a project, using the following rules:
|
|
|
|
|
* <ul>
|
|
|
|
|
* <li> Entries cannot collide with each other; that is, all entry paths must be unique.
|
|
|
|
|
* <li> The output entry location path can be empty, if not they must be located inside the project.
|
|
|
|
|
* <li> The output entry location path can be empty, if not they must be located inside
|
|
|
|
|
* the project.
|
|
|
|
|
* <li> Source entry location can be null, if not they must be located inside the project,
|
|
|
|
|
* <li> A project entry cannot refer to itself directly (that is, a project cannot prerequisite itself).
|
|
|
|
|
* <li> Source entries or output locations cannot coincidate or be nested in each other, except for the following scenarii listed below:
|
|
|
|
|
* <ul><li> A source folder can coincidate with its own output location, in which case this output can then contain library archives.
|
|
|
|
|
* However, a specific output location cannot coincidate with any library or a distinct source folder than the one referring to it. </li>
|
|
|
|
|
* <li> A source/library folder can be nested in any source folder as long as the nested folder is excluded from the enclosing one. </li>
|
|
|
|
|
* <li> An output location can be nested in a source folder, if the source folder coincidates with the project itself, or if the output
|
|
|
|
|
* location is excluded from the source folder. </li>
|
|
|
|
|
* <li> A project entry cannot refer to itself directly (that is, a project cannot
|
|
|
|
|
* prerequisite itself).
|
|
|
|
|
* <li> Source entries or output locations cannot coincide or be nested in each other, except
|
|
|
|
|
* for the following scenarios listed below:
|
|
|
|
|
* <ul>
|
|
|
|
|
* <li> A source folder can coincide with its own output location, in which case this
|
|
|
|
|
* output can then contain library archives. However, a specific output location
|
|
|
|
|
* cannot coincide with any library or a distinct source folder than the one
|
|
|
|
|
* referring to it.</li>
|
|
|
|
|
* <li> A source/library folder can be nested in any source folder as long as
|
|
|
|
|
* the nested folder is excluded from the enclosing one. </li>
|
|
|
|
|
* <li> An output location can be nested in a source folder, if the source folder
|
|
|
|
|
* coincides with the project itself, or if the output location is excluded from
|
|
|
|
|
* the source folder. </li>
|
|
|
|
|
* </ul>
|
|
|
|
|
* </ul>
|
|
|
|
|
*
|
|
|
|
|
* Note that the entries are not validated automatically. Only bound variables or containers are considered
|
|
|
|
|
* in the checking process (this allows to perform a consistency check on an entry which has references to
|
|
|
|
|
* yet non existing projects, folders, ...).
|
|
|
|
|
* <p>
|
|
|
|
|
* This validation is intended to anticipate issues prior to assigning it to a project. In particular, it will automatically
|
|
|
|
|
* be performed during the setting operation (if validation fails, the classpath setting will not complete)
|
|
|
|
|
* and during getResolvedPathEntries.
|
|
|
|
|
* Note that the entries are not validated automatically. Only bound variables or containers
|
|
|
|
|
* are considered in the checking process (this allows to perform a consistency check on
|
|
|
|
|
* an entry which has references to yet non existing projects, folders, ...).
|
|
|
|
|
* <p>
|
|
|
|
|
* This validation is intended to anticipate issues prior to assigning it to a project.
|
|
|
|
|
* In particular, it will automatically be performed during the setting operation
|
|
|
|
|
* (if validation fails, the classpath setting will not complete) and during
|
|
|
|
|
* {@link #getResolvedPathEntries}.
|
|
|
|
|
*
|
|
|
|
|
* @param cProject the given C project
|
|
|
|
|
* @return a status object with code <code>IStatus.OK</code> if
|
|
|
|
|
* @return a status object with code {@code IStatus.OK} if
|
|
|
|
|
* the entries location are compatible, otherwise a status
|
|
|
|
|
* object indicating what is wrong with them
|
|
|
|
|
*/
|
|
|
|
@ -1108,14 +1108,16 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a C model status describing the problem related to this entry if any,
|
|
|
|
|
* a status object with code <code>IStatus.OK</code> if the entry is fine (that is, if the
|
|
|
|
|
* a status object with code {@code IStatus.OK} if the entry is fine (that is, if the
|
|
|
|
|
* given entry denotes a valid element).
|
|
|
|
|
*
|
|
|
|
|
* @param cProject the given C project
|
|
|
|
|
* @param entry the given entry
|
|
|
|
|
* @param checkSourceAttachment a flag to determine if source attachement should be checked
|
|
|
|
|
* @param recurseInContainers flag indicating whether validation should be applied to container entries recursively
|
|
|
|
|
* @return a c model status describing the problem related to this entry if any, a status object with code <code>IStatus.OK</code> if the entry is fine
|
|
|
|
|
* @param checkSourceAttachment a flag to determine if source attachment should be checked
|
|
|
|
|
* @param recurseInContainers flag indicating whether validation should be applied to container
|
|
|
|
|
* entries recursively
|
|
|
|
|
* @return a c model status describing the problem related to this entry if any, a status object
|
|
|
|
|
* with code {@code IStatus.OK} if the entry is fine
|
|
|
|
|
*/
|
|
|
|
|
public static ICModelStatus validatePathEntry(ICProject cProject, IPathEntry entry, boolean checkSourceAttachment, boolean recurseInContainers){
|
|
|
|
|
return pathEntryManager.validatePathEntry(cProject, entry, checkSourceAttachment, recurseInContainers);
|
|
|
|
@ -1184,7 +1186,7 @@ public class CoreModel {
|
|
|
|
|
* </p>
|
|
|
|
|
*
|
|
|
|
|
* @param action the action to perform
|
|
|
|
|
* @param monitor a progress monitor, or <code>null</code> if progress
|
|
|
|
|
* @param monitor a progress monitor, or {@code null} if progress
|
|
|
|
|
* reporting and cancellation are not desired
|
|
|
|
|
* @exception CoreException if the operation failed.
|
|
|
|
|
* @since 2.1
|
|
|
|
@ -1216,13 +1218,13 @@ public class CoreModel {
|
|
|
|
|
* <p>
|
|
|
|
|
* The supplied scheduling rule is used to determine whether this operation can be
|
|
|
|
|
* run simultaneously with workspace changes in other threads. See
|
|
|
|
|
* <code>IWorkspace.run(...)</code> for more details.
|
|
|
|
|
* {@code IWorkspace.run(...)} for more details.
|
|
|
|
|
* </p>
|
|
|
|
|
*
|
|
|
|
|
* @param action the action to perform
|
|
|
|
|
* @param rule the scheduling rule to use when running this operation, or
|
|
|
|
|
* <code>null</code> if there are no scheduling restrictions for this operation.
|
|
|
|
|
* @param monitor a progress monitor, or <code>null</code> if progress
|
|
|
|
|
* {@code null} if there are no scheduling restrictions for this operation.
|
|
|
|
|
* @param monitor a progress monitor, or {@code null} if progress
|
|
|
|
|
* reporting and cancellation are not desired
|
|
|
|
|
* @exception CoreException if the operation failed.
|
|
|
|
|
* @since 3.0
|
|
|
|
@ -1239,7 +1241,7 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The method returns whether scanner information for a resource is empty or not.
|
|
|
|
|
* If <code>null</code> is supplied the method returns <code>true</code>.
|
|
|
|
|
* If {@code null} is supplied the method returns {@code true}.
|
|
|
|
|
*
|
|
|
|
|
* @param resource
|
|
|
|
|
* @since 3.0
|
|
|
|
@ -1269,7 +1271,6 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
|
|
|
|
|
if (lSetting != null && lSetting instanceof CLanguageSettingCache){
|
|
|
|
@ -1345,7 +1346,7 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* this method is a full equivalent to <code>createProjectDescription(project, loadIfExists, false)</code>.
|
|
|
|
|
* this method is a full equivalent to {@code createProjectDescription(project, loadIfExists, false)}.
|
|
|
|
|
*
|
|
|
|
|
* @see #createProjectDescription(IProject, boolean, boolean)
|
|
|
|
|
*/
|
|
|
|
@ -1443,8 +1444,8 @@ public class CoreModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Forces the cached data of the specified projects to be re-calculated.
|
|
|
|
|
* if the <code>projects</code> argument is <code>null</code> al projects
|
|
|
|
|
* within the workspace are updated
|
|
|
|
|
* If the {@code projects} argument is {@code null}, all projects
|
|
|
|
|
* within the workspace are updated.
|
|
|
|
|
*
|
|
|
|
|
* @param projects
|
|
|
|
|
* @param monitor
|
|
|
|
@ -1455,14 +1456,16 @@ public class CoreModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Answers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
|
|
|
|
* Answers whether the given project is a new-style project,
|
|
|
|
|
* i.e. CConfigurationDataProvider-driven.
|
|
|
|
|
*/
|
|
|
|
|
public boolean isNewStyleProject(IProject project){
|
|
|
|
|
return descriptionManager.isNewStyleProject(project);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Answers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
|
|
|
|
* Answers whether the given project is a new-style project,
|
|
|
|
|
* i.e. CConfigurationDataProvider-driven
|
|
|
|
|
*/
|
|
|
|
|
public boolean isNewStyleProject(ICProjectDescription des){
|
|
|
|
|
return descriptionManager.isNewStyleProject(des);
|
|
|
|
|