use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class ProjectNameListener method handleTypedEvent.
@Override
protected void handleTypedEvent(PropertyContentEvent event) {
NewLiferayPluginProjectOp op = op(event);
op.setImportProjectStatus(false);
NewLiferayPluginProjectOpMethods.updateLocation(op);
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class ProjectNameValidationService method dispose.
@Override
public void dispose() {
super.dispose();
NewLiferayPluginProjectOp op = _op();
op.detach(_listener, "*");
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class PluginTypeValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
NewLiferayPluginProjectOp op = _op();
try {
SDK sdk = SDKUtil.getWorkspaceSDK();
if (sdk == null) {
Path sdkLocation = op.getSdkLocation().content();
if (sdkLocation != null) {
sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkLocation));
}
}
PluginType pluginType = op.getPluginType().content();
if (sdk != null) {
if (pluginType.equals(PluginType.web) && !supportsTypePlugin(op, "web")) {
StringBuilder sb = new StringBuilder();
sb.append("The selected Plugins SDK does not support creating new web type plugins. ");
sb.append("");
sb.append("Please configure version 7.0 or greater.");
return Status.createErrorStatus(sb.toString());
} else if (pluginType.equals(PluginType.theme) && !supportsTypePlugin(op, "theme")) {
StringBuilder sb = new StringBuilder();
sb.append("The selected Plugins SDK does not support creating theme type plugins. ");
sb.append("");
sb.append("Please configure version 6.2 or less or using gulp way.");
return Status.createErrorStatus(sb.toString());
} else if (pluginType.equals(PluginType.ext) && !supportsTypePlugin(op, "ext")) {
StringBuilder sb = new StringBuilder();
sb.append("The selected Plugins SDK does not support creating ext type plugins. ");
sb.append("");
sb.append("Please try to confirm whether sdk has ext folder.");
return Status.createErrorStatus(sb.toString());
}
} else if (pluginType.equals(PluginType.ext) && !supportsTypePlugin(op, "ext")) {
retval = Status.createErrorStatus("New ext plugins with maven build type are no longer supported.");
}
} catch (CoreException ce) {
}
return retval;
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class PortletFrameworkValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
NewLiferayPluginProjectOp op = _op();
ILiferayProjectProvider projectProvider = op.getProjectProvider().content();
IPortletFramework portletFramework = op.getPortletFramework().content();
if (!portletFramework.supports(projectProvider)) {
return Status.createErrorStatus("Selected portlet framework is not supported with " + projectProvider.getDisplayName());
}
try {
if ("ant".equals(projectProvider.getShortName())) {
SDK sdk = SDKUtil.getWorkspaceSDK();
if (sdk != null) {
Version requiredVersion = new Version(portletFramework.getRequiredSDKVersion());
Version sdkVersion = new Version(sdk.getVersion());
if (CoreUtil.compareVersions(requiredVersion, sdkVersion) > 0) {
retval = Status.createErrorStatus("Selected portlet framework requires SDK version at least " + requiredVersion);
}
}
}
} catch (CoreException ce) {
}
return retval;
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class SDKLocationValidationService method compute.
@Override
protected Status compute() {
NewLiferayPluginProjectOp op = _op();
NewLiferayProjectProvider<NewLiferayPluginProjectOp> provider = op.getProjectProvider().content();
if (!provider.getShortName().equals("ant")) {
return Status.createOkStatus();
}
int countPossibleWorkspaceSDKProjects = SDKUtil.countPossibleWorkspaceSDKProjects();
if (countPossibleWorkspaceSDKProjects > 1) {
return StatusBridge.create(ProjectCore.createErrorStatus("This workspace has more than one SDK."));
}
Path sdkLocation = op.getSdkLocation().content(true);
if ((sdkLocation == null) || sdkLocation.isEmpty()) {
return StatusBridge.create(ProjectCore.createErrorStatus("This sdk location is empty."));
}
SDK sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkLocation));
if (sdk != null) {
IStatus status = sdk.validate(true);
if (!status.isOK()) {
return StatusBridge.create(status);
}
} else {
return StatusBridge.create(ProjectCore.createErrorStatus("This sdk location is not correct."));
}
Path projectLocation = op.getLocation().content();
String projectName = op.getProjectName().content();
IPath projectPath = PathBridge.create(projectLocation);
if (FileUtil.exists(projectPath)) {
return StatusBridge.create(ProjectCore.createErrorStatus("Project(" + projectName + ") is existed in sdk folder, please set new project name."));
}
PluginType pluginType = op.getPluginType().content();
if (pluginType.equals(PluginType.web) && !supportsTypePlugin(op, "web")) {
StringBuilder sb = new StringBuilder();
sb.append("The selected Plugins SDK does not support creating new web type plugins. ");
sb.append("");
sb.append("Please configure version 7.0 or greater.");
return Status.createErrorStatus(sb.toString());
} else if (pluginType.equals(PluginType.theme) && !supportsTypePlugin(op, "theme")) {
StringBuilder sb = new StringBuilder();
sb.append("The selected Plugins SDK does not support creating theme type plugins. ");
sb.append("");
sb.append("Please configure version 6.2 or less or using gulp way.");
return Status.createErrorStatus(sb.toString());
} else if (pluginType.equals(PluginType.portlet)) {
IPortletFramework portletFramework = op.getPortletFramework().content();
Version requiredVersion = new Version(portletFramework.getRequiredSDKVersion());
Version sdkVersion = new Version(sdk.getVersion());
if (CoreUtil.compareVersions(requiredVersion, sdkVersion) > 0) {
StringBuilder sb = new StringBuilder();
sb.append("Selected portlet framework requires SDK version at least ");
sb.append("");
sb.append(requiredVersion);
return Status.createErrorStatus(sb.toString());
}
} else if (pluginType.equals(PluginType.ext) && !supportsTypePlugin(op, "ext")) {
StringBuilder sb = new StringBuilder();
sb.append("The selected Plugins SDK does not support creating ext type plugins. ");
sb.append("");
sb.append("Please try to confirm whether sdk has ext folder.");
return Status.createErrorStatus(sb.toString());
}
return Status.createOkStatus();
}
Aggregations