use of com.liferay.ide.core.util.MultiStatusBuilder in project liferay-ide by liferay.
the class SDKImportProjectsOpMethods method execute.
public static final Status execute(SDKProjectsImportOp op, ProgressMonitor pm) {
IProgressMonitor monitor = ProgressMonitorBridge.create(pm);
monitor.beginTask("Importing Liferay plugin projects...", 100);
Status retval = Status.createOkStatus();
Path projectLocation = op.getSdkLocation().content();
if ((projectLocation == null) || projectLocation.isEmpty()) {
return Status.createErrorStatus("Project cannot be empty");
}
Job job = new WorkspaceJob("Importing Liferay projects...") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
MultiStatusBuilder statusBuilder = new MultiStatusBuilder(ProjectCore.PLUGIN_ID);
ElementList<ProjectNamedItem> projectItems = op.getSelectedProjects();
for (NamedItem projectNamedItem : projectItems) {
try {
if (projectNamedItem instanceof ProjectNamedItem) {
String projectPath = ((ProjectNamedItem) projectNamedItem).getLocation().content();
String projectLocation = new Path(projectPath).toPortableString();
ProjectImportUtil.importProject(PathBridge.create(new Path(projectLocation)), new NullProgressMonitor(), null);
}
} catch (Exception e) {
statusBuilder.add(StatusBridge.create(Status.createErrorStatus(e.getMessage())));
}
}
return statusBuilder.retval();
}
};
job.schedule();
return retval;
}
use of com.liferay.ide.core.util.MultiStatusBuilder in project liferay-ide by liferay.
the class MavenProjectBuilder method execGoals.
public IStatus execGoals(List<String> goals, IProgressMonitor monitor) throws CoreException {
IStatus retval = null;
IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), monitor);
ICallable<IStatus> callable = new ICallable<IStatus>() {
public IStatus call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
IStatus execStatus = MavenUtil.executeGoals(facade, context, goals, monitor);
MavenSession session = context.getSession();
List<Throwable> exceptions = session.getResult().getExceptions();
MultiStatusBuilder multiStatusBuilder = LiferayMavenCore.newMultiStatus();
multiStatusBuilder.add(execStatus);
multiStatusBuilder.addAll(exceptions);
return multiStatusBuilder.retval();
}
};
retval = executeMaven(facade, callable, monitor);
return retval;
}
Aggregations