geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r617752 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui: META-INF/MANIFEST.MF src/org/apache/geronimo/st/ui/util/ClasspathContainersHelper.java
Date Sat, 02 Feb 2008 05:32:50 GMT
Author: mcconne
Date: Fri Feb  1 21:32:34 2008
New Revision: 617752

URL: http://svn.apache.org/viewvc?rev=617752&view=rev
Log:
GERONIMODEVTOOLS-264 Finish implementation of frontend UI classpath containers support

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/util/ClasspathContainersHelper.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/META-INF/MANIFEST.MF?rev=617752&r1=617751&r2=617752&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/META-INF/MANIFEST.MF
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/META-INF/MANIFEST.MF
Fri Feb  1 21:32:34 2008
@@ -19,7 +19,8 @@
  org.eclipse.jdt.debug.ui,
  org.eclipse.wst.common.modulecore,
  org.eclipse.jface;visibility:=reexport,
- org.eclipse.ui.workbench.texteditor
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.jdt.core
 Eclipse-LazyStart: true
 Export-Package: org,
  org.apache,

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/util/ClasspathContainersHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/util/ClasspathContainersHelper.java?rev=617752&r1=617751&r2=617752&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/util/ClasspathContainersHelper.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/util/ClasspathContainersHelper.java
Fri Feb  1 21:32:34 2008
@@ -18,7 +18,13 @@
 
 import java.util.ArrayList;
 import java.util.List;
-
+import org.apache.geronimo.st.ui.internal.Trace;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
 
 /**
  *
@@ -27,13 +33,49 @@
  */
 public class ClasspathContainersHelper {
 
+    //
+    // Query the workspace for the set of classpath containers
+    //
+    public static List<String> queryWorkspace() {
+        Trace.tracePoint("ENTRY", "ClasspathContainersHelper.queryWorkspace");
+
+        ArrayList<String> containers = new ArrayList<String>();
+
+        IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+
+        for ( IProject project : projects ) {
+
+            try {
+                if ( project.getNature(JavaCore.NATURE_ID) !=null ) {
+
+                    IJavaProject javaProject = JavaCore.create(project);
+                    IClasspathEntry[] cp = javaProject.getRawClasspath();
+
+                    for ( IClasspathEntry cpEntry : cp ) {
+                        int kind = cpEntry.getEntryKind();
+                        if (kind == IClasspathEntry.CPE_CONTAINER) {
+                            addEntry( containers, cpEntry.getPath().toString());
+                        }
+                    }
+                }
+            }
+            catch ( CoreException e ) {
+                e.printStackTrace();
+            }
+        }
+
+        Trace.tracePoint("ENTRY", "ClasspathContainersHelper.queryWorkspace", containers);
+        return containers;
+    }
+
 
     //
-    // query()
+    // Ensure no duplicates
     //
-	public static List<String> queryWorkspace() {
-        // TODO Return set of Classpath Containers discovered in the workspace
-        return new ArrayList<String>();
-	}
+    public static void addEntry( List<String> containers, String container ) {
 
-}
+        if ( containers.indexOf( container ) < 0 ) {
+            containers.add( container );
+        }
+    }
+}
\ No newline at end of file



Mime
View raw message