You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2010/08/23 19:52:31 UTC
svn commit: r988229 - in /ant/ivy/ivyde/trunk: ./
org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/
org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/
org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ org.apa...
Author: hibou
Date: Mon Aug 23 17:52:30 2010
New Revision: 988229
URL: http://svn.apache.org/viewvc?rev=988229&view=rev
Log:
IVYDE-230 : Shared Javadoc/Source attachments
Added:
ant/ivy/ivyde/trunk/test/map-one-source/ (with props)
ant/ivy/ivyde/trunk/test/map-one-source/.classpath
ant/ivy/ivyde/trunk/test/map-one-source/.project
ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml (with props)
ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml (with props)
ant/ivy/ivyde/trunk/test/map-one-source/src/
Modified:
ant/ivy/ivyde/trunk/CHANGES.txt
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyResolver.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.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/IvyClasspathContainerMapper.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathResolver.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/AcceptedSuffixesTypesComposite.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
Modified: ant/ivy/ivyde/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/CHANGES.txt?rev=988229&r1=988228&r2=988229&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/CHANGES.txt (original)
+++ ant/ivy/ivyde/trunk/CHANGES.txt Mon Aug 23 17:52:30 2010
@@ -10,6 +10,7 @@
- IMPROVE: let IvyDE refresh workspace after a resolve (IVYDE-27) (thanks to Clint Burghduff)
- IMPROVE: IvyDE now resolve by batch, then preventing too many workspace build (IVYDE-177)
+- IMPROVE: Shared Javadoc/Source attachments (IVYDE-230) (thanks to Jason A. Guild)
- FIX: Variable based path for ivysettings doesn't work it there are some spaces in the path (IVYDE-253)
- FIX: Triggers are not called (IVYDE-244)
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyResolver.java?rev=988229&r1=988228&r2=988229&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyResolver.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyResolver.java Mon Aug 23 17:52:30 2010
@@ -72,7 +72,7 @@ public class IvyResolver {
protected String[] confs;
- private Map artifactsByDependency = new HashMap();
+ protected Map artifactsByDependency = new HashMap();
private final String ivyXmlPath;
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java?rev=988229&r1=988228&r2=988229&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java Mon Aug 23 17:52:30 2010
@@ -31,6 +31,10 @@ public class ContainerMappingSetup {
private List/* <String> */javadocSuffixes;
+ private boolean mapIfOnlyOneSource = false;
+
+ private boolean mapIfOnlyOneJavadoc = false;
+
/**
* Default constructor
*/
@@ -44,6 +48,8 @@ public class ContainerMappingSetup {
this.javadocTypes = setup.javadocTypes;
this.sourceSuffixes = setup.sourceSuffixes;
this.javadocSuffixes = setup.javadocSuffixes;
+ this.mapIfOnlyOneSource = setup.mapIfOnlyOneSource;
+ this.mapIfOnlyOneJavadoc = setup.mapIfOnlyOneJavadoc;
}
public List getAcceptedTypes() {
@@ -86,4 +92,20 @@ public class ContainerMappingSetup {
this.javadocSuffixes = javadocSuffixes;
}
+ public boolean isMapIfOnlyOneSource() {
+ return mapIfOnlyOneSource;
+ }
+
+ public void setMapIfOnlyOneSource(boolean autoMap) {
+ mapIfOnlyOneSource = autoMap;
+ }
+
+ public boolean isMapIfOnlyOneJavadoc() {
+ return mapIfOnlyOneJavadoc;
+ }
+
+ public void setMapIfOnlyOneJavadoc(boolean autoMap) {
+ mapIfOnlyOneJavadoc = autoMap;
+ }
+
}
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=988229&r1=988228&r2=988229&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 Mon Aug 23 17:52:30 2010
@@ -179,6 +179,12 @@ public final class IvyClasspathContainer
} else if (parameter[0].equals("retrievedClasspathTypes")) {
retrievedClasspathSetup.setRetrieveTypes(value);
conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("mapIfOnlyOneSource")) {
+ mappingSetup.setMapIfOnlyOneSource(Boolean.valueOf(value).booleanValue());
+ conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("mapIfOnlyOneJavadoc")) {
+ mappingSetup.setMapIfOnlyOneJavadoc(Boolean.valueOf(value).booleanValue());
+ conf.setAdvancedProjectSpecific(true);
// the following is the retrieve conf pre -IVYDE-56
// from this conf should be build StandaloneRetrieveSetup
@@ -370,6 +376,8 @@ public final class IvyClasspathContainer
append(path, "retrievedClasspathSync", retrieveSetup.isRetrieveSync());
append(path, "retrievedClasspathTypes", retrieveSetup.getRetrieveTypes());
}
+ append(path, "mapIfOnlyOneSource", setup.isMapIfOnlyOneSource());
+ append(path, "mapIfOnlyOneJavadoc", setup.isMapIfOnlyOneJavadoc());
}
} catch (UnsupportedEncodingException e) {
IvyPlugin.log(IStatus.ERROR, UTF8_ERROR, e);
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=988229&r1=988228&r2=988229&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 Mon Aug 23 17:52:30 2010
@@ -305,6 +305,22 @@ public class IvyClasspathContainerConfig
return retrievedClasspathSetup;
}
+ public boolean isInheritedMapIfOnlyOneSource() {
+ if (!isAdvancedProjectSpecific) {
+ return IvyPlugin.getPreferenceStoreHelper().getContainerMappingSetup()
+ .isMapIfOnlyOneSource();
+ }
+ return containerMappingSetup.isMapIfOnlyOneSource();
+ }
+
+ public boolean isInheritedMapIfOnlyOneJavadoc() {
+ if (!isAdvancedProjectSpecific) {
+ return IvyPlugin.getPreferenceStoreHelper().getContainerMappingSetup()
+ .isMapIfOnlyOneJavadoc();
+ }
+ return containerMappingSetup.isMapIfOnlyOneJavadoc();
+ }
+
public String toString() {
return ivyXmlPath + confs
+ (javaProject == null ? "" : " in '" + javaProject.getProject().getName() + "'");
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java?rev=988229&r1=988228&r2=988229&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java Mon Aug 23 17:52:30 2010
@@ -86,12 +86,14 @@ public class IvyClasspathContainerMapper
paths.add(JavaCore.newProjectEntry(new Path(artifact.getName()), true));
} else if (artifact.getLocalFile() != null && accept(artifact.getArtifact())) {
Path classpathArtifact = getArtifactPath(artifact);
- Path sourcesArtifact = getSourcesArtifactPath(artifact);
- Path javadocArtifact = getJavadocArtifactPath(artifact);
- paths.add(JavaCore.newLibraryEntry(classpathArtifact, getSourceAttachment(
- classpathArtifact, sourcesArtifact), getSourceAttachmentRoot(classpathArtifact,
- sourcesArtifact), null, getExtraAttribute(classpathArtifact, javadocArtifact),
- false));
+ Path sourcesArtifact = getArtifactPath(artifact, sourceArtifactMatcher,
+ conf.isInheritedMapIfOnlyOneSource());
+ Path javadocArtifact = getArtifactPath(artifact, javadocArtifactMatcher,
+ conf.isInheritedMapIfOnlyOneJavadoc());
+ paths.add(JavaCore.newLibraryEntry(classpathArtifact,
+ getSourceAttachment(classpathArtifact, sourcesArtifact),
+ getSourceAttachmentRoot(classpathArtifact, sourcesArtifact), null,
+ getExtraAttribute(classpathArtifact, javadocArtifact), false));
}
}
@@ -110,16 +112,25 @@ public class IvyClasspathContainerMapper
return new Path(artifact.getLocalFile().getAbsolutePath());
}
- private Path getSourcesArtifactPath(ArtifactDownloadReport adr) {
+ interface ArtifactMatcher {
+ boolean matchName(String binaryName, String artifactName);
+
+ boolean match(Artifact a);
+
+ String getName();
+ }
+
+ private Path getArtifactPath(ArtifactDownloadReport adr, ArtifactMatcher matcher,
+ boolean mapIfOnlyOne) {
Artifact artifact = adr.getArtifact();
- monitor.subTask("searching sources for " + artifact);
+ monitor.subTask("searching " + matcher.getName() + " for " + artifact);
for (Iterator iter = all.iterator(); iter.hasNext();) {
ArtifactDownloadReport otherAdr = (ArtifactDownloadReport) iter.next();
Artifact a = otherAdr.getArtifact();
if (otherAdr.getLocalFile() != null
- && isSourceArtifactName(artifact.getName(), a.getName())
+ && matcher.matchName(artifact.getName(), a.getName())
&& a.getModuleRevisionId().equals(artifact.getModuleRevisionId())
- && isSources(a)) {
+ && matcher.match(a)) {
return getArtifactPath(otherAdr);
}
}
@@ -128,54 +139,81 @@ public class IvyClasspathContainerMapper
ModuleRevisionId mrid = artifact.getId().getModuleRevisionId();
Artifact[] artifacts = (Artifact[]) artifactsByDependency.get(mrid);
if (artifacts != null) {
+ Artifact foundArtifact = null;
+ int nbFound = 0;
for (int i = 0; i < artifacts.length; i++) {
Artifact metaArtifact = artifacts[i];
- if (isSourceArtifactName(artifact.getName(), metaArtifact.getName())
- && isSources(metaArtifact)) {
- // we've found the source artifact, let's provision it
- ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(metaArtifact,
+ if (matcher.match(metaArtifact)) {
+ if (matcher.matchName(artifact.getName(), metaArtifact.getName())) {
+ // we've found a matching artifact, let's provision it
+ ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(
+ metaArtifact, new DownloadOptions());
+ if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
+ return getArtifactPath(metaAdr);
+ }
+ }
+ // keep a reference to the artifact so we could fall back
+ // to map-if-only-one
+ nbFound++;
+ foundArtifact = metaArtifact;
+ }
+ }
+ if (mapIfOnlyOne) {
+ // we haven't found artifact in the module declaring the artifact and having
+ // a matching name.
+ if (nbFound == 1) {
+ // If there is only 1 found artifact, it is the winner ;-)
+ ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(foundArtifact,
new DownloadOptions());
if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
- return getArtifactPath(metaAdr);
+ return new Path(metaAdr.getLocalFile().getAbsolutePath());
}
}
}
}
+
return null;
}
- private Path getJavadocArtifactPath(ArtifactDownloadReport adr) {
- Artifact artifact = adr.getArtifact();
- monitor.subTask("searching javadoc for " + artifact);
- for (Iterator iter = all.iterator(); iter.hasNext();) {
- ArtifactDownloadReport otherAdr = (ArtifactDownloadReport) iter.next();
- Artifact a = otherAdr.getArtifact();
- if (otherAdr.getLocalFile() != null
- && isJavadocArtifactName(artifact.getName(), a.getName())
- && a.getModuleRevisionId().equals(artifact.getModuleRevisionId())
- && isJavadoc(a)) {
- return getArtifactPath(otherAdr);
- }
+ private ArtifactMatcher sourceArtifactMatcher = new ArtifactMatcher() {
+ public boolean matchName(String jar, String source) {
+ return isArtifactName(jar, source, conf.getInheritedSourceSuffixes());
}
- // we haven't found javadoc artifact in resolved artifacts,
- // let's look in the module declaring the artifact
- ModuleRevisionId mrid = artifact.getId().getModuleRevisionId();
- Artifact[] artifacts = (Artifact[]) artifactsByDependency.get(mrid);
- if (artifacts != null) {
- for (int i = 0; i < artifacts.length; i++) {
- Artifact metaArtifact = artifacts[i];
- if (isJavadocArtifactName(artifact.getName(), metaArtifact.getName())
- && isJavadoc(metaArtifact)) {
- // we've found the javadoc artifact, let's provision it
- ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(metaArtifact,
- new DownloadOptions());
- if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
- return getArtifactPath(metaAdr);
- }
- }
+
+ public boolean match(Artifact a) {
+ return conf.getInheritedSourceTypes().contains(a.getType());
+ }
+
+ public String getName() {
+ return "sources";
+ }
+ };
+
+ private ArtifactMatcher javadocArtifactMatcher = new ArtifactMatcher() {
+ public boolean matchName(String jar, String javadoc) {
+ return isArtifactName(jar, javadoc, conf.getInheritedJavadocSuffixes());
+ }
+
+ public boolean match(Artifact a) {
+ return conf.getInheritedJavadocTypes().contains(a.getType());
+ }
+
+ public String getName() {
+ return "javadoc";
+ }
+ };
+
+ private boolean isArtifactName(String jar, String name, Collection/* <String> */suffixes) {
+ if (name.equals(jar)) {
+ return true;
+ }
+ Iterator it = suffixes.iterator();
+ while (it.hasNext()) {
+ if (name.equals(jar + it.next())) {
+ return true;
}
}
- return null;
+ return false;
}
private IPath getSourceAttachment(Path classpathArtifact, Path sourcesArtifact) {
@@ -198,8 +236,8 @@ public class IvyClasspathContainerMapper
private IClasspathAttribute[] getExtraAttribute(Path classpathArtifact, Path javadocArtifact) {
List result = new ArrayList();
- URL url = IvyPlugin.getDefault().getPackageFragmentExtraInfo().getDocAttachment(
- classpathArtifact);
+ URL url = IvyPlugin.getDefault().getPackageFragmentExtraInfo()
+ .getDocAttachment(classpathArtifact);
if (url == null) {
Path path = javadocArtifact;
@@ -228,27 +266,6 @@ public class IvyClasspathContainerMapper
return (IClasspathAttribute[]) result.toArray(new IClasspathAttribute[result.size()]);
}
- public boolean isJavadocArtifactName(String jar, String javadoc) {
- return isArtifactName(jar, javadoc, conf.getInheritedJavadocSuffixes());
- }
-
- public boolean isSourceArtifactName(String jar, String source) {
- return isArtifactName(jar, source, conf.getInheritedSourceSuffixes());
- }
-
- private boolean isArtifactName(String jar, String name, Collection/* <String> */suffixes) {
- if (name.equals(jar)) {
- return true;
- }
- Iterator it = suffixes.iterator();
- while (it.hasNext()) {
- if (name.equals(jar + it.next())) {
- return true;
- }
- }
- return false;
- }
-
/**
* Check if the artifact is an artifact which can be added to the classpath container
*
@@ -262,12 +279,4 @@ public class IvyClasspathContainerMapper
&& !conf.getInheritedJavadocTypes().contains(artifact.getType());
}
- public boolean isSources(Artifact artifact) {
- return conf.getInheritedSourceTypes().contains(artifact.getType());
- }
-
- public boolean isJavadoc(Artifact artifact) {
- return conf.getInheritedJavadocTypes().contains(artifact.getType());
- }
-
}
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathResolver.java?rev=988229&r1=988228&r2=988229&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathResolver.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathResolver.java Mon Aug 23 17:52:30 2010
@@ -19,7 +19,6 @@ package org.apache.ivyde.eclipse.cpconta
import java.io.IOException;
import java.text.ParseException;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -54,8 +53,6 @@ public class IvyClasspathResolver extend
private IClasspathEntry[] classpathEntries = null;
- private Map artifactsByDependency = new HashMap();
-
/**
* Mapping of resolved artifact to their retrieved path, <code>null</code> if there were no
* retrieve
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=988229&r1=988228&r2=988229&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 Aug 23 17:52:30 2010
@@ -22,6 +22,7 @@ import org.apache.ivyde.eclipse.cpcontai
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@@ -42,6 +43,14 @@ public class AcceptedSuffixesTypesCompos
public static final String TOOLTIP_JAVADOC_SUFFIXES = "Comma separated list of suffixes to"
+ " match javadocs to artifacts.\nExample: -javadoc, -doc";
+
+ public static final String TOOLTIP_MAP_IF_ONLY_ONE_SOURCE = "Will map the source artifact"
+ + " to all jar artifact in modules with multiple jar artifacts and only one"
+ + " source artifact";
+
+ public static final String TOOLTIP_MAP_IF_ONLY_ONE_JAVADOC= "Will map the javadoc artifact"
+ + " to all jar artifact in modules with multiple jar artifacts and only one"
+ + " javadoc artifact";
private Text acceptedTypesText;
@@ -53,6 +62,10 @@ public class AcceptedSuffixesTypesCompos
private Text javadocSuffixesText;
+ private Button mapIfOnlyOneSourceCheck;
+
+ private Button mapIfOnlyOneJavadocCheck;
+
public AcceptedSuffixesTypesComposite(Composite parent, int style) {
super(parent, style);
GridLayout layout = new GridLayout(2, false);
@@ -95,6 +108,19 @@ public class AcceptedSuffixesTypesCompos
javadocSuffixesText = new Text(this, SWT.SINGLE | SWT.BORDER);
javadocSuffixesText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
javadocSuffixesText.setToolTipText(TOOLTIP_JAVADOC_SUFFIXES);
+
+ mapIfOnlyOneSourceCheck= new Button(this, SWT.CHECK);
+ mapIfOnlyOneSourceCheck.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
+ false, 2, 1));
+ mapIfOnlyOneSourceCheck.setText("Auto map jar artifacts with unique source artifact");
+ mapIfOnlyOneSourceCheck.setToolTipText(TOOLTIP_MAP_IF_ONLY_ONE_SOURCE);
+
+ mapIfOnlyOneJavadocCheck = new Button(this, SWT.CHECK);
+ mapIfOnlyOneJavadocCheck.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
+ false, 2, 1));
+ mapIfOnlyOneJavadocCheck.setText("Auto map jar artifacts with unique javadoc artifact");
+ mapIfOnlyOneJavadocCheck.setToolTipText(TOOLTIP_MAP_IF_ONLY_ONE_JAVADOC);
+
}
public void init(ContainerMappingSetup setup) {
@@ -103,6 +129,8 @@ public class AcceptedSuffixesTypesCompos
sourceSuffixesText.setText(IvyClasspathUtil.concat(setup.getSourceSuffixes()));
javadocTypesText.setText(IvyClasspathUtil.concat(setup.getJavadocTypes()));
javadocSuffixesText.setText(IvyClasspathUtil.concat(setup.getJavadocSuffixes()));
+ mapIfOnlyOneSourceCheck.setSelection(setup.isMapIfOnlyOneSource());
+ mapIfOnlyOneJavadocCheck.setSelection(setup.isMapIfOnlyOneJavadoc());
}
public void setEnabled(boolean enabled) {
@@ -112,6 +140,8 @@ public class AcceptedSuffixesTypesCompos
sourceSuffixesText.setEnabled(enabled);
javadocTypesText.setEnabled(enabled);
javadocSuffixesText.setEnabled(enabled);
+ mapIfOnlyOneSourceCheck.setEnabled(enabled);
+ mapIfOnlyOneJavadocCheck.setEnabled(enabled);
}
public ContainerMappingSetup getContainerMappingSetup() {
@@ -121,6 +151,8 @@ public class AcceptedSuffixesTypesCompos
setup.setJavadocTypes(IvyClasspathUtil.split(javadocTypesText.getText()));
setup.setSourceSuffixes(IvyClasspathUtil.split(sourceSuffixesText.getText()));
setup.setJavadocSuffixes(IvyClasspathUtil.split(javadocSuffixesText.getText()));
+ setup.setMapIfOnlyOneSource(mapIfOnlyOneSourceCheck.getSelection());
+ setup.setMapIfOnlyOneJavadoc(mapIfOnlyOneJavadocCheck.getSelection());
return 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=988229&r1=988228&r2=988229&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 Aug 23 17:52:30 2010
@@ -79,6 +79,8 @@ public class IvyDEPreferenceStoreHelper
.getString(PreferenceConstants.SOURCES_SUFFIXES)));
setup.setJavadocSuffixes(IvyClasspathUtil.split(prefStore
.getString(PreferenceConstants.JAVADOC_SUFFIXES)));
+ setup.setMapIfOnlyOneSource(prefStore.getBoolean(PreferenceConstants.MAP_IF_ONLY_ONE_SOURCE));
+ setup.setMapIfOnlyOneJavadoc(prefStore.getBoolean(PreferenceConstants.MAP_IF_ONLY_ONE_JAVADOC));
return setup;
}
@@ -93,6 +95,8 @@ public class IvyDEPreferenceStoreHelper
.getSourceSuffixes()));
prefStore.setValue(PreferenceConstants.JAVADOC_SUFFIXES, IvyClasspathUtil.concat(setup
.getJavadocSuffixes()));
+ prefStore.setValue(PreferenceConstants.MAP_IF_ONLY_ONE_SOURCE, setup.isMapIfOnlyOneSource());
+ prefStore.setValue(PreferenceConstants.MAP_IF_ONLY_ONE_JAVADOC, setup.isMapIfOnlyOneJavadoc());
}
public boolean isAlphOrder() {
@@ -253,4 +257,5 @@ public class IvyDEPreferenceStoreHelper
prefStore.setValue(PreferenceConstants.RETRIEVED_CLASSPATH_TYPES, retrieveSetup
.getRetrieveTypes());
}
+
}
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=988229&r1=988228&r2=988229&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java Mon Aug 23 17:52:30 2010
@@ -103,4 +103,8 @@ public final class PreferenceConstants {
public static final String RETRIEVED_CLASSPATH_TYPES = "retrievedClasspath.types";
+ public static final String MAP_IF_ONLY_ONE_SOURCE = "mapIfOnlyOneSource";
+
+ public static final String MAP_IF_ONLY_ONE_JAVADOC = "mapIfOnlyOneJavadoc";
+
}
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=988229&r1=988228&r2=988229&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 Aug 23 17:52:30 2010
@@ -61,6 +61,10 @@ public class PreferenceInitializer exten
public static final String DEFAULT_JAVADOC_SUFFIXES = "-javadoc,-javadocs,-doc,-docs";
+ public static final boolean DEFAULT_MAP_IF_ONLY_ONE_SOURCE = false;
+
+ public static final boolean DEFAULT_MAP_IF_ONLY_ONE_JAVADOC = false;
+
public static final int DEFAULT_IVY_CONSOLE_LOG_MESSAGE = Message.MSG_INFO;
public static final ContainerMappingSetup DEFAULT_CONTAINER_MAPPING_SETUP =
@@ -77,6 +81,8 @@ public class PreferenceInitializer exten
.split(DEFAULT_SOURCES_SUFFIXES));
DEFAULT_CONTAINER_MAPPING_SETUP.setJavadocSuffixes(IvyClasspathUtil
.split(DEFAULT_JAVADOC_SUFFIXES));
+ DEFAULT_CONTAINER_MAPPING_SETUP.setMapIfOnlyOneSource(DEFAULT_MAP_IF_ONLY_ONE_SOURCE);
+ DEFAULT_CONTAINER_MAPPING_SETUP.setMapIfOnlyOneJavadoc(DEFAULT_MAP_IF_ONLY_ONE_JAVADOC);
}
public static final boolean DEFAULT_ALPHABETICAL_ORDER = false;
@@ -126,6 +132,8 @@ public class PreferenceInitializer exten
store.setDefault(PreferenceConstants.JAVADOC_TYPES, DEFAULT_JAVADOC_TYPES);
store.setDefault(PreferenceConstants.SOURCES_SUFFIXES, DEFAULT_SOURCES_SUFFIXES);
store.setDefault(PreferenceConstants.JAVADOC_SUFFIXES, DEFAULT_JAVADOC_SUFFIXES);
+ store.setDefault(PreferenceConstants.MAP_IF_ONLY_ONE_SOURCE, DEFAULT_MAP_IF_ONLY_ONE_SOURCE);
+ store.setDefault(PreferenceConstants.MAP_IF_ONLY_ONE_JAVADOC, DEFAULT_MAP_IF_ONLY_ONE_JAVADOC);
store.setDefault(PreferenceConstants.ALPHABETICAL_ORDER, DEFAULT_ALPHABETICAL_ORDER);
store.setDefault(PreferenceConstants.RESOLVE_IN_WORKSPACE, DEFAULT_RESOLVE_IN_WORKSPACE);
Propchange: ant/ivy/ivyde/trunk/test/map-one-source/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 23 17:52:30 2010
@@ -0,0 +1 @@
+bin
Added: ant/ivy/ivyde/trunk/test/map-one-source/.classpath
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/map-one-source/.classpath?rev=988229&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/map-one-source/.classpath (added)
+++ ant/ivy/ivyde/trunk/test/map-one-source/.classpath Mon Aug 23 17:52:30 2010
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&confs=*&ivySettingsPath=%24%7Bworkspace_loc%3Aivydetest-local-cache%2Fivysettings.xml%7D&loadSettingsOnDemand=false&propertyFiles=&acceptedTypes=jar&sourceTypes=source&javadocTypes=javadoc&sourceSuffixes=-source%2C-sources%2C-src&javadocSuffixes=-javadoc%2C-javadocs%2C-doc%2C-docs&alphaOrder=false&resolveInWorkspace=false&resolveBeforeLaunch=false&retrievedClasspath=false&mapIfOnlyOneSource=true&mapIfOnlyOneJavadoc=true"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: ant/ivy/ivyde/trunk/test/map-one-source/.project
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/map-one-source/.project?rev=988229&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/map-one-source/.project (added)
+++ ant/ivy/ivyde/trunk/test/map-one-source/.project Mon Aug 23 17:52:30 2010
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>ivydetest-map-one-source</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.apache.ivyde.eclipse.ivyNature</nature>
+ </natures>
+</projectDescription>
Added: ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml?rev=988229&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml (added)
+++ ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml Mon Aug 23 17:52:30 2010
@@ -0,0 +1,32 @@
+<!--
+ 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.
+-->
+<ivy-module version="1.0">
+ <info organisation="org.apache.ivyde" module="ivytest-map-one-source">
+ <description>
+ Project which classpath should have some source mapped to the jar
+ even if the names doesn't match
+ </description>
+ </info>
+ <configurations>
+ <conf name="default" />
+ </configurations>
+ <dependencies>
+ <dependency org="myorg" name="somemodule" rev="1.1" conf="default" />
+ </dependencies>
+</ivy-module>
Propchange: ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/test/map-one-source/ivy.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml?rev=988229&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml (added)
+++ ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml Mon Aug 23 17:52:30 2010
@@ -0,0 +1,28 @@
+<!--
+ 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.
+-->
+<ivysettings>
+ <caches defaultCacheDir="${ivy.settings.dir}/../cache-fakerepo" useOrigin="false" />
+ <settings defaultResolver="fakerepo" checkUpToDate="false" />
+ <resolvers>
+ <filesystem name="fakerepo">
+ <ivy pattern="${ivy.settings.dir}/../fakerepo/[organisation]/[module]/ivy-[revision].xml"/>
+ <artifact pattern="${ivy.settings.dir}/../fakerepo/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
+ </filesystem>
+ </resolvers>
+</ivysettings>
Propchange: ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/test/map-one-source/ivysettings.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml