1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 05:45:58 +02:00

Work in progress, for the Library Entry UI

This commit is contained in:
Alain Magloire 2004-05-04 20:05:27 +00:00
parent c8bbe7c2eb
commit 771e8d51cf
10 changed files with 117 additions and 83 deletions

View file

@ -146,7 +146,7 @@ public class CPathEntryTest extends TestCase {
entries = new IPathEntry[3]; entries = new IPathEntry[3];
entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true); entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true);
entries[1] = CoreModel.newIncludeEntry(new Path("cpaththest/foo.c"), null, new Path("/usr/include"), true); entries[1] = CoreModel.newIncludeEntry(new Path("cpaththest/foo.c"), null, new Path("/usr/include"), true);
entries[2] = CoreModel.newLibraryEntry(null, new Path("/usr/lib/libc.so.1"), null, null, null, false); entries[2] = CoreModel.newLibraryEntry(new Path(""), null, new Path("/usr/lib/libc.so.1"), null, null, null, false);
testProject.setRawPathEntries(entries, new NullProgressMonitor()); testProject.setRawPathEntries(entries, new NullProgressMonitor());
entries = testProject.getResolvedPathEntries(); entries = testProject.getResolvedPathEntries();
// We always have at least two entries: // We always have at least two entries:
@ -171,7 +171,7 @@ public class CPathEntryTest extends TestCase {
IPathEntry[] entries = new IPathEntry[3]; IPathEntry[] entries = new IPathEntry[3];
entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true); entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true);
entries[1] = CoreModel.newIncludeEntry(new Path("foo"), null, new Path("/usr/include"), true); entries[1] = CoreModel.newIncludeEntry(new Path("foo"), null, new Path("/usr/include"), true);
entries[2] = CoreModel.newLibraryEntry(null, new Path("/usr/lib/libc.so.1"), null, null, null, false); entries[2] = CoreModel.newLibraryEntry(new Path(""), null, new Path("/usr/lib/libc.so.1"), null, null, null, false);
CElementListener listener = new CElementListener(); CElementListener listener = new CElementListener();
CoreModel.getDefault().addElementChangedListener(listener); CoreModel.getDefault().addElementChangedListener(listener);
testProject.setRawPathEntries(entries, new NullProgressMonitor()); testProject.setRawPathEntries(entries, new NullProgressMonitor());
@ -198,7 +198,7 @@ public class CPathEntryTest extends TestCase {
IPathEntry[] entries = new IPathEntry[3]; IPathEntry[] entries = new IPathEntry[3];
entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true); entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true);
entries[1] = CoreModel.newIncludeEntry(new Path("foo.c"), null, new Path("/usr/include"), true); entries[1] = CoreModel.newIncludeEntry(new Path("foo.c"), null, new Path("/usr/include"), true);
entries[2] = CoreModel.newLibraryEntry(null, new Path("/usr/lib/libc.so.1"), null, null, null, true); entries[2] = CoreModel.newLibraryEntry(new Path(""), null, new Path("/usr/lib/libc.so.1"), null, null, null, true);
return entries; return entries;
} }

View file

@ -359,6 +359,8 @@ 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</code>
* for the archive or folder identified by the given absolute path. * for the archive or folder identified by the given absolute path.
* *
* @param resourcePath
* the affected project-relative resource path
* @param baseRef * @param baseRef
* the base reference path to find the library * the base reference path to find the library
* @param libraryPath * @param libraryPath
@ -366,8 +368,8 @@ public class CoreModel {
* @return a new library entry * @return a new library entry
* *
*/ */
public static ILibraryEntry newLibraryRefEntry(IPath baseRef, IPath libraryPath) { public static ILibraryEntry newLibraryRefEntry(IPath resourcePath, IPath baseRef, IPath libraryPath) {
return new LibraryEntry(null, baseRef, libraryPath, null, null, null, false); return new LibraryEntry(resourcePath, null, baseRef, libraryPath, null, null, null, false);
} }
@ -379,6 +381,8 @@ public class CoreModel {
* resources at the given paths. * resources at the given paths.
* <p> * <p>
* *
* @param resourcePath
* the affected project-relative resource path
* @param basePath * @param basePath
* the base path of the library * the base path of the library
* @param libraryPath * @param libraryPath
@ -396,9 +400,9 @@ public class CoreModel {
* @return a new library entry * @return a new library entry
* *
*/ */
public static ILibraryEntry newLibraryEntry(IPath basePath, IPath libraryPath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, public static ILibraryEntry newLibraryEntry(IPath resourcePath, IPath basePath, IPath libraryPath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
IPath sourceAttachmentPrefixMapping, boolean isExported) { IPath sourceAttachmentPrefixMapping, boolean isExported) {
return new LibraryEntry(basePath, null, libraryPath, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported); return new LibraryEntry(resourcePath, basePath, null, libraryPath, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported);
} }
/** /**

View file

@ -70,6 +70,12 @@ public interface ILibraryEntry extends IPathEntry {
*/ */
IPath getBaseReference(); IPath getBaseReference();
/**
* Return the library path.
* @return
*/
IPath getLibraryPath();
/** /**
* Returns the complete path, equivalent to: * Returns the complete path, equivalent to:
* getBasepath().append(getPath()); * getBasepath().append(getPath());

View file

@ -34,9 +34,10 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
* @param sourceAttachmentPrefixMapping * @param sourceAttachmentPrefixMapping
* @param isExported * @param isExported
*/ */
public LibraryEntry(IPath basePath, IPath baseRef, IPath libraryPath, IPath sourceAttachmentPath, public LibraryEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath libraryPath, IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) { IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
super(ILibraryEntry.CDT_LIBRARY, basePath, baseRef, libraryPath, APathEntry.NO_EXCLUSION_PATTERNS, isExported); super(ILibraryEntry.CDT_LIBRARY, basePath, baseRef, resourcePath, APathEntry.NO_EXCLUSION_PATTERNS, isExported);
this.libraryPath = libraryPath;
this.sourceAttachmentPath = sourceAttachmentPath; this.sourceAttachmentPath = sourceAttachmentPath;
this.sourceAttachmentRootPath = sourceAttachmentRootPath; this.sourceAttachmentRootPath = sourceAttachmentRootPath;
this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping; this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;
@ -96,7 +97,17 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
if (!super.equals(obj)) { if (!super.equals(obj)) {
return false; return false;
} }
IPath otherPath = otherEntry.getSourceAttachmentPath(); IPath otherPath = otherEntry.getLibraryPath();
if (libraryPath == null) {
if (otherPath != null) {
return false;
}
} else {
if (!libraryPath.equals(otherPath)) {
return false;
}
}
otherPath = otherEntry.getSourceAttachmentPath();
if (sourceAttachmentPath == null) { if (sourceAttachmentPath == null) {
if (otherPath != null) { if (otherPath != null) {
return false; return false;
@ -137,4 +148,11 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
return p; return p;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ILibraryEntry#getLibraryPath()
*/
public IPath getLibraryPath() {
return libraryPath;
}
} }

View file

@ -20,7 +20,7 @@ public class LibraryReference extends Parent implements ILibraryReference {
ILibraryEntry entry; ILibraryEntry entry;
public LibraryReference(ICElement parent, ILibraryEntry e) { public LibraryReference(ICElement parent, ILibraryEntry e) {
super(parent, e.getPath().lastSegment(), ICElement.C_VCONTAINER); super(parent, e.getLibraryPath().lastSegment(), ICElement.C_VCONTAINER);
entry = e; entry = e;
} }
@ -42,7 +42,7 @@ public class LibraryReference extends Parent implements ILibraryReference {
* @see org.eclipse.cdt.core.model.ICElement#getPath() * @see org.eclipse.cdt.core.model.ICElement#getPath()
*/ */
public IPath getPath() { public IPath getPath() {
return entry.getPath(); return entry.getFullLibraryPath();
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -209,7 +209,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
ILibraryEntry libEntry = (ILibraryEntry)entry; ILibraryEntry libEntry = (ILibraryEntry)entry;
IPath refPath = libEntry.getBaseReference(); IPath refPath = libEntry.getBaseReference();
if (refPath != null && !refPath.isEmpty()) { if (refPath != null && !refPath.isEmpty()) {
IPath libraryPath = libEntry.getPath(); IPath libraryPath = libEntry.getLibraryPath();
if (refPath.isAbsolute()) { if (refPath.isAbsolute()) {
IResource res = cproject.getCModel().getWorkspace().getRoot().findMember(refPath); IResource res = cproject.getCModel().getWorkspace().getRoot().findMember(refPath);
if (res != null && res.getType() == IResource.PROJECT) { if (res != null && res.getType() == IResource.PROJECT) {
@ -220,8 +220,8 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) { if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) {
ILibraryEntry refEntry = (ILibraryEntry)entries[i]; ILibraryEntry refEntry = (ILibraryEntry)entries[i];
if (refEntry.getPath().equals(libraryPath)) { if (refEntry.getPath().equals(libraryPath)) {
return CoreModel.newLibraryEntry(refEntry.getBasePath(), return CoreModel.newLibraryEntry(entry.getPath(), refEntry.getBasePath(),
refEntry.getPath(), refEntry.getSourceAttachmentPath(), refEntry.getLibraryPath(), refEntry.getSourceAttachmentPath(),
refEntry.getSourceAttachmentRootPath(), refEntry.getSourceAttachmentRootPath(),
refEntry.getSourceAttachmentPrefixMapping(), false); refEntry.getSourceAttachmentPrefixMapping(), false);
} }
@ -237,8 +237,8 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) { if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
ILibraryEntry refEntry = (ILibraryEntry)entries[i]; ILibraryEntry refEntry = (ILibraryEntry)entries[i];
if (refEntry.getPath().equals(libraryPath)) { if (refEntry.getPath().equals(libraryPath)) {
return CoreModel.newLibraryEntry(refEntry.getBasePath(), return CoreModel.newLibraryEntry(entry.getPath(), refEntry.getBasePath(),
refEntry.getPath(), refEntry.getSourceAttachmentPath(), refEntry.getLibraryPath(), refEntry.getSourceAttachmentPath(),
refEntry.getSourceAttachmentRootPath(), refEntry.getSourceAttachmentRootPath(),
refEntry.getSourceAttachmentPrefixMapping(), false); refEntry.getSourceAttachmentPrefixMapping(), false);
} }

View file

@ -57,6 +57,7 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
static String ATTRIBUTE_PREFIXMAPPING = "prefixmapping"; //$NON-NLS-1$ static String ATTRIBUTE_PREFIXMAPPING = "prefixmapping"; //$NON-NLS-1$
static String ATTRIBUTE_EXCLUDING = "excluding"; //$NON-NLS-1$ static String ATTRIBUTE_EXCLUDING = "excluding"; //$NON-NLS-1$
static String ATTRIBUTE_INCLUDE = "include"; //$NON-NLS-1$ static String ATTRIBUTE_INCLUDE = "include"; //$NON-NLS-1$
static String ATTRIBUTE_LIBRARY = "library"; //$NON-NLS-1$
static String ATTRIBUTE_SYSTEM = "system"; //$NON-NLS-1$ static String ATTRIBUTE_SYSTEM = "system"; //$NON-NLS-1$
static String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$ static String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
static String ATTRIBUTE_VALUE = "value"; //$NON-NLS-1$ static String ATTRIBUTE_VALUE = "value"; //$NON-NLS-1$
@ -142,14 +143,6 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
// get the base ref // get the base ref
IPath baseRef = new Path(element.getAttribute(ATTRIBUTE_BASE_REF)); IPath baseRef = new Path(element.getAttribute(ATTRIBUTE_BASE_REF));
// source attachment info (optional)
IPath sourceAttachmentPath = element.hasAttribute(ATTRIBUTE_SOURCEPATH) ? new Path(
element.getAttribute(ATTRIBUTE_SOURCEPATH)) : null;
IPath sourceAttachmentRootPath = element.hasAttribute(ATTRIBUTE_ROOTPATH) ? new Path(
element.getAttribute(ATTRIBUTE_ROOTPATH)) : null;
IPath sourceAttachmentPrefixMapping = element.hasAttribute(ATTRIBUTE_PREFIXMAPPING) ? new Path(
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;
@ -168,14 +161,23 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
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 : {
IPath libraryPath = new Path(element.getAttribute(ATTRIBUTE_LIBRARY));
// source attachment info (optional)
IPath sourceAttachmentPath = element.hasAttribute(ATTRIBUTE_SOURCEPATH) ? new Path(
element.getAttribute(ATTRIBUTE_SOURCEPATH)) : null;
IPath sourceAttachmentRootPath = element.hasAttribute(ATTRIBUTE_ROOTPATH) ? new Path(
element.getAttribute(ATTRIBUTE_ROOTPATH)) : null;
IPath sourceAttachmentPrefixMapping = element.hasAttribute(ATTRIBUTE_PREFIXMAPPING) ? new Path(
element.getAttribute(ATTRIBUTE_PREFIXMAPPING)) : null;
if (baseRef != null && !baseRef.isEmpty()) { if (baseRef != null && !baseRef.isEmpty()) {
return CoreModel.newLibraryRefEntry(baseRef, path); return CoreModel.newLibraryRefEntry(path, baseRef, libraryPath);
} }
return CoreModel.newLibraryEntry(basePath, path, sourceAttachmentPath, sourceAttachmentRootPath, return CoreModel.newLibraryEntry(path, basePath, libraryPath, sourceAttachmentPath, sourceAttachmentRootPath,
sourceAttachmentPrefixMapping, isExported); sourceAttachmentPrefixMapping, isExported);
case IPathEntry.CDT_SOURCE : }
{ case IPathEntry.CDT_SOURCE : {
// must be an entry in this project or specify another // must be an entry in this project or specify another
// project // project
String projSegment = path.segment(0); String projSegment = path.segment(0);
@ -187,11 +189,8 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
} }
} }
case IPathEntry.CDT_OUTPUT : case IPathEntry.CDT_OUTPUT :
{
return CoreModel.newOutputEntry(path, exclusionPatterns); return CoreModel.newOutputEntry(path, exclusionPatterns);
} case IPathEntry.CDT_INCLUDE : {
case IPathEntry.CDT_INCLUDE :
{
// include path info // include path info
IPath includePath = new Path(element.getAttribute(ATTRIBUTE_INCLUDE)); IPath includePath = new Path(element.getAttribute(ATTRIBUTE_INCLUDE));
// isSysteminclude // isSysteminclude
@ -204,8 +203,7 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
} }
return CoreModel.newIncludeEntry(path, basePath, includePath, isSystemInclude, exclusionPatterns, isExported); return CoreModel.newIncludeEntry(path, basePath, includePath, isSystemInclude, exclusionPatterns, isExported);
} }
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);
if (baseRef != null && !baseRef.isEmpty()) { if (baseRef != null && !baseRef.isEmpty()) {
@ -213,13 +211,11 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
} }
return CoreModel.newMacroEntry(path, macroName, macroValue, exclusionPatterns, isExported); return CoreModel.newMacroEntry(path, macroName, macroValue, exclusionPatterns, isExported);
} }
case IPathEntry.CDT_CONTAINER : case IPathEntry.CDT_CONTAINER : {
{
IPath id = new Path(element.getAttribute(ATTRIBUTE_PATH)); IPath id = new Path(element.getAttribute(ATTRIBUTE_PATH));
return CoreModel.newContainerEntry(id, isExported); return CoreModel.newContainerEntry(id, isExported);
} }
default : default : {
{
ICModelStatus status = new CModelStatus(ICModelStatus.ERROR, "PathEntry: unknown kind (" + kindAttr + ")"); //$NON-NLS-1$ //$NON-NLS-2$ ICModelStatus status = new CModelStatus(ICModelStatus.ERROR, "PathEntry: unknown kind (" + kindAttr + ")"); //$NON-NLS-1$ //$NON-NLS-2$
throw new CModelException(status); throw new CModelException(status);
} }
@ -267,6 +263,8 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
break; break;
case IPathEntry.CDT_LIBRARY: { case IPathEntry.CDT_LIBRARY: {
ILibraryEntry lib = (ILibraryEntry) entries[i]; ILibraryEntry lib = (ILibraryEntry) entries[i];
IPath libraryPath = lib.getLibraryPath();
element.setAttribute(ATTRIBUTE_LIBRARY, libraryPath.toString());
IPath sourcePath = lib.getSourceAttachmentPath(); IPath sourcePath = lib.getSourceAttachmentPath();
if (sourcePath != null) { if (sourcePath != null) {
// translate to project relative from absolute // translate to project relative from absolute

View file

@ -32,6 +32,7 @@ public class CPElement {
public static final String SOURCEATTACHMENTROOT = "rootpath"; //$NON-NLS-1$ public static final String SOURCEATTACHMENTROOT = "rootpath"; //$NON-NLS-1$
public static final String EXCLUSION = "exclusion"; //$NON-NLS-1$ public static final String EXCLUSION = "exclusion"; //$NON-NLS-1$
public static final String INCLUDE = "includepath"; //$NON-NLS-1$ public static final String INCLUDE = "includepath"; //$NON-NLS-1$
public static final String LIBRARY = "librarypath"; //$NON-NLS-1$
public static final String SYSTEM_INCLUDE = "systeminclude"; //$NON-NLS-1$ public static final String SYSTEM_INCLUDE = "systeminclude"; //$NON-NLS-1$
public static final String MACRO_NAME = "macroname"; //$NON-NLS-1$ public static final String MACRO_NAME = "macroname"; //$NON-NLS-1$
public static final String MACRO_VALUE = "macrovalue"; //$NON-NLS-1$ public static final String MACRO_VALUE = "macrovalue"; //$NON-NLS-1$
@ -70,6 +71,7 @@ public class CPElement {
createAttributeElement(EXCLUSION, new Path[0]); createAttributeElement(EXCLUSION, new Path[0]);
break; break;
case IPathEntry.CDT_LIBRARY: case IPathEntry.CDT_LIBRARY:
createAttributeElement(LIBRARY, new Path("")); //$NON-NLS-1$
createAttributeElement(SOURCEATTACHMENT, null); createAttributeElement(SOURCEATTACHMENT, null);
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
@ -123,11 +125,12 @@ public class CPElement {
case IPathEntry.CDT_SOURCE: case IPathEntry.CDT_SOURCE:
return CoreModel.newSourceEntry(fPath, exclusionPattern); return CoreModel.newSourceEntry(fPath, exclusionPattern);
case IPathEntry.CDT_LIBRARY: case IPathEntry.CDT_LIBRARY:
IPath libraryPath = (IPath)getAttribute(LIBRARY);
IPath attach = (IPath) getAttribute(SOURCEATTACHMENT); IPath attach = (IPath) getAttribute(SOURCEATTACHMENT);
if (!baseRef.isEmpty()) { if (!baseRef.isEmpty()) {
return CoreModel.newLibraryRefEntry(baseRef, fPath); return CoreModel.newLibraryRefEntry(fPath, baseRef, libraryPath);
} else { } else {
return CoreModel.newLibraryEntry(base, fPath, attach, null, null, isExported()); return CoreModel.newLibraryEntry(fPath, base, libraryPath, attach, null, null, isExported());
} }
case IPathEntry.CDT_PROJECT: case IPathEntry.CDT_PROJECT:
return CoreModel.newProjectEntry(fPath, isExported()); return CoreModel.newProjectEntry(fPath, isExported());
@ -207,6 +210,8 @@ public class CPElement {
appendEncodePath(base, buf); appendEncodePath(base, buf);
IPath sourceAttach = (IPath) getAttribute(SOURCEATTACHMENT); IPath sourceAttach = (IPath) getAttribute(SOURCEATTACHMENT);
appendEncodePath(sourceAttach, buf); appendEncodePath(sourceAttach, buf);
IPath library = (IPath) getAttribute(LIBRARY);
appendEncodePath(library, buf);
break; break;
default: default:
} }
@ -305,8 +310,9 @@ public class CPElement {
} }
switch (fEntryKind) { switch (fEntryKind) {
case IPathEntry.CDT_LIBRARY: case IPathEntry.CDT_LIBRARY:
return getAttribute(BASE).equals(elem.getAttribute(BASE)) return (getAttribute(LIBRARY).equals(elem.getAttribute(LIBRARY))
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)); && getAttribute(BASE).equals(elem.getAttribute(BASE))
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)));
case IPathEntry.CDT_INCLUDE: case IPathEntry.CDT_INCLUDE:
return (getAttribute(INCLUDE).equals(elem.getAttribute(INCLUDE)) return (getAttribute(INCLUDE).equals(elem.getAttribute(INCLUDE))
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals( && getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
@ -406,6 +412,7 @@ public class CPElement {
IPath sourceAttachment = null; IPath sourceAttachment = null;
IPath[] exclusion = null; IPath[] exclusion = null;
IPath include = null; IPath include = null;
IPath library = null;
String macroName = null; String macroName = null;
String macroValue = null; String macroValue = null;
boolean sysInclude = false; boolean sysInclude = false;
@ -434,6 +441,7 @@ public class CPElement {
} }
isMissing = !path.toFile().isFile(); // look for external isMissing = !path.toFile().isFile(); // look for external
} }
library = ((ILibraryEntry) curr).getLibraryPath();
sourceAttachment = ((ILibraryEntry) curr).getSourceAttachmentPath(); sourceAttachment = ((ILibraryEntry) curr).getSourceAttachmentPath();
base = ((ILibraryEntry) curr).getBasePath(); base = ((ILibraryEntry) curr).getBasePath();
baseRef = ((ILibraryEntry) curr).getBaseReference(); baseRef = ((ILibraryEntry) curr).getBaseReference();
@ -503,6 +511,7 @@ public class CPElement {
elem.setAttribute(SOURCEATTACHMENT, sourceAttachment); elem.setAttribute(SOURCEATTACHMENT, sourceAttachment);
elem.setAttribute(EXCLUSION, exclusion); elem.setAttribute(EXCLUSION, exclusion);
elem.setAttribute(INCLUDE, include); elem.setAttribute(INCLUDE, include);
elem.setAttribute(LIBRARY, library);
elem.setAttribute(MACRO_NAME, macroName); elem.setAttribute(MACRO_NAME, macroName);
elem.setAttribute(MACRO_VALUE, macroValue); elem.setAttribute(MACRO_VALUE, macroValue);
elem.setAttribute(SYSTEM_INCLUDE, Boolean.valueOf(sysInclude)); elem.setAttribute(SYSTEM_INCLUDE, Boolean.valueOf(sysInclude));

View file

@ -54,16 +54,16 @@ class CPElementLabelProvider extends LabelProvider {
public String getText(Object element) { public String getText(Object element) {
if (element instanceof CPElement) { if (element instanceof CPElement) {
return getCPListElementText((CPElement)element); return getCPElementText((CPElement)element);
} else if (element instanceof CPElementAttribute) { } else if (element instanceof CPElementAttribute) {
return getCPListElementAttributeText((CPElementAttribute)element); return getCPElementAttributeText((CPElementAttribute)element);
} else if (element instanceof IPathEntry) { } else if (element instanceof IPathEntry) {
return getCPListElementText(CPElement.createFromExisting((IPathEntry)element, null)); return getCPElementText(CPElement.createFromExisting((IPathEntry)element, null));
} }
return super.getText(element); return super.getText(element);
} }
public String getCPListElementAttributeText(CPElementAttribute attrib) { public String getCPElementAttributeText(CPElementAttribute attrib) {
String notAvailable = CPathEntryMessages.getString("CPListLabelProvider.none"); //$NON-NLS-1$ String notAvailable = CPathEntryMessages.getString("CPListLabelProvider.none"); //$NON-NLS-1$
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
String key = attrib.getKey(); String key = attrib.getKey();
@ -101,7 +101,7 @@ class CPElementLabelProvider extends LabelProvider {
return buf.toString(); return buf.toString();
} }
public String getCPListElementText(CPElement cpentry) { public String getCPElementText(CPElement cpentry) {
IPath path = cpentry.getPath(); IPath path = cpentry.getPath();
switch (cpentry.getEntryKind()) { switch (cpentry.getEntryKind()) {
case IPathEntry.CDT_LIBRARY : case IPathEntry.CDT_LIBRARY :
@ -178,7 +178,7 @@ class CPElementLabelProvider extends LabelProvider {
// } // }
} }
private ImageDescriptor getCPListElementBaseImage(CPElement cpentry) { private ImageDescriptor getCPElementBaseImage(CPElement cpentry) {
switch (cpentry.getEntryKind()) { switch (cpentry.getEntryKind()) {
case IPathEntry.CDT_OUTPUT : case IPathEntry.CDT_OUTPUT :
if (cpentry.getPath().segmentCount() == 1) { if (cpentry.getPath().segmentCount() == 1) {
@ -228,7 +228,7 @@ class CPElementLabelProvider extends LabelProvider {
public Image getImage(Object element) { public Image getImage(Object element) {
if (element instanceof CPElement) { if (element instanceof CPElement) {
CPElement cpentry = (CPElement)element; CPElement cpentry = (CPElement)element;
ImageDescriptor imageDescriptor = getCPListElementBaseImage(cpentry); ImageDescriptor imageDescriptor = getCPElementBaseImage(cpentry);
if (imageDescriptor != null) { if (imageDescriptor != null) {
if (cpentry.isMissing()) { if (cpentry.isMissing()) {
imageDescriptor = new CElementImageDescriptor(imageDescriptor, CElementImageDescriptor.WARNING, SMALL_SIZE); imageDescriptor = new CElementImageDescriptor(imageDescriptor, CElementImageDescriptor.WARNING, SMALL_SIZE);

View file

@ -89,7 +89,6 @@ public class CPathLibraryEntryPage extends CPathBasePage {
} }
private void updateLibrariesList() { private void updateLibrariesList() {
//List cpelements= fLibrariesList.getElements();
List cpelements = filterList(fCPathList.getElements()); List cpelements = filterList(fCPathList.getElements());
List libelements= new ArrayList(cpelements.size()); List libelements= new ArrayList(cpelements.size());