use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class NewMavenJSFModuleProjectProvider method validateProjectLocation.
@Override
public IStatus validateProjectLocation(String projectName, IPath path) {
IStatus retval = Status.OK_STATUS;
Path currentProjectLocation = PathBridge.create(path);
boolean liferayWorkspace = false;
if (currentProjectLocation != null) {
liferayWorkspace = LiferayWorkspaceUtil.isValidWorkspaceLocation(currentProjectLocation.toOSString());
}
if (LiferayWorkspaceUtil.isValidWorkspaceLocation(currentProjectLocation.toOSString())) {
retval = LiferayMavenCore.createErrorStatus("Can't set WorkspaceProject root folder as project directory.");
}
if (liferayWorkspace) {
File workspaceDir = LiferayWorkspaceUtil.getWorkspaceDir(currentProjectLocation.toFile());
if (FileUtil.notExists(workspaceDir)) {
return LiferayCore.createErrorStatus("The project location of Liferay Workspace shoule be existed.");
}
String[] folders = LiferayWorkspaceUtil.getLiferayWorkspaceProjectWarsDirs(workspaceDir.getAbsolutePath());
if (folders != null) {
boolean appendWarFolder = false;
IPath projectLocation = PathBridge.create(currentProjectLocation);
for (String folder : folders) {
if (projectLocation.lastSegment().endsWith(folder)) {
appendWarFolder = true;
break;
}
}
if (appendWarFolder == false) {
return LiferayMavenCore.createErrorStatus("The project location should be wars folder of Liferay workspace.");
}
} else {
return LiferayMavenCore.createErrorStatus("The Liferay Workspace wasn't defined wars folder path.");
}
}
return retval;
}
Aggregations