Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 56181 invoked from network); 11 May 2008 10:24:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 May 2008 10:24:27 -0000 Received: (qmail 23562 invoked by uid 500); 11 May 2008 10:24:29 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 23538 invoked by uid 500); 11 May 2008 10:24:29 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 23526 invoked by uid 99); 11 May 2008 10:24:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 May 2008 03:24:29 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 May 2008 10:23:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A106D2388A27; Sun, 11 May 2008 03:24:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r655292 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: CHANGES.txt src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java Date: Sun, 11 May 2008 10:24:06 -0000 To: notifications@ant.apache.org From: hibou@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080511102406.A106D2388A27@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hibou Date: Sun May 11 03:24:05 2008 New Revision: 655292 URL: http://svn.apache.org/viewvc?rev=655292&view=rev Log: FIX: Error while trying to edit an ivy.xml without a configured container (IVYDE-83) - add more checks that the Ivy instance is not null Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt?rev=655292&r1=655291&r2=655292&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt Sun May 11 03:24:05 2008 @@ -13,6 +13,7 @@ - IMPROVE: Simplify the resolve process (IVYDE-64) (thanks to Nicolas Lalevée) - IMPROVE: Add new target to build.xml to build the plugin with Ant (IVYDE-88) +- FIX: Error while trying to edit an ivy.xml without a configured container (IVYDE-83) - FIX: IvyDE resolve also evicted artifacts (IVYDE-76) (thanks to Nicolas Lalevée) - FIX: IvyDE is using some internal classes of Eclipse (IVYDE-68) (thanks to Nicolas Lalevée) - FIX: "Add Ivy library" not working in eclipse 3.3 (IVYDE-57) Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java?rev=655292&r1=655291&r2=655292&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java Sun May 11 03:24:05 2008 @@ -35,9 +35,10 @@ import org.apache.ivy.core.resolve.ResolveData; import org.apache.ivy.core.resolve.ResolveOptions; import org.apache.ivy.core.resolve.ResolvedModuleRevision; -import org.apache.ivy.core.settings.IvySettings; import org.apache.ivy.plugins.resolver.DependencyResolver; import org.apache.ivyde.eclipse.IvyPlugin; +import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; +import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants; import org.eclipse.jdt.core.IJavaProject; @@ -351,7 +352,7 @@ String org = ivyFile.getDependencyOrganisation(); Map otherAttValues = ivyFile.getAllAttsValues(); if (org != null && otherAttValues != null && otherAttValues.get("name") != null - && otherAttValues.get("rev") != null && getIvy() != null) { + && otherAttValues.get("rev") != null) { otherAttValues.remove("org"); String branch = (String) otherAttValues.remove("branch"); otherAttValues.remove("conf"); @@ -392,6 +393,10 @@ private String[] getDependencyConfs(String org, String name, String branch, String rev, Map otherAtts, String qualifier, StringBuffer base, int arrowIndex) { + Ivy ivy = getIvy(); + if (ivy == null) { + return null; + } base.append(qualifier.substring(0, arrowIndex + 2)); qualifier = qualifier.substring(arrowIndex + 2); // search for word after last comma @@ -402,13 +407,12 @@ base.append(' '); qualifier = qualifier.substring(1); } - ResolveData data = new ResolveData(getIvy().getResolveEngine(), - new ResolveOptions()); + ResolveData data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions()); ModuleRevisionId mrid = ModuleRevisionId.newInstance(org, name, branch, rev, otherAtts); DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor(mrid, false); try { - DependencyResolver resolver = getIvySettings().getResolver(mrid); + DependencyResolver resolver = ivy.getSettings().getResolver(mrid); if (resolver == null) { return null; } @@ -442,14 +446,14 @@ "a comma separated list of dependency configurations \nto which this master configuration should be mapped", false, new IValueProvider() { public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) { + Ivy ivy = getIvy(); int[] indexes = ivyFile.getParentTagIndex(); - if (indexes != null) { + if (indexes != null && ivy != null) { Map otherAttValues = ivyFile.getAllAttsValues(indexes[0] + 1); String org = ivyFile.getDependencyOrganisation(otherAttValues); if (org != null && otherAttValues != null && otherAttValues.get("name") != null - && otherAttValues.get("rev") != null - && getIvy() != null) { + && otherAttValues.get("rev") != null) { StringBuffer base = new StringBuffer(); String qualifier = ivyFile.getAttributeValueQualifier(); // search for word after last comma @@ -460,15 +464,15 @@ base.append(' '); qualifier = qualifier.substring(1); } - ResolveData data = new ResolveData(getIvy() - .getResolveEngine(), new ResolveOptions()); + ResolveData data = new ResolveData(ivy.getResolveEngine(), + new ResolveOptions()); ModuleRevisionId mrid = ModuleRevisionId.newInstance(org, (String) otherAttValues.get("name"), (String) otherAttValues.get("rev")); DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor( mrid, false); try { - String[] confs = getIvySettings().getResolver(mrid) + String[] confs = ivy.getSettings().getResolver(mrid) .getDependency(ddd, data).getDescriptor() .getConfigurationsNames(); for (int i = 0; i < confs.length; i++) { @@ -496,8 +500,9 @@ "the name of the dependency configuration mapped. \n'*' wildcard can be used to designate all configurations of this module", true, new IValueProvider() { public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) { + Ivy ivy = getIvy(); int[] indexes = ivyFile.getParentTagIndex(); - if (indexes != null) { + if (indexes != null && ivy != null) { indexes = ivyFile.getParentTagIndex(indexes[0]); if (indexes != null) { Map otherAttValues = ivyFile @@ -506,9 +511,8 @@ .getDependencyOrganisation(otherAttValues); if (org != null && otherAttValues != null && otherAttValues.get("name") != null - && otherAttValues.get("rev") != null - && getIvy() != null) { - ResolveData data = new ResolveData(getIvy() + && otherAttValues.get("rev") != null) { + ResolveData data = new ResolveData(ivy .getResolveEngine(), new ResolveOptions()); ModuleRevisionId mrid = ModuleRevisionId.newInstance( org, (String) otherAttValues.get("name"), @@ -516,9 +520,9 @@ DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor( mrid, false); try { - String[] confs = getIvySettings().getResolver(mrid) - .getDependency(ddd, data).getDescriptor() - .getConfigurationsNames(); + String[] confs = ivy.getSettings() + .getResolver(mrid).getDependency(ddd, data) + .getDescriptor().getConfigurationsNames(); List ret = new ArrayList(Arrays.asList(confs)); ret.add("*"); return (String[]) ret @@ -537,8 +541,12 @@ conf3.addChildIvyTag(mapped); MODEL.put(mapped.getName(), mapped); - ListValueProvider matcherNamesProvider = new ListValueProvider((String[]) getIvy() - .getSettings().getMatcherNames().toArray(new String[0])); + String[] matcherNames = new String[0]; + Ivy ivy = getIvy(); + if (ivy != null) { + matcherNames = (String[]) ivy.getSettings().getMatcherNames().toArray(new String[0]); + } + ListValueProvider matcherNamesProvider = new ListValueProvider(matcherNames); IvyTag artifact2 = new IvyTag("artifact", "defines artifacts restriction \nuse only if you do not control dependency ivy file"); @@ -713,14 +721,10 @@ return (IvyTag) MODEL.get("ivy-module"); } - private Ivy getIvy() { + Ivy getIvy() { return IvyPlugin.getIvy(_javaProject); } - private IvySettings getIvySettings() { - return getIvy().getSettings(); - } - private List listDependencyTokenValues(String att, IvyFile ivyfile) { Map allAttsValues = ivyfile.getAllAttsValues(); String org = ivyfile.getOrganisation(); @@ -732,19 +736,20 @@ private List listDependencyTokenValues(String att, Map otherAttValues) { List ret = new ArrayList(); - if (getIvy() != null) { + Ivy ivy = getIvy(); + if (ivy != null) { replaceToken(otherAttValues, "org", IvyPatternHelper.ORGANISATION_KEY); replaceToken(otherAttValues, "name", IvyPatternHelper.MODULE_KEY); replaceToken(otherAttValues, "rev", IvyPatternHelper.REVISION_KEY); if (!otherAttValues.containsKey(IvyPatternHelper.BRANCH_KEY)) { - otherAttValues - .put(IvyPatternHelper.BRANCH_KEY, getIvySettings().getDefaultBranch()); + otherAttValues.put(IvyPatternHelper.BRANCH_KEY, ivy.getSettings() + .getDefaultBranch()); } String stdAtt = standardiseDependencyAttribute(att); otherAttValues.remove(stdAtt); - String[] revs = getIvy().listTokenValues(stdAtt, otherAttValues); + String[] revs = ivy.listTokenValues(stdAtt, otherAttValues); if (revs != null) { ret.addAll(Arrays.asList(revs)); }