use of org.eclipse.sapphire.modeling.Path 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;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ModuleFragmentProjectGroupIdDefaultValueService method compute.
@Override
protected String compute() {
String groupId = null;
NewModuleFragmentOp op = _op();
Path location = op.getLocation().content();
if (location != null) {
String parentProjectLocation = location.toOSString();
IPath parentProjectOsPath = org.eclipse.core.runtime.Path.fromOSString(parentProjectLocation);
String projectName = op.getProjectName().content();
groupId = NewModuleFragmentOpMethods.getMavenParentPomGroupId(op, projectName, parentProjectOsPath);
}
if (groupId == null) {
groupId = _getDefaultMavenGroupId();
if (CoreUtil.isNullOrEmpty(groupId)) {
groupId = op.getProjectName().content();
}
}
return groupId;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ImportLiferayModuleProjectOpMethods method execute.
public static final Status execute(ImportLiferayModuleProjectOp op, ProgressMonitor pm) {
IProgressMonitor monitor = ProgressMonitorBridge.create(pm);
monitor.beginTask("Importing Module project...", 100);
Path path = op.getLocation().content();
String location = path.toOSString();
ILiferayProjectImporter importer = LiferayCore.getImporter(op.getBuildType().content());
Status retval = Status.createOkStatus();
try {
importer.importProjects(location, monitor);
} catch (CoreException ce) {
retval = Status.createErrorStatus(ce);
}
return retval;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ImportModuleProjectLocationValidationService method compute.
@Override
protected Status compute() {
ImportLiferayModuleProjectOp op = _op();
Path path = op.getLocation().content();
if ((path == null) || path.isEmpty()) {
return Status.createOkStatus();
}
String location = path.toOSString();
Status retval = StatusBridge.create(ProjectImportUtil.validatePath(location));
if (!retval.ok()) {
return retval;
}
if (LiferayWorkspaceUtil.isValidWorkspaceLocation(location)) {
return Status.createErrorStatus("Can't import Liferay Workspace, please use Import Liferay Workspace Project wizard.");
}
retval = StatusBridge.create(ImportLiferayModuleProjectOpMethods.getBuildType(location));
if (retval.severity() == Status.Severity.ERROR) {
return retval;
}
String projectName = path.lastSegment();
if (FileUtil.exists(CoreUtil.getProject(projectName))) {
return Status.createErrorStatus("A project with that name already exists.");
}
return retval;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class CheckSDKLocationDerivedValueService method _checkProjects.
private void _checkProjects(CodeUpgradeOp op, SDK sdk) {
File[] portlets = _getFiles(sdk, "portlet");
if (portlets != null) {
for (File file : portlets) {
if (file.isDirectory()) {
op.setHasPortlet("true");
File serviceXml = new Path(file.getPath()).append("docroot/WEB-INF/service.xml").toFile();
if (FileUtil.exists(serviceXml)) {
op.setHasServiceBuilder("true");
}
}
}
}
File[] hooks = _getFiles(sdk, "hook");
if (hooks != null) {
for (File file : hooks) {
if (file.isDirectory()) {
op.setHasHook("true");
File serviceXml = new Path(file.getPath()).append("docroot/WEB-INF/service.xml").toFile();
if (FileUtil.exists(serviceXml)) {
op.setHasServiceBuilder("true");
}
}
}
}
File[] exts = _getFiles(sdk, "ext");
if (exts != null) {
for (File file : exts) {
if (file.isDirectory()) {
op.setHasExt("true");
break;
}
}
}
File[] layouttpls = _getFiles(sdk, "layouttpl");
if (layouttpls != null) {
for (File file : layouttpls) {
if (file.isDirectory()) {
op.setHasLayout("true");
break;
}
}
}
File[] themes = _getFiles(sdk, "theme");
if (themes != null) {
for (File file : themes) {
if (file.isDirectory()) {
op.setHasTheme("true");
break;
}
}
}
File[] webs = _getFiles(sdk, "web");
if (webs != null) {
for (File file : webs) {
if (file.isDirectory()) {
op.setHasWeb("true");
break;
}
}
}
}
Aggregations