use of com.liferay.ide.sdk.core.SDK in project liferay-ide by liferay.
the class PluginsSDKBundleProject method getOutputs.
public Collection<IFile> getOutputs(boolean build, IProgressMonitor monitor) throws CoreException {
Collection<IFile> outputs = new HashSet<>();
if (!build) {
return outputs;
}
getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
SDK sdk = SDKUtil.getSDK(getProject());
IStatus warStatus = sdk.war(getProject(), null, true, monitor);
if (warStatus.isOK()) {
}
return outputs;
}
use of com.liferay.ide.sdk.core.SDK in project liferay-ide by liferay.
the class PluginsSDKBundleProject method getOutputBundle.
@Override
public IPath getOutputBundle(boolean cleanBuild, IProgressMonitor monitor) throws CoreException {
IPath retval = null;
SDK sdk = getSDK();
IStatus status = sdk.validate();
if (!status.isOK()) {
throw new CoreException(status);
}
IStatus warStatus = sdk.war(getProject(), null, true, new String[] { "-Duser.timezone=GMT" }, monitor);
IPath distPath = sdk.getLocation().append("dist");
// TODO need to find a better way to determine the actual output file.
File[] distFiles = distPath.toFile().listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
IPath location = getProject().getLocation();
return name.contains(location.lastSegment());
}
});
if (warStatus.isOK()) {
try {
retval = new Path(distFiles[0].getCanonicalPath());
} catch (IOException ioe) {
throw new CoreException(ProjectCore.createErrorStatus(ioe));
}
}
return retval;
}
use of com.liferay.ide.sdk.core.SDK in project liferay-ide by liferay.
the class PluginsSDKProjectProvider method _getSDK.
private static SDK _getSDK(NewLiferayPluginProjectOp op) {
SDK sdk = null;
try {
boolean sdkValid = false;
sdk = SDKUtil.getWorkspaceSDK();
if (sdk != null) {
IStatus sdkStatus = sdk.validate();
if (sdkStatus.isOK()) {
sdkValid = true;
}
}
if (sdkValid == false) {
Path sdkLocation = op.getSdkLocation().content(true);
if (sdkLocation != null) {
sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkLocation));
if (sdk != null) {
IStatus sdkStatus = sdk.validate();
if (sdkStatus.isOK()) {
sdkValid = true;
}
}
}
}
if (!sdkValid) {
return null;
}
} catch (CoreException ce) {
return null;
}
return sdk;
}
use of com.liferay.ide.sdk.core.SDK in project liferay-ide by liferay.
the class BinaryProjectImportOperation method execute.
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Object selectedProjects = getDataModel().getProperty(ISDKProjectsImportDataModelProperties.SELECTED_PROJECTS);
BridgedRuntime bridgedRuntime = (BridgedRuntime) model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
String sdkLocation = model.getStringProperty(ISDKProjectsImportDataModelProperties.SDK_LOCATION);
if (selectedProjects == null) {
return super.execute(monitor, info);
}
SDKManager sdkManager = SDKManager.getInstance();
SDK liferaySDK = sdkManager.getSDK(new Path(sdkLocation));
Object[] seleBinaryRecords = (Object[]) selectedProjects;
ProjectRecord[] projectRecords = new ProjectRecord[1];
BinaryProjectRecord pluginBinaryRecord = (BinaryProjectRecord) seleBinaryRecords[0];
try {
projectRecords[0] = ProjectImportUtil.createSDKPluginProject(bridgedRuntime, pluginBinaryRecord, liferaySDK);
} catch (Exception e) {
throw new ExecutionException("Error while importing Binary:" + pluginBinaryRecord.getBinaryName(), e);
}
getDataModel().setProperty(SELECTED_PROJECTS, projectRecords);
return super.execute(monitor, info);
}
use of com.liferay.ide.sdk.core.SDK in project liferay-ide by liferay.
the class SDKProjectConvertOperation method getSDKName.
protected String getSDKName() {
String sdkLocation = getDataModel().getStringProperty(SDK_LOCATION);
IPath sdkLocationPath = new Path(sdkLocation);
SDK sdk = SDKManager.getInstance().getSDK(sdkLocationPath);
String sdkName = null;
if (sdk != null) {
sdkName = sdk.getName();
} else {
sdk = SDKUtil.createSDKFromLocation(sdkLocationPath);
SDKManager.getInstance().addSDK(sdk);
sdkName = sdk.getName();
}
return sdkName;
}
Aggregations