Search in sources :

Example 1 with BuildServiceJob

use of com.liferay.ide.service.core.job.BuildServiceJob in project liferay-ide by liferay.

the class BuildServiceHandler method executeServiceBuild.

protected IStatus executeServiceBuild(IProject project) {
    IStatus retval = null;
    try {
        new BuildServiceJob(project).schedule();
        retval = Status.OK_STATUS;
    } catch (Exception e) {
        retval = ServiceCore.createErrorStatus("Unable to execute build-service command", e);
    }
    return retval;
}
Also used : BuildServiceJob(com.liferay.ide.service.core.job.BuildServiceJob) IStatus(org.eclipse.core.runtime.IStatus) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 2 with BuildServiceJob

use of com.liferay.ide.service.core.job.BuildServiceJob in project liferay-ide by liferay.

the class BuildServicesActionHandler method run.

@Override
protected Object run(Presentation context) {
    Element modelElement = context.part().getModelElement();
    IFile file = modelElement.adapt(IFile.class);
    if (FileUtil.exists(file)) {
        if (ServiceUIUtil.shouldCreateServiceBuilderJob(file)) {
            new BuildServiceJob(file.getProject()).schedule();
        }
    } else {
        MessageDialog.openWarning(((SwtPresentation) context).shell(), Msgs.buildServices, Msgs.actionUnavailableImportProject);
    }
    return null;
}
Also used : BuildServiceJob(com.liferay.ide.service.core.job.BuildServiceJob) IFile(org.eclipse.core.resources.IFile) Element(org.eclipse.sapphire.Element)

Example 3 with BuildServiceJob

use of com.liferay.ide.service.core.job.BuildServiceJob 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)

Aggregations

BuildServiceJob (com.liferay.ide.service.core.job.BuildServiceJob)3 IStatus (org.eclipse.core.runtime.IStatus)2 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Element (org.eclipse.sapphire.Element)1 Status (org.eclipse.sapphire.modeling.Status)1