Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDE-1962 Create new import sdk project wizard - SDK change
- Loading branch information
Showing
4 changed files
with
233 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...ins/com.liferay.ide.sdk.core/src/com/liferay/ide/sdk/core/AbstractPropertySetterTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
tools/plugins/com.liferay.ide.sdk.core/src/com/liferay/ide/sdk/core/AntPropertyCopy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
Oops, something went wrong.