ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r991920 - /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
Date Thu, 02 Sep 2010 12:51:47 GMT
Author: hibou
Date: Thu Sep  2 12:51:47 2010
New Revision: 991920

URL: http://svn.apache.org/viewvc?rev=991920&view=rev
Log:
Make the workspace resolver even less java related

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java?rev=991920&r1=991919&r2=991920&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
Thu Sep  2 12:51:47 2010
@@ -53,41 +53,37 @@ import org.apache.ivyde.eclipse.cpcontai
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
 
 /**
  * This is an Eclipse workspace Ivy resolver. When used with the custom IvyClasspathContainer
  * changes, this resolver will link dependent projects when they are open in the same workspace,
  * allowing full-fledged linked project functionality Eclipse provides, such as incremental
  * compilation, debugging, mouseover javadocs, and source browsing across projects.
- *
+ * 
  * <b>How it works</b> During a resolve, it looks at all open projects in the
workspace that have
  * Ivy containers. The <b>first</b> project that publishes the module on which
the project being
  * resolved depends, will be picked and returned as a special type of artifact called "project".
- *
+ * 
  * The IvyClasspathContainer will recognize the artifact as a project and put the eclipse
project as
  * a dependent project within the classpath container of the parent.
- *
+ * 
  * If you do not want a project to be linked as a dependency, close it or delete from the
workspace.
  * As soon as you do that, any projects that were linked to it will automatically re-resolve
(see
  * {@link WorkspaceResourceChangeListener}) and use the standard Ivy means of finding the
  * dependency.
- *
+ * 
  * The {@link WorkspaceResourceChangeListener} will also auto-resolve when a new project
is added or
  * opened, so opening a project will automatically link it into the currently open projects
where
  * necessary.
- *
+ * 
  * Since the resolver is not aware which module revision a project is publishing, it optimistically
  * matches any revision of the module.
- *
+ * 
  * Since the resolver stops after finding the first open project which matches the module,
having
  * multiple open versions of the same project in the workspace (for example, different branches)
may
  * set the wrong version as a dependency. You are advised to only open the version of the
project
  * which you want other projects in the workspace to depend on.
- *
+ * 
  * NOTE: Transitive dependencies are not passed from the dependent project to the parent
when
  * projects are linked. If you find you are missing some transitive dependencies, just set
your
  * dependent eclipse project to export its ivy dependencies. (Project->Properties->Java
Build
@@ -103,7 +99,7 @@ public class WorkspaceResolver extends A
 
     public static final String CACHE_NAME = "__ivyde-workspace-resolver-cache";
 
-    private IJavaProject[] projects;
+    private IProject[] projects;
 
     private boolean ignoreBranchOnWorkspaceProjects;
 
@@ -115,12 +111,7 @@ public class WorkspaceResolver extends A
         setSettings(ivySettings);
         setCache(CACHE_NAME);
 
-        try {
-            projects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
-        } catch (JavaModelException e) {
-            IvyPlugin.log(IStatus.ERROR, "JDT Error while resolving in workspace for the
project "
-                    + projectName, e);
-        }
+        projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
 
         ignoreBranchOnWorkspaceProjects = IvyPlugin.getPreferenceStoreHelper()
                 .getIgnoreBranchOnWorkspaceProjects();
@@ -160,12 +151,12 @@ public class WorkspaceResolver extends A
         // Iterate over workspace to find Java project which has an Ivy
         // container for this dependency
         for (int i = 0; i < projects.length; i++) {
-            IJavaProject javaProject = projects[i];
-            if (!javaProject.exists()) {
+            IProject p = projects[i];
+            if (!p.exists()) {
                 continue;
             }
             List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
-                    .getIvyClasspathContainers(javaProject);
+                    .getIvyClasspathContainers(p);
             Iterator/* <IvyClasspathContainer> */itContainer = containers.iterator();
             while (itContainer.hasNext()) {
                 IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
@@ -180,7 +171,7 @@ public class WorkspaceResolver extends A
                     // it doesn't match org#module
                     continue;
                 }
-                
+
                 if (!ignoreBranchOnWorkspaceProjects) {
                     ModuleId mid = dependencyMrid.getModuleId();
                     String defaultBranch = getSettings().getDefaultBranch(mid);
@@ -210,8 +201,8 @@ public class WorkspaceResolver extends A
                         || md.getModuleRevisionId().getRevision().equals(Ivy.getWorkingRevision())
                         || versionMatcher.accept(dd.getDependencyRevisionId(), md)) {
 
-                    Artifact af = new DefaultArtifact(md.getModuleRevisionId(), md
-                            .getPublicationDate(), javaProject.getPath().toString(),
+                    Artifact af = new DefaultArtifact(md.getModuleRevisionId(),
+                            md.getPublicationDate(), p.getFullPath().toString(),
                             ECLIPSE_PROJECT_TYPE, ECLIPSE_PROJECT_EXTENSION);
 
                     DefaultModuleDescriptor workspaceMd = cloneMd(md, af);



Mime
View raw message