ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r659790 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer: IvyClasspathInitializer.java IvyClasspathUtil.java
Date Sat, 24 May 2008 10:54:02 GMT
Author: hibou
Date: Sat May 24 03:54:00 2008
New Revision: 659790

URL: http://svn.apache.org/viewvc?rev=659790&view=rev
Log:
IVYDE-68: IvyDE is using some internal classes of Eclipse
 - verbatim copy of the internal Eclipse function

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java?rev=659790&r1=659789&r2=659790&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
Sat May 24 03:54:00 2008
@@ -29,7 +29,6 @@
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations;
 import org.eclipse.swt.widgets.Display;
 
 /**
@@ -103,13 +102,14 @@
                 String entryPath = entry.getPath().toPortableString();
                 ei.setSourceAttachmentPath(containerPath, entryPath, path);
                 ei.setSourceAttachmentRootPath(containerPath, entryPath, path);
-                ei.setJavaDocLocation(containerPath, entryPath, JavaDocLocations
+                ei.setJavaDocLocation(containerPath, entryPath, IvyClasspathUtil
                         .getLibraryJavadocLocation(entry));
             }
             // force refresh of ivy classpath entry in ui thread
             Display.getDefault().asyncExec(new Runnable() {
                 public void run() {
-                    IvyClasspathContainer ivycp = IvyClasspathUtil.getIvyClasspathContainer(project);
+                    IvyClasspathContainer ivycp = IvyClasspathUtil
+                            .getIvyClasspathContainer(project);
                     if (ivycp != null) {
                         ivycp.scheduleRefresh(true);
                     }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java?rev=659790&r1=659789&r2=659790&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
Sat May 24 03:54:00 2008
@@ -17,9 +17,8 @@
  */
 package org.apache.ivyde.eclipse.cpcontainer;
 
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -31,6 +30,7 @@
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathAttribute;
 import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaProject;
@@ -204,4 +204,35 @@
         return b.toString();
     }
 
+    /**
+     * Just a verbatim copy of the internal Eclipse function:
+     * {@link JavaDocLocations#getLibraryJavadocLocation(IClasspathEntry)}
+     * 
+     * @param entry
+     * @return
+     */
+    public static URL getLibraryJavadocLocation(IClasspathEntry entry) {
+        if (entry == null) {
+            throw new IllegalArgumentException("Entry must not be null"); //$NON-NLS-1$
+        }
+
+        int kind = entry.getEntryKind();
+        if (kind != IClasspathEntry.CPE_LIBRARY && kind != IClasspathEntry.CPE_VARIABLE)
{
+            throw new IllegalArgumentException("Entry must be of kind CPE_LIBRARY or CPE_VARIABLE");
//$NON-NLS-1$
+        }
+
+        IClasspathAttribute[] extraAttributes = entry.getExtraAttributes();
+        for (int i = 0; i < extraAttributes.length; i++) {
+            IClasspathAttribute attrib = extraAttributes[i];
+            if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(attrib.getName()))
{
+                try {
+                    return new URL(attrib.getValue());
+                } catch (MalformedURLException e) {
+                    return null;
+                }
+            }
+        }
+        return null;
+    }
+
 }



Mime
View raw message