Search in sources :

Example 1 with BladeCLIException

use of com.liferay.ide.project.core.modules.BladeCLIException in project liferay-ide by liferay.

the class InitConfigureProjectPage method _createLiferayWorkspace.

private void _createLiferayWorkspace(IPath targetSDKLocation, IProgressMonitor monitor) throws CoreException {
    SubMonitor progress = SubMonitor.convert(monitor, 100);
    try {
        progress.beginTask("Initializing Liferay Workspace...", 100);
        StringBuilder sb = new StringBuilder();
        sb.append("--base ");
        sb.append("\"" + targetSDKLocation.toFile().getAbsolutePath() + "\" ");
        sb.append("init -u");
        progress.worked(30);
        BladeCLI.execute(sb.toString());
        progress.worked(100);
    } catch (BladeCLIException bclie) {
        ProjectUI.logError(bclie);
        throw new CoreException(StatusBridge.create(Status.createErrorStatus("Faild execute Liferay Workspace Init Command...", bclie)));
    } finally {
        progress.done();
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) BladeCLIException(com.liferay.ide.project.core.modules.BladeCLIException) SubMonitor(org.eclipse.core.runtime.SubMonitor)

Example 2 with BladeCLIException

use of com.liferay.ide.project.core.modules.BladeCLIException in project liferay-ide by liferay.

the class LiferayGradleWorkspaceProjectProvider method createNewProject.

@Override
public IStatus createNewProject(NewLiferayWorkspaceOp op, IProgressMonitor monitor) throws CoreException {
    IPath location = PathBridge.create(op.getLocation().content());
    String wsName = op.getWorkspaceName().toString();
    IPath wsLocation = location.append(wsName);
    StringBuilder sb = new StringBuilder();
    sb.append("--base ");
    sb.append("\"");
    sb.append(wsLocation.toFile().getAbsolutePath());
    sb.append("\" ");
    sb.append("");
    sb.append("init");
    try {
        BladeCLI.execute(sb.toString());
    } catch (BladeCLIException bclie) {
        return ProjectCore.createErrorStatus(bclie);
    }
    String workspaceLocation = location.append(wsName).toPortableString();
    boolean initBundle = op.getProvisionLiferayBundle().content();
    String bundleUrl = op.getBundleUrl().content(false);
    return importProject(workspaceLocation, monitor, initBundle, bundleUrl);
}
Also used : IPath(org.eclipse.core.runtime.IPath) BladeCLIException(com.liferay.ide.project.core.modules.BladeCLIException)

Example 3 with BladeCLIException

use of com.liferay.ide.project.core.modules.BladeCLIException in project liferay-ide by liferay.

the class LiferayMavenWorkspaceProjectProvider method createNewProject.

@Override
public IStatus createNewProject(NewLiferayWorkspaceOp op, IProgressMonitor monitor) throws CoreException {
    IPath location = PathBridge.create(op.getLocation().content());
    String wsName = op.getWorkspaceName().toString();
    IPath wsLocation = location.append(wsName);
    StringBuilder sb = new StringBuilder();
    sb.append("--base ");
    sb.append("\"");
    sb.append(wsLocation.toFile().getAbsolutePath());
    sb.append("\" ");
    sb.append("init ");
    sb.append("-b ");
    sb.append("maven");
    try {
        BladeCLI.execute(sb.toString());
    } catch (BladeCLIException bclie) {
        return ProjectCore.createErrorStatus(bclie);
    }
    String workspaceLocation = location.append(wsName).toPortableString();
    boolean initBundle = op.getProvisionLiferayBundle().content();
    String bundleUrl = op.getBundleUrl().content(false);
    return importProject(workspaceLocation, monitor, initBundle, bundleUrl);
}
Also used : IPath(org.eclipse.core.runtime.IPath) BladeCLIException(com.liferay.ide.project.core.modules.BladeCLIException)

Aggregations

BladeCLIException (com.liferay.ide.project.core.modules.BladeCLIException)3 IPath (org.eclipse.core.runtime.IPath)2 CoreException (org.eclipse.core.runtime.CoreException)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1