Author: xavier
Date: Thu Jul  5 23:22:10 2007
New Revision: 553755

URL: http://svn.apache.org/viewvc?view=rev&rev=553755
Log:
FIX: Automatic javadoc attachment is not working (IVYDE-55)

Modified:
    incubator/ivy/ivyde/trunk/CHANGES.txt
    incubator/ivy/ivyde/trunk/plugin.xml
    
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
    
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java
    
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java

Modified: incubator/ivy/ivyde/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/CHANGES.txt?view=diff&rev=553755&r1=553754&r2=553755
==============================================================================
--- incubator/ivy/ivyde/trunk/CHANGES.txt (original)
+++ incubator/ivy/ivyde/trunk/CHANGES.txt Thu Jul  5 23:22:10 2007
@@ -5,6 +5,9 @@
 ===========================
 - IMPROVE: enable 'Resolve all' action (IVYDE-42) (thanks to Thomas FRIOL)
 - IMPROVE: Support javadoc and sources even in modules where they are not 
declared (IVYDE-46)
+
+- FIX: Automatic javadoc attachment is not working (IVYDE-55)
+
 - moved to apache, packages renamed to org.apache.ivyde
                                
 

Modified: incubator/ivy/ivyde/trunk/plugin.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/plugin.xml?view=diff&rev=553755&r1=553754&r2=553755
==============================================================================
--- incubator/ivy/ivyde/trunk/plugin.xml (original)
+++ incubator/ivy/ivyde/trunk/plugin.xml Thu Jul  5 23:22:10 2007
@@ -3,7 +3,7 @@
 <plugin
    id="org.apache.ivyde.eclipse"
    name="IvyDE Eclipse Plug-in"
-   version="1.2.0"
+   version="1.3.0.20070706071200"
    provider-name="Apache"
    class="org.apache.ivyde.eclipse.IvyPlugin">
 

Modified: 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java?view=diff&rev=553755&r1=553754&r2=553755
==============================================================================
--- 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
 (original)
+++ 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
 Thu Jul  5 23:22:10 2007
@@ -4,6 +4,7 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.text.ParseException;
 import java.util.ArrayList;
@@ -340,7 +341,7 @@
                 }
             }
             if (IvyPlugin.shouldTestNonDeclaredSources(_javaProject)) {
-               return getMetaArtifact(artifact, "source");
+               return getMetaArtifact(artifact, "source", "sources");
             } else {
                return null;
             }
@@ -360,17 +361,17 @@
                                }
                        }
                        if 
(IvyPlugin.shouldTestNonDeclaredSources(_javaProject)) {
-               return getMetaArtifact(artifact, "javadoc");
+               return getMetaArtifact(artifact, "javadoc", "javadoc");
                        } else {
                return null;
             }
                }
 
-               private File getMetaArtifact(Artifact artifact, String 
metaType) {
+               private File getMetaArtifact(Artifact artifact, String 
metaType, String metaClassifier) {
                        // meta artifact (source or javadoc) not found in 
resolved artifacts, 
                        // try to see if a non declared one is available
                        Map extraAtt = new 
HashMap(artifact.getExtraAttributes());
-                       extraAtt.put("classifier", metaType+"s");
+                       extraAtt.put("classifier", metaClassifier);
                        Artifact metaArtifact = new DefaultArtifact(
                                        artifact.getModuleRevisionId(),
                                        artifact.getPublicationDate(),
@@ -590,13 +591,18 @@
 
     private IClasspathAttribute[] getExtraAttribute(ClasspathItem 
classpathItem) {
         List result  = new ArrayList();
-        IPath p = 
IvyPlugin.getDefault().getPackageFragmentExtraInfo().getDocAttachment(classpathItem.getClasspathArtifactPath());
+        URL url = 
IvyPlugin.getDefault().getPackageFragmentExtraInfo().getDocAttachment(classpathItem.getClasspathArtifactPath());
         
-        if (p == null)
-               p = classpathItem.getJavadocArtifactPath();
+        if (url == null) {
+               try {
+                       url = new 
URL("jar:"+classpathItem.getJavadocArtifactPath().toFile().toURI().toURL().toExternalForm()+"!/");
+               } catch (MalformedURLException e) {
+                       // ignored
+               }
+        }
                
-        if(p != null) {
-            result.add(new 
ClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, 
p.toPortableString()));
+        if(url != null) {
+               result.add(new 
ClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, 
url.toExternalForm()));
         }
         return (IClasspathAttribute[]) result.toArray(new 
IClasspathAttribute[result.size()]);
     }

Modified: 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java?view=diff&rev=553755&r1=553754&r2=553755
==============================================================================
--- 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java
 (original)
+++ 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java
 Thu Jul  5 23:22:10 2007
@@ -10,7 +10,7 @@
     
     public IPath getSourceAttachmentRoot(Path path);
     
-    public IPath getDocAttachment(Path path);
+    public URL getDocAttachment(Path path);
 
     public void setSourceAttachmentPath(IPath containerPath, String entryPath, 
IPath sourcePath);
 

Modified: 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java?view=diff&rev=553755&r1=553754&r2=553755
==============================================================================
--- 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java
 (original)
+++ 
incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java
 Thu Jul  5 23:22:10 2007
@@ -1,5 +1,6 @@
 package org.apache.ivyde.eclipse.cpcontainer.fragmentinfo;
 
+import java.net.MalformedURLException;
 import java.net.URL;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
@@ -32,10 +33,14 @@
         return null;
     }    
     
-    public IPath getDocAttachment(Path path) {
+    public URL getDocAttachment(Path path) {
         String srcPath = 
_preferenceStore.getString(path.toPortableString()+DOC_SUFFIX);
         if(!"".equals(srcPath)) {
-            return Path.fromPortableString(srcPath);
+            try {
+                               return new URL(srcPath);
+                       } catch (MalformedURLException e) {
+                               return null;
+                       }
         }
         return null;
     }


Reply via email to