Author: hibou Date: Tue Sep 15 16:56:34 2009 New Revision: 815394 URL: http://svn.apache.org/viewvc?rev=815394&view=rev Log: - finally the launch configuration doesn't seem to like very well the attributes, let's go back to using paramteres - and make the launch do a resolve before starting
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FixedRuntimeClasspathEntryResolver.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FixedRuntimeClasspathEntryResolver.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FixedRuntimeClasspathEntryResolver.java?rev=815394&r1=815393&r2=815394&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FixedRuntimeClasspathEntryResolver.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FixedRuntimeClasspathEntryResolver.java Tue Sep 15 16:56:34 2009 @@ -20,10 +20,12 @@ import java.util.ArrayList; import java.util.List; +import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.jdt.core.IClasspathContainer; @@ -61,6 +63,7 @@ IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR, message, null)); // execution will not reach here - exception will be thrown } + ((IvyClasspathContainer) container).launchResolve(false, false, new NullProgressMonitor()); IClasspathEntry[] cpes = container.getClasspathEntries(); int property = -1; switch (container.getKind()) { Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java?rev=815394&r1=815393&r2=815394&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java Tue Sep 15 16:56:34 2009 @@ -23,7 +23,6 @@ import java.net.URL; import java.net.URLDecoder; import java.net.URLEncoder; -import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -33,7 +32,6 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IClasspathAttribute; -import org.eclipse.jdt.core.JavaCore; /** * This class maps the IvyDE classpath container configuration into Eclipse objects representing @@ -57,7 +55,7 @@ } else { loadV1(conf, path); } - loadAttributes(conf, attributes); + conf.setAttributes(attributes); } /** @@ -178,90 +176,6 @@ } } - private static void loadAttributes(IvyClasspathContainerConfiguration conf, - IClasspathAttribute[] attributes) { - ContainerMappingSetup mappingSetup = conf.getContainerMappingSetup(); - RetrieveSetup retrieveSetup = conf.getRetrieveSetup(); - IvySettingsSetup settingsSetup = conf.getIvySettingsSetup(); - - if (attributes != null) { - for (int i = 0; i < attributes.length; i++) { - String name = attributes[i].getName(); - String value = attributes[i].getValue(); - if (name.equals("ivyXmlPath")) { - conf.setIvyXmlPath(value); - } else if (name.equals("confs")) { - List confs = IvyClasspathUtil.split(value); - if (confs.isEmpty()) { - confs = Collections.singletonList("*"); - } - conf.setConfs(confs); - } else if (name.equals("ivySettingsPath")) { - settingsSetup.setIvySettingsPath(readOldSettings(conf, value)); - conf.setSettingsProjectSpecific(true); - } else if (name.equals("loadSettingsOnDemand")) { - settingsSetup.setLoadSettingsOnDemand(Boolean.valueOf(value).booleanValue()); - conf.setSettingsProjectSpecific(true); - } else if (name.equals("propertyFiles")) { - settingsSetup.setPropertyFiles(IvyClasspathUtil.split(value)); - conf.setSettingsProjectSpecific(true); - } else if (name.equals("doRetrieve")) { - // if the value is not actually "true" or "false", the Boolean class ensure to - // return false, so it is fine - retrieveSetup.setDoRetrieve(Boolean.valueOf(value).booleanValue()); - conf.setRetrieveProjectSpecific(true); - } else if (name.equals("retrievePattern")) { - retrieveSetup.setRetrievePattern(value); - conf.setRetrieveProjectSpecific(true); - } else if (name.equals("retrieveSync")) { - retrieveSetup.setRetrieveSync(Boolean.valueOf(value).booleanValue()); - conf.setRetrieveProjectSpecific(true); - } else if (name.equals("retrieveConfs")) { - retrieveSetup.setRetrieveConfs(value); - conf.setRetrieveProjectSpecific(true); - } else if (name.equals("retrieveTypes")) { - retrieveSetup.setRetrieveTypes(value); - conf.setRetrieveProjectSpecific(true); - } else if (name.equals("acceptedTypes")) { - mappingSetup.setAcceptedTypes(IvyClasspathUtil.split(value)); - conf.setAdvancedProjectSpecific(true); - } else if (name.equals("sourceTypes")) { - mappingSetup.setSourceTypes(IvyClasspathUtil.split(value)); - conf.setAdvancedProjectSpecific(true); - } else if (name.equals("javadocTypes")) { - mappingSetup.setJavadocTypes(IvyClasspathUtil.split(value)); - conf.setAdvancedProjectSpecific(true); - } else if (name.equals("sourceSuffixes")) { - mappingSetup.setSourceSuffixes(IvyClasspathUtil.split(value)); - conf.setAdvancedProjectSpecific(true); - } else if (name.equals("javadocSuffixes")) { - mappingSetup.setJavadocSuffixes(IvyClasspathUtil.split(value)); - conf.setAdvancedProjectSpecific(true); - } else if (name.equals("alphaOrder")) { - // if the value is not actually "true" or "false", the Boolean class ensure to - // return false, so it is fine - conf.setAlphaOrder(Boolean.valueOf(value).booleanValue()); - conf.setAdvancedProjectSpecific(true); - } else if (name.equals("resolveInWorkspace")) { - conf.setResolveInWorkspace(Boolean.valueOf(value).booleanValue()); - conf.setAdvancedProjectSpecific(true); - } else { - conf.addExtraAttribute(attributes[i]); - } - } - } - if (conf.isAdvancedProjectSpecific()) { - // in this V1 version, it is just some paranoid check - checkNonNullConf(conf); - } - if (conf.isRetrieveProjectSpecific()) { - if (retrieveSetup.getRetrievePattern() == null) { - retrieveSetup.setRetrievePattern(IvyPlugin.getPreferenceStoreHelper() - .getRetrieveSetup().getRetrievePattern()); - } - } - } - /** * Read old configuration that were based on relative urls, like: "file://./ivysettings.xml" or * "file:./ivysettings.xml". This kind of URL "project:///ivysettings.xml" should be used now. @@ -324,8 +238,31 @@ path.append("ivyXmlPath="); try { path.append(URLEncoder.encode(conf.getIvyXmlPath(), "UTF-8")); - path.append("&confs="); - path.append(URLEncoder.encode(IvyClasspathUtil.concat(conf.getConfs()), "UTF-8")); + append(path, "confs", conf.getConfs()); + if (conf.isSettingsProjectSpecific()) { + IvySettingsSetup setup = conf.getIvySettingsSetup(); + append(path, "ivySettingsPath", setup.getIvySettingsPath()); + append(path, "loadSettingsOnDemand", setup.isLoadSettingsOnDemand()); + append(path, "propertyFiles", setup.getPropertyFiles()); + } + if (conf.isRetrieveProjectSpecific()) { + RetrieveSetup setup = conf.getRetrieveSetup(); + append(path, "doRetrieve", setup.isDoRetrieve()); + append(path, "retrievePattern", setup.getRetrievePattern()); + append(path, "retrieveSync", setup.isRetrieveSync()); + append(path, "retrieveConfs", setup.getRetrieveConfs()); + append(path, "retrieveTypes", setup.getRetrieveTypes()); + } + if (conf.isAdvancedProjectSpecific()) { + ContainerMappingSetup setup = conf.getContainerMappingSetup(); + append(path, "acceptedTypes", setup.getAcceptedTypes()); + append(path, "sourceTypes", setup.getSourceTypes()); + append(path, "javadocTypes", setup.getJavadocTypes()); + append(path, "sourceSuffixes", setup.getSourceSuffixes()); + append(path, "javadocSuffixes", setup.getJavadocSuffixes()); + append(path, "alphaOrder", conf.isAlphaOrder()); + append(path, "resolveInWorkspace", conf.isResolveInWorkspace()); + } } catch (UnsupportedEncodingException e) { IvyPlugin.log(IStatus.ERROR, UTF8_ERROR, e); throw new RuntimeException(UTF8_ERROR, e); @@ -333,45 +270,21 @@ return new Path(IvyClasspathContainer.CONTAINER_ID).append(path.toString()); } - public static IClasspathAttribute[] getAttributes(IvyClasspathContainerConfiguration conf) { - List atts = new ArrayList(conf.getExtraAttributes()); - if (conf.isSettingsProjectSpecific()) { - IvySettingsSetup settingsSetup = conf.getIvySettingsSetup(); - addAttribute(atts, "ivySettingsPath", settingsSetup.getIvySettingsPath()); - addAttribute(atts, "loadSettingsOnDemand", settingsSetup.isLoadSettingsOnDemand()); - addAttribute(atts, "propertyFiles", settingsSetup.getPropertyFiles()); - } - if (conf.isRetrieveProjectSpecific()) { - RetrieveSetup retrieveSetup = conf.getRetrieveSetup(); - addAttribute(atts, "doRetrieve", retrieveSetup.isDoRetrieve()); - addAttribute(atts, "retrievePattern", retrieveSetup.getRetrievePattern()); - addAttribute(atts, "retrieveSync", retrieveSetup.isRetrieveSync()); - addAttribute(atts, "retrieveConfs", retrieveSetup.getRetrieveConfs()); - addAttribute(atts, "retrieveTypes", retrieveSetup.getRetrieveTypes()); - } - if (conf.isAdvancedProjectSpecific()) { - ContainerMappingSetup mappingSetup = conf.getContainerMappingSetup(); - addAttribute(atts, "acceptedTypes", mappingSetup.getAcceptedTypes()); - addAttribute(atts, "sourceTypes", mappingSetup.getSourceTypes()); - addAttribute(atts, "javadocTypes", mappingSetup.getJavadocTypes()); - addAttribute(atts, "sourceSuffixes", mappingSetup.getSourceSuffixes()); - addAttribute(atts, "javadocSuffixes", mappingSetup.getJavadocSuffixes()); - addAttribute(atts, "alphaOrder", conf.isAlphaOrder()); - addAttribute(atts, "resolveInWorkspace", conf.isResolveInWorkspace()); - } - return (IClasspathAttribute[]) atts.toArray(new IClasspathAttribute[0]); - } - - private static void addAttribute(List atts, String name, String value) { - atts.add(JavaCore.newClasspathAttribute(name, value)); - } - - private static void addAttribute(List atts, String name, List values) { - addAttribute(atts, name, IvyClasspathUtil.concat(values)); - } - - private static void addAttribute(List atts, String name, boolean bool) { - addAttribute(atts, name, Boolean.toString(bool)); + private static void append(StringBuffer path, String name, String value) + throws UnsupportedEncodingException { + path.append('&'); + path.append(name); + path.append('='); + path.append(URLEncoder.encode(value, "UTF-8")); + } + + private static void append(StringBuffer path, String name, List values) + throws UnsupportedEncodingException { + append(path, name, IvyClasspathUtil.concat(values)); + } + + private static void append(StringBuffer path, String name, boolean value) + throws UnsupportedEncodingException { + append(path, name, Boolean.toString(value)); } - } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java?rev=815394&r1=815393&r2=815394&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java Tue Sep 15 16:56:34 2009 @@ -17,7 +17,6 @@ */ package org.apache.ivyde.eclipse.cpcontainer; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -58,7 +57,7 @@ /** * attributes attached to the container but not IvyDE related (Webtools or AspectJfor instance) */ - private List/* <IClasspathAttribute> */extraAttributes = new ArrayList(); + private IClasspathAttribute[] attributes; /** * Constructor @@ -183,12 +182,12 @@ return javaProject; } - public void addExtraAttribute(IClasspathAttribute attribute) { - extraAttributes.add(attribute); + public void setAttributes(IClasspathAttribute[] attributes) { + this.attributes = attributes; } - public List/* <IClasspathAttribute> */getExtraAttributes() { - return extraAttributes; + public IClasspathAttribute[] getAttributes() { + return attributes; } // /////////////////////////// Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java?rev=815394&r1=815393&r2=815394&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java Tue Sep 15 16:56:34 2009 @@ -226,7 +226,7 @@ } IPath path = IvyClasspathContainerConfAdapter.getPath(conf); - IClasspathAttribute[] atts = IvyClasspathContainerConfAdapter.getAttributes(conf); + IClasspathAttribute[] atts = conf.getAttributes(); entry = JavaCore.newContainerEntry(path, null, atts, exported);