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 2009/01/05 12:03:24 UTC
svn commit: r731524 - in /ant/ivy/ivyde/trunk: org.apache.ivyde.eclipse/
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/iv...
Author: hibou
Date: Mon Jan 5 03:03:24 2009
New Revision: 731524
URL: http://svn.apache.org/viewvc?rev=731524&view=rev
Log:
IVYDE-13:
- add the support of property files
- improve a little bit how are displyed error messages
Added:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java (contents, props changed)
- copied, changed from r731513, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java
ant/ivy/ivyde/trunk/test/property-files/ (with props)
ant/ivy/ivyde/trunk/test/property-files/.classpath
ant/ivy/ivyde/trunk/test/property-files/.project
ant/ivy/ivyde/trunk/test/property-files/build.properties (with props)
ant/ivy/ivyde/trunk/test/property-files/ivy.xml (with props)
ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml (with props)
ant/ivy/ivyde/trunk/test/property-files/src/
Removed:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.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/IvyClasspathUtil.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.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/IvyPreferencePage.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt?rev=731524&r1=731523&r2=731524&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt Mon Jan 5 03:03:24 2009
@@ -5,6 +5,7 @@
==========================
- NEW: Add the IvyDE documentation to the Eclipse help (IVYDE-150)
- NEW: Export IVY_HOME as a classpath variable (IVYDE-141)
+- NEW: Support variables in ivyconf.xml (IVYDE-13) (thanks to Will Gorman)
- FIX: When migrating from ivyde alpha to ivyde beta eclipse is throwing NPE at startup (IVYDE-136) (thanks to Daniel Becheanu)
- FIX: The retrieve configuration doesn't support '*' as accepted types (IVYDE-137) (thanks to Daniel Becheanu)
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java?rev=731524&r1=731523&r2=731524&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java Mon Jan 5 03:03:24 2009
@@ -29,6 +29,8 @@
private final String shortMsg;
+ private String msg;
+
/**
* Default constructor
*
@@ -40,14 +42,23 @@
* the underlying cause
*/
public IvyDEException(String shortMsg, String msg, Throwable cause) {
- super(msg, cause);
+ super(cause);
this.shortMsg = shortMsg;
+ this.msg = msg;
}
public String getShortMsg() {
return shortMsg;
}
+ public String getMessage() {
+ return msg;
+ }
+
+ public void contextualizeMessage(String context) {
+ this.msg = context + ":\n " + msg;
+ }
+
/**
* Create a popup window to display the exception to the end user.
*
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=731524&r1=731523&r2=731524&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 Jan 5 03:03:24 2009
@@ -18,7 +18,10 @@
package org.apache.ivyde.eclipse.cpcontainer;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -28,7 +31,9 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
import org.apache.ivy.Ivy;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
@@ -47,8 +52,6 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
/**
* path: org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER? ivyXmlPath=ivy.xml &confs=default
@@ -74,6 +77,8 @@
String ivySettingsPath;
+ List/* <String> */propertyFiles;
+
List/* <String> */acceptedTypes;
List/* <String> */sourceTypes;
@@ -110,6 +115,8 @@
boolean isRetrieveProjectSpecific;
+ boolean isSettingsSpecific;
+
/**
* Constructor
*
@@ -150,9 +157,8 @@
}
public String toString() {
- return (javaProject == null ? "" : "project '" + javaProject.getProject().getName()
- + "' and ivy file '")
- + ivyXmlPath + (javaProject == null ? "" : "'");
+ return ivyXmlPath
+ + (javaProject == null ? "" : " in '" + javaProject.getProject().getName() + "'");
}
/**
@@ -183,6 +189,7 @@
String[] parameters = url.split("&");
isAdvancedProjectSpecific = false;
isRetrieveProjectSpecific = false;
+ isSettingsSpecific = false;
for (int i = 0; i < parameters.length; i++) {
String[] parameter = parameters[i].split("=");
if (parameter == null || parameter.length == 0) {
@@ -205,6 +212,10 @@
}
} else if (parameter[0].equals("ivySettingsPath")) {
ivySettingsPath = readOldIvySettings(value);
+ isSettingsSpecific = true;
+ } else if (parameter[0].equals("propertyFiles")) {
+ propertyFiles = IvyClasspathUtil.split(value);
+ isSettingsSpecific = true;
} else if (parameter[0].equals("doRetrieve")) {
// if the value is not actually "true" or "false", the Boolean class ensure to
// return false, so it is fine
@@ -292,6 +303,9 @@
if (acceptedTypes == null) {
acceptedTypes = IvyPlugin.getPreferenceStoreHelper().getAcceptedTypes();
}
+ if (propertyFiles == null) {
+ propertyFiles = IvyPlugin.getPreferenceStoreHelper().getPropertyFiles();
+ }
if (sourceTypes == null) {
sourceTypes = IvyPlugin.getPreferenceStoreHelper().getSourceTypes();
}
@@ -314,9 +328,11 @@
path.append(URLEncoder.encode(ivyXmlPath, "UTF-8"));
path.append("&confs=");
path.append(URLEncoder.encode(IvyClasspathUtil.concat(confs), "UTF-8"));
- if (ivySettingsPath != null) {
+ if (isSettingsSpecific) {
path.append("&ivySettingsPath=");
path.append(URLEncoder.encode(ivySettingsPath, "UTF-8"));
+ path.append("&propertyFiles=");
+ path.append(URLEncoder.encode(IvyClasspathUtil.concat(propertyFiles), "UTF-8"));
}
if (isRetrieveProjectSpecific) {
path.append("&doRetrieve=");
@@ -412,14 +428,20 @@
}
public Ivy getIvy() throws IvyDEException {
+ try {
+ return doGetIvy();
+ } catch (IvyDEException e) {
+ e.contextualizeMessage("Error while resolving the ivy instance for " + this.toString());
+ throw e;
+ }
+ }
+
+ private Ivy doGetIvy() throws IvyDEException {
String settingsPath = getInheritedIvySettingsPath();
if (settingsPath == null || settingsPath.trim().length() == 0) {
// no settings specified, so take the default one
if (ivy == null) {
- IvySettings ivySettings = new IvySettings();
- if (javaProject != null) {
- ivySettings.setBaseDir(javaProject.getProject().getLocation().toFile());
- }
+ IvySettings ivySettings = createIvySettings();
try {
ivySettings.loadDefault();
} catch (ParseException e) {
@@ -496,10 +518,7 @@
} else {
// an URL but not a file
if (ivy == null || ivySettingsLastModified == -1) {
- IvySettings ivySettings = new IvySettings();
- if (javaProject != null) {
- ivySettings.setBaseDir(javaProject.getProject().getLocation().toFile());
- }
+ IvySettings ivySettings = createIvySettings();
try {
ivySettings.load(url);
ivySettingsLastModified = 0;
@@ -526,17 +545,13 @@
private Ivy getIvy(File file) throws IvyDEException {
if (!file.exists()) {
IvyDEException ex = new IvyDEException("Ivy settings file not found",
- "The Ivy settings file '" + ivySettingsPath + "' cannot be found ("
- + this.toString() + ")", null);
+ "The Ivy settings file '" + ivySettingsPath + "' cannot be found", null);
setConfStatus(ex);
throw ex;
}
if (file.lastModified() != ivySettingsLastModified) {
- IvySettings ivySettings = new IvySettings();
- if (javaProject != null) {
- ivySettings.setBaseDir(javaProject.getProject().getLocation().toFile());
- }
+ IvySettings ivySettings = createIvySettings();
if (ivySettingsLastModified == -1) {
Message.info("\n\n");
} else {
@@ -546,26 +561,80 @@
ivySettings.load(file);
} catch (ParseException e) {
IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
- "The ivy settings file '" + ivySettingsPath + "' could not be parsed ("
- + this.toString() + ")", e);
+ "The ivy settings file '" + ivySettingsPath + "' could not be parsed", e);
setConfStatus(ex);
throw ex;
} catch (IOException e) {
IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
- "The ivy settings file '" + ivySettingsPath + "' could not be read ("
- + this.toString() + ")", e);
+ "The ivy settings file '" + ivySettingsPath + "' could not be read", e);
setConfStatus(ex);
throw ex;
}
ivy = Ivy.newInstance(ivySettings);
ivySettingsLastModified = file.lastModified();
}
-
return ivy;
}
+ private IvySettings createIvySettings() throws IvyDEException {
+ IvySettings ivySettings = new IvySettings();
+ if (javaProject != null) {
+ ivySettings.setBaseDir(javaProject.getProject().getLocation().toFile());
+ }
+ Collection propFiles = getInheritedPropertyFiles();
+ if (propFiles != null) {
+ Iterator iter = propFiles.iterator();
+ while (iter.hasNext()) {
+ String file = (String) iter.next();
+ InputStream is;
+ Path p = new Path(file);
+ if (javaProject != null && !p.isAbsolute()) {
+ try {
+ is = javaProject.getProject().getFile(file).getContents();
+ } catch (CoreException e) {
+ IvyDEException ex = new IvyDEException("Unreadable property file",
+ "The property file '" + file + "' could not be read", e);
+ setConfStatus(ex);
+ throw ex;
+ }
+ } else {
+ try {
+ is = new FileInputStream(file);
+ } catch (FileNotFoundException e) {
+ IvyDEException ex = new IvyDEException("Property file not found",
+ "The property file '" + file + "' was not found", e);
+ setConfStatus(ex);
+ throw ex;
+ }
+ }
+ Properties props = new Properties();
+ try {
+ props.load(is);
+ } catch (IOException e) {
+ IvyDEException ex = new IvyDEException("Not a property file",
+ "The property file '" + file + "' could not be loaded", e);
+ setConfStatus(ex);
+ throw ex;
+ }
+ try {
+ is.close();
+ } catch (IOException e) {
+ // don't care
+ }
+
+ Iterator keys = props.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = (String) keys.next();
+ String value = props.getProperty(key);
+ ivySettings.setVariable(key, value);
+ }
+ }
+ }
+ return ivySettings;
+ }
+
public String getInheritedIvySettingsPath() {
- if (ivySettingsPath == null) {
+ if (!isSettingsSpecific) {
return IvyPlugin.getPreferenceStoreHelper().getIvySettingsPath();
}
return ivySettingsPath;
@@ -660,7 +729,7 @@
}
public boolean isSettingsProjectSpecific() {
- return ivySettingsPath != null;
+ return isSettingsSpecific;
}
public boolean isAdvancedProjectSpecific() {
@@ -686,7 +755,7 @@
File file = getIvyFile();
if (!file.exists()) {
IvyDEException ex = new IvyDEException("Ivy file not found", "The ivy.xml file '"
- + file.getAbsolutePath() + "' was not found (" + this.toString() + ")", null);
+ + file.getAbsolutePath() + "' was not found", null);
setConfStatus(ex);
throw ex;
}
@@ -698,22 +767,28 @@
return md;
} catch (MalformedURLException e) {
IvyDEException ex = new IvyDEException("Incorrect URL of the Ivy file",
- "The URL to the ivy.xml file is incorrect: '" + file.getAbsolutePath() + "' ("
- + this.toString() + ")", e);
+ "The URL to the ivy.xml file is incorrect: '" + file.getAbsolutePath() + "'", e);
setConfStatus(ex);
throw ex;
} catch (ParseException e) {
IvyDEException ex = new IvyDEException("Parsing error of the Ivy file",
- "The ivy file '" + file.getAbsolutePath() + "' could not be parsed ("
- + this.toString() + ")", e);
+ "The ivy file '" + file.getAbsolutePath() + "' could not be parsed", e);
setConfStatus(ex);
throw ex;
} catch (IOException e) {
IvyDEException ex = new IvyDEException("Read error of the Ivy file", "The ivy file '"
- + file.getAbsolutePath() + "' could not be read (" + this.toString() + ")", e);
+ + file.getAbsolutePath() + "' could not be read", e);
setConfStatus(ex);
throw ex;
}
}
+ public Collection getInheritedPropertyFiles() {
+ if (!isSettingsSpecific) {
+ return IvyPlugin.getPreferenceStoreHelper().getPropertyFiles();
+ } else {
+ return propertyFiles;
+ }
+ }
+
}
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java?rev=731524&r1=731523&r2=731524&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java Mon Jan 5 03:03:24 2009
@@ -35,6 +35,7 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations;
import org.eclipse.jdt.internal.ui.packageview.ClassPathContainer;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -175,6 +176,9 @@
}
public static String concat(Collection/* <String> */list) {
+ if (list == null) {
+ return "";
+ }
StringBuffer b = new StringBuffer();
Iterator it = list.iterator();
while (it.hasNext()) {
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java?rev=731524&r1=731523&r2=731524&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java Mon Jan 5 03:03:24 2009
@@ -111,7 +111,7 @@
private ModuleDescriptor md;
public IvyResolveJob(IvyClasspathContainer container, boolean usePreviousResolveIfExist) {
- super("Resolve " + container.getConf() + " dependencies");
+ super("Ivy resolve job of " + container.getConf());
this.container = container;
this.conf = container.getConf();
this.usePreviousResolveIfExist = usePreviousResolveIfExist;
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=731524&r1=731523&r2=731524&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 Jan 5 03:03:24 2009
@@ -26,9 +26,9 @@
import org.apache.ivyde.eclipse.ui.ConfTableViewer;
import org.apache.ivyde.eclipse.ui.IvyFilePathText;
import org.apache.ivyde.eclipse.ui.RetrieveComposite;
-import org.apache.ivyde.eclipse.ui.SettingsPathText;
+import org.apache.ivyde.eclipse.ui.SettingsEditor;
import org.apache.ivyde.eclipse.ui.IvyFilePathText.IvyXmlPathListener;
-import org.apache.ivyde.eclipse.ui.SettingsPathText.SettingsPathListener;
+import org.apache.ivyde.eclipse.ui.SettingsEditor.SettingsEditorListener;
import org.apache.ivyde.eclipse.ui.preferences.IvyDEPreferenceStoreHelper;
import org.apache.ivyde.eclipse.ui.preferences.IvyPreferencePage;
import org.eclipse.core.runtime.IStatus;
@@ -63,7 +63,7 @@
private ConfTableViewer confTableViewer;
- private SettingsPathText settingsText;
+ private SettingsEditor settingsEditor;
private Combo alphaOrderCheck;
@@ -129,7 +129,8 @@
}
if (settingsProjectSpecificButton.getSelection()) {
- conf.ivySettingsPath = settingsText.getSettingsPath();
+ conf.ivySettingsPath = settingsEditor.getSettingsPath();
+ conf.propertyFiles = settingsEditor.getPropertyFiles();
conf.acceptedTypes = acceptedSuffixesTypesComposite.getAcceptedTypes();
conf.sourceTypes = acceptedSuffixesTypesComposite.getSourcesTypes();
conf.javadocTypes = acceptedSuffixesTypesComposite.getJavadocTypes();
@@ -205,7 +206,7 @@
tabs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ivyFilePathText.updateErrorMarker();
- settingsText.updateErrorMarker();
+ settingsEditor.updateErrorMarker();
}
});
@@ -230,7 +231,7 @@
settingsProjectSpecificButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateFieldsStatusSettings();
- conf.ivySettingsPath = settingsText.getSettingsPath();
+ conf.ivySettingsPath = settingsEditor.getSettingsPath();
settingsUpdated();
}
});
@@ -254,13 +255,10 @@
configComposite.setLayout(new GridLayout(3, false));
configComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
- Label label = new Label(configComposite, SWT.NONE);
- label.setText("Ivy settings path:");
-
- settingsText = new SettingsPathText(configComposite, SWT.NONE);
- settingsText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
- settingsText.addListener(new SettingsPathListener() {
- public void settingsPathUpdated(String path) {
+ 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;
settingsUpdated();
}
@@ -419,9 +417,9 @@
try {
conf.ivySettingsLastModified = -1;
conf.getIvy();
- settingsText.setSettingsError(null);
+ settingsEditor.setSettingsError(null);
} catch (IvyDEException e) {
- settingsText.setSettingsError(e);
+ settingsEditor.setSettingsError(e);
}
checkIvyXmlPath();
}
@@ -434,10 +432,10 @@
if (conf.isSettingsProjectSpecific()) {
settingsProjectSpecificButton.setSelection(true);
- settingsText.init(conf.ivySettingsPath);
+ settingsEditor.init(conf.ivySettingsPath, conf.propertyFiles);
} else {
settingsProjectSpecificButton.setSelection(false);
- settingsText.init(helper.getIvySettingsPath());
+ settingsEditor.init(helper.getIvySettingsPath(), helper.getPropertyFiles());
}
if (conf.isRetrieveProjectSpecific()) {
@@ -446,8 +444,8 @@
conf.retrieveTypes, conf.retrieveSync);
} else {
retrieveProjectSpecificButton.setSelection(false);
- retrieveComposite.init(helper.getDoRetrieve(), helper.getRetrievePattern(), helper.getRetrieveConfs(), helper.getRetrieveTypes(), helper
- .getRetrieveSync());
+ retrieveComposite.init(helper.getDoRetrieve(), helper.getRetrievePattern(), helper
+ .getRetrieveConfs(), helper.getRetrieveTypes(), helper.getRetrieveSync());
}
if (conf.isAdvancedProjectSpecific()) {
@@ -472,7 +470,7 @@
void updateFieldsStatusSettings() {
boolean projectSpecific = settingsProjectSpecificButton.getSelection();
mainGeneralSettingsLink.setEnabled(!projectSpecific);
- settingsText.setEnabled(projectSpecific);
+ settingsEditor.setEnabled(projectSpecific);
}
void updateFieldsStatusRetrieve() {
Copied: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java (from r731513, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java)
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java?p2=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java&p1=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java&r1=731513&r2=731524&rev=731524&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java Mon Jan 5 03:03:24 2009
@@ -25,6 +25,7 @@
import org.apache.ivyde.eclipse.IvyDEException;
import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.fieldassist.DecoratedField;
import org.eclipse.jface.fieldassist.FieldDecoration;
@@ -33,8 +34,6 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -43,15 +42,19 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-public class SettingsPathText extends Composite {
+public class SettingsEditor extends Composite {
- public static final String TOOLTIP_SETTINGS = "The url where your ivysettings file can be found. \n"
+ 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"
+ "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";
+
private Text settingsText;
private DecoratedField settingsTextDeco;
@@ -62,13 +65,18 @@
private FieldDecoration errorDecoration;
- public SettingsPathText(Composite parent, int style) {
+ private Text propFilesText;
+
+ public SettingsEditor(Composite parent, int style) {
super(parent, style);
- GridLayout layout = new GridLayout(2, false);
+ GridLayout layout = new GridLayout(3, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
setLayout(layout);
+ Label label = new Label(this, SWT.NONE);
+ label.setText("Ivy settings path:");
+
errorDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
FieldDecorationRegistry.DEC_ERROR);
@@ -79,7 +87,7 @@
});
settingsTextDeco.addFieldDecoration(errorDecoration, SWT.TOP | SWT.LEFT, false);
// settingsTextDeco.setMarginWidth(2);
- settingsTextDeco.hideDecoration(errorDecoration);
+ settingsTextDeco.hideDecoration(errorDecoration);
// this doesn't work well: we want the decoration image to be clickable, but it actually
// hides the clickable area
// settingsTextDeco.getLayoutControl().addMouseListener(new MouseAdapter() {
@@ -94,7 +102,7 @@
// });
settingsText = (Text) settingsTextDeco.getControl();
- settingsText.setToolTipText(TOOLTIP_SETTINGS);
+ settingsText.setToolTipText(TOOLTIP_SETTINGS_PATH);
settingsTextDeco.getLayoutControl().setLayoutData(
new GridData(GridData.FILL, GridData.FILL, true, false));
settingsText.addModifyListener(new ModifyListener() {
@@ -120,23 +128,39 @@
}
}
});
+
+ label = new Label(this, SWT.NONE);
+ label.setText("Property files:");
+
+ propFilesText = new Text(this, SWT.BORDER);
+ propFilesText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+ propFilesText.setToolTipText(TOOLTIP_PROPERTY_FILES);
+ propFilesText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ settingsPathUpdated();
+ }
+ });
}
public String getSettingsPath() {
return settingsText.getText();
}
- public interface SettingsPathListener {
- void settingsPathUpdated(String path);
+ public List getPropertyFiles() {
+ return IvyClasspathUtil.split(propFilesText.getText());
+ }
+
+ public interface SettingsEditorListener {
+ void settingsEditorUpdated(String path);
}
- public void addListener(SettingsPathListener listener) {
+ public void addListener(SettingsEditorListener listener) {
synchronized (listeners) {
listeners.add(listener);
}
}
- public void remodeListener(SettingsPathListener listener) {
+ public void remodeListener(SettingsEditorListener listener) {
synchronized (listeners) {
listeners.remove(listener);
}
@@ -146,7 +170,7 @@
synchronized (listeners) {
Iterator it = listeners.iterator();
while (it.hasNext()) {
- ((SettingsPathListener) it.next()).settingsPathUpdated(settingsText.getText());
+ ((SettingsEditorListener) it.next()).settingsEditorUpdated(settingsText.getText());
}
}
}
@@ -191,12 +215,19 @@
return null;
}
- public void init(String ivySettingsPath) {
+ public void init(String ivySettingsPath, String propertyFiles) {
settingsText.setText(ivySettingsPath);
+ propFilesText.setText(propertyFiles);
+ }
+
+ public void init(String ivySettingsPath, List propertyFiles) {
+ init(ivySettingsPath, IvyClasspathUtil.concat(propertyFiles));
}
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
settingsText.setEnabled(enabled);
+ propFilesText.setEnabled(enabled);
}
+
}
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
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=731524&r1=731523&r2=731524&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 Jan 5 03:03:24 2009
@@ -54,6 +54,8 @@
public static final boolean DEFAULT_ALPHABETICAL_ORDER = false;
public static final boolean DEFAULT_RESOLVE_IN_WORKSPACE = false;
+
+ public static final String DEFAULT_PROPERTY_FILES = "";
private final IPreferenceStore prefStore;
@@ -96,6 +98,7 @@
prefStore.setDefault(PreferenceConstants.ALPHABETICAL_ORDER, DEFAULT_ALPHABETICAL_ORDER);
prefStore
.setDefault(PreferenceConstants.RESOLVE_IN_WORKSPACE, DEFAULT_RESOLVE_IN_WORKSPACE);
+ prefStore.setDefault(PreferenceConstants.PROPERTY_FILES, DEFAULT_PROPERTY_FILES);
}
public String getIvyOrg() {
@@ -234,4 +237,11 @@
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));
+ }
}
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java?rev=731524&r1=731523&r2=731524&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java Mon Jan 5 03:03:24 2009
@@ -21,7 +21,7 @@
import org.apache.ivyde.eclipse.IvyPlugin;
import org.apache.ivyde.eclipse.ui.AcceptedSuffixesTypesComposite;
import org.apache.ivyde.eclipse.ui.RetrieveComposite;
-import org.apache.ivyde.eclipse.ui.SettingsPathText;
+import org.apache.ivyde.eclipse.ui.SettingsEditor;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -54,7 +54,7 @@
private RetrieveComposite retrieveComposite;
- private SettingsPathText settingsPathText;
+ private SettingsEditor settingsEditor;
private Button resolveInWorkspaceCheck;
@@ -93,8 +93,8 @@
settingsGroup.setLayout(new GridLayout());
settingsGroup.setText("Global settings");
- settingsPathText = new SettingsPathText(settingsGroup, SWT.NONE);
- settingsPathText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+ settingsEditor = new SettingsEditor(settingsGroup, SWT.NONE);
+ settingsEditor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
Group retrieveGroup = new Group(composite, SWT.NONE);
retrieveGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
@@ -156,7 +156,7 @@
private void initPreferences() {
IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper();
- settingsPathText.init(helper.getIvySettingsPath());
+ settingsEditor.init(helper.getIvySettingsPath(), helper.getPropertyFiles());
retrieveComposite.init(helper.getDoRetrieve(), helper.getRetrievePattern(), helper
.getRetrieveConfs(), helper.getRetrieveTypes(), helper.getRetrieveSync());
resolveInWorkspaceCheck.setSelection(helper.isResolveInWorkspace());
@@ -169,7 +169,8 @@
public boolean performOk() {
IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper();
- helper.setIvySettingsPath(settingsPathText.getSettingsPath());
+ helper.setIvySettingsPath(settingsEditor.getSettingsPath());
+ helper.setPropertyFiles(settingsEditor.getPropertyFiles());
helper.setDoRetrieve(retrieveComposite.isRetrieveEnabled());
helper.setRetrievePattern(retrieveComposite.getRetrievePattern());
helper.setRetrieveSync(retrieveComposite.isSyncEnabled());
@@ -188,7 +189,8 @@
}
protected void performDefaults() {
- settingsPathText.init(IvyDEPreferenceStoreHelper.DEFAULT_IVYSETTINGS_PATH);
+ settingsEditor.init(IvyDEPreferenceStoreHelper.DEFAULT_IVYSETTINGS_PATH,
+ IvyDEPreferenceStoreHelper.DEFAULT_PROPERTY_FILES);
retrieveComposite.init(IvyDEPreferenceStoreHelper.DEFAULT_DO_RETRIEVE,
IvyDEPreferenceStoreHelper.DEFAULT_RETRIEVE_PATTERN,
IvyDEPreferenceStoreHelper.DEFAULT_RETRIEVE_CONFS,
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=731524&r1=731523&r2=731524&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 Jan 5 03:03:24 2009
@@ -66,5 +66,6 @@
public static final String RESOLVE_IN_WORKSPACE = "resolveInWorkspace";
+ public static final String PROPERTY_FILES = "propertyFiles";
}
Propchange: ant/ivy/ivyde/trunk/test/property-files/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jan 5 03:03:24 2009
@@ -0,0 +1,2 @@
+bin
+
Added: ant/ivy/ivyde/trunk/test/property-files/.classpath
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/property-files/.classpath?rev=731524&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/property-files/.classpath (added)
+++ ant/ivy/ivyde/trunk/test/property-files/.classpath Mon Jan 5 03:03:24 2009
@@ -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=project%3A%2F%2F%2Fivysettings.xml&propertyFiles=build.properties&doRetrieve=false&retrievePattern=lib%2F%5Bconf%5D%2F%5Bartifact%5D.%5Bext%5D&retrieveSync=false&retrieveConfs=*&retrieveTypes=*&acceptedTypes=jar&sourceTypes=source&javadocTypes=javadoc&sourceSuffixes=-source%2C-sources%2C-src&javadocSuffixes=-javadoc%2C-javadocs%2C-doc%2C-docs&alphaOrder=false&resolveInWorkspace=false"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: ant/ivy/ivyde/trunk/test/property-files/.project
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/property-files/.project?rev=731524&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/property-files/.project (added)
+++ ant/ivy/ivyde/trunk/test/property-files/.project Mon Jan 5 03:03:24 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>ivydetest-property-files</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>
+ </natures>
+</projectDescription>
Added: ant/ivy/ivyde/trunk/test/property-files/build.properties
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/property-files/build.properties?rev=731524&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/property-files/build.properties (added)
+++ ant/ivy/ivyde/trunk/test/property-files/build.properties Mon Jan 5 03:03:24 2009
@@ -0,0 +1 @@
+fakerepo.dir=${ivy.settings.dir}/../fakerepo
\ No newline at end of file
Propchange: ant/ivy/ivyde/trunk/test/property-files/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/test/property-files/build.properties
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Added: ant/ivy/ivyde/trunk/test/property-files/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/property-files/ivy.xml?rev=731524&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/property-files/ivy.xml (added)
+++ ant/ivy/ivyde/trunk/test/property-files/ivy.xml Mon Jan 5 03:03:24 2009
@@ -0,0 +1,31 @@
+<!--
+ 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-property-files">
+ <description>
+ Project using some settings relying on 'external' property files
+ </description>
+ </info>
+ <configurations>
+ <conf name="default" />
+ </configurations>
+ <dependencies>
+ <dependency org="myorg" name="mymodule" rev="1.1" conf="default" />
+ </dependencies>
+</ivy-module>
Propchange: ant/ivy/ivyde/trunk/test/property-files/ivy.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/test/property-files/ivy.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/test/property-files/ivy.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml?rev=731524&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml (added)
+++ ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml Mon Jan 5 03:03:24 2009
@@ -0,0 +1,9 @@
+<ivysettings>
+ <settings defaultResolver="fakerepo" checkUpToDate="false" />
+ <resolvers>
+ <filesystem name="fakerepo">
+ <ivy pattern="${fakerepo.dir}/[organisation]/[module]/ivy-[revision].xml"/>
+ <artifact pattern="${fakerepo.dir}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
+ </filesystem>
+ </resolvers>
+</ivysettings>
Propchange: ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/test/property-files/ivysettings.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml