use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class DocrootRelativePathService method roots.
@Override
public List<Path> roots() {
List<Path> roots = new ArrayList<>();
Hook hook = context(Hook.class);
if (hook != null) {
IProject project = hook.adapt(IProject.class);
// IDE-110
IWebProject lrproject = LiferayCore.create(IWebProject.class, project);
if (lrproject != null) {
IFolder defaultDocroot = lrproject.getDefaultDocrootFolder();
if (FileUtil.exists(defaultDocroot)) {
roots.add(new Path(defaultDocroot.getLocation().toPortableString()));
}
}
}
return roots;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class CreatePortletAppResourceBundleActionHandler method run.
/**
* (non-Javadoc)
*
* @see
* org.eclipse.sapphire.ui.SapphireActionHandler#run(org.eclipse.sapphire.ui.
* SapphireRenderingContext)
*/
@Override
protected Object run(Presentation context) {
Element element = getModelElement();
IProject project = element.adapt(IProject.class);
Property property = property();
Value<Path> resourceBundle = element.property((ValueProperty) property.definition());
String resourceBundleText = resourceBundle.text();
int index = resourceBundleText.lastIndexOf(".");
if (index == -1) {
index = resourceBundleText.length();
}
String packageName = resourceBundleText.substring(0, index);
String defaultRBFileName = PortletUtil.convertJavaToIoFileName(resourceBundleText, GenericResourceBundlePathService.RB_FILE_EXTENSION);
IFolder rbSourecFolder = getResourceBundleFolderLocation(project, defaultRBFileName);
IPath entryPath = rbSourecFolder.getLocation();
if (getModelElement() instanceof PortletApp) {
List<IFile> missingRBFiles = new ArrayList<>();
StringBuilder rbFileBuffer = new StringBuilder("#Portlet Application Resource Bundle \n");
IFile rbFile = wroot.getFileForLocation(entryPath.append(defaultRBFileName));
missingRBFiles.add(rbFile);
createFiles(context, project, packageName, missingRBFiles, rbFileBuffer);
setEnabled(false);
Property modelElement = getModelElement().property(property().definition());
modelElement.refresh();
}
return null;
}
use of org.eclipse.sapphire.modeling.Path 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 org.eclipse.sapphire.modeling.Path 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.Path in project liferay-ide by liferay.
the class SDKImportDerivedValueService method compute.
@Override
protected String compute() {
String retVal = null;
ParentSDKProjectImportOp op = _op();
Value<Path> path = op.getSdkLocation();
if ((path != null) && (path.content() != null) && !path.content().isEmpty()) {
Path sdkPath = path.content();
SDK sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkPath));
if (sdk != null) {
retVal = sdk.getVersion();
}
}
return retVal;
}
Aggregations