You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/02/01 17:02:58 UTC
svn commit: r617532 - in /ant/ivy/ivyde/trunk: ./
src/java/org/apache/ivyde/eclipse/
src/java/org/apache/ivyde/eclipse/cpcontainer/
src/java/org/apache/ivyde/eclipse/ui/preferences/
src/java/org/apache/ivyde/eclipse/ui/properties/
Author: xavier
Date: Fri Feb 1 08:02:47 2008
New Revision: 617532
URL: http://svn.apache.org/viewvc?rev=617532&view=rev
Log:
IMPROVE: Recognize more source and javadoc artifacts names (IVYDE-66) (thanks to Nicolas Lalevée)
Modified:
ant/ivy/ivyde/trunk/CHANGES.txt
ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java
Modified: ant/ivy/ivyde/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/CHANGES.txt?rev=617532&r1=617531&r2=617532&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/CHANGES.txt (original)
+++ ant/ivy/ivyde/trunk/CHANGES.txt Fri Feb 1 08:02:47 2008
@@ -5,6 +5,7 @@
===========================
- NEW: [build] Use the latest ivy to resolve dependencies (IVYDE-62) (thanks to Nicolas Lalevée)
+- IMPROVE: Recognize more source and javadoc artifacts names (IVYDE-66) (thanks to Nicolas Lalevée)
- IMPROVE: Use Ivy Bundle instead of packaging ivy.jar in IvyDE bundle (IVYDE-67)
- IMPROVE: enable 'Resolve all' action (IVYDE-42) (thanks to Thomas FRIOL)
- IMPROVE: Support javadoc and sources even in modules where they are not declared (IVYDE-46)
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java?rev=617532&r1=617531&r2=617532&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java Fri Feb 1 08:02:47 2008
@@ -237,7 +237,7 @@
IJavaProject[] projects = plugin.javaModel.getJavaProjects();
String defaultConfURL = getIvyconfURL();
for (int i = 0; i < projects.length; i++) {
- if ("[inherited]".equals(getTypesString(projects[i], typesCode))) {
+ if ("[inherited]".equals(getInheritablePreferenceString(projects[i], typesCode))) {
resolve(projects[i]);
}
}
@@ -413,15 +413,15 @@
}
private static Collection getAcceptedTypes(IJavaProject project) {
- return getTypes(project, PreferenceConstants.ACCEPTED_TYPES, "jar");
+ return getInheritablePreferenceList(project, PreferenceConstants.ACCEPTED_TYPES, "jar");
}
public static String getAcceptedTypesString(IJavaProject project) {
- return getTypesString(project, PreferenceConstants.ACCEPTED_TYPES);
+ return getInheritablePreferenceString(project, PreferenceConstants.ACCEPTED_TYPES);
}
public static void setAcceptedTypes(IJavaProject project, String types) {
- setTypes(project, types, PreferenceConstants.ACCEPTED_TYPES);
+ setInheritablePreferenceString(project, types, PreferenceConstants.ACCEPTED_TYPES);
}
public static boolean isSources(IJavaProject project, Artifact artifact) {
@@ -429,15 +429,40 @@
}
private static Collection getSourcesTypes(IJavaProject project) {
- return getTypes(project, PreferenceConstants.SOURCES_TYPES, "source");
+ return getInheritablePreferenceList(project, PreferenceConstants.SOURCES_TYPES, "source");
}
public static String getSourcesTypesString(IJavaProject project) {
- return getTypesString(project, PreferenceConstants.SOURCES_TYPES);
+ return getInheritablePreferenceString(project, PreferenceConstants.SOURCES_TYPES);
}
public static void setSourcesTypes(IJavaProject project, String types) {
- setTypes(project, types, PreferenceConstants.SOURCES_TYPES);
+ setInheritablePreferenceString(project, types, PreferenceConstants.SOURCES_TYPES);
+ }
+
+ public static boolean isSourceArtifactName(IJavaProject project, String jar, String source) {
+ if (source.equals(jar)) {
+ return true;
+ }
+ Iterator it = getSourcesSuffixes(project).iterator();
+ while (it.hasNext()) {
+ if (source.equals(jar + it.next())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static Collection getSourcesSuffixes(IJavaProject project) {
+ return getInheritablePreferenceList(project, PreferenceConstants.SOURCES_SUFFIXES, "-source, -sources, -src");
+ }
+
+ public static String getSourcesSuffixesString(IJavaProject project) {
+ return getInheritablePreferenceString(project, PreferenceConstants.SOURCES_SUFFIXES);
+ }
+
+ public static void setSourcesSuffixes(IJavaProject project, String types) {
+ setInheritablePreferenceString(project, types, PreferenceConstants.SOURCES_SUFFIXES);
}
public static boolean isJavadoc(IJavaProject project, Artifact artifact) {
@@ -445,25 +470,50 @@
}
private static Collection getJavadocTypes(IJavaProject project) {
- return getTypes(project, PreferenceConstants.JAVADOC_TYPES, "javadoc");
+ return getInheritablePreferenceList(project, PreferenceConstants.JAVADOC_TYPES, "javadoc");
}
public static String getJavadocTypesString(IJavaProject project) {
- return getTypesString(project, PreferenceConstants.JAVADOC_TYPES);
+ return getInheritablePreferenceString(project, PreferenceConstants.JAVADOC_TYPES);
}
public static void setJavadocTypes(IJavaProject project, String types) {
- setTypes(project, types, PreferenceConstants.JAVADOC_TYPES);
+ setInheritablePreferenceString(project, types, PreferenceConstants.JAVADOC_TYPES);
+ }
+
+ public static boolean isJavadocArtifactName(IJavaProject project, String jar, String javadoc) {
+ if (javadoc.equals(jar)) {
+ return true;
+ }
+ Iterator it = getJavadocSuffixes(project).iterator();
+ while (it.hasNext()) {
+ if (javadoc.equals(jar + it.next())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static Collection getJavadocSuffixes(IJavaProject project) {
+ return getInheritablePreferenceList(project, PreferenceConstants.JAVADOC_SUFFIXES, "-javadoc, -javadocs, -doc, -docs");
+ }
+
+ public static String getJavadocSuffixesString(IJavaProject project) {
+ return getInheritablePreferenceString(project, PreferenceConstants.JAVADOC_SUFFIXES);
+ }
+
+ public static void setJavadocSuffixes(IJavaProject project, String types) {
+ setInheritablePreferenceString(project, types, PreferenceConstants.JAVADOC_SUFFIXES);
}
- private static Collection getTypes(IJavaProject project, String typesCode, String defaultTypes) {
- String types = getTypesString(project, typesCode);
+ private static Collection getInheritablePreferenceList(IJavaProject project, String code, String defaultValues) {
+ String types = getInheritablePreferenceString(project, code);
if ("[inherited]".equals(types)) {
String workspaceTypes = IvyPlugin.getDefault().getPreferenceStore()
- .getString(typesCode);
+ .getString(code);
if (workspaceTypes == null || workspaceTypes.trim().length() == 0) {
- types = defaultTypes;
+ types = defaultValues;
} else {
types = workspaceTypes.trim();
}
@@ -471,19 +521,19 @@
return split(types);
}
- private static String getTypesString(IJavaProject project, String typesCode) {
- String types = IvyPlugin.getDefault().getProjectPreferences(project).get(typesCode, null);
- if (types == null || types.trim().length() == 0) {
+ private static String getInheritablePreferenceString(IJavaProject project, String code) {
+ String values = IvyPlugin.getDefault().getProjectPreferences(project).get(code, null);
+ if (values == null || values.trim().length() == 0) {
return "[inherited]";
}
- return types.trim();
+ return values.trim();
}
- private static void setTypes(IJavaProject project, String types, String typesCode) {
- if (types == null || types.trim().length() == 0 || types.trim().startsWith("[inherited]")) {
- IvyPlugin.getDefault().getProjectPreferences(project).put(typesCode, "[inherited]");
+ private static void setInheritablePreferenceString(IJavaProject project, String values, String code) {
+ if (values == null || values.trim().length() == 0 || values.trim().startsWith("[inherited]")) {
+ IvyPlugin.getDefault().getProjectPreferences(project).put(code, "[inherited]");
} else {
- IvyPlugin.getDefault().getProjectPreferences(project).put(typesCode, types);
+ IvyPlugin.getDefault().getProjectPreferences(project).put(code, values);
}
flushProjectPreferences(project);
resolve(project);
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java?rev=617532&r1=617531&r2=617532&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java Fri Feb 1 08:02:47 2008
@@ -353,7 +353,8 @@
for (Iterator iter = all.iterator(); iter.hasNext();) {
ArtifactDownloadReport otherAdr = (ArtifactDownloadReport) iter.next();
Artifact a = otherAdr.getArtifact();
- if (otherAdr.getLocalFile() != null && a.getName().equals(artifact.getName())
+ if (otherAdr.getLocalFile() != null
+ && IvyPlugin.isSourceArtifactName(_javaProject, artifact.getName(), a.getName())
&& a.getId().getRevision().equals(artifact.getId().getRevision())
&& IvyPlugin.isSources(_javaProject, a)) {
return new Path(otherAdr.getLocalFile().getAbsolutePath());
@@ -372,7 +373,8 @@
for (Iterator iter = all.iterator(); iter.hasNext();) {
ArtifactDownloadReport otherAdr = (ArtifactDownloadReport) iter.next();
Artifact a = otherAdr.getArtifact();
- if (otherAdr.getLocalFile() != null && a.getName().equals(artifact.getName())
+ if (otherAdr.getLocalFile() != null
+ && IvyPlugin.isJavadocArtifactName(_javaProject, artifact.getName(), a.getName())
&& a.getModuleRevisionId().equals(artifact.getModuleRevisionId())
&& a.getId().equals(artifact.getId())
&& IvyPlugin.isJavadoc(_javaProject, a)) {
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java?rev=617532&r1=617531&r2=617532&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java Fri Feb 1 08:02:47 2008
@@ -140,6 +140,16 @@
explanation
.setText("Comma separated list of artifact types to be used as sources. \nExample: source, src");
+ addField(new StringFieldEditor(PreferenceConstants.SOURCES_SUFFIXES, "Sources suffixes",
+ fieldParent));
+
+ new Label(fieldParent, SWT.NONE); // space
+ explanation = new Label(fieldParent, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+ 1));
+ explanation
+ .setText("Comma separated list of suffixes to match sources and artifacts. \nExample: -source, -src");
+
addField(new StringFieldEditor(PreferenceConstants.JAVADOC_TYPES, "Javadoc types",
fieldParent));
@@ -149,6 +159,16 @@
1));
explanation
.setText("Comma separated list of artifact types to be used as javadoc. \nExample: javadoc");
+
+ addField(new StringFieldEditor(PreferenceConstants.JAVADOC_SUFFIXES, "Javadoc suffixes",
+ fieldParent));
+
+ new Label(fieldParent, SWT.NONE); // space
+ explanation = new Label(fieldParent, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+ 1));
+ explanation
+ .setText("Comma separated list of suffixes to match javadocs and artifacts. \nExample: -javadoc, -doc");
spacer = new Label(fieldParent, SWT.NONE);
spacerData = new GridData();
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=617532&r1=617531&r2=617532&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java Fri Feb 1 08:02:47 2008
@@ -15,7 +15,11 @@
public static final String SOURCES_TYPES = "sourceTypes";
+ public static final String SOURCES_SUFFIXES = "sourceSuffixes";
+
public static final String JAVADOC_TYPES = "javadocTypes";
+
+ public static final String JAVADOC_SUFFIXES = "javadocSuffixes";
public static final String P_BOOLEAN = "booleanPreference";
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java?rev=617532&r1=617531&r2=617532&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java Fri Feb 1 08:02:47 2008
@@ -30,8 +30,12 @@
private static final String SOURCES_TYPES_TITLE = "Sources types:";
+ private static final String SOURCES_SUFFIXES_TITLE = "Sources suffixes:";
+
private static final String JAVADOC_TYPES_TITLE = "Javadoc types:";
+ private static final String JAVADOC_SUFFIXES_TITLE = "Javadoc suffixes:";
+
private Text _pathValueText;
private Button _retreiveB;
@@ -44,6 +48,10 @@
private Text _javadocTypesText;
+ private Text _sourcesSuffixesText;
+
+ private Text _javadocSuffixesText;
+
public IvyProjectPropertyPage() {
super();
}
@@ -118,6 +126,22 @@
1));
explanation.setText("Comma separated list of artifact types to be used as sources.");
+ Label sourcesSuffixesLabel = new Label(composite, SWT.NONE);
+ sourcesSuffixesLabel.setText(SOURCES_SUFFIXES_TITLE);
+
+ _sourcesSuffixesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ _sourcesSuffixesText.setText(IvyPlugin.getSourcesSuffixesString(getJavaProject()));
+ _sourcesSuffixesText
+ .setToolTipText("Example: -source, -src\nUse [inherited] to use your general eclise setting.");
+ _sourcesSuffixesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true,
+ false, 3, 1));
+
+ new Label(composite, SWT.NONE); // space
+ explanation = new Label(composite, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3,
+ 1));
+ explanation.setText("Comma separated list of suffixes to match sources to artifacts.");
+
Label javadocTypesLabel = new Label(composite, SWT.NONE);
javadocTypesLabel.setText(JAVADOC_TYPES_TITLE);
@@ -134,6 +158,22 @@
1));
explanation.setText("Comma separated list of artifact types to be used as javadoc.");
+ Label javadocSuffixesLabel = new Label(composite, SWT.NONE);
+ javadocSuffixesLabel.setText(JAVADOC_TYPES_TITLE);
+
+ _javadocSuffixesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ _javadocSuffixesText.setText(IvyPlugin.getJavadocSuffixesString(getJavaProject()));
+ _javadocSuffixesText
+ .setToolTipText("Example: -javadoc, -doc\nUse [inherited] to use your general eclise setting.");
+ _javadocSuffixesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true,
+ false, 3, 1));
+
+ new Label(composite, SWT.NONE); // space
+ explanation = new Label(composite, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3,
+ 1));
+ explanation.setText("Comma separated list of suffixes to match javadocs to artifacts.");
+
new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
GridData.BEGINNING, false, false, 4, 1)); // space
@@ -243,7 +283,9 @@
_patternT.setText("");
_acceptedTypesText.setText("[inherited]");
_sourcesTypesText.setText("[inherited]");
+ _sourcesSuffixesText.setText("[inherited]");
_javadocTypesText.setText("[inherited]");
+ _javadocSuffixesText.setText("[inherited]");
}
private String getDefaultIvyconfURLForDisplay() {
@@ -269,7 +311,9 @@
IvyPlugin.setAcceptedTypes(getJavaProject(), _acceptedTypesText.getText());
IvyPlugin.setSourcesTypes(getJavaProject(), _sourcesTypesText.getText());
+ IvyPlugin.setSourcesSuffixes(getJavaProject(), _sourcesSuffixesText.getText());
IvyPlugin.setJavadocTypes(getJavaProject(), _javadocTypesText.getText());
+ IvyPlugin.setJavadocSuffixes(getJavaProject(), _javadocSuffixesText.getText());
return true;
} finally {
IvyPlugin.commitChanges();