Search in sources :

Example 36 with Path

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;
    }
}
Also used : Path(org.eclipse.sapphire.modeling.Path)

Example 37 with Path

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;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.sapphire.modeling.Path) CoreException(org.eclipse.core.runtime.CoreException) SDK(com.liferay.ide.sdk.core.SDK) CodeUpgradeOp(com.liferay.ide.project.core.upgrade.CodeUpgradeOp)

Example 38 with Path

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;
}
Also used : Path(org.eclipse.sapphire.modeling.Path) PortalBundle(com.liferay.ide.server.core.portal.PortalBundle)

Example 39 with Path

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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.sapphire.modeling.Status) Path(org.eclipse.sapphire.modeling.Path) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException)

Example 40 with Path

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);
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.sapphire.modeling.Path) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) Element(org.eclipse.sapphire.Element)

Aggregations

Path (org.eclipse.sapphire.modeling.Path)71 IPath (org.eclipse.core.runtime.IPath)37 IStatus (org.eclipse.core.runtime.IStatus)18 Status (org.eclipse.sapphire.modeling.Status)18 IProject (org.eclipse.core.resources.IProject)17 SDK (com.liferay.ide.sdk.core.SDK)16 CoreException (org.eclipse.core.runtime.CoreException)16 IFile (org.eclipse.core.resources.IFile)12 File (java.io.File)9 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)8 ArrayList (java.util.ArrayList)8 IFolder (org.eclipse.core.resources.IFolder)8 Hook (com.liferay.ide.hook.core.model.Hook)6 Element (org.eclipse.sapphire.Element)6 CustomJspDir (com.liferay.ide.hook.core.model.CustomJspDir)5 IWebProject (com.liferay.ide.core.IWebProject)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)3 ValueProperty (org.eclipse.sapphire.ValueProperty)3 ILiferayPortal (com.liferay.ide.core.ILiferayPortal)2