use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class BackupLocationValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
Value<Path> backupLocation = _op().getBackupLocation();
Path location = backupLocation.content();
if (location != null) {
if (!location.isAbsolute()) {
return Status.createErrorStatus("\"" + location.toPortableString() + "\" is not an absolute path.");
}
if (location.toFile().isFile()) {
return Status.createErrorStatus("\"" + location.toPortableString() + "\" is not a folder.");
}
}
return retval;
}
use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class PortletColumnWeightValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
PortletColumnElement portletColumn = context(PortletColumnElement.class);
int weight = portletColumn.getWeight().content();
LayoutTplElement layoutTpl = portletColumn.nearest(LayoutTplElement.class);
if (layoutTpl != null) {
if (layoutTpl.getBootstrapStyle().content()) {
if ((weight <= 0) || (weight > 12)) {
retval = Status.createErrorStatus("The weight value is invalid, should be in (0, 12]");
}
} else {
if ((weight <= 0) || (weight > 100)) {
retval = Status.createErrorStatus("The weight value is invalid, should be in (0, 100]");
}
}
}
return retval;
}
use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class PortletColumnsValidtionSerivce method compute.
// store PortletColumns who have attached the listener
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
PortletLayoutElement portletLayout = context(PortletLayoutElement.class);
LayoutTplElement layoutTpl = portletLayout.nearest(LayoutTplElement.class);
int actualWeightSum = 0;
int exceptedweightSum = layoutTpl.getBootstrapStyle().content() ? 12 : 100;
for (PortletColumnElement col : portletLayout.getPortletColumns()) {
/*
* attach listener for the newly added PortletColumn there should be a better
* way to do this which makes more sense
*/
if (!_columnsAttachedListener.contains(col)) {
col.getWeight().attach(_listener);
_columnsAttachedListener.add(col);
}
Value<Integer> weight = col.getWeight();
Integer content = weight.content();
actualWeightSum += content.intValue();
}
if (!((actualWeightSum == exceptedweightSum) || ((exceptedweightSum == 100) && (actualWeightSum == 99)))) {
retval = Status.createErrorStatus("The sum of weight of columns should be: " + exceptedweightSum);
}
return retval;
}
use of org.eclipse.sapphire.modeling.Status 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 org.eclipse.sapphire.modeling.Status 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;
}
Aggregations