From b16ee6c7b2c8070f3455b7745f4351803e2177e6 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Thu, 8 Jan 2015 14:03:38 +0100 Subject: [PATCH] Editor: removed duplicated classes DefaultRunHandler, and DefaultPresentHandler in favour of generic BuildHandler --- app/src/processing/app/Editor.java | 43 +++++++++++------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 776b454fb..bd0d6c75c 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -1426,8 +1426,8 @@ public class Editor extends JFrame implements RunnerListener { public void resetHandlers() { - runHandler = new DefaultRunHandler(); - presentHandler = new DefaultPresentHandler(); + runHandler = new BuildHandler(); + presentHandler = new BuildHandler(true); stopHandler = new DefaultStopHandler(); exportHandler = new DefaultExportHandler(); exportAppHandler = new DefaultExportAppHandler(); @@ -1917,33 +1917,23 @@ public class Editor extends JFrame implements RunnerListener { new Thread(verbose ? presentHandler : runHandler).start(); } - // DAM: in Arduino, this is compile - class DefaultRunHandler implements Runnable { - public void run() { - try { - sketch.prepare(); - sketch.build(false); - statusNotice(_("Done compiling.")); - } catch (PreferencesMapException e) { - statusError(I18n.format( - _("Error while compiling: missing '{0}' configuration parameter"), - e.getMessage())); - } catch (Exception e) { - status.unprogress(); - statusError(e); - } + class BuildHandler implements Runnable { - status.unprogress(); - toolbar.deactivate(EditorToolbar.RUN); + private final boolean verbose; + + public BuildHandler() { + this(false); } - } - // DAM: in Arduino, this is compile (with verbose output) - class DefaultPresentHandler implements Runnable { + public BuildHandler(boolean verbose) { + this.verbose = verbose; + } + + @Override public void run() { try { sketch.prepare(); - sketch.build(true); + sketch.build(verbose); statusNotice(_("Done compiling.")); } catch (PreferencesMapException e) { statusError(I18n.format( @@ -1961,11 +1951,8 @@ public class Editor extends JFrame implements RunnerListener { class DefaultStopHandler implements Runnable { public void run() { - try { - // DAM: we should try to kill the compilation or upload process here. - } catch (Exception e) { - statusError(e); - } + // TODO + // DAM: we should try to kill the compilation or upload process here. } }