mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
Draft work on LibaryReference and IncludeReference
This commit is contained in:
parent
8a6680ea21
commit
9561454a65
21 changed files with 462 additions and 101 deletions
|
@ -1,3 +1,25 @@
|
||||||
|
2004-04-03 Alain Magloire
|
||||||
|
|
||||||
|
Draft work on LibraryReferences and IncludeReferences.
|
||||||
|
|
||||||
|
* model/org/eclipse/cdt/core/model/CoreModel.java
|
||||||
|
* model/org/eclipse/cdt/core/model/ICProject.java
|
||||||
|
* model/org/eclipse/cdt/core/model/IIncludeEntry.java
|
||||||
|
* model/org/eclipse/cdt/core/model/IIncludeReference.java
|
||||||
|
* model/org/eclipse/cdt/core/model/ILibararyentry.java
|
||||||
|
* model/org/eclipse/cdt/core/model/IPathEntry.java
|
||||||
|
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/APathEntry.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/CProject.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/CProjectInfo.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/IncludeEntry.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/IncludeReference.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/LibraryEntry.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/LibraryReferenceArchive.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/LibraryReferenceShared.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/MacroEntry.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
|
||||||
|
|
||||||
2004-04-03 Alain Magloire
|
2004-04-03 Alain Magloire
|
||||||
|
|
||||||
Fix for PR 57287
|
Fix for PR 57287
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class CoreModel {
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* the absolute path of the binary archive
|
* the absolute path of the library
|
||||||
* @param sourceAttachmentPath
|
* @param sourceAttachmentPath
|
||||||
* the absolute path of the corresponding source archive or
|
* the absolute path of the corresponding source archive or
|
||||||
* folder, or <code>null</code> if none.
|
* folder, or <code>null</code> if none.
|
||||||
|
@ -279,9 +279,9 @@ public class CoreModel {
|
||||||
* @return a new library entry
|
* @return a new library entry
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static ILibraryEntry newLibraryEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
|
public static ILibraryEntry newLibraryEntry(IPath libraryPath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
|
||||||
IPath sourceAttachmentPrefixMapping) {
|
IPath sourceAttachmentPrefixMapping) {
|
||||||
return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, false);
|
return newLibraryEntry(libraryPath, null, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -293,7 +293,9 @@ public class CoreModel {
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* the absolute path of the binary archive
|
* the path of the library
|
||||||
|
* @param path
|
||||||
|
* the base path of the library
|
||||||
* @param sourceAttachmentPath
|
* @param sourceAttachmentPath
|
||||||
* the absolute path of the corresponding source archive or
|
* the absolute path of the corresponding source archive or
|
||||||
* folder, or <code>null</code> if none.
|
* folder, or <code>null</code> if none.
|
||||||
|
@ -305,9 +307,9 @@ public class CoreModel {
|
||||||
* @return a new library entry
|
* @return a new library entry
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static ILibraryEntry newLibraryEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
|
public static ILibraryEntry newLibraryEntry(IPath libraryPath, IPath basePath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
|
||||||
IPath sourceAttachmentPrefixMapping, boolean isExported) {
|
IPath sourceAttachmentPrefixMapping, boolean isExported) {
|
||||||
return new LibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported);
|
return new LibraryEntry(libraryPath, basePath, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -391,6 +393,17 @@ public class CoreModel {
|
||||||
return new SourceEntry(path, exclusionPatterns);
|
return new SourceEntry(path, exclusionPatterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||||
|
*
|
||||||
|
* @param includePath
|
||||||
|
* the absolute path of the include
|
||||||
|
* @return IIncludeEntry
|
||||||
|
*/
|
||||||
|
public static IIncludeEntry newIncludeEntry(IPath includePath) {
|
||||||
|
return newIncludeEntry(null, includePath, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||||
*
|
*
|
||||||
|
@ -404,17 +417,6 @@ public class CoreModel {
|
||||||
return newIncludeEntry(resourcePath, includePath, false);
|
return newIncludeEntry(resourcePath, includePath, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
|
||||||
*
|
|
||||||
* @param includePath
|
|
||||||
* the absolute path of the include
|
|
||||||
* @return IIncludeEntry
|
|
||||||
*/
|
|
||||||
public static IIncludeEntry newIncludeEntry(IPath includePath) {
|
|
||||||
return newIncludeEntry(null, includePath, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
* * Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||||
*
|
*
|
||||||
|
@ -428,7 +430,7 @@ public class CoreModel {
|
||||||
* @return IIncludeEntry
|
* @return IIncludeEntry
|
||||||
*/
|
*/
|
||||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude) {
|
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude) {
|
||||||
return newIncludeEntry(resourcePath, includePath, isSystemInclude, IncludeEntry.NO_EXCLUSION_PATTERNS);
|
return newIncludeEntry(resourcePath, includePath, null, isSystemInclude, IncludeEntry.NO_EXCLUSION_PATTERNS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -448,9 +450,32 @@ public class CoreModel {
|
||||||
* exclusion patterns in the resource if a container
|
* exclusion patterns in the resource if a container
|
||||||
* @return IIincludeEntry
|
* @return IIincludeEntry
|
||||||
*/
|
*/
|
||||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude,
|
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude, IPath[] exclusionPathterns) {
|
||||||
|
return newIncludeEntry(resourcePath, includePath, null, isSystemInclude, exclusionPathterns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
* the affected project-relative resource path
|
||||||
|
* @param includePath
|
||||||
|
* the path of the include
|
||||||
|
* @param basePath
|
||||||
|
* the base path of the include
|
||||||
|
* @param isSystemInclude
|
||||||
|
* wheter this include path should be consider the system
|
||||||
|
* include path
|
||||||
|
* @param isRecursive
|
||||||
|
* if the resource is a folder the include applied to all
|
||||||
|
* recursively
|
||||||
|
* @param exclusionPatterns
|
||||||
|
* exclusion patterns in the resource if a container
|
||||||
|
* @return IIincludeEntry
|
||||||
|
*/
|
||||||
|
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, IPath basePath, boolean isSystemInclude,
|
||||||
IPath[] exclusionPatterns) {
|
IPath[] exclusionPatterns) {
|
||||||
return new IncludeEntry(resourcePath, includePath, isSystemInclude, exclusionPatterns);
|
return new IncludeEntry(resourcePath, includePath, basePath, isSystemInclude, exclusionPatterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -465,7 +490,7 @@ public class CoreModel {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IMacroEntry newMacroEntry(String macroName, String macroValue) {
|
public static IMacroEntry newMacroEntry(String macroName, String macroValue) {
|
||||||
return newMacroEntry(null, macroName, macroValue, MacroEntry.NO_EXCLUSION_PATTERNS);
|
return newMacroEntry(null, macroName, macroValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -479,8 +504,23 @@ public class CoreModel {
|
||||||
* the value of the macro
|
* the value of the macro
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IMacroEntry newMacroEntry(IPath path, String macroName, String macroValue) {
|
public static IMacroEntry newMacroEntry(IPath basePath, String macroName) {
|
||||||
return newMacroEntry(path, macroName, macroValue, MacroEntry.NO_EXCLUSION_PATTERNS);
|
return newMacroEntry(null, basePath, macroName, null, MacroEntry.NO_EXCLUSION_PATTERNS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
* the affected workspace-relative resource path
|
||||||
|
* @param macroName
|
||||||
|
* the name of the macro
|
||||||
|
* @param macroValue
|
||||||
|
* the value of the macro
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static IMacroEntry newMacroEntry(IPath resourcePath, String macroName, String macroValue) {
|
||||||
|
return newMacroEntry(resourcePath, macroName, macroValue, MacroEntry.NO_EXCLUSION_PATTERNS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -496,10 +536,26 @@ public class CoreModel {
|
||||||
* exclusion patterns in the resource if a container
|
* exclusion patterns in the resource if a container
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IMacroEntry newMacroEntry(IPath path, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
public static IMacroEntry newMacroEntry(IPath resourcePath, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
||||||
return new MacroEntry(path, macroName, macroValue, exclusionPatterns);
|
return newMacroEntry(resourcePath, null, macroName, macroValue, exclusionPatterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
* the affected workspace-relative resource path
|
||||||
|
* @param macroName
|
||||||
|
* the name of the macro
|
||||||
|
* @param macroValue
|
||||||
|
* the value of the macro
|
||||||
|
* @param exclusionPatterns
|
||||||
|
* exclusion patterns in the resource if a container
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static IMacroEntry newMacroEntry(IPath resourcePath, IPath basePath, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
||||||
|
return new MacroEntry(resourcePath, basePath, macroName, macroValue, exclusionPatterns);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Answers the project specific value for a given container. In case this
|
* 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</code>.
|
||||||
|
|
|
@ -94,6 +94,14 @@ public interface ICProject extends IParent, IOpenable, ICElement {
|
||||||
*/
|
*/
|
||||||
ILibraryReference[] getLibraryReferences() throws CModelException;
|
ILibraryReference[] getLibraryReferences() throws CModelException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the include paths set on the project.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws CModelException
|
||||||
|
*/
|
||||||
|
IIncludeReference[] getIncludeReferences() throws CModelException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the names of the projects that are directly required by this
|
* Returns the names of the projects that are directly required by this
|
||||||
* project. A project is required if it is in its cpath entries.
|
* project. A project is required if it is in its cpath entries.
|
||||||
|
|
|
@ -22,6 +22,12 @@ public interface IIncludeEntry extends IPathEntry {
|
||||||
*/
|
*/
|
||||||
IPath getIncludePath();
|
IPath getIncludePath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the base path of the includePath
|
||||||
|
* @return IPath
|
||||||
|
*/
|
||||||
|
IPath getBasePath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not it a system include path
|
* Whether or not it a system include path
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.core.model;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IIncludeReference
|
||||||
|
*/
|
||||||
|
public interface IIncludeReference extends IParent, ICElement {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pathEntry
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IIncludeEntry getIncludeEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the affected path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPath getAffectedPath();
|
||||||
|
}
|
|
@ -57,4 +57,10 @@ public interface ILibraryEntry extends IPathEntry {
|
||||||
*/
|
*/
|
||||||
IPath getSourceAttachmentPrefixMapping();
|
IPath getSourceAttachmentPrefixMapping();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the base path of the library.
|
||||||
|
* @return IPath
|
||||||
|
*/
|
||||||
|
IPath getBasePath();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,4 +35,10 @@ public interface IMacroEntry extends IPathEntry {
|
||||||
*/
|
*/
|
||||||
IPath[] getExclusionPatterns();
|
IPath[] getExclusionPatterns();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the base path.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPath getBasePath();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,6 @@ public interface IPathEntry {
|
||||||
*/
|
*/
|
||||||
int CDT_OUTPUT = 7;
|
int CDT_OUTPUT = 7;
|
||||||
|
|
||||||
/**
|
|
||||||
* Entry kind constant describing an entry defined using
|
|
||||||
* a path that begins with a variable reference.
|
|
||||||
*/
|
|
||||||
int CDT_VARIABLE = 10;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the kind of this path entry.
|
* Returns the kind of this path entry.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,11 +18,13 @@ public abstract class APathEntry extends PathEntry {
|
||||||
|
|
||||||
public static IPath[] NO_EXCLUSION_PATTERNS = {};
|
public static IPath[] NO_EXCLUSION_PATTERNS = {};
|
||||||
IPath[] exclusionPatterns;
|
IPath[] exclusionPatterns;
|
||||||
|
IPath basePath;
|
||||||
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$
|
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$
|
||||||
char[][]fullCharExclusionPatterns = UNINIT_PATTERNS;
|
char[][]fullCharExclusionPatterns = UNINIT_PATTERNS;
|
||||||
|
|
||||||
public APathEntry (int kind, IPath path, IPath[] exclusionPatterns, boolean isExported) {
|
public APathEntry (int kind, IPath path, IPath basePath, IPath[] exclusionPatterns, boolean isExported) {
|
||||||
super(kind, path, isExported);
|
super(kind, path, isExported);
|
||||||
|
this.basePath = basePath;
|
||||||
this.exclusionPatterns = exclusionPatterns;
|
this.exclusionPatterns = exclusionPatterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +36,15 @@ public abstract class APathEntry extends PathEntry {
|
||||||
return exclusionPatterns;
|
return exclusionPatterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* Returns the base Path
|
||||||
|
* @return IPath
|
||||||
|
*/
|
||||||
|
public IPath getBasePath() {
|
||||||
|
return basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Returns a char based representation of the exclusions patterns full path.
|
* Returns a char based representation of the exclusions patterns full path.
|
||||||
*/
|
*/
|
||||||
public char[][] fullExclusionPatternChars() {
|
public char[][] fullExclusionPatternChars() {
|
||||||
|
@ -71,6 +81,12 @@ public abstract class APathEntry extends PathEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IPath otherBasePath = otherEntry.getBasePath();
|
||||||
|
if (basePath != null) {
|
||||||
|
if (otherBasePath != null && !basePath.equals(otherBasePath)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.equals(obj);
|
return super.equals(obj);
|
||||||
|
|
|
@ -27,6 +27,8 @@ import org.eclipse.cdt.core.model.IBinaryContainer;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICModelStatusConstants;
|
import org.eclipse.cdt.core.model.ICModelStatusConstants;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.model.IIncludeEntry;
|
||||||
|
import org.eclipse.cdt.core.model.IIncludeReference;
|
||||||
import org.eclipse.cdt.core.model.ILibraryEntry;
|
import org.eclipse.cdt.core.model.ILibraryEntry;
|
||||||
import org.eclipse.cdt.core.model.ILibraryReference;
|
import org.eclipse.cdt.core.model.ILibraryReference;
|
||||||
import org.eclipse.cdt.core.model.IOutputEntry;
|
import org.eclipse.cdt.core.model.IOutputEntry;
|
||||||
|
@ -131,14 +133,29 @@ public class CProject extends Openable implements ICProject {
|
||||||
return getProject().hashCode();
|
return getProject().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IIncludeReference[] getIncludeReferences() throws CModelException {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries();
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||||
|
IIncludeEntry entry = (IIncludeEntry) entries[i];
|
||||||
|
IIncludeReference inc = new IncludeReference(this, entry);
|
||||||
|
if (inc != null) {
|
||||||
|
list.add(inc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (IIncludeReference[]) list.toArray(new IIncludeReference[0]);
|
||||||
|
}
|
||||||
|
|
||||||
public ILibraryReference[] getLibraryReferences() throws CModelException {
|
public ILibraryReference[] getLibraryReferences() throws CModelException {
|
||||||
ArrayList list = new ArrayList(5);
|
|
||||||
IBinaryParser[] binParsers = null;
|
IBinaryParser[] binParsers = null;
|
||||||
try {
|
try {
|
||||||
binParsers = CCorePlugin.getDefault().getBinaryParser(getProject());
|
binParsers = CCorePlugin.getDefault().getBinaryParser(getProject());
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
IPathEntry[] entries = getResolvedPathEntries();
|
IPathEntry[] entries = getResolvedPathEntries();
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||||
ILibraryEntry entry = (ILibraryEntry) entries[i];
|
ILibraryEntry entry = (ILibraryEntry) entries[i];
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.IArchiveContainer;
|
import org.eclipse.cdt.core.model.IArchiveContainer;
|
||||||
import org.eclipse.cdt.core.model.IBinaryContainer;
|
import org.eclipse.cdt.core.model.IBinaryContainer;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.IIncludeReference;
|
||||||
import org.eclipse.cdt.core.model.ILibraryReference;
|
import org.eclipse.cdt.core.model.ILibraryReference;
|
||||||
import org.eclipse.cdt.core.model.ISourceRoot;
|
import org.eclipse.cdt.core.model.ISourceRoot;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
@ -27,6 +28,8 @@ class CProjectInfo extends OpenableInfo {
|
||||||
BinaryContainer vBin;
|
BinaryContainer vBin;
|
||||||
ArchiveContainer vLib;
|
ArchiveContainer vLib;
|
||||||
ILibraryReference[] libReferences;
|
ILibraryReference[] libReferences;
|
||||||
|
IIncludeReference[] incReferences;
|
||||||
|
|
||||||
Object[] nonCResources = null;
|
Object[] nonCResources = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,6 +133,16 @@ class CProjectInfo extends OpenableInfo {
|
||||||
try {
|
try {
|
||||||
((CElement)libReferences[i]).close();
|
((CElement)libReferences[i]).close();
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (incReferences != null) {
|
||||||
|
for (int i = 0; i < incReferences.length; i++) {
|
||||||
|
try {
|
||||||
|
((CElement)incReferences[i]).close();
|
||||||
|
} catch (CModelException e) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class IncludeEntry extends APathEntry implements IIncludeEntry {
|
||||||
IPath includePath;
|
IPath includePath;
|
||||||
boolean isSystemInclude;
|
boolean isSystemInclude;
|
||||||
|
|
||||||
public IncludeEntry(IPath path, IPath includePath, boolean isSystemInclude, IPath[] exclusionPatterns) {
|
public IncludeEntry(IPath resourcePath, IPath includePath, IPath basePath, boolean isSystemInclude, IPath[] exclusionPatterns) {
|
||||||
super(IIncludeEntry.CDT_INCLUDE, path, exclusionPatterns, path == null);
|
super(IIncludeEntry.CDT_INCLUDE, resourcePath, basePath, exclusionPatterns, resourcePath == null);
|
||||||
this.includePath = includePath;
|
this.includePath = includePath;
|
||||||
this.isSystemInclude = isSystemInclude;
|
this.isSystemInclude = isSystemInclude;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.internal.core.model;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.model.IIncludeEntry;
|
||||||
|
import org.eclipse.cdt.core.model.IIncludeReference;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IncludeReference
|
||||||
|
*/
|
||||||
|
public class IncludeReference extends Openable implements IIncludeReference {
|
||||||
|
|
||||||
|
IIncludeEntry fIncludeEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param parent
|
||||||
|
* @param name
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
|
public IncludeReference(ICProject cproject, IIncludeEntry entry) {
|
||||||
|
super(cproject, null, entry.getIncludePath().toString(), ICElement.C_VCONTAINER);
|
||||||
|
fIncludeEntry = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.model.ICElement#getResource()
|
||||||
|
*/
|
||||||
|
public IResource getResource() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.model.CElement#createElementInfo()
|
||||||
|
*/
|
||||||
|
protected CElementInfo createElementInfo() {
|
||||||
|
return new OpenableInfo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.model.IIncludeReference#getIncludeEntry()
|
||||||
|
*/
|
||||||
|
public IIncludeEntry getIncludeEntry() {
|
||||||
|
return fIncludeEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.model.Openable#generateInfos(org.eclipse.cdt.internal.core.model.OpenableInfo, org.eclipse.core.runtime.IProgressMonitor, java.util.Map, org.eclipse.core.resources.IResource)
|
||||||
|
*/
|
||||||
|
protected boolean generateInfos(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws CModelException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.model.IIncludeReference#getAffectedPath()
|
||||||
|
*/
|
||||||
|
public IPath getAffectedPath() {
|
||||||
|
return fIncludeEntry.getPath();
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,16 +15,16 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
import org.eclipse.cdt.core.model.ILibraryEntry;
|
import org.eclipse.cdt.core.model.ILibraryEntry;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
public class LibraryEntry extends PathEntry implements ILibraryEntry {
|
public class LibraryEntry extends APathEntry implements ILibraryEntry {
|
||||||
|
|
||||||
IPath libraryPath;
|
IPath libraryPath;
|
||||||
IPath sourceAttachmentPath;
|
IPath sourceAttachmentPath;
|
||||||
IPath sourceAttachmentRootPath;
|
IPath sourceAttachmentRootPath;
|
||||||
IPath sourceAttachmentPrefixMapping;
|
IPath sourceAttachmentPrefixMapping;
|
||||||
|
|
||||||
public LibraryEntry(IPath path, IPath sourceAttachmentPath,
|
public LibraryEntry(IPath libraryPath, IPath basePath, IPath sourceAttachmentPath,
|
||||||
IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
|
IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
|
||||||
super(ILibraryEntry.CDT_LIBRARY, path, isExported);
|
super(ILibraryEntry.CDT_LIBRARY, libraryPath, basePath, APathEntry.NO_EXCLUSION_PATTERNS, isExported);
|
||||||
this.sourceAttachmentPath = sourceAttachmentPath;
|
this.sourceAttachmentPath = sourceAttachmentPath;
|
||||||
this.sourceAttachmentRootPath = sourceAttachmentRootPath;
|
this.sourceAttachmentRootPath = sourceAttachmentRootPath;
|
||||||
this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;
|
this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;
|
||||||
|
|
|
@ -22,7 +22,6 @@ public class LibraryReferenceArchive extends Archive implements ILibraryReferenc
|
||||||
|
|
||||||
public LibraryReferenceArchive(ICElement parent, ILibraryEntry e, IBinaryArchive ar) {
|
public LibraryReferenceArchive(ICElement parent, ILibraryEntry e, IBinaryArchive ar) {
|
||||||
super(parent, e.getPath(), ar);
|
super(parent, e.getPath(), ar);
|
||||||
setElementType(ICElement.C_VCONTAINER);
|
|
||||||
entry = e;
|
entry = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ public class LibraryReferenceShared extends Binary implements ILibraryReference
|
||||||
|
|
||||||
public LibraryReferenceShared(ICElement parent, ILibraryEntry e, IBinaryObject bin) {
|
public LibraryReferenceShared(ICElement parent, ILibraryEntry e, IBinaryObject bin) {
|
||||||
super(parent, e.getPath(), bin);
|
super(parent, e.getPath(), bin);
|
||||||
setElementType(ICElement.C_VCONTAINER);
|
|
||||||
entry = e;
|
entry = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ public class MacroEntry extends APathEntry implements IMacroEntry {
|
||||||
String macroName;
|
String macroName;
|
||||||
String macroValue;
|
String macroValue;
|
||||||
|
|
||||||
public MacroEntry (IPath path, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
public MacroEntry (IPath path, IPath basePath, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
||||||
super(IMacroEntry.CDT_MACRO, path, exclusionPatterns, path == null);
|
super(IMacroEntry.CDT_MACRO, path, basePath, exclusionPatterns, path == null);
|
||||||
this.macroName = macroName;
|
this.macroName = macroName;
|
||||||
this.macroValue = macroValue;
|
this.macroValue = macroValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class OutputEntry extends APathEntry implements IOutputEntry {
|
||||||
* @param isExported
|
* @param isExported
|
||||||
*/
|
*/
|
||||||
public OutputEntry(IPath path, IPath[] exclusionPatterns, boolean isExported) {
|
public OutputEntry(IPath path, IPath[] exclusionPatterns, boolean isExported) {
|
||||||
super(CDT_OUTPUT, path, exclusionPatterns, isExported);
|
super(CDT_OUTPUT, path, null, exclusionPatterns, isExported);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
|
|
@ -98,8 +98,6 @@ public class PathEntry implements IPathEntry {
|
||||||
return "src"; //$NON-NLS-1$
|
return "src"; //$NON-NLS-1$
|
||||||
case IPathEntry.CDT_LIBRARY :
|
case IPathEntry.CDT_LIBRARY :
|
||||||
return "lib"; //$NON-NLS-1$
|
return "lib"; //$NON-NLS-1$
|
||||||
//case IPathEntry.CDT_VARIABLE :
|
|
||||||
// return "var"; //$NON-NLS-1$
|
|
||||||
case IPathEntry.CDT_INCLUDE :
|
case IPathEntry.CDT_INCLUDE :
|
||||||
return "inc"; //$NON-NLS-1$
|
return "inc"; //$NON-NLS-1$
|
||||||
case IPathEntry.CDT_MACRO :
|
case IPathEntry.CDT_MACRO :
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
static String PATH_ENTRY_ID = "org.eclipse.cdt.core.pathentry"; //$NON-NLS-1$
|
static String PATH_ENTRY_ID = "org.eclipse.cdt.core.pathentry"; //$NON-NLS-1$
|
||||||
static String ATTRIBUTE_KIND = "kind"; //$NON-NLS-1$
|
static String ATTRIBUTE_KIND = "kind"; //$NON-NLS-1$
|
||||||
static String ATTRIBUTE_PATH = "path"; //$NON-NLS-1$
|
static String ATTRIBUTE_PATH = "path"; //$NON-NLS-1$
|
||||||
|
static String ATTRIBUTE_BASE_PATH = "base"; //$NON-NLS-1$
|
||||||
static String ATTRIBUTE_EXPORTED = "exported"; //$NON-NLS-1$
|
static String ATTRIBUTE_EXPORTED = "exported"; //$NON-NLS-1$
|
||||||
static String ATTRIBUTE_SOURCEPATH = "sourcepath"; //$NON-NLS-1$
|
static String ATTRIBUTE_SOURCEPATH = "sourcepath"; //$NON-NLS-1$
|
||||||
static String ATTRIBUTE_ROOTPATH = "roopath"; //$NON-NLS-1$
|
static String ATTRIBUTE_ROOTPATH = "roopath"; //$NON-NLS-1$
|
||||||
|
@ -107,6 +108,84 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
return pathEntryManager;
|
return pathEntryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IOutputEntry[] getOutputEntries(ICProject cproject) throws CModelException {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries(cproject);
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
|
for (int i = 0; i < entries.length; ++i) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_OUTPUT) {
|
||||||
|
list.add(entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IOutputEntry[] outs = new IOutputEntry[list.size()];
|
||||||
|
list.toArray(outs);
|
||||||
|
return outs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IProjectEntry[] getProjectEntries(ICProject cproject) throws CModelException {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries(cproject);
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
|
for (int i = 0; i < entries.length; ++i) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_PROJECT) {
|
||||||
|
list.add(entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IProjectEntry[] projects = new IProjectEntry[list.size()];
|
||||||
|
list.toArray(projects);
|
||||||
|
return projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ISourceEntry[] getSourceEntries(ICProject cproject) throws CModelException {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries(cproject);
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
|
for (int i = 0; i < entries.length; ++i) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_SOURCE) {
|
||||||
|
list.add(entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ISourceEntry[] sources = new ISourceEntry[list.size()];
|
||||||
|
list.toArray(sources);
|
||||||
|
return sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILibraryEntry[] getLibraryEntries(ICProject cproject) throws CModelException {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries(cproject);
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
|
for (int i = 0; i < entries.length; ++i) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||||
|
list.add(entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ILibraryEntry[] libs = new ILibraryEntry[list.size()];
|
||||||
|
list.toArray(libs);
|
||||||
|
return libs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMacroEntry[] getMacroEntries(ICProject cproject) throws CModelException {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries(cproject);
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
|
for (int i = 0; i < entries.length; ++i) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||||
|
list.add(entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IMacroEntry[] macros = new IMacroEntry[list.size()];
|
||||||
|
list.toArray(macros);
|
||||||
|
return macros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IIncludeEntry[] getIncludeEntries(ICProject cproject) throws CModelException {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries(cproject);
|
||||||
|
ArrayList list = new ArrayList(entries.length);
|
||||||
|
for (int i = 0; i < entries.length; ++i) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||||
|
list.add(entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IIncludeEntry[] includes = new IIncludeEntry[list.size()];
|
||||||
|
list.toArray(includes);
|
||||||
|
return includes;
|
||||||
|
}
|
||||||
|
|
||||||
public IPathEntry[] getResolvedPathEntries(ICProject cproject) throws CModelException {
|
public IPathEntry[] getResolvedPathEntries(ICProject cproject) throws CModelException {
|
||||||
IPathEntry[] entries = (IPathEntry[]) resolvedMap.get(cproject);
|
IPathEntry[] entries = (IPathEntry[]) resolvedMap.get(cproject);
|
||||||
if (entries == null) {
|
if (entries == null) {
|
||||||
|
@ -235,8 +314,7 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
remaining++;
|
remaining++;
|
||||||
oldResolvedEntries[i] = (IPathEntry[]) resolvedMap.get(affectedProject);
|
oldResolvedEntries[i] = (IPathEntry[]) resolvedMap.remove(affectedProject);
|
||||||
resolvedMap.put(affectedProject, null);
|
|
||||||
containerPut(affectedProject, containerPath, newContainer);
|
containerPut(affectedProject, containerPath, newContainer);
|
||||||
}
|
}
|
||||||
// Nothing change.
|
// Nothing change.
|
||||||
|
@ -422,7 +500,7 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
encodePathEntries(cproject.getPath(), doc, rootElement, newRawEntries);
|
encodePathEntries(cproject.getPath(), doc, rootElement, newRawEntries);
|
||||||
}
|
}
|
||||||
descriptor.saveProjectData();
|
descriptor.saveProjectData();
|
||||||
resolvedMap.put(cproject, null);
|
resolvedMap.remove(cproject);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
throw new CModelException(e);
|
throw new CModelException(e);
|
||||||
}
|
}
|
||||||
|
@ -504,33 +582,46 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
flag = ICElementDelta.F_PATHENTRY_REORDER;
|
flag = ICElementDelta.F_PATHENTRY_REORDER;
|
||||||
} else {
|
} else {
|
||||||
int kind = entry.getEntryKind();
|
int kind = entry.getEntryKind();
|
||||||
if (kind == IPathEntry.CDT_SOURCE) {
|
switch (kind) {
|
||||||
|
case IPathEntry.CDT_SOURCE: {
|
||||||
ISourceEntry source = (ISourceEntry) entry;
|
ISourceEntry source = (ISourceEntry) entry;
|
||||||
IPath path = source.getPath();
|
IPath path = source.getPath();
|
||||||
celement = CoreModel.getDefault().create(path);
|
celement = CoreModel.getDefault().create(path);
|
||||||
flag = (removed) ? ICElementDelta.F_REMOVED_PATHENTRY_SOURCE : ICElementDelta.F_ADDED_PATHENTRY_SOURCE;
|
flag = (removed) ? ICElementDelta.F_REMOVED_PATHENTRY_SOURCE : ICElementDelta.F_ADDED_PATHENTRY_SOURCE;
|
||||||
} else if (kind == IPathEntry.CDT_LIBRARY) {
|
break;
|
||||||
|
}
|
||||||
|
case IPathEntry.CDT_LIBRARY: {
|
||||||
ILibraryEntry lib = (ILibraryEntry) entry;
|
ILibraryEntry lib = (ILibraryEntry) entry;
|
||||||
celement = CProject.getLibraryReference(cproject, null, lib);
|
celement = cproject;
|
||||||
flag = (removed) ? ICElementDelta.F_ADDED_PATHENTRY_LIBRARY : ICElementDelta.F_REMOVED_PATHENTRY_LIBRARY;
|
flag = (removed) ? ICElementDelta.F_REMOVED_PATHENTRY_LIBRARY : ICElementDelta.F_ADDED_PATHENTRY_LIBRARY;
|
||||||
} else if (kind == IPathEntry.CDT_PROJECT) {
|
break;
|
||||||
|
}
|
||||||
|
case IPathEntry.CDT_PROJECT: {
|
||||||
//IProjectEntry pentry = (IProjectEntry) entry;
|
//IProjectEntry pentry = (IProjectEntry) entry;
|
||||||
celement = cproject;
|
celement = cproject;
|
||||||
flag = ICElementDelta.F_CHANGED_PATHENTRY_PROJECT;
|
flag = ICElementDelta.F_CHANGED_PATHENTRY_PROJECT;
|
||||||
} else if (kind == IPathEntry.CDT_INCLUDE) {
|
break;
|
||||||
|
}
|
||||||
|
case IPathEntry.CDT_INCLUDE: {
|
||||||
IIncludeEntry include = (IIncludeEntry) entry;
|
IIncludeEntry include = (IIncludeEntry) entry;
|
||||||
IPath path = include.getPath();
|
IPath path = include.getPath();
|
||||||
celement = CoreModel.getDefault().create(path);
|
celement = CoreModel.getDefault().create(path);
|
||||||
flag = ICElementDelta.F_CHANGED_PATHENTRY_INCLUDE;
|
flag = ICElementDelta.F_CHANGED_PATHENTRY_INCLUDE;
|
||||||
} else if (kind == IPathEntry.CDT_MACRO) {
|
break;
|
||||||
|
}
|
||||||
|
case IPathEntry.CDT_MACRO: {
|
||||||
IMacroEntry macro = (IMacroEntry) entry;
|
IMacroEntry macro = (IMacroEntry) entry;
|
||||||
IPath path = macro.getPath();
|
IPath path = macro.getPath();
|
||||||
celement = CoreModel.getDefault().create(path);
|
celement = CoreModel.getDefault().create(path);
|
||||||
flag = ICElementDelta.F_CHANGED_PATHENTRY_MACRO;
|
flag = ICElementDelta.F_CHANGED_PATHENTRY_MACRO;
|
||||||
} else if (kind == IPathEntry.CDT_CONTAINER) {
|
break;
|
||||||
|
}
|
||||||
|
case IPathEntry.CDT_CONTAINER: {
|
||||||
//IContainerEntry container = (IContainerEntry) entry;
|
//IContainerEntry container = (IContainerEntry) entry;
|
||||||
//celement = cproject;
|
//celement = cproject;
|
||||||
//SHOULD NOT BE HERE Container are resolved.
|
//SHOULD NOT BE HERE Container are resolved.
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (celement == null) {
|
if (celement == null) {
|
||||||
|
@ -566,21 +657,31 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
|
|
||||||
static IPathEntry decodePathEntry(ICProject cProject, Element element) throws CModelException {
|
static IPathEntry decodePathEntry(ICProject cProject, Element element) throws CModelException {
|
||||||
IPath projectPath = cProject.getProject().getFullPath();
|
IPath projectPath = cProject.getProject().getFullPath();
|
||||||
|
|
||||||
// kind
|
// kind
|
||||||
String kindAttr = element.getAttribute(ATTRIBUTE_KIND);
|
String kindAttr = element.getAttribute(ATTRIBUTE_KIND);
|
||||||
int kind = PathEntry.kindFromString(kindAttr);
|
int kind = PathEntry.kindFromString(kindAttr);
|
||||||
|
|
||||||
// exported flag
|
// exported flag
|
||||||
boolean isExported = false;
|
boolean isExported = false;
|
||||||
if (element.hasAttribute(ATTRIBUTE_EXPORTED)) {
|
if (element.hasAttribute(ATTRIBUTE_EXPORTED)) {
|
||||||
isExported = element.getAttribute(ATTRIBUTE_EXPORTED).equals(VALUE_TRUE);
|
isExported = element.getAttribute(ATTRIBUTE_EXPORTED).equals(VALUE_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure path is absolute
|
// ensure path is absolute
|
||||||
boolean hasPath = element.hasAttribute(ATTRIBUTE_PATH);
|
boolean hasPath = element.hasAttribute(ATTRIBUTE_PATH);
|
||||||
String pathAttr = element.getAttribute(ATTRIBUTE_PATH);
|
String pathAttr = element.getAttribute(ATTRIBUTE_PATH);
|
||||||
IPath path = new Path(pathAttr);
|
IPath path = new Path(pathAttr);
|
||||||
if (kind != IPathEntry.CDT_VARIABLE && !path.isAbsolute()) {
|
if (!path.isAbsolute()) {
|
||||||
path = projectPath.append(path);
|
path = projectPath.append(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check fo the base path
|
||||||
|
IPath basePath = null;
|
||||||
|
if (element.hasAttribute(ATTRIBUTE_BASE_PATH)) {
|
||||||
|
basePath = new Path(element.getAttribute(ATTRIBUTE_BASE_PATH));
|
||||||
|
}
|
||||||
|
|
||||||
// source attachment info (optional)
|
// source attachment info (optional)
|
||||||
IPath sourceAttachmentPath = element.hasAttribute(ATTRIBUTE_SOURCEPATH) ? new Path(
|
IPath sourceAttachmentPath = element.hasAttribute(ATTRIBUTE_SOURCEPATH) ? new Path(
|
||||||
element.getAttribute(ATTRIBUTE_SOURCEPATH)) : null;
|
element.getAttribute(ATTRIBUTE_SOURCEPATH)) : null;
|
||||||
|
@ -588,6 +689,7 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
element.getAttribute(ATTRIBUTE_ROOTPATH)) : null;
|
element.getAttribute(ATTRIBUTE_ROOTPATH)) : null;
|
||||||
IPath sourceAttachmentPrefixMapping = element.hasAttribute(ATTRIBUTE_PREFIXMAPPING) ? new Path(
|
IPath sourceAttachmentPrefixMapping = element.hasAttribute(ATTRIBUTE_PREFIXMAPPING) ? new Path(
|
||||||
element.getAttribute(ATTRIBUTE_PREFIXMAPPING)) : null;
|
element.getAttribute(ATTRIBUTE_PREFIXMAPPING)) : null;
|
||||||
|
|
||||||
// exclusion patterns (optional)
|
// exclusion patterns (optional)
|
||||||
String exclusion = element.getAttribute(ATTRIBUTE_EXCLUDING);
|
String exclusion = element.getAttribute(ATTRIBUTE_EXCLUDING);
|
||||||
IPath[] exclusionPatterns = APathEntry.NO_EXCLUSION_PATTERNS;
|
IPath[] exclusionPatterns = APathEntry.NO_EXCLUSION_PATTERNS;
|
||||||
|
@ -601,12 +703,13 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// recreate the CP entry
|
|
||||||
|
// recreate the entry
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case IPathEntry.CDT_PROJECT :
|
case IPathEntry.CDT_PROJECT :
|
||||||
return CoreModel.newProjectEntry(path, isExported);
|
return CoreModel.newProjectEntry(path, isExported);
|
||||||
case IPathEntry.CDT_LIBRARY :
|
case IPathEntry.CDT_LIBRARY :
|
||||||
return CoreModel.newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath,
|
return CoreModel.newLibraryEntry(path, basePath, sourceAttachmentPath, sourceAttachmentRootPath,
|
||||||
sourceAttachmentPrefixMapping, isExported);
|
sourceAttachmentPrefixMapping, isExported);
|
||||||
case IPathEntry.CDT_SOURCE :
|
case IPathEntry.CDT_SOURCE :
|
||||||
{
|
{
|
||||||
|
@ -635,13 +738,13 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
if (element.hasAttribute(ATTRIBUTE_SYSTEM)) {
|
if (element.hasAttribute(ATTRIBUTE_SYSTEM)) {
|
||||||
isSystemInclude = element.getAttribute(ATTRIBUTE_SYSTEM).equals(VALUE_TRUE);
|
isSystemInclude = element.getAttribute(ATTRIBUTE_SYSTEM).equals(VALUE_TRUE);
|
||||||
}
|
}
|
||||||
return CoreModel.newIncludeEntry(path, includePath, isSystemInclude, exclusionPatterns);
|
return CoreModel.newIncludeEntry(path, includePath, basePath, isSystemInclude, exclusionPatterns);
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_MACRO :
|
case IPathEntry.CDT_MACRO :
|
||||||
{
|
{
|
||||||
String macroName = element.getAttribute(ATTRIBUTE_NAME);
|
String macroName = element.getAttribute(ATTRIBUTE_NAME);
|
||||||
String macroValue = element.getAttribute(ATTRIBUTE_VALUE);
|
String macroValue = element.getAttribute(ATTRIBUTE_VALUE);
|
||||||
return CoreModel.newMacroEntry(path, macroName, macroValue, exclusionPatterns);
|
return CoreModel.newMacroEntry(path, basePath, macroName, macroValue, exclusionPatterns);
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_CONTAINER :
|
case IPathEntry.CDT_CONTAINER :
|
||||||
{
|
{
|
||||||
|
@ -691,6 +794,9 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
ILibraryEntry lib = (ILibraryEntry) entries[i];
|
ILibraryEntry lib = (ILibraryEntry) entries[i];
|
||||||
IPath path = lib.getPath();
|
IPath path = lib.getPath();
|
||||||
element.setAttribute(ATTRIBUTE_PATH, path.toString());
|
element.setAttribute(ATTRIBUTE_PATH, path.toString());
|
||||||
|
if (lib.getBasePath() != null) {
|
||||||
|
element.setAttribute(ATTRIBUTE_BASE_PATH, lib.getBasePath().toString());
|
||||||
|
}
|
||||||
if (lib.getSourceAttachmentPath() != null) {
|
if (lib.getSourceAttachmentPath() != null) {
|
||||||
element.setAttribute(ATTRIBUTE_SOURCEPATH, lib.getSourceAttachmentPath().toString());
|
element.setAttribute(ATTRIBUTE_SOURCEPATH, lib.getSourceAttachmentPath().toString());
|
||||||
}
|
}
|
||||||
|
@ -706,9 +812,11 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
element.setAttribute(ATTRIBUTE_PATH, path.toString());
|
element.setAttribute(ATTRIBUTE_PATH, path.toString());
|
||||||
} else if (kind == IPathEntry.CDT_INCLUDE) {
|
} else if (kind == IPathEntry.CDT_INCLUDE) {
|
||||||
IIncludeEntry include = (IIncludeEntry) entries[i];
|
IIncludeEntry include = (IIncludeEntry) entries[i];
|
||||||
IPath path = include.getPath();
|
if (include.getPath() != null) {
|
||||||
if (path != null) {
|
element.setAttribute(ATTRIBUTE_PATH, include.getPath().toString());
|
||||||
element.setAttribute(ATTRIBUTE_PATH, path.toString());
|
}
|
||||||
|
if (include.getBasePath() != null) {
|
||||||
|
element.setAttribute(ATTRIBUTE_BASE_PATH, include.getBasePath().toString());
|
||||||
}
|
}
|
||||||
IPath includePath = include.getIncludePath();
|
IPath includePath = include.getIncludePath();
|
||||||
element.setAttribute(ATTRIBUTE_INCLUDE, includePath.toString());
|
element.setAttribute(ATTRIBUTE_INCLUDE, includePath.toString());
|
||||||
|
@ -717,9 +825,11 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
}
|
}
|
||||||
} else if (kind == IPathEntry.CDT_MACRO) {
|
} else if (kind == IPathEntry.CDT_MACRO) {
|
||||||
IMacroEntry macro = (IMacroEntry) entries[i];
|
IMacroEntry macro = (IMacroEntry) entries[i];
|
||||||
IPath path = macro.getPath();
|
if (macro.getPath() != null) {
|
||||||
if (path != null) {
|
element.setAttribute(ATTRIBUTE_PATH, macro.getPath().toString());
|
||||||
element.setAttribute(ATTRIBUTE_PATH, path.toString());
|
}
|
||||||
|
if (macro.getBasePath() != null) {
|
||||||
|
element.setAttribute(ATTRIBUTE_BASE_PATH, macro.getBasePath().toString());
|
||||||
}
|
}
|
||||||
element.setAttribute(ATTRIBUTE_NAME, macro.getMacroName());
|
element.setAttribute(ATTRIBUTE_NAME, macro.getMacroName());
|
||||||
element.setAttribute(ATTRIBUTE_VALUE, macro.getMacroValue());
|
element.setAttribute(ATTRIBUTE_VALUE, macro.getMacroValue());
|
||||||
|
@ -744,8 +854,9 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
ICDescriptor cdesc = event.getDescriptor();
|
ICDescriptor cdesc = event.getDescriptor();
|
||||||
if (cdesc != null) {
|
if (cdesc != null) {
|
||||||
CModelManager manager = CModelManager.getDefault();
|
CModelManager manager = CModelManager.getDefault();
|
||||||
ICProject cproject = manager.create(cdesc.getProject());
|
IProject project = cdesc.getProject();
|
||||||
IProject project = cproject.getProject();
|
if (manager.hasCNature(project) || manager.hasCCNature(project)) {
|
||||||
|
ICProject cproject = manager.create(project);
|
||||||
try {
|
try {
|
||||||
IPathEntry[] oldResolvedEntries = getResolvedPathEntries(cproject);
|
IPathEntry[] oldResolvedEntries = getResolvedPathEntries(cproject);
|
||||||
resolvedMap.remove(cproject);
|
resolvedMap.remove(cproject);
|
||||||
|
@ -764,3 +875,4 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
public class SourceEntry extends APathEntry implements ISourceEntry {
|
public class SourceEntry extends APathEntry implements ISourceEntry {
|
||||||
|
|
||||||
public SourceEntry(IPath path, IPath[] exclusionPatterns) {
|
public SourceEntry(IPath path, IPath[] exclusionPatterns) {
|
||||||
super(ISourceEntry.CDT_SOURCE, path, exclusionPatterns, false);
|
super(ISourceEntry.CDT_SOURCE, path, null, exclusionPatterns, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals (Object obj) {
|
public boolean equals (Object obj) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue