Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2003-04-03 04:28:03 +0000
committerAlain Magloire2003-04-03 04:28:03 +0000
commiteac587f614b74ed0107d9bd157ba831f70ed5597 (patch)
tree07915bd74d1f0e6f530953fa8579ecf0af67f050
parent46d2f50c480e3dfb4d8f55d2c3863072f6a718b0 (diff)
downloadorg.eclipse.cdt-eac587f614b74ed0107d9bd157ba831f70ed5597.tar.gz
org.eclipse.cdt-eac587f614b74ed0107d9bd157ba831f70ed5597.tar.xz
org.eclipse.cdt-eac587f614b74ed0107d9bd157ba831f70ed5597.zip
Add new method getLibraryReferences()
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java11
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java22
2 files changed, 33 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
index 57099bdca31..0a830ea9f47 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
@@ -39,5 +39,16 @@ public interface ICProject extends ICContainer {
*/
IBinaryContainer getBinaryContainer();
+ /**
+ * Return the library references for this project.
+ *
+ * @return [] ILibraryReference
+ */
+ ILibraryReference[] getLibraryReferences() throws CModelException;
+
+ /**
+ *
+ * @return IProject
+ */
IProject getProject();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
index 054665b29f9..3ee938e478b 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
@@ -5,13 +5,19 @@ package org.eclipse.cdt.internal.core.model;
* All Rights Reserved.
*/
+import java.util.ArrayList;
+
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.ICPathEntry;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IArchiveContainer;
import org.eclipse.cdt.core.model.IBinaryContainer;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModelStatusConstants;
import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.ILibraryReference;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -75,4 +81,20 @@ public class CProject extends CContainer implements ICProject {
return getProject().hashCode();
}
+ public ILibraryReference[] getLibraryReferences() throws CModelException {
+ ArrayList list = new ArrayList(5);
+ try {
+ ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(getProject());
+ ICPathEntry[] entries = cdesc.getPathEntries();
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i].getEntryKind() == ICPathEntry.CDT_LIBRARY) {
+ ICPathEntry entry = entries[i];
+ list.add(new LibraryReference(this, entry.getPath().lastSegment(),entry));
+ }
+ }
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ return (ILibraryReference[])list.toArray(new ILibraryReference[0]);
+ }
}

Back to the top