Small threading fixes for run/present/tweak

This commit is contained in:
Jakub Valtar
2017-01-21 19:03:12 +01:00
parent c5d9b713b8
commit 916e38b98d
2 changed files with 18 additions and 17 deletions

View File

@@ -1057,15 +1057,15 @@ public class JavaEditor extends Editor {
debugger.continueDebug();
} else {
prepareRun();
toolbar.activateRun();
new Thread(new Runnable() {
public void run() {
prepareRun();
try {
toolbar.activateRun();
//runtime = jmode.handleRun(sketch, JavaEditor.this);
runtime = jmode.handleLaunch(sketch, JavaEditor.this, false);
} catch (Exception e) {
statusError(e);
EventQueue.invokeLater(() -> statusError(e));
}
}
}).start();
@@ -1074,15 +1074,15 @@ public class JavaEditor extends Editor {
public void handlePresent() {
prepareRun();
toolbar.activateRun();
new Thread(new Runnable() {
public void run() {
prepareRun();
try {
toolbar.activateRun();
//runtime = jmode.handlePresent(sketch, JavaEditor.this);
runtime = jmode.handleLaunch(sketch, JavaEditor.this, true);
} catch (Exception e) {
statusError(e);
EventQueue.invokeLater(() -> statusError(e));
}
}
}).start();
@@ -1090,15 +1090,23 @@ public class JavaEditor extends Editor {
public void handleTweak() {
prepareRun();
//toolbar.activate(JavaToolbar.RUN);
toolbar.activateRun();
if (sketch.isModified()) {
toolbar.deactivateRun();
Messages.showMessage(Language.text("menu.file.save"),
Language.text("tweak_mode.save_before_tweak"));
return;
}
new Thread(new Runnable() {
public void run() {
prepareRun();
try {
// toolbar.activate(JavaToolbar.RUN);
toolbar.activateRun();
runtime = jmode.handleTweak(sketch, JavaEditor.this);
} catch (Exception e) {
statusError(e);
EventQueue.invokeLater(() -> statusError(e));
}
}
}).start();

View File

@@ -144,13 +144,6 @@ public class JavaMode extends Mode {
// final boolean present) throws SketchException {
final JavaEditor editor = (JavaEditor) listener;
if (isSketchModified(sketch)) {
editor.deactivateRun();
Messages.showMessage(Language.text("menu.file.save"),
Language.text("tweak_mode.save_before_tweak"));
return null;
}
// first try to build the unmodified code
JavaBuild build = new JavaBuild(sketch);
// String appletClassName = build.build(false);