use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class ThemeFrameworkValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
NewLiferayPluginProjectOp op = _op();
String currentThemeFramework = op.getThemeFramework().content();
if (currentThemeFramework.equals("JSP")) {
retval = Status.createWarningStatus("For advanced theme developers only.");
}
return retval;
}
use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class NewLiferayPluginProjectOpMethods method execute.
public static final Status execute(NewLiferayPluginProjectOp op, ProgressMonitor pm) {
IProgressMonitor monitor = ProgressMonitorBridge.create(pm);
monitor.beginTask("Creating Liferay plugin project (this process may take several minutes)", 100);
Status retval = null;
try {
NewLiferayProjectProvider<NewLiferayPluginProjectOp> projectProvider = op.getProjectProvider().content(true);
// IDE-1306 If the user types too quickly all the model changes may not have propagated
Path projectLocation = op.getLocation().content();
updateLocation(op, projectLocation);
IStatus status = projectProvider.createNewProject(op, monitor);
if (status.isOK()) {
_updateProjectPrefs(op);
_removeSampleCodeAndFiles(op);
op.setImportProjectStatus(true);
}
retval = StatusBridge.create(status);
} catch (Exception e) {
String msg = "Error creating Liferay plugin project.";
ProjectCore.logError(msg, e);
return Status.createErrorStatus(msg + " Please see Eclipse error log for more details.", e);
}
return retval;
}
use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class NewLiferayModuleProjectOpMethods method execute.
public static final Status execute(NewLiferayModuleProjectOp op, ProgressMonitor pm) {
IProgressMonitor monitor = ProgressMonitorBridge.create(pm);
monitor.beginTask("Creating Liferay module project (this process may take several minutes)", 100);
Status retval = null;
try {
NewLiferayProjectProvider<BaseModuleOp> projectProvider = op.getProjectProvider().content(true);
IStatus status = projectProvider.createNewProject(op, monitor);
retval = StatusBridge.create(status);
String projectName = op.getProjectName().content();
IPath location = PathBridge.create(op.getLocation().content());
IPath projectLocation = location;
String lastSegment = location.lastSegment();
if ((location != null) && (location.segmentCount() > 0) && !lastSegment.equals(projectName)) {
projectLocation = location.append(projectName);
}
List<IPath> finalClassPaths = _getClassFilePath(projectLocation);
for (IPath classFilePath : finalClassPaths) {
File finalClassFile = classFilePath.toFile();
if (FileUtil.exists(finalClassFile)) {
ElementList<PropertyKey> propertyKeys = op.getPropertyKeys();
List<String> properties = new ArrayList<>();
for (PropertyKey propertyKey : propertyKeys) {
properties.add(propertyKey.getName().content(true) + "=" + propertyKey.getValue().content(true));
}
if (addProperties(finalClassFile, properties)) {
IProject project = CoreUtil.getProject(op.getProjectName().content());
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
}
}
if (retval.ok()) {
_updateBuildPrefs(op);
}
} catch (Exception e) {
String msg = "Error creating Liferay module project.";
ProjectCore.logError(msg, e);
return Status.createErrorStatus(msg + " " + e.getMessage(), e);
}
return retval;
}
use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class PackageNameValidationService method compute.
@Override
protected Status compute() {
NewLiferayModuleProjectOp op = _op();
String packageName = op.getPackageName().content(true);
Status retval = Status.createOkStatus();
int packageNameStatus = IStatus.OK;
if (!CoreUtil.isNullOrEmpty(packageName)) {
IStatus status = JavaConventions.validatePackageName(packageName, CompilerOptions.VERSION_1_7, CompilerOptions.VERSION_1_7);
packageNameStatus = status.getSeverity();
if (packageNameStatus == IStatus.ERROR) {
retval = Status.createErrorStatus("Invalid package name");
}
}
return retval;
}
use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.
the class ModuleProjectNameValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
BaseModuleOp op = op();
String currentProjectName = op.getProjectName().content();
if (!CoreUtil.empty(currentProjectName)) {
IStatus nameStatus = CoreUtil.getWorkspace().validateName(currentProjectName, IResource.PROJECT);
if (!nameStatus.isOK()) {
return StatusBridge.create(nameStatus);
}
if (ValidationUtil.isExistingProjectName(currentProjectName)) {
return Status.createErrorStatus("A project with that name(ignore case) already exists.");
}
if (!_validProjectName(currentProjectName)) {
return Status.createErrorStatus("The project name is invalid.");
}
Path currentProjectLocation = op.getLocation().content();
if (currentProjectLocation != null) {
String currentPath = currentProjectLocation.toOSString();
IPath osPath = org.eclipse.core.runtime.Path.fromOSString(currentPath);
NewLiferayProjectProvider<BaseModuleOp> provider = op.getProjectProvider().content();
IStatus projectStatus = provider.validateProjectLocation(currentProjectName, osPath);
if (!projectStatus.isOK()) {
return StatusBridge.create(projectStatus);
}
File projectFodler = osPath.append(currentProjectName).toFile();
if (FileUtil.hasChildren(projectFodler)) {
return StatusBridge.create(ProjectCore.createErrorStatus("Target project folder is not empty."));
}
}
}
return retval;
}
Aggregations