Search in sources :

Example 66 with Status

use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.

the class GradleModuleProjectTests method create.

private IProject create(NewLiferayModuleProjectOp op) throws Exception {
    Status status = op.execute(ProgressMonitorBridge.create(_monitor));
    assertNotNull(status);
    assertTrue(status.message(), status.ok());
    Util.waitForBuildAndValidation();
    return CoreUtil.getProject(op.getProjectName().content());
}
Also used : Status(org.eclipse.sapphire.modeling.Status)

Example 67 with Status

use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.

the class BundleNameValidationService method compute.

@Override
protected Status compute() {
    Status retval = Status.createOkStatus();
    Value<String> bundleName = _op().getBundleName();
    String serverName = bundleName.content();
    if (CoreUtil.empty(serverName)) {
        retval = Status.createErrorStatus("The Server Name is empty. Please input one.");
        return retval;
    }
    if (ServerPlugin.isNameInUse(null, serverName)) {
        retval = Status.createErrorStatus("The Server Name \"" + serverName + "\"+ is already in use. Specify a different name.");
        return retval;
    }
    return retval;
}
Also used : Status(org.eclipse.sapphire.modeling.Status)

Example 68 with Status

use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.

the class ConvertedProjectLocationValidationService method compute.

@Override
protected Status compute() {
    Status retval = Status.createOkStatus();
    Value<Path> convertedProjectLocation = _op().getConvertedProjectLocation();
    final Path currentProjectLocation = convertedProjectLocation.content(true);
    if (currentProjectLocation != null) {
        final String currentPath = currentProjectLocation.toPortableString();
        if (!org.eclipse.core.runtime.Path.EMPTY.isValidPath(currentPath)) {
            retval = Status.createErrorStatus("\"" + currentPath + "\" is not a valid path.");
        } else {
            IPath osPath = org.eclipse.core.runtime.Path.fromOSString(currentPath);
            if (!osPath.toFile().isAbsolute()) {
                retval = Status.createErrorStatus("\"" + currentPath + "\" is not an absolute path.");
            } else {
                if (!osPath.toFile().exists()) {
                    if (!_canCreate(osPath.toFile())) {
                        retval = Status.createErrorStatus("Cannot create project content at \"" + currentPath + "\"");
                    }
                }
            }
        }
    } else {
        retval = Status.createErrorStatus("Converted Project Location must be specified.");
    }
    return retval;
}
Also used : Status(org.eclipse.sapphire.modeling.Status) IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.sapphire.modeling.Path) IPath(org.eclipse.core.runtime.IPath)

Example 69 with Status

use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.

the class UpgradeServiceBuilderHandler method execute.

@Override
public Status execute(IProject project, String runtimeName, IProgressMonitor monitor, int perUnit) {
    Status retval = Status.createOkStatus();
    try {
        int worked = 0;
        IProgressMonitor submon = CoreUtil.newSubMonitor(monitor, 25);
        submon.subTask("Executing build-service for " + project.getName());
        worked = worked + perUnit;
        submon.worked(worked);
        BuildServiceJob job = new BuildServiceJob(project);
        job.schedule();
        job.join();
        IStatus result = job.getResult();
        if (!result.isOK()) {
            throw new CoreException(result);
        }
        worked = worked + perUnit;
        submon.worked(worked);
    } catch (Exception e) {
        IStatus error = ServiceCore.createErrorStatus("Unable to run service build task for " + project.getName(), e);
        ServiceCore.logError("Unable to run service build task for " + project.getName(), e);
        retval = StatusBridge.create(error);
    }
    return retval;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.sapphire.modeling.Status) BuildServiceJob(com.liferay.ide.service.core.job.BuildServiceJob) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) CoreException(org.eclipse.core.runtime.CoreException)

Example 70 with Status

use of org.eclipse.sapphire.modeling.Status in project liferay-ide by liferay.

the class NewNodeNameValidationService method compute.

@Override
public Status compute() {
    Status retval = Status.createOkStatus();
    WorkflowNode newNode = context(WorkflowNode.class);
    WorkflowDefinition workflowDefinition = newNode.adapt(WorkflowDefinition.class);
    if (workflowDefinition != null) {
        for (WorkflowNode node : workflowDefinition.getDiagramNodes()) {
            Value<String> nodeName = node.getName();
            String name = nodeName.content();
            if ((name != null) && name.equals(newNode.getName().content())) {
                retval = Status.createErrorStatus("Name already in use.");
                break;
            }
        }
    }
    return retval;
}
Also used : Status(org.eclipse.sapphire.modeling.Status) WorkflowDefinition(com.liferay.ide.kaleo.core.model.WorkflowDefinition) WorkflowNode(com.liferay.ide.kaleo.core.model.WorkflowNode)

Aggregations

Status (org.eclipse.sapphire.modeling.Status)83 IProject (org.eclipse.core.resources.IProject)33 Test (org.junit.Test)31 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)29 IStatus (org.eclipse.core.runtime.IStatus)25 Path (org.eclipse.sapphire.modeling.Path)18 CoreException (org.eclipse.core.runtime.CoreException)15 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)15 NewLiferayJSFModuleProjectOp (com.liferay.ide.project.core.jsf.NewLiferayJSFModuleProjectOp)14 IFile (org.eclipse.core.resources.IFile)12 IPath (org.eclipse.core.runtime.IPath)11 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)10 NewLiferayModuleProjectOp (com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp)9 SDK (com.liferay.ide.sdk.core.SDK)9 File (java.io.File)6 NewLiferayComponentOp (com.liferay.ide.project.core.modules.NewLiferayComponentOp)5 IRuntime (org.eclipse.wst.server.core.IRuntime)5 PropertyKey (com.liferay.ide.project.core.modules.PropertyKey)3 NewModuleFragmentOp (com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp)3 ArrayList (java.util.ArrayList)3