Skip to content

Commit b16ee6c

Browse files
author
Federico Fissore
committed
Editor: removed duplicated classes DefaultRunHandler, and DefaultPresentHandler in favour of generic BuildHandler
1 parent fd4a5a8 commit b16ee6c

File tree

1 file changed

+15
-28
lines changed

1 file changed

+15
-28
lines changed

app/src/processing/app/Editor.java

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,8 +1426,8 @@ public void setHandlers(Runnable runHandler, Runnable presentHandler,
14261426

14271427

14281428
public void resetHandlers() {
1429-
runHandler = new DefaultRunHandler();
1430-
presentHandler = new DefaultPresentHandler();
1429+
runHandler = new BuildHandler();
1430+
presentHandler = new BuildHandler(true);
14311431
stopHandler = new DefaultStopHandler();
14321432
exportHandler = new DefaultExportHandler();
14331433
exportAppHandler = new DefaultExportAppHandler();
@@ -1917,33 +1917,23 @@ public void handleRun(final boolean verbose) {
19171917
new Thread(verbose ? presentHandler : runHandler).start();
19181918
}
19191919

1920-
// DAM: in Arduino, this is compile
1921-
class DefaultRunHandler implements Runnable {
1922-
public void run() {
1923-
try {
1924-
sketch.prepare();
1925-
sketch.build(false);
1926-
statusNotice(_("Done compiling."));
1927-
} catch (PreferencesMapException e) {
1928-
statusError(I18n.format(
1929-
_("Error while compiling: missing '{0}' configuration parameter"),
1930-
e.getMessage()));
1931-
} catch (Exception e) {
1932-
status.unprogress();
1933-
statusError(e);
1934-
}
1920+
class BuildHandler implements Runnable {
19351921

1936-
status.unprogress();
1937-
toolbar.deactivate(EditorToolbar.RUN);
1922+
private final boolean verbose;
1923+
1924+
public BuildHandler() {
1925+
this(false);
19381926
}
1939-
}
19401927

1941-
// DAM: in Arduino, this is compile (with verbose output)
1942-
class DefaultPresentHandler implements Runnable {
1928+
public BuildHandler(boolean verbose) {
1929+
this.verbose = verbose;
1930+
}
1931+
1932+
@Override
19431933
public void run() {
19441934
try {
19451935
sketch.prepare();
1946-
sketch.build(true);
1936+
sketch.build(verbose);
19471937
statusNotice(_("Done compiling."));
19481938
} catch (PreferencesMapException e) {
19491939
statusError(I18n.format(
@@ -1961,11 +1951,8 @@ public void run() {
19611951

19621952
class DefaultStopHandler implements Runnable {
19631953
public void run() {
1964-
try {
1965-
// DAM: we should try to kill the compilation or upload process here.
1966-
} catch (Exception e) {
1967-
statusError(e);
1968-
}
1954+
// TODO
1955+
// DAM: we should try to kill the compilation or upload process here.
19691956
}
19701957
}
19711958

0 commit comments

Comments
 (0)