felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r993364 - /felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/WorkspaceRepository.java
Date Tue, 07 Sep 2010 13:51:50 GMT
Author: dsavage
Date: Tue Sep  7 13:51:50 2010
New Revision: 993364

URL: http://svn.apache.org/viewvc?rev=993364&view=rev
Log:
fix for FELIX-2583 - use java model vs resources to find package names

Modified:
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/WorkspaceRepository.java

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/WorkspaceRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/WorkspaceRepository.java?rev=993364&r1=993363&r2=993364&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/WorkspaceRepository.java
(original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/WorkspaceRepository.java
Tue Sep  7 13:51:50 2010
@@ -39,10 +39,14 @@ import org.eclipse.core.resources.IResou
 import org.eclipse.core.resources.IResourceDeltaVisitor;
 import org.eclipse.core.resources.IResourceVisitor;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.content.IContentType;
 import org.eclipse.core.runtime.content.IContentTypeManager;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
 
 public class WorkspaceRepository extends AbstractBundleRepository implements IResourceChangeListener
 {
@@ -88,7 +92,7 @@ public class WorkspaceRepository extends
 
         for (IPackageExport pe : bundle.getBundleInfo().getExports())
         {
-            final String packagePath = pe.getPackageName().replace('.', '/');
+            final String packagePath = pe.getPackageName();
             if (!packages.contains(packagePath))
             {
                 bundle.getBundleInfo().removeExport(pe);
@@ -116,10 +120,9 @@ public class WorkspaceRepository extends
                         IContentType ct = contentTypeManager.findContentTypeFor(f.getName());
                         if (ct != null && ct.isKindOf(javaContentType))
                         {
-                            IPath p = f.getProjectRelativePath();
-                            p = p.removeLastSegments(1);
-                            p = p.removeFirstSegments(1);
-                            packages.add(p.toString());
+                            ICompilationUnit cu = (ICompilationUnit) JavaCore.create(f);
+                            IPackageFragment pf = (IPackageFragment) cu.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
+                            packages.add(pf.getElementName());
                         }
                     }
 



Mime
View raw message