use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class BundleUrlDefaultValueService method compute.
@Override
protected String compute() {
String bundleURL = null;
ImportLiferayWorkspaceOp op = _op();
Value<Path> workspaceLocationValue = op.getWorkspaceLocation();
Path path = workspaceLocationValue.content();
if (path == null) {
return null;
}
String workspaceLocation = path.toPortableString();
String buildType = LiferayWorkspaceUtil.getWorkspaceType(workspaceLocation);
if (buildType == null) {
return bundleURL;
}
if (buildType.startsWith("gradle")) {
return LiferayWorkspaceUtil.getGradleProperty(workspaceLocation, LiferayWorkspaceUtil.LIFERAY_WORKSPACE_BUNDLE_URL, BaseLiferayWorkspaceOp.DEFAULT_BUNDLE_URL);
} else {
return bundleURL = BaseLiferayWorkspaceOp.DEFAULT_BUNDLE_URL;
}
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class CheckSDKLocationDerivedValueService method compute.
@Override
protected String compute() {
CodeUpgradeOp op = _op();
final Path path = op.getSdkLocation().content();
SDK sdk = SDKUtil.createSDKFromLocation(PathBridge.create(path));
String liferay62ServerLocation = null;
try {
if (sdk != null) {
liferay62ServerLocation = (String) (sdk.getBuildProperties(true).get(ISDKConstants.PROPERTY_APP_SERVER_PARENT_DIR));
_checkProjects(op, sdk);
} else {
_setAllStateFalse(op);
}
} catch (CoreException ce) {
}
return liferay62ServerLocation;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ImportLiferayWorkspaceServerNameService method compute.
@Override
protected String compute() {
Value<Path> workspaceLocation = _op().getWorkspaceLocation();
Path path = workspaceLocation.content();
if (path == null) {
return StringPool.EMPTY;
}
String serverName = path.lastSegment() + " server";
PortalBundle bundle = LiferayServerCore.newPortalBundle(PathBridge.create(path).append("bundles"));
if (bundle != null) {
serverName = bundle.getServerReleaseInfo();
}
return serverName;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ImportWorkspaceLocationValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
try {
if (LiferayWorkspaceUtil.hasWorkspace()) {
return Status.createErrorStatus(LiferayWorkspaceUtil.hasLiferayWorkspaceMsg);
}
} catch (CoreException ce) {
return Status.createErrorStatus(LiferayWorkspaceUtil.multiWorkspaceErrorMsg);
}
Value<Path> workspaceLocation = _op().getWorkspaceLocation();
Path currentProjectLocation = workspaceLocation.content(true);
if ((currentProjectLocation != null) && !currentProjectLocation.isEmpty()) {
String currentPath = currentProjectLocation.toOSString();
IStatus validPathStatus = ProjectImportUtil.validatePath(currentPath);
if (!validPathStatus.isOK()) {
return Status.createErrorStatus(validPathStatus.getMessage());
}
if (LiferayWorkspaceUtil.getWorkspaceType(currentPath) == null) {
return Status.createErrorStatus("Invalid Liferay Workspace");
}
String projectName = currentProjectLocation.lastSegment();
if (CoreUtil.getProject(projectName).exists()) {
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 ImportPathService method convertToAbsolute.
@Override
public Path convertToAbsolute(Path path) {
if (path != null) {
IFile file = context(Element.class).adapt(IFile.class);
if (file != null) {
IPath baseLocation = file.getParent().getLocation();
IPath absoluteLocation = baseLocation.append(PathBridge.create(path));
Path absolute = PathBridge.create(absoluteLocation.makeAbsolute());
return absolute;
}
}
return super.convertToAbsolute(path);
}
Aggregations