use of org.jetbrains.idea.maven.project.MavenConsole in project intellij-community by JetBrains.
the class MavenRunner method runBatch.
public boolean runBatch(List<MavenRunnerParameters> commands, @Nullable MavenGeneralSettings coreSettings, @Nullable MavenRunnerSettings runnerSettings, @Nullable final String action, @Nullable ProgressIndicator indicator) {
LOG.assertTrue(!ApplicationManager.getApplication().isReadAccessAllowed());
if (commands.isEmpty())
return true;
MavenConsole console;
AccessToken accessToken = ReadAction.start();
try {
if (myProject.isDisposed())
return false;
console = createConsole();
} finally {
accessToken.finish();
}
try {
int count = 0;
for (MavenRunnerParameters command : commands) {
if (indicator != null) {
indicator.setFraction(((double) count++) / commands.size());
}
MavenExecutor executor;
accessToken = ReadAction.start();
try {
if (myProject.isDisposed())
break;
executor = createExecutor(command, coreSettings, runnerSettings, console);
} finally {
accessToken.finish();
}
executor.setAction(action);
if (!executor.execute(indicator)) {
updateTargetFolders();
return false;
}
}
updateTargetFolders();
} finally {
console.finish();
}
return true;
}
use of org.jetbrains.idea.maven.project.MavenConsole in project intellij-community by JetBrains.
the class MavenRunner method run.
public void run(final MavenRunnerParameters parameters, final MavenRunnerSettings settings, final Runnable onComplete) {
FileDocumentManager.getInstance().saveAllDocuments();
final MavenConsole console = createConsole();
try {
final MavenExecutor[] executor = new MavenExecutor[] { createExecutor(parameters, null, settings, console) };
ProgressManager.getInstance().run(new Task.Backgroundable(myProject, executor[0].getCaption(), true) {
public void run(@NotNull ProgressIndicator indicator) {
try {
try {
if (executor[0].execute(indicator)) {
if (onComplete != null)
onComplete.run();
}
} catch (ProcessCanceledException ignore) {
}
executor[0] = null;
updateTargetFolders();
} finally {
console.finish();
}
}
@Nullable
public NotificationInfo getNotificationInfo() {
return new NotificationInfo("Maven", "Maven Task Finished", "");
}
public boolean shouldStartInBackground() {
return settings.isRunMavenInBackground();
}
public void processSentToBackground() {
settings.setRunMavenInBackground(true);
}
public void processRestoredToForeground() {
settings.setRunMavenInBackground(false);
}
});
} catch (Exception e) {
console.printException(e);
console.finish();
MavenLog.LOG.warn(e);
}
}
Aggregations