Skip to content

Commit 5b47d2b

Browse files
committed
ProgressHandler to runTests.
1 parent 2824fa5 commit 5b47d2b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/actions/RunTestsLocallyAction.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ public RunTestsLocallyAction() {
3232

3333
@Override
3434
protected void performAction(final Node[] nodes) {
35-
3635
if (nodes.length == 1) {
3736
this.project = projectsFromNodes(nodes).get(0);
38-
3937
WindowManager.getDefault().invokeWhenUIReady(this);
4038
}
4139
}

tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import static java.util.logging.Level.INFO;
3636
import java.util.logging.Logger;
3737
import javax.swing.SwingUtilities;
38+
import org.netbeans.api.progress.ProgressHandle;
39+
import org.netbeans.api.progress.ProgressHandleFactory;
3840
import org.netbeans.api.project.Project;
3941
import org.openide.util.Exceptions;
4042

@@ -72,21 +74,27 @@ public void performAction(final ResultCollector resultCollector, Project... proj
7274
for (final Project project : projects) {
7375
final TmcProjectInfo projectInfo = projectMediator.wrapProject(project);
7476
eventBus.post(new InvokedEvent(projectInfo));
77+
final ProgressHandle runningTestsLocally = ProgressHandleFactory.createSystemHandle(
78+
"Running tests.");
79+
runningTestsLocally.start();
7580
try {
7681
ListenableFuture<RunResult> result = TmcCoreSingleton.getInstance().test(projectInfo.getProjectDirAbsPath(), NBTmcSettings.getDefault());
7782
Futures.addCallback(result, new FutureCallback<RunResult>() {
7883
@Override
7984
public void onSuccess(final RunResult result) {
85+
runningTestsLocally.finish();
8086
explainResults(result, projectInfo, resultCollector);
8187
}
8288

8389
@Override
8490
public void onFailure(final Throwable ex) {
91+
runningTestsLocally.finish();
8592
explainFailure(ex);
8693
}
8794

8895
});
8996
} catch (TmcCoreException ex) {
97+
runningTestsLocally.finish();
9098
Exceptions.printStackTrace(ex);
9199
}
92100
}
@@ -120,7 +128,7 @@ public void run() {
120128
public void run() {
121129
exerciseSubmitter.performAction(projectInfo.getProject());
122130
}
123-
}, resultCollector);
131+
}, resultCollector);
124132
}
125133
});
126134
}

0 commit comments

Comments
 (0)