Skip to content

Commit

Permalink
IDE-1962 Create new import sdk project wizard - SDK change
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjhy committed Jun 12, 2015
1 parent 23db243 commit d5bbab5
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 15 deletions.
3 changes: 2 additions & 1 deletion tools/plugins/com.liferay.ide.sdk.core/META-INF/MANIFEST.MF
Expand Up @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.jdt.launching,
org.eclipse.core.externaltools,
org.eclipse.core.expressions,
org.eclipse.core.variables,
org.apache.commons.lang;bundle-version="2.6.0"
org.apache.commons.lang;bundle-version="2.6.0",
org.apache.ant
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.liferay.ide.sdk.core
@@ -0,0 +1,41 @@
package com.liferay.ide.sdk.core;


import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Property;

public abstract class AbstractPropertySetterTask extends Task {
private boolean override;
private String property;

public void setOverride(boolean override) {
this.override = override;
}

public void setProperty(String property) {
this.property = property;
}

protected void validate() {
if (this.property == null)
throw new BuildException("You must specify a property to set.");
}

@SuppressWarnings( "deprecation" )
protected final void setPropertyValue(String value) {
if (value == null)
return;
if (this.override) {
if (getProject().getUserProperty(this.property) == null)
getProject().setProperty(this.property, value);
else
getProject().setUserProperty(this.property, value);
} else {
Property p = (Property) this.project.createTask("property");
p.setName(this.property);
p.setValue(value);
p.execute();
}
}
}
@@ -0,0 +1,44 @@
package com.liferay.ide.sdk.core;

import org.apache.tools.ant.BuildException;

public class AntPropertyCopy extends AbstractPropertySetterTask {
private String from;
private boolean silent;

public AntPropertyCopy() {
this.from = null;
this.silent = false;
}

public void setName(String name) {
setProperty(name);
}

public void setFrom(String from) {
this.from = from;
}

public void setSilent(boolean silent) {
this.silent = silent;
}

protected void validate() {
super.validate();
if (this.from == null)
throw new BuildException("Missing the 'from' attribute.");
}

public void execute() throws BuildException {
validate();

String value = getProject().getProperty(this.from);

if ((value == null) && (!(this.silent))) {
throw new BuildException("Property '" + this.from
+ "' is not defined.");
}
if (value != null)
setPropertyValue(value);
}
}

0 comments on commit d5bbab5

Please sign in to comment.