Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 5575 invoked from network); 14 Sep 2009 21:48:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Sep 2009 21:48:19 -0000 Received: (qmail 46005 invoked by uid 500); 14 Sep 2009 21:48:19 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 45933 invoked by uid 500); 14 Sep 2009 21:48:19 -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 45924 invoked by uid 99); 14 Sep 2009 21:48:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Sep 2009 21:48:19 +0000 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; Mon, 14 Sep 2009 21:48:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 71AD92388999; Mon, 14 Sep 2009 21:47:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r814877 [3/3] - in /ant/ivy/ivyde/trunk: ./ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontaine... Date: Mon, 14 Sep 2009 21:47:45 -0000 To: notifications@ant.apache.org From: hibou@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090914214746.71AD92388999@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java?rev=814877&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java Mon Sep 14 21:47:44 2009 @@ -0,0 +1,343 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.ivyde.eclipse.cpcontainer; + +import java.io.File; +import java.io.IOException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.ivy.Ivy; +import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; +import org.apache.ivy.core.module.descriptor.ModuleDescriptor; +import org.apache.ivy.core.module.id.ModuleRevisionId; +import org.apache.ivy.core.report.ArtifactDownloadReport; +import org.apache.ivy.core.report.ResolveReport; +import org.apache.ivy.core.resolve.IvyNode; +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.retrieve.RetrieveOptions; +import org.apache.ivy.plugins.report.XmlReportParser; +import org.apache.ivy.plugins.resolver.DependencyResolver; +import org.apache.ivy.util.Message; +import org.apache.ivy.util.filter.ArtifactTypeFilter; +import org.apache.ivyde.eclipse.FakeProjectManager; +import org.apache.ivyde.eclipse.IvyPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jdt.core.IClasspathEntry; + +/** + * Eclipse classpath container that will contain the ivy resolved entries. + */ +public class IvyResolveJobThread extends Thread { + + private static final int MONITOR_LENGTH = 1000; + + private final Ivy ivy; + + private final IProgressMonitor monitor; + + private final IvyClasspathContainerConfiguration conf; + + private final ModuleDescriptor md; + + private final boolean usePreviousResolveIfExist; + + private IStatus status = null; + + private IClasspathEntry[] classpathEntries = null; + + private LinkedHashSet all; + + private List problemMessages; + + private String[] confs; + + private Map artifactsByDependency = new HashMap(); + + public IvyResolveJobThread(IvyClasspathContainerConfiguration conf, Ivy ivy, + ModuleDescriptor md, boolean usePreviousResolveIfExist, IProgressMonitor monitor) { + this.ivy = ivy; + this.md = md; + this.usePreviousResolveIfExist = usePreviousResolveIfExist; + this.monitor = monitor; + this.conf = conf; + } + + public IStatus getStatus() { + return status; + } + + public IClasspathEntry[] getClasspathEntries() { + return classpathEntries; + } + + public void run() { + try { + ivy.pushContext(); + IvyResolveJobListener ivyResolveJobListener = new IvyResolveJobListener(monitor); + ivy.getEventManager().addIvyListener(ivyResolveJobListener); + + monitor.beginTask("resolving dependencies", MONITOR_LENGTH); + monitor.setTaskName("resolving dependencies..."); + + // context Classloader hook for commons logging used by httpclient + // It will also be used by the SaxParserFactory in Ivy + ClassLoader old = Thread.currentThread().getContextClassLoader(); + Thread.currentThread() + .setContextClassLoader(IvyResolveJobThread.class.getClassLoader()); + try { + computeConfs(); + + if (usePreviousResolveIfExist) { + if (!resolveWithPrevious()) { + // resolve canceled + return; + } + } else { + Message.info("\n\nIVYDE: calling resolve on " + conf.getIvyXmlPath() + "\n"); + if (!resolve()) { + // resolve canceled + return; + } + } + + IvyClasspathContainerMapper mapper = new IvyClasspathContainerMapper(monitor, ivy, + conf); + + warnIfDuplicates(mapper); + + classpathEntries = mapper.map(all, artifactsByDependency); + } catch (ParseException e) { + String errorMsg = "Error while parsing the ivy file " + conf.getIvyXmlPath() + "\n" + + e.getMessage(); + Message.error(errorMsg); + status = new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, errorMsg, e); + return; + } catch (Exception e) { + String errorMsg = "Error while resolving dependencies for " + conf.getIvyXmlPath() + + "\n" + e.getMessage(); + Message.error(errorMsg); + status = new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, errorMsg, e); + return; + } finally { + Thread.currentThread().setContextClassLoader(old); + monitor.done(); + ivy.getEventManager().removeIvyListener(ivyResolveJobListener); + } + + if (!problemMessages.isEmpty()) { + MultiStatus multiStatus = new MultiStatus(IvyPlugin.ID, IStatus.ERROR, + "Impossible to resolve dependencies of " + md.getModuleRevisionId(), null); + for (Iterator iter = problemMessages.iterator(); iter.hasNext();) { + multiStatus.add(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, + (String) iter.next(), null)); + } + status = multiStatus; + return; + } + + status = Status.OK_STATUS; + } catch (Throwable e) { + status = new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, "The resolve job of " + + conf + " has unexpectedly stopped", e); + } + } + + private void computeConfs() { + Set configurations = new HashSet(); + configurations.addAll(conf.getConfs()); + if (conf.getInheritedDoRetrieve()) { + configurations.addAll(Arrays.asList(conf.getInheritedRetrieveConfs().split(","))); + } + + if (configurations.contains("*")) { + confs = md.getConfigurationsNames(); + } else { + confs = (String[]) configurations.toArray(new String[configurations.size()]); + } + } + + private boolean resolveWithPrevious() throws ParseException, IOException { + all = new LinkedHashSet(); + problemMessages = new ArrayList(); + // we check if all required configurations have been + // resolved + boolean parsingOk = true; + for (int i = 0; i < confs.length && parsingOk; i++) { + File report = ivy.getResolutionCacheManager().getConfigurationResolveReportInCache( + ResolveOptions.getDefaultResolveId(md), confs[i]); + parsingOk = false; + if (report.exists()) { + // found a report, try to parse it. + try { + XmlReportParser parser = new XmlReportParser(); + parser.parse(report); + all.addAll(Arrays.asList(parser.getArtifactReports())); + parsingOk = true; + findAllArtifactOnRefresh(parser); + } catch (ParseException e) { + Message.info("\n\nIVYDE: Error while parsing the report " + report + + ". Falling back by doing a resolve again."); + // it fails, so let's try resolving + } + } + } + if (!parsingOk) { + // no resolve previously done for at least one conf... we do it now + return resolve(); + } + return true; + } + + private boolean resolve() throws ParseException, IOException { + ResolveOptions resolveOption = new ResolveOptions().setConfs(confs); + resolveOption.setValidate(ivy.getSettings().doValidate()); + ResolveReport report = ivy.resolve(md, resolveOption); + problemMessages = report.getAllProblemMessages(); + all = new LinkedHashSet(Arrays.asList(report.getArtifactsReports(null, false))); + confs = report.getConfigurations(); + artifactsByDependency.putAll(getArtifactsByDependency(report)); + if (monitor.isCanceled()) { + status = Status.CANCEL_STATUS; + return false; + } + maybeRetrieve(); + return true; + } + + /** + * Populate the map of artifact. The map should be populated by metadata in cache as this is + * called in the refresh process. + * + * @param parser + * @throws ParseException + */ + private void findAllArtifactOnRefresh(XmlReportParser parser) throws ParseException { + ModuleRevisionId[] dependencyMrdis = parser.getDependencyRevisionIds(); + for (int iDep = 0; iDep < dependencyMrdis.length; iDep++) { + DependencyResolver depResolver = ivy.getSettings().getResolver(dependencyMrdis[iDep]); + DefaultDependencyDescriptor depDescriptor = new DefaultDependencyDescriptor( + dependencyMrdis[iDep], false); + ResolveOptions options = new ResolveOptions(); + options.setRefresh(true); + options.setUseCacheOnly(true); + ResolvedModuleRevision dependency = depResolver.getDependency(depDescriptor, + new ResolveData(ivy.getResolveEngine(), options)); + if (dependency != null) { + artifactsByDependency.put(dependencyMrdis[iDep], dependency.getDescriptor() + .getAllArtifacts()); + } + } + } + + /** + * Trigger a warn if there are duplicates entries due to configuration conflict. + *

+ * TODO: the algorithm can be more clever and find which configuration are conflicting. + * + */ + private void warnIfDuplicates(IvyClasspathContainerMapper mapper) { + ArtifactDownloadReport[] reports = (ArtifactDownloadReport[]) all + .toArray(new ArtifactDownloadReport[all.size()]); + + Set duplicates = new HashSet(); + + for (int i = 0; i < reports.length - 1; i++) { + if (!mapper.accept(reports[i].getArtifact())) { + continue; + } + + ModuleRevisionId mrid1 = reports[i].getArtifact().getModuleRevisionId(); + + for (int j = i + 1; j < reports.length; j++) { + if (!mapper.accept(reports[j].getArtifact())) { + continue; + } + ModuleRevisionId mrid2 = reports[j].getArtifact().getModuleRevisionId(); + if (mrid1.getModuleId().equals(mrid2.getModuleId()) + && !mrid1.getRevision().equals(mrid2.getRevision())) { + duplicates.add(mrid1.getModuleId()); + break; + } + } + } + + if (duplicates.isEmpty()) { + return; + } + + StringBuffer buffer = new StringBuffer("There are some duplicates entries due to conflicts" + + " between the resolved configurations " + conf.getConfs()); + buffer.append(":\n - "); + Iterator it = duplicates.iterator(); + while (it.hasNext()) { + buffer.append(it.next()); + if (it.hasNext()) { + buffer.append("\n - "); + } + } + ivy.getLoggerEngine().log(buffer.toString(), Message.MSG_WARN); + } + + private void maybeRetrieve() throws IOException { + if (!conf.getInheritedDoRetrieve()) { + return; + } + if (FakeProjectManager.isFake(conf.getJavaProject())) { + return; + } + String pattern = conf.getJavaProject().getProject().getLocation().toPortableString() + "/" + + conf.getInheritedRetrievePattern(); + monitor.setTaskName("retrieving dependencies in " + pattern); + RetrieveOptions c = new RetrieveOptions(); + c.setSync(conf.getInheritedRetrieveSync()); + c.setConfs(conf.getInheritedRetrieveConfs().split(",")); + String inheritedRetrieveTypes = conf.getInheritedRetrieveTypes(); + if (inheritedRetrieveTypes != null && !inheritedRetrieveTypes.equals("*")) { + c.setArtifactFilter(new ArtifactTypeFilter(IvyClasspathUtil + .split(inheritedRetrieveTypes))); + } + ivy.retrieve(md.getModuleRevisionId(), pattern, c); + } + + private Map/* */getArtifactsByDependency(ResolveReport r) { + Map result = new HashMap(); + for (Iterator it = r.getDependencies().iterator(); it.hasNext();) { + IvyNode node = (IvyNode) it.next(); + if (node.getDescriptor() != null) { + result.put(node.getResolvedId(), node.getDescriptor().getAllArtifacts()); + } + } + return result; + } + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java?rev=814877&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java Mon Sep 14 21:47:44 2009 @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.ivyde.eclipse.cpcontainer; + +import java.util.List; + +/** + * This class is just a simple bean defining the properties which configure an IvyDE classpath + * container. + */ +public class IvySettingsSetup { + + private String ivySettingsPath; + + private List/* */propertyFiles; + + private boolean loadSettingsOnDemand = false; + + /** + * Default constructor + */ + public IvySettingsSetup() { + // default constructor + } + + public void set(IvySettingsSetup setup) { + this.ivySettingsPath = setup.ivySettingsPath; + this.propertyFiles = setup.propertyFiles; + this.loadSettingsOnDemand = setup.loadSettingsOnDemand; + } + + public String getIvySettingsPath() { + return ivySettingsPath; + } + + public void setIvySettingsPath(String ivySettingsPath) { + this.ivySettingsPath = ivySettingsPath; + } + + public List getPropertyFiles() { + return propertyFiles; + } + + public void setPropertyFiles(List propertyFiles) { + this.propertyFiles = propertyFiles; + } + + public boolean isLoadSettingsOnDemand() { + return loadSettingsOnDemand; + } + + public void setLoadSettingsOnDemand(boolean loadSettingsOnDemand) { + this.loadSettingsOnDemand = loadSettingsOnDemand; + } + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java ------------------------------------------------------------------------------ svn:mime-type = text/plain 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=814877&r1=814876&r2=814877&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 Mon Sep 14 21:47:44 2009 @@ -23,6 +23,7 @@ import java.util.List; import org.apache.ivy.core.module.descriptor.ModuleDescriptor; +import org.apache.ivyde.eclipse.FakeProjectManager; import org.apache.ivyde.eclipse.IvyDEException; import org.apache.ivyde.eclipse.IvyPlugin; import org.apache.ivyde.eclipse.ui.AcceptedSuffixesTypesComposite; @@ -38,10 +39,14 @@ import org.apache.ivyde.eclipse.ui.preferences.RetrievePreferencePage; import org.apache.ivyde.eclipse.ui.preferences.SettingsPreferencePage; import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; +import org.eclipse.jdt.core.IClasspathAttribute; +import org.eclipse.jdt.core.IClasspathContainer; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.wizards.IClasspathContainerPage; import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension; import org.eclipse.jdt.ui.wizards.NewElementWizardPage; @@ -61,6 +66,9 @@ import org.eclipse.swt.widgets.TabItem; import org.eclipse.ui.dialogs.PreferencesUtil; +/** + * Editor of the classpath container configuration at the project level. + */ public class IvydeContainerPage extends NewElementWizardPage implements IClasspathContainerPage, IClasspathContainerPageExtension { @@ -98,12 +106,14 @@ private Link retrieveGeneralSettingsLink; - private boolean exported; + private boolean exported = false; private String oldIvyFile = null; private List oldConfs = null; + private IvyClasspathContainerState state; + /** * Constructor */ @@ -147,18 +157,19 @@ IvyClasspathContainerConfiguration cpc = ivycp.getConf(); // first check that this is not the one we are editing - if (oldIvyFile != null && cpc.ivyXmlPath.equals(oldIvyFile) && oldConfs != null - && oldConfs.size() == cpc.confs.size() && oldConfs.containsAll(cpc.confs)) { + if (oldIvyFile != null && cpc.getIvyXmlPath().equals(oldIvyFile) && oldConfs != null + && oldConfs.size() == cpc.getConfs().size() + && oldConfs.containsAll(cpc.getConfs())) { continue; } - if (cpc.ivyXmlPath.equals(ivyFilePath)) { + if (cpc.getIvyXmlPath().equals(ivyFilePath)) { if (selectedConfigurations.isEmpty() || selectedConfigurations.contains("*") - || cpc.confs.isEmpty() || cpc.confs.contains("*")) { + || cpc.getConfs().isEmpty() || cpc.getConfs().contains("*")) { error = "A container already exists for the selected conf of " + "the module descriptor"; } else { - ArrayList list = new ArrayList(cpc.confs); + ArrayList list = new ArrayList(cpc.getConfs()); list.retainAll(selectedConfigurations); if (!list.isEmpty()) { error = "A container already exists for the selected conf of " @@ -174,7 +185,7 @@ void checkIvyXmlPath() { ModuleDescriptor md; try { - md = conf.getModuleDescriptor(); + md = state.getModuleDescriptor(); ivyFilePathText.setIvyXmlError(null); } catch (IvyDEException e) { md = null; @@ -185,54 +196,50 @@ } public boolean finish() { - conf.confs = confTableViewer.getSelectedConfigurations(); - if (conf.confs.isEmpty()) { - conf.confs = Collections.singletonList("*"); + List confs = confTableViewer.getSelectedConfigurations(); + if (confs.isEmpty()) { + confs = Collections.singletonList("*"); } + conf.setConfs(confs); if (settingsProjectSpecificButton.getSelection()) { - conf.isSettingsSpecific = true; - conf.ivySettingsPath = settingsEditor.getSettingsPath(); - conf.loadSettingsOnDemand = settingsEditor.getLoadOnDemand(); - conf.propertyFiles = settingsEditor.getPropertyFiles(); - conf.acceptedTypes = acceptedSuffixesTypesComposite.getAcceptedTypes(); - conf.sourceTypes = acceptedSuffixesTypesComposite.getSourcesTypes(); - conf.javadocTypes = acceptedSuffixesTypesComposite.getJavadocTypes(); - conf.sourceSuffixes = acceptedSuffixesTypesComposite.getSourceSuffixes(); - conf.javadocSuffixes = acceptedSuffixesTypesComposite.getJavadocSuffixes(); - conf.doRetrieve = retrieveComposite.isRetrieveEnabled(); - conf.retrievePattern = retrieveComposite.getRetrievePattern(); - conf.retrieveSync = retrieveComposite.isSyncEnabled(); - conf.retrieveConfs = retrieveComposite.getRetrieveConfs(); - conf.retrieveTypes = retrieveComposite.getRetrieveTypes(); - conf.alphaOrder = alphaOrderCheck.getSelectionIndex() == 1; - conf.resolveInWorkspace = resolveInWorkspaceCheck.getSelection(); + conf.setSettingsProjectSpecific(true); + conf.setIvySettingsSetup(settingsEditor.getIvySettingsSetup()); } else { - conf.isSettingsSpecific = false; + conf.setSettingsProjectSpecific(false); } if (retrieveProjectSpecificButton.getSelection()) { - conf.isRetrieveProjectSpecific = true; - conf.doRetrieve = retrieveComposite.isRetrieveEnabled(); - conf.retrievePattern = retrieveComposite.getRetrievePattern(); - conf.retrieveSync = retrieveComposite.isSyncEnabled(); - conf.retrieveConfs = retrieveComposite.getRetrieveConfs(); - conf.retrieveTypes = retrieveComposite.getRetrieveTypes(); + conf.setRetrieveProjectSpecific(true); + conf.setRetrieveSetup(retrieveComposite.getRetrieveSetup()); } else { - conf.isRetrieveProjectSpecific = false; + conf.setRetrieveProjectSpecific(false); } if (advancedProjectSpecificButton.getSelection()) { - conf.isAdvancedProjectSpecific = true; - conf.acceptedTypes = acceptedSuffixesTypesComposite.getAcceptedTypes(); - conf.sourceTypes = acceptedSuffixesTypesComposite.getSourcesTypes(); - conf.javadocTypes = acceptedSuffixesTypesComposite.getJavadocTypes(); - conf.sourceSuffixes = acceptedSuffixesTypesComposite.getSourceSuffixes(); - conf.javadocSuffixes = acceptedSuffixesTypesComposite.getJavadocSuffixes(); - conf.alphaOrder = alphaOrderCheck.getSelectionIndex() == 1; - conf.resolveInWorkspace = resolveInWorkspaceCheck.getSelection(); + conf.setAdvancedProjectSpecific(true); + conf + .setContainerMappingSetup(acceptedSuffixesTypesComposite + .getContainerMappingSetup()); + conf.setAlphaOrder(alphaOrderCheck.getSelectionIndex() == 1); + conf.setResolveInWorkspace(resolveInWorkspaceCheck.getSelection()); } else { - conf.isAdvancedProjectSpecific = false; + conf.setAdvancedProjectSpecific(false); + } + + IPath path = IvyClasspathContainerConfAdapter.getPath(conf); + IClasspathAttribute[] atts = IvyClasspathContainerConfAdapter.getAttributes(conf); + + entry = JavaCore.newContainerEntry(path, null, atts, exported); + + try { + IvyClasspathContainer ivycp = new IvyClasspathContainer(project, path, + new IClasspathEntry[0], atts); + JavaCore.setClasspathContainer(path, new IJavaProject[] {project}, + new IClasspathContainer[] {ivycp}, null); + ivycp.launchResolve(false, true, null); + } catch (JavaModelException e) { + IvyPlugin.log(e); } - entry = JavaCore.newContainerEntry(conf.getPath(), exported); + return true; } @@ -245,21 +252,30 @@ } public void setSelection(IClasspathEntry entry) { + checkProject(); if (entry == null) { conf = new IvyClasspathContainerConfiguration(project, "ivy.xml", true); - exported = false; } else { - conf = new IvyClasspathContainerConfiguration(project, entry.getPath(), true); + conf = new IvyClasspathContainerConfiguration(project, entry.getPath(), true, entry + .getExtraAttributes()); exported = entry.isExported(); } - oldIvyFile = conf.ivyXmlPath; - oldConfs = conf.confs; + state = new IvyClasspathContainerState(conf); + oldIvyFile = conf.getIvyXmlPath(); + oldConfs = conf.getConfs(); } public void setSelection(IFile ivyfile) { + checkProject(); conf = new IvyClasspathContainerConfiguration(project, ivyfile.getProjectRelativePath() .toString(), true); - exported = false; + state = new IvyClasspathContainerState(conf); + } + + private void checkProject() { + if (project == null) { + project = FakeProjectManager.createPlaceholderProject(); + } } public void createControl(Composite parent) { @@ -309,7 +325,7 @@ settingsProjectSpecificButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateFieldsStatusSettings(); - conf.ivySettingsPath = settingsEditor.getSettingsPath(); + conf.setIvySettingsSetup(settingsEditor.getIvySettingsSetup()); settingsUpdated(); } }); @@ -337,8 +353,8 @@ settingsEditor = new SettingsEditor(configComposite, SWT.NONE); settingsEditor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 3, 1)); settingsEditor.addListener(new SettingsEditorListener() { - public void settingsEditorUpdated(String path) { - conf.ivySettingsPath = path; + public void settingsEditorUpdated(IvySettingsSetup setup) { + conf.setIvySettingsSetup(setup); settingsUpdated(); } }); @@ -354,7 +370,7 @@ ivyFilePathText = new IvyFilePathText(configComposite, SWT.NONE, project); ivyFilePathText.addListener(new IvyXmlPathListener() { public void ivyXmlPathUpdated(String path) { - conf.ivyXmlPath = path; + conf.setIvyXmlPath(path); checkIvyXmlPath(); } }); @@ -382,7 +398,7 @@ public void widgetSelected(SelectionEvent ev) { ModuleDescriptor md; try { - md = conf.getModuleDescriptor(); + md = state.getModuleDescriptor(); } catch (IvyDEException e) { md = null; e.show(IStatus.ERROR, "Ivy configuration error", @@ -500,8 +516,8 @@ void settingsUpdated() { try { - conf.ivySettingsLastModified = -1; - conf.getIvy(); + state.setIvySettingsLastModified(-1); + state.getIvy(); settingsEditor.setSettingsError(null); checkIvyXmlPath(); } catch (IvyDEException e) { @@ -510,41 +526,35 @@ } private void loadFromConf() { - ivyFilePathText.init(conf.ivyXmlPath); - confTableViewer.init(conf.confs); + ivyFilePathText.init(conf.getIvyXmlPath()); + confTableViewer.init(conf.getConfs()); IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper(); if (conf.isSettingsProjectSpecific()) { settingsProjectSpecificButton.setSelection(true); - settingsEditor - .init(conf.ivySettingsPath, conf.propertyFiles, conf.loadSettingsOnDemand); + settingsEditor.init(conf.getIvySettingsSetup()); } else { settingsProjectSpecificButton.setSelection(false); - settingsEditor.init(helper.getIvySettingsPath(), helper.getPropertyFiles(), helper - .getLoadSettingsOnDemand()); + settingsEditor.init(helper.getIvySettingsSetup()); } if (conf.isRetrieveProjectSpecific()) { retrieveProjectSpecificButton.setSelection(true); - retrieveComposite.init(conf.doRetrieve, conf.retrievePattern, conf.retrieveConfs, - conf.retrieveTypes, conf.retrieveSync); + retrieveComposite.init(conf.getRetrieveSetup()); } else { retrieveProjectSpecificButton.setSelection(false); - retrieveComposite.init(helper.getDoRetrieve(), helper.getRetrievePattern(), helper - .getRetrieveConfs(), helper.getRetrieveTypes(), helper.getRetrieveSync()); + retrieveComposite.init(helper.getRetrieveSetup()); } if (conf.isAdvancedProjectSpecific()) { advancedProjectSpecificButton.setSelection(true); - acceptedSuffixesTypesComposite.init(conf.acceptedTypes, conf.sourceTypes, - conf.sourceSuffixes, conf.javadocTypes, conf.javadocSuffixes); - alphaOrderCheck.select(conf.alphaOrder ? 1 : 0); - resolveInWorkspaceCheck.setSelection(this.conf.resolveInWorkspace); + acceptedSuffixesTypesComposite.init(conf.getContainerMappingSetup()); + alphaOrderCheck.select(conf.isAlphaOrder() ? 1 : 0); + resolveInWorkspaceCheck.setSelection(conf.isResolveInWorkspace()); } else { advancedProjectSpecificButton.setSelection(false); - acceptedSuffixesTypesComposite.init(helper.getAcceptedTypes(), helper.getSourceTypes(), - helper.getSourceSuffixes(), helper.getJavadocTypes(), helper.getJavadocSuffixes()); + acceptedSuffixesTypesComposite.init(helper.getContainerMappingSetup()); alphaOrderCheck.select(helper.isAlphOrder() ? 1 : 0); resolveInWorkspaceCheck.setSelection(helper.isResolveInWorkspace()); } Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java?rev=814877&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java Mon Sep 14 21:47:44 2009 @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.ivyde.eclipse.cpcontainer; + +/** + * This class is just a simple bean defining the properties which configure an IvyDE classpath + * container. + */ +public class RetrieveSetup { + + private boolean doRetrieve; + + private String retrievePattern; + + private boolean retrieveSync = false; + + private String retrieveConfs = "*"; + + private String retrieveTypes = "*"; + + /** + * Default constructor + */ + public RetrieveSetup() { + // default constructor + } + + public void set(RetrieveSetup setup) { + this.doRetrieve = setup.doRetrieve; + this.retrievePattern = setup.retrievePattern; + this.retrieveConfs = setup.retrieveConfs; + this.retrieveTypes = setup.retrieveTypes; + } + + public boolean isDoRetrieve() { + return doRetrieve; + } + + public void setDoRetrieve(boolean doRetrieve) { + this.doRetrieve = doRetrieve; + } + + public String getRetrievePattern() { + return retrievePattern; + } + + public void setRetrievePattern(String retrievePattern) { + this.retrievePattern = retrievePattern; + } + + public boolean isRetrieveSync() { + return retrieveSync; + } + + public void setRetrieveSync(boolean retrieveSync) { + this.retrieveSync = retrieveSync; + } + + public String getRetrieveConfs() { + return retrieveConfs; + } + + public void setRetrieveConfs(String retrieveConfs) { + this.retrieveConfs = retrieveConfs; + } + + public String getRetrieveTypes() { + return retrieveTypes; + } + + public void setRetrieveTypes(String retrieveTypes) { + this.retrieveTypes = retrieveTypes; + } + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/AcceptedSuffixesTypesComposite.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/AcceptedSuffixesTypesComposite.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/AcceptedSuffixesTypesComposite.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/AcceptedSuffixesTypesComposite.java Mon Sep 14 21:47:44 2009 @@ -17,9 +17,7 @@ */ package org.apache.ivyde.eclipse.ui; -import java.util.Collection; -import java.util.List; - +import org.apache.ivyde.eclipse.cpcontainer.ContainerMappingSetup; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -47,9 +45,9 @@ private Text acceptedTypesText; - private Text sourcesTypesText; + private Text sourceTypesText; - private Text sourcesSuffixesText; + private Text sourceSuffixesText; private Text javadocTypesText; @@ -72,17 +70,17 @@ label = new Label(this, SWT.NONE); label.setText("Sources types:"); - sourcesTypesText = new Text(this, SWT.SINGLE | SWT.BORDER); - sourcesTypesText + sourceTypesText = new Text(this, SWT.SINGLE | SWT.BORDER); + sourceTypesText .setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false)); - sourcesTypesText.setToolTipText(TOOLTIP_SOURCE_TYPES); + sourceTypesText.setToolTipText(TOOLTIP_SOURCE_TYPES); label = new Label(this, SWT.NONE); label.setText("Sources suffixes:"); - sourcesSuffixesText = new Text(this, SWT.SINGLE | SWT.BORDER); - sourcesSuffixesText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); - sourcesSuffixesText.setToolTipText(TOOLTIP_SOURCE_SUFFIXES); + sourceSuffixesText = new Text(this, SWT.SINGLE | SWT.BORDER); + sourceSuffixesText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); + sourceSuffixesText.setToolTipText(TOOLTIP_SOURCE_SUFFIXES); label = new Label(this, SWT.NONE); label.setText("Javadoc types:"); @@ -99,48 +97,30 @@ javadocSuffixesText.setToolTipText(TOOLTIP_JAVADOC_SUFFIXES); } - public void init(Collection acceptedTypes, Collection sourceTypes, Collection sourceSuffixes, - Collection javadocTypes, Collection javadocSuffixes) { - init(IvyClasspathUtil.concat(acceptedTypes), IvyClasspathUtil.concat(sourceTypes), - IvyClasspathUtil.concat(sourceSuffixes), IvyClasspathUtil.concat(javadocTypes), - IvyClasspathUtil.concat(javadocSuffixes)); - } - - public void init(String acceptedTypes, String sourceTypes, String sourceSuffixes, - String javadocTypes, String javadocSuffixes) { - acceptedTypesText.setText(acceptedTypes); - sourcesTypesText.setText(sourceTypes); - sourcesSuffixesText.setText(sourceSuffixes); - javadocTypesText.setText(javadocTypes); - javadocSuffixesText.setText(javadocSuffixes); + public void init(ContainerMappingSetup setup) { + acceptedTypesText.setText(IvyClasspathUtil.concat(setup.getAcceptedTypes())); + sourceTypesText.setText(IvyClasspathUtil.concat(setup.getSourceTypes())); + sourceSuffixesText.setText(IvyClasspathUtil.concat(setup.getSourceSuffixes())); + javadocTypesText.setText(IvyClasspathUtil.concat(setup.getJavadocTypes())); + javadocSuffixesText.setText(IvyClasspathUtil.concat(setup.getJavadocSuffixes())); } public void setEnabled(boolean enabled) { super.setEnabled(enabled); acceptedTypesText.setEnabled(enabled); - sourcesTypesText.setEnabled(enabled); - sourcesSuffixesText.setEnabled(enabled); + sourceTypesText.setEnabled(enabled); + sourceSuffixesText.setEnabled(enabled); javadocTypesText.setEnabled(enabled); javadocSuffixesText.setEnabled(enabled); } - public List getAcceptedTypes() { - return IvyClasspathUtil.split(acceptedTypesText.getText()); - } - - public List getSourcesTypes() { - return IvyClasspathUtil.split(sourcesTypesText.getText()); - } - - public List getJavadocTypes() { - return IvyClasspathUtil.split(javadocTypesText.getText()); - } - - public List getSourceSuffixes() { - return IvyClasspathUtil.split(sourcesSuffixesText.getText()); - } - - public List getJavadocSuffixes() { - return IvyClasspathUtil.split(javadocSuffixesText.getText()); + public ContainerMappingSetup getContainerMappingSetup() { + ContainerMappingSetup setup = new ContainerMappingSetup(); + setup.setAcceptedTypes(IvyClasspathUtil.split(acceptedTypesText.getText())); + setup.setSourceTypes(IvyClasspathUtil.split(sourceTypesText.getText())); + setup.setJavadocTypes(IvyClasspathUtil.split(javadocTypesText.getText())); + setup.setSourceSuffixes(IvyClasspathUtil.split(sourceSuffixesText.getText())); + setup.setJavadocSuffixes(IvyClasspathUtil.split(javadocSuffixesText.getText())); + return setup; } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java Mon Sep 14 21:47:44 2009 @@ -166,7 +166,7 @@ private class BrowseButtonListener extends SelectionAdapter { public void widgetSelected(SelectionEvent e) { String path = null; - if (project != null) { + if (project != null && project.getProject().getLocation() != null) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display .getDefault().getActiveShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/NewIvyDEContainerWizard.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/NewIvyDEContainerWizard.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/NewIvyDEContainerWizard.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/NewIvyDEContainerWizard.java Mon Sep 14 21:47:44 2009 @@ -17,7 +17,6 @@ */ package org.apache.ivyde.eclipse.ui; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -27,7 +26,6 @@ import org.apache.ivyde.eclipse.cpcontainer.IvydeContainerPage; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; import org.eclipse.jdt.core.IClasspathContainer; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; @@ -56,7 +54,7 @@ IJavaProject project = containerPage.getProject(); try { IvyClasspathContainer ivycp = new IvyClasspathContainer(project, path, - new IClasspathEntry[0]); + new IClasspathEntry[0], null); JavaCore.setClasspathContainer(path, new IJavaProject[] {project}, new IClasspathContainer[] {ivycp}, null); IClasspathEntry[] entries = project.getRawClasspath(); @@ -69,9 +67,6 @@ } catch (JavaModelException e) { IvyPlugin.log(e); return false; - } catch (IOException e) { - IvyPlugin.log(IStatus.ERROR, "", e); - return false; } return true; } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java Mon Sep 14 21:47:44 2009 @@ -17,6 +17,7 @@ */ package org.apache.ivyde.eclipse.ui; +import org.apache.ivyde.eclipse.cpcontainer.RetrieveSetup; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -90,7 +91,7 @@ typesText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); typesText.setEnabled(doRetrieveButton.getSelection()); typesText.setToolTipText(TOOLTIP_RETRIEVE_TYPES); - + doRetrieveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { retrievePatternText.setEnabled(doRetrieveButton.getSelection()); @@ -101,32 +102,22 @@ }); } - public boolean isRetrieveEnabled() { - return doRetrieveButton.getSelection(); - } - - public boolean isSyncEnabled() { - return retrieveSyncButton.getSelection(); - } - - public String getRetrievePattern() { - return retrievePatternText.getText(); - } - - public String getRetrieveConfs() { - return confsText.getText(); - } - - public String getRetrieveTypes() { - return typesText.getText(); - } - - public void init(boolean doRetrieve, String retrievePattern, String confs, String types, boolean retrieveSync) { - doRetrieveButton.setSelection(doRetrieve); - retrievePatternText.setText(retrievePattern); - retrieveSyncButton.setSelection(retrieveSync); - confsText.setText(confs); - typesText.setText(types); + public RetrieveSetup getRetrieveSetup() { + RetrieveSetup setup = new RetrieveSetup(); + setup.setDoRetrieve(doRetrieveButton.getSelection()); + setup.setRetrieveSync(retrieveSyncButton.getSelection()); + setup.setRetrievePattern(retrievePatternText.getText()); + setup.setRetrieveConfs(confsText.getText()); + setup.setRetrieveTypes(typesText.getText()); + return setup; + } + + public void init(RetrieveSetup setup) { + doRetrieveButton.setSelection(setup.isDoRetrieve()); + retrievePatternText.setText(setup.getRetrievePattern()); + retrieveSyncButton.setSelection(setup.isRetrieveSync()); + confsText.setText(setup.getRetrieveConfs()); + typesText.setText(setup.getRetrieveTypes()); setEnabled(true); } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java Mon Sep 14 21:47:44 2009 @@ -26,6 +26,7 @@ import org.apache.ivyde.eclipse.IvyDEException; import org.apache.ivyde.eclipse.IvyPlugin; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; +import org.apache.ivyde.eclipse.cpcontainer.IvySettingsSetup; import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.fieldassist.DecoratedField; import org.eclipse.jface.fieldassist.FieldDecoration; @@ -47,13 +48,13 @@ public class SettingsEditor extends Composite { - public static final String TOOLTIP_SETTINGS_PATH = "The url where your ivysettings file can be found. \n" - + "Leave it empty to reference the default ivy settings. \n" + public static final String TOOLTIP_SETTINGS_PATH = "The url where your ivysettings file can be" + + " found. \nLeave it empty to reference the default ivy settings. \n" + "Relative paths are handled relative to the project.\n" + " Example: 'project:///ivysettings.xml' or 'project://myproject/ivysettings.xml'."; - public static final String TOOLTIP_PROPERTY_FILES = "Comma separated list of build property files.\n" - + "Example: build.properties, override.properties"; + public static final String TOOLTIP_PROPERTY_FILES = "Comma separated list of build property" + + " files.\nExample: build.properties, override.properties"; private Text settingsText; @@ -85,8 +86,8 @@ FieldDecorationRegistry.DEC_ERROR); settingsTextDeco = new DecoratedField(this, SWT.LEFT | SWT.TOP, new IControlCreator() { - public Control createControl(Composite parent, int style) { - return new Text(parent, SWT.SINGLE | SWT.BORDER); + public Control createControl(Composite p, int s) { + return new Text(p, SWT.SINGLE | SWT.BORDER); } }); settingsTextDeco.addFieldDecoration(errorDecoration, SWT.TOP | SWT.LEFT, false); @@ -153,20 +154,16 @@ }); } - public String getSettingsPath() { - return settingsText.getText(); - } - - public boolean getLoadOnDemand() { - return loadOnDemandButton.getSelection(); - } - - public List getPropertyFiles() { - return IvyClasspathUtil.split(propFilesText.getText()); + public IvySettingsSetup getIvySettingsSetup() { + IvySettingsSetup setup = new IvySettingsSetup(); + setup.setIvySettingsPath(settingsText.getText()); + setup.setLoadSettingsOnDemand(loadOnDemandButton.getSelection()); + setup.setPropertyFiles(IvyClasspathUtil.split(propFilesText.getText())); + return setup; } public interface SettingsEditorListener { - void settingsEditorUpdated(String path); + void settingsEditorUpdated(IvySettingsSetup setup); } public void addListener(SettingsEditorListener listener) { @@ -183,9 +180,10 @@ void settingsPathUpdated() { synchronized (listeners) { + IvySettingsSetup setup = getIvySettingsSetup(); Iterator it = listeners.iterator(); while (it.hasNext()) { - ((SettingsEditorListener) it.next()).settingsEditorUpdated(settingsText.getText()); + ((SettingsEditorListener) it.next()).settingsEditorUpdated(setup); } } } @@ -230,14 +228,10 @@ return null; } - public void init(String ivySettingsPath, String propertyFiles, boolean loadOnDemand) { - settingsText.setText(ivySettingsPath); - propFilesText.setText(propertyFiles); - loadOnDemandButton.setSelection(loadOnDemand); - } - - public void init(String ivySettingsPath, List propertyFiles, boolean loadOnDemand) { - init(ivySettingsPath, IvyClasspathUtil.concat(propertyFiles), loadOnDemand); + public void init(IvySettingsSetup setup) { + settingsText.setText(setup.getIvySettingsPath()); + propFilesText.setText(IvyClasspathUtil.concat(setup.getPropertyFiles())); + loadOnDemandButton.setSelection(setup.isLoadSettingsOnDemand()); } public void setEnabled(boolean enabled) { Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java Mon Sep 14 21:47:44 2009 @@ -33,7 +33,7 @@ protected void fill(Menu menu, IvyClasspathContainer ivycp) { try { - fill(menu, ivycp.getConf().getIvy()); + fill(menu, ivycp.getState().getIvy()); } catch (IvyDEException e) { e.log(IStatus.WARNING, "Cache delection actions in the context menu could not be populated. "); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java Mon Sep 14 21:47:44 2009 @@ -17,6 +17,7 @@ */ package org.apache.ivyde.eclipse.ui.actions; +import org.apache.ivyde.eclipse.FakeProjectManager; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainerConfiguration; import org.eclipse.core.resources.IFile; @@ -42,7 +43,7 @@ public void run(IAction action) { IvyClasspathContainerConfiguration conf = cp.getConf(); - if (conf.getJavaProject() == null) { + if (FakeProjectManager.isFake(conf.getJavaProject())) { return; } IFile file = conf.getJavaProject().getProject().getFile(conf.getIvyXmlPath()); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java Mon Sep 14 21:47:44 2009 @@ -65,7 +65,7 @@ return null; } try { - return ivycp.getConf().getIvy(); + return ivycp.getState().getIvy(); } catch (IvyDEException e) { e.log(IStatus.WARNING, null); return null; Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/ClasspathPreferencePage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/ClasspathPreferencePage.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/ClasspathPreferencePage.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/ClasspathPreferencePage.java Mon Sep 14 21:47:44 2009 @@ -34,7 +34,8 @@ public class ClasspathPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { /** the ID of the preference page */ - public static final String PEREFERENCE_PAGE_ID = "org.apache.ivyde.eclipse.ui.preferences.ClasspathPreferencePage"; + public static final String PEREFERENCE_PAGE_ID = + "org.apache.ivyde.eclipse.ui.preferences.ClasspathPreferencePage"; private Button resolveInWorkspaceCheck; @@ -88,29 +89,20 @@ IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper(); resolveInWorkspaceCheck.setSelection(helper.isResolveInWorkspace()); alphaOrderCheck.select(helper.isAlphOrder() ? 1 : 0); - acceptedSuffixesTypesComposite.init(helper.getAcceptedTypes(), helper.getSourceTypes(), - helper.getSourceSuffixes(), helper.getJavadocTypes(), helper.getJavadocSuffixes()); + acceptedSuffixesTypesComposite.init(helper.getContainerMappingSetup()); } public boolean performOk() { IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper(); helper.setResolveInWorkspace(resolveInWorkspaceCheck.getSelection()); helper.setAlphOrder(alphaOrderCheck.getSelectionIndex() == 1); - helper.setAcceptedTypes(acceptedSuffixesTypesComposite.getAcceptedTypes()); - helper.setSourceTypes(acceptedSuffixesTypesComposite.getSourcesTypes()); - helper.setSourceSuffixes(acceptedSuffixesTypesComposite.getSourceSuffixes()); - helper.setJavadocTypes(acceptedSuffixesTypesComposite.getJavadocTypes()); - helper.setJavadocSuffixes(acceptedSuffixesTypesComposite.getJavadocSuffixes()); + helper.setContainerMappingSetup(acceptedSuffixesTypesComposite.getContainerMappingSetup()); return true; } protected void performDefaults() { resolveInWorkspaceCheck.setSelection(PreferenceInitializer.DEFAULT_RESOLVE_IN_WORKSPACE); alphaOrderCheck.select(PreferenceInitializer.DEFAULT_ALPHABETICAL_ORDER ? 1 : 0); - acceptedSuffixesTypesComposite.init(PreferenceInitializer.DEFAULT_ACCEPTED_TYPES, - PreferenceInitializer.DEFAULT_SOURCES_TYPES, - PreferenceInitializer.DEFAULT_SOURCES_SUFFIXES, - PreferenceInitializer.DEFAULT_JAVADOC_TYPES, - PreferenceInitializer.DEFAULT_JAVADOC_SUFFIXES); + acceptedSuffixesTypesComposite.init(PreferenceInitializer.DEFAULT_CONTAINER_MAPPING_SETUP); } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java Mon Sep 14 21:47:44 2009 @@ -17,10 +17,10 @@ */ package org.apache.ivyde.eclipse.ui.preferences; -import java.util.Collection; -import java.util.List; - +import org.apache.ivyde.eclipse.cpcontainer.ContainerMappingSetup; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; +import org.apache.ivyde.eclipse.cpcontainer.IvySettingsSetup; +import org.apache.ivyde.eclipse.cpcontainer.RetrieveSetup; import org.eclipse.jface.preference.IPreferenceStore; public class IvyDEPreferenceStoreHelper { @@ -47,96 +47,68 @@ prefStore.setValue(PreferenceConstants.ORGANISATION_URL, url); } - public String getIvySettingsPath() { - return prefStore.getString(PreferenceConstants.IVYSETTINGS_PATH); - } - - public void setIvySettingsPath(String path) { - prefStore.setValue(PreferenceConstants.IVYSETTINGS_PATH, path); - } - - public List getAcceptedTypes() { - return IvyClasspathUtil.split(prefStore.getString(PreferenceConstants.ACCEPTED_TYPES)); - } - - public void setAcceptedTypes(Collection acceptedTypes) { - prefStore.setValue(PreferenceConstants.ACCEPTED_TYPES, IvyClasspathUtil - .concat(acceptedTypes)); - } - - public List getSourceTypes() { - return IvyClasspathUtil.split(prefStore.getString(PreferenceConstants.SOURCES_TYPES)); - } - - public void setSourceTypes(Collection sourceTypes) { - prefStore.setValue(PreferenceConstants.SOURCES_TYPES, IvyClasspathUtil.concat(sourceTypes)); - } - - public List getJavadocTypes() { - return IvyClasspathUtil.split(prefStore.getString(PreferenceConstants.JAVADOC_TYPES)); - } - - public void setJavadocTypes(Collection javadocTypes) { - prefStore - .setValue(PreferenceConstants.JAVADOC_TYPES, IvyClasspathUtil.concat(javadocTypes)); - } - - public List getSourceSuffixes() { - return IvyClasspathUtil.split(prefStore.getString(PreferenceConstants.SOURCES_SUFFIXES)); - } - - public void setSourceSuffixes(Collection sourceSuffixes) { - prefStore.setValue(PreferenceConstants.SOURCES_SUFFIXES, IvyClasspathUtil - .concat(sourceSuffixes)); - } - - public List getJavadocSuffixes() { - return IvyClasspathUtil.split(prefStore.getString(PreferenceConstants.JAVADOC_SUFFIXES)); - } - - public void setJavadocSuffixes(Collection javadocSuffixes) { - prefStore.setValue(PreferenceConstants.JAVADOC_SUFFIXES, IvyClasspathUtil - .concat(javadocSuffixes)); - } - - public boolean getDoRetrieve() { - return prefStore.getBoolean(PreferenceConstants.DO_RETRIEVE); - } - - public void setDoRetrieve(boolean doretrieve) { - prefStore.setValue(PreferenceConstants.DO_RETRIEVE, doretrieve); - } - - public String getRetrievePattern() { - return prefStore.getString(PreferenceConstants.RETRIEVE_PATTERN); - } - - public void setRetrievePattern(String pattern) { - prefStore.setValue(PreferenceConstants.RETRIEVE_PATTERN, pattern); - } - - public boolean getRetrieveSync() { - return prefStore.getBoolean(PreferenceConstants.RETRIEVE_SYNC); - } - - public void setRetrieveSync(boolean sync) { - prefStore.setValue(PreferenceConstants.RETRIEVE_SYNC, sync); - } - - public String getRetrieveConfs() { - return prefStore.getString(PreferenceConstants.RETRIEVE_CONFS); - } - - public void setRetrieveConfs(String confs) { - prefStore.setValue(PreferenceConstants.RETRIEVE_CONFS, confs); - } - - public String getRetrieveTypes() { - return prefStore.getString(PreferenceConstants.RETRIEVE_TYPES); - } - - public void setRetrieveTypes(String types) { - prefStore.setValue(PreferenceConstants.RETRIEVE_TYPES, types); + public IvySettingsSetup getIvySettingsSetup() { + IvySettingsSetup setup = new IvySettingsSetup(); + setup.setIvySettingsPath(prefStore.getString(PreferenceConstants.IVYSETTINGS_PATH)); + setup.setLoadSettingsOnDemand(prefStore + .getBoolean(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND)); + setup.setPropertyFiles(IvyClasspathUtil.split(prefStore + .getString(PreferenceConstants.PROPERTY_FILES))); + return setup; + } + + public void setIvySettingsSetup(IvySettingsSetup setup) { + prefStore.setValue(PreferenceConstants.IVYSETTINGS_PATH, setup.getIvySettingsPath()); + prefStore.setValue(PreferenceConstants.PROPERTY_FILES, IvyClasspathUtil.concat(setup + .getPropertyFiles())); + prefStore.setValue(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND, setup + .isLoadSettingsOnDemand()); + } + + public ContainerMappingSetup getContainerMappingSetup() { + ContainerMappingSetup setup = new ContainerMappingSetup(); + setup.setAcceptedTypes(IvyClasspathUtil.split(prefStore + .getString(PreferenceConstants.ACCEPTED_TYPES))); + setup.setSourceTypes(IvyClasspathUtil.split(prefStore + .getString(PreferenceConstants.SOURCES_TYPES))); + setup.setJavadocTypes(IvyClasspathUtil.split(prefStore + .getString(PreferenceConstants.JAVADOC_TYPES))); + setup.setSourceSuffixes(IvyClasspathUtil.split(prefStore + .getString(PreferenceConstants.SOURCES_SUFFIXES))); + setup.setJavadocSuffixes(IvyClasspathUtil.split(prefStore + .getString(PreferenceConstants.JAVADOC_SUFFIXES))); + return setup; + } + + public void setContainerMappingSetup(ContainerMappingSetup setup) { + prefStore.setValue(PreferenceConstants.ACCEPTED_TYPES, IvyClasspathUtil.concat(setup + .getAcceptedTypes())); + prefStore.setValue(PreferenceConstants.SOURCES_TYPES, IvyClasspathUtil.concat(setup + .getSourceTypes())); + prefStore.setValue(PreferenceConstants.JAVADOC_TYPES, IvyClasspathUtil.concat(setup + .getJavadocTypes())); + prefStore.setValue(PreferenceConstants.SOURCES_SUFFIXES, IvyClasspathUtil.concat(setup + .getSourceSuffixes())); + prefStore.setValue(PreferenceConstants.JAVADOC_SUFFIXES, IvyClasspathUtil.concat(setup + .getJavadocSuffixes())); + } + + public RetrieveSetup getRetrieveSetup() { + RetrieveSetup setup = new RetrieveSetup(); + setup.setDoRetrieve(prefStore.getBoolean(PreferenceConstants.DO_RETRIEVE)); + setup.setRetrieveConfs(prefStore.getString(PreferenceConstants.RETRIEVE_CONFS)); + setup.setRetrievePattern(prefStore.getString(PreferenceConstants.RETRIEVE_PATTERN)); + setup.setRetrieveSync(prefStore.getBoolean(PreferenceConstants.RETRIEVE_SYNC)); + setup.setRetrieveTypes(prefStore.getString(PreferenceConstants.RETRIEVE_TYPES)); + return setup; + } + + public void setRetrieveSetup(RetrieveSetup setup) { + prefStore.setValue(PreferenceConstants.DO_RETRIEVE, setup.isDoRetrieve()); + prefStore.setValue(PreferenceConstants.RETRIEVE_PATTERN, setup.getRetrievePattern()); + prefStore.setValue(PreferenceConstants.RETRIEVE_SYNC, setup.isRetrieveSync()); + prefStore.setValue(PreferenceConstants.RETRIEVE_CONFS, setup.getRetrieveConfs()); + prefStore.setValue(PreferenceConstants.RETRIEVE_TYPES, setup.getRetrieveTypes()); } public boolean isAlphOrder() { @@ -171,22 +143,6 @@ prefStore.setValue(PreferenceConstants.ORGANISATION_URL, url); } - public List getPropertyFiles() { - return IvyClasspathUtil.split(prefStore.getString(PreferenceConstants.PROPERTY_FILES)); - } - - public void setPropertyFiles(List files) { - prefStore.setValue(PreferenceConstants.PROPERTY_FILES, IvyClasspathUtil.concat(files)); - } - - public boolean getLoadSettingsOnDemand() { - return prefStore.getBoolean(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND); - } - - public void setLoadSettingsOnDemand(boolean onDemand) { - prefStore.setValue(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND, onDemand); - } - public int getResolveOnStartup() { return prefStore.getInt(PreferenceConstants.RESOLVE_ON_STARTUP); } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java Mon Sep 14 21:47:44 2009 @@ -18,6 +18,10 @@ package org.apache.ivyde.eclipse.ui.preferences; import org.apache.ivyde.eclipse.IvyPlugin; +import org.apache.ivyde.eclipse.cpcontainer.ContainerMappingSetup; +import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; +import org.apache.ivyde.eclipse.cpcontainer.IvySettingsSetup; +import org.apache.ivyde.eclipse.cpcontainer.RetrieveSetup; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.jface.preference.IPreferenceStore; @@ -26,12 +30,24 @@ */ public class PreferenceInitializer extends AbstractPreferenceInitializer { - public static final String DEFAULT_IVYSETTINGS_PATH = ""; - public static final String DEFAULT_ORGANISATION = ""; public static final String DEFAULT_ORGANISATION_URL = ""; + public static final String DEFAULT_IVYSETTINGS_PATH = ""; + + public static final String DEFAULT_PROPERTY_FILES = ""; + + public static final boolean DEFAULT_LOAD_SETTINGS_ON_DEMAND = false; + + public static final IvySettingsSetup DEFAULT_IVY_SETTINGS_SETUP = new IvySettingsSetup(); + + static { + DEFAULT_IVY_SETTINGS_SETUP.setIvySettingsPath(DEFAULT_IVYSETTINGS_PATH); + DEFAULT_IVY_SETTINGS_SETUP.setLoadSettingsOnDemand(DEFAULT_LOAD_SETTINGS_ON_DEMAND); + DEFAULT_IVY_SETTINGS_SETUP.setPropertyFiles(IvyClasspathUtil.split(DEFAULT_PROPERTY_FILES)); + } + public static final String DEFAULT_ACCEPTED_TYPES = "jar,bundle,ejb,maven-plugin"; public static final String DEFAULT_SOURCES_TYPES = "source"; @@ -42,6 +58,22 @@ public static final String DEFAULT_JAVADOC_SUFFIXES = "-javadoc,-javadocs,-doc,-docs"; + public static final ContainerMappingSetup DEFAULT_CONTAINER_MAPPING_SETUP = + new ContainerMappingSetup(); + + static { + DEFAULT_CONTAINER_MAPPING_SETUP.setAcceptedTypes(IvyClasspathUtil + .split(DEFAULT_ACCEPTED_TYPES)); + DEFAULT_CONTAINER_MAPPING_SETUP.setSourceTypes(IvyClasspathUtil + .split(DEFAULT_SOURCES_TYPES)); + DEFAULT_CONTAINER_MAPPING_SETUP.setJavadocTypes(IvyClasspathUtil + .split(DEFAULT_JAVADOC_TYPES)); + DEFAULT_CONTAINER_MAPPING_SETUP.setSourceSuffixes(IvyClasspathUtil + .split(DEFAULT_SOURCES_SUFFIXES)); + DEFAULT_CONTAINER_MAPPING_SETUP.setJavadocSuffixes(IvyClasspathUtil + .split(DEFAULT_JAVADOC_SUFFIXES)); + } + public static final boolean DEFAULT_DO_RETRIEVE = false; public static final String DEFAULT_RETRIEVE_PATTERN = "lib/[conf]/[artifact].[ext]"; @@ -52,13 +84,19 @@ public static final String DEFAULT_RETRIEVE_TYPES = "*"; - public static final boolean DEFAULT_ALPHABETICAL_ORDER = false; + public static final RetrieveSetup DEFAULT_RETRIEVE_SETUP = new RetrieveSetup(); - public static final boolean DEFAULT_RESOLVE_IN_WORKSPACE = false; + static { + DEFAULT_RETRIEVE_SETUP.setDoRetrieve(DEFAULT_DO_RETRIEVE); + DEFAULT_RETRIEVE_SETUP.setRetrievePattern(DEFAULT_RETRIEVE_PATTERN); + DEFAULT_RETRIEVE_SETUP.setRetrieveSync(DEFAULT_RETRIEVE_SYNC); + DEFAULT_RETRIEVE_SETUP.setRetrieveConfs(DEFAULT_RETRIEVE_CONFS); + DEFAULT_RETRIEVE_SETUP.setRetrieveTypes(DEFAULT_RETRIEVE_TYPES); + } - public static final String DEFAULT_PROPERTY_FILES = ""; + public static final boolean DEFAULT_ALPHABETICAL_ORDER = false; - public static final boolean DEFAULT_LOAD_SETTINGS_ON_DEMAND = false; + public static final boolean DEFAULT_RESOLVE_IN_WORKSPACE = false; public static final int DEFAULT_RESOLVE_ON_STARTUP = 1; Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/RetrievePreferencePage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/RetrievePreferencePage.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/RetrievePreferencePage.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/RetrievePreferencePage.java Mon Sep 14 21:47:44 2009 @@ -31,7 +31,8 @@ public class RetrievePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { /** the ID of the preference page */ - public static final String PEREFERENCE_PAGE_ID = "org.apache.ivyde.eclipse.ui.preferences.RetrievePreferencePage"; + public static final String PEREFERENCE_PAGE_ID = + "org.apache.ivyde.eclipse.ui.preferences.RetrievePreferencePage"; private RetrieveComposite retrieveComposite; @@ -60,25 +61,16 @@ private void initPreferences() { IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper(); - retrieveComposite.init(helper.getDoRetrieve(), helper.getRetrievePattern(), helper - .getRetrieveConfs(), helper.getRetrieveTypes(), helper.getRetrieveSync()); + retrieveComposite.init(helper.getRetrieveSetup()); } public boolean performOk() { IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper(); - helper.setDoRetrieve(retrieveComposite.isRetrieveEnabled()); - helper.setRetrievePattern(retrieveComposite.getRetrievePattern()); - helper.setRetrieveSync(retrieveComposite.isSyncEnabled()); - helper.setRetrieveConfs(retrieveComposite.getRetrieveConfs()); - helper.setRetrieveTypes(retrieveComposite.getRetrieveTypes()); + helper.setRetrieveSetup(retrieveComposite.getRetrieveSetup()); return true; } protected void performDefaults() { - retrieveComposite.init(PreferenceInitializer.DEFAULT_DO_RETRIEVE, - PreferenceInitializer.DEFAULT_RETRIEVE_PATTERN, - PreferenceInitializer.DEFAULT_RETRIEVE_CONFS, - PreferenceInitializer.DEFAULT_RETRIEVE_TYPES, - PreferenceInitializer.DEFAULT_RETRIEVE_SYNC); + retrieveComposite.init(PreferenceInitializer.DEFAULT_RETRIEVE_SETUP); } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/SettingsPreferencePage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/SettingsPreferencePage.java?rev=814877&r1=814876&r2=814877&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/SettingsPreferencePage.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/SettingsPreferencePage.java Mon Sep 14 21:47:44 2009 @@ -31,7 +31,8 @@ public class SettingsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { /** the ID of the preference page */ - public static final String PEREFERENCE_PAGE_ID = "org.apache.ivyde.eclipse.ui.preferences.SettingsPreferencePage"; + public static final String PEREFERENCE_PAGE_ID = + "org.apache.ivyde.eclipse.ui.preferences.SettingsPreferencePage"; private SettingsEditor settingsEditor; @@ -60,21 +61,16 @@ private void initPreferences() { IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper(); - settingsEditor.init(helper.getIvySettingsPath(), helper.getPropertyFiles(), helper - .getLoadSettingsOnDemand()); + settingsEditor.init(helper.getIvySettingsSetup()); } public boolean performOk() { IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper(); - helper.setIvySettingsPath(settingsEditor.getSettingsPath()); - helper.setPropertyFiles(settingsEditor.getPropertyFiles()); - helper.setLoadSettingsOnDemand(settingsEditor.getLoadOnDemand()); + helper.setIvySettingsSetup(settingsEditor.getIvySettingsSetup()); return true; } protected void performDefaults() { - settingsEditor.init(PreferenceInitializer.DEFAULT_IVYSETTINGS_PATH, - PreferenceInitializer.DEFAULT_PROPERTY_FILES, - PreferenceInitializer.DEFAULT_LOAD_SETTINGS_ON_DEMAND); + settingsEditor.init(PreferenceInitializer.DEFAULT_IVY_SETTINGS_SETUP); } } 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=814877&r1=814876&r2=814877&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 Mon Sep 14 21:47:44 2009 @@ -166,7 +166,7 @@ IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next(); ModuleDescriptor md; try { - md = ivycp.getConf().getCachedModuleDescriptor(); + md = ivycp.getState().getCachedModuleDescriptor(); } catch (IvyDEException e) { IvyPlugin.log(IStatus.WARNING, "Resolve in workspace for '" + resolvingJavaProject.getElementName() + "' cannot depend on "