mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +01:00
Moved all initializations into Base constructor
This commit is contained in:
parent
e7f51f225b
commit
fbe6bf3792
@ -128,59 +128,13 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
guardedMain(args);
|
INSTANCE = new Base(args);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
System.exit(255);
|
System.exit(255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void guardedMain(String args[]) throws Exception {
|
|
||||||
Thread deleteFilesOnShutdownThread = new Thread(DeleteFilesOnShutdown.INSTANCE);
|
|
||||||
deleteFilesOnShutdownThread.setName("DeleteFilesOnShutdown");
|
|
||||||
Runtime.getRuntime().addShutdownHook(deleteFilesOnShutdownThread);
|
|
||||||
|
|
||||||
BaseNoGui.initLogger();
|
|
||||||
|
|
||||||
initLogger();
|
|
||||||
|
|
||||||
BaseNoGui.initPlatform();
|
|
||||||
|
|
||||||
BaseNoGui.getPlatform().init();
|
|
||||||
|
|
||||||
BaseNoGui.initPortableFolder();
|
|
||||||
|
|
||||||
BaseNoGui.initParameters(args);
|
|
||||||
|
|
||||||
splashScreenHelper.splashText(tr("Loading configuration..."));
|
|
||||||
|
|
||||||
BaseNoGui.initVersion();
|
|
||||||
|
|
||||||
// Use native popups so they don't look so crappy on osx
|
|
||||||
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
|
||||||
|
|
||||||
// Don't put anything above this line that might make GUI,
|
|
||||||
// because the platform has to be inited properly first.
|
|
||||||
|
|
||||||
// setup the theme coloring fun
|
|
||||||
Theme.init();
|
|
||||||
System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true"));
|
|
||||||
|
|
||||||
// Set the look and feel before opening the window
|
|
||||||
try {
|
|
||||||
BaseNoGui.getPlatform().setLookAndFeel();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a location for untitled sketches
|
|
||||||
untitledFolder = FileUtils.createTempFolder("untitled" + new Random().nextInt(Integer.MAX_VALUE), ".tmp");
|
|
||||||
DeleteFilesOnShutdown.add(untitledFolder);
|
|
||||||
|
|
||||||
INSTANCE = new Base(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static public void initLogger() {
|
static public void initLogger() {
|
||||||
Handler consoleHandler = new ConsoleLogger();
|
Handler consoleHandler = new ConsoleLogger();
|
||||||
consoleHandler.setLevel(Level.ALL);
|
consoleHandler.setLevel(Level.ALL);
|
||||||
@ -227,6 +181,47 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Base(String[] args) throws Exception {
|
public Base(String[] args) throws Exception {
|
||||||
|
Thread deleteFilesOnShutdownThread = new Thread(DeleteFilesOnShutdown.INSTANCE);
|
||||||
|
deleteFilesOnShutdownThread.setName("DeleteFilesOnShutdown");
|
||||||
|
Runtime.getRuntime().addShutdownHook(deleteFilesOnShutdownThread);
|
||||||
|
|
||||||
|
BaseNoGui.initLogger();
|
||||||
|
|
||||||
|
initLogger();
|
||||||
|
|
||||||
|
BaseNoGui.initPlatform();
|
||||||
|
|
||||||
|
BaseNoGui.getPlatform().init();
|
||||||
|
|
||||||
|
BaseNoGui.initPortableFolder();
|
||||||
|
|
||||||
|
BaseNoGui.initParameters(args);
|
||||||
|
|
||||||
|
splashScreenHelper.splashText(tr("Loading configuration..."));
|
||||||
|
|
||||||
|
BaseNoGui.initVersion();
|
||||||
|
|
||||||
|
// Use native popups so they don't look so crappy on osx
|
||||||
|
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
||||||
|
|
||||||
|
// Don't put anything above this line that might make GUI,
|
||||||
|
// because the platform has to be inited properly first.
|
||||||
|
|
||||||
|
// setup the theme coloring fun
|
||||||
|
Theme.init();
|
||||||
|
System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true"));
|
||||||
|
|
||||||
|
// Set the look and feel before opening the window
|
||||||
|
try {
|
||||||
|
BaseNoGui.getPlatform().setLookAndFeel();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a location for untitled sketches
|
||||||
|
untitledFolder = FileUtils.createTempFolder("untitled" + new Random().nextInt(Integer.MAX_VALUE), ".tmp");
|
||||||
|
DeleteFilesOnShutdown.add(untitledFolder);
|
||||||
|
|
||||||
BaseNoGui.notifier = new GUIUserNotifier(this);
|
BaseNoGui.notifier = new GUIUserNotifier(this);
|
||||||
|
|
||||||
CommandlineParser parser = new CommandlineParser(args);
|
CommandlineParser parser = new CommandlineParser(args);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user