Skip to content

Commit fbe6bf3

Browse files
committed
Moved all initializations into Base constructor
1 parent e7f51f2 commit fbe6bf3

File tree

1 file changed

+42
-47
lines changed

1 file changed

+42
-47
lines changed

app/src/processing/app/Base.java

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -128,59 +128,13 @@ static public void main(String args[]) throws Exception {
128128
}
129129

130130
try {
131-
guardedMain(args);
131+
INSTANCE = new Base(args);
132132
} catch (Throwable e) {
133133
e.printStackTrace(System.err);
134134
System.exit(255);
135135
}
136136
}
137137

138-
static public void guardedMain(String args[]) throws Exception {
139-
Thread deleteFilesOnShutdownThread = new Thread(DeleteFilesOnShutdown.INSTANCE);
140-
deleteFilesOnShutdownThread.setName("DeleteFilesOnShutdown");
141-
Runtime.getRuntime().addShutdownHook(deleteFilesOnShutdownThread);
142-
143-
BaseNoGui.initLogger();
144-
145-
initLogger();
146-
147-
BaseNoGui.initPlatform();
148-
149-
BaseNoGui.getPlatform().init();
150-
151-
BaseNoGui.initPortableFolder();
152-
153-
BaseNoGui.initParameters(args);
154-
155-
splashScreenHelper.splashText(tr("Loading configuration..."));
156-
157-
BaseNoGui.initVersion();
158-
159-
// Use native popups so they don't look so crappy on osx
160-
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
161-
162-
// Don't put anything above this line that might make GUI,
163-
// because the platform has to be inited properly first.
164-
165-
// setup the theme coloring fun
166-
Theme.init();
167-
System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true"));
168-
169-
// Set the look and feel before opening the window
170-
try {
171-
BaseNoGui.getPlatform().setLookAndFeel();
172-
} catch (Exception e) {
173-
// ignore
174-
}
175-
176-
// Create a location for untitled sketches
177-
untitledFolder = FileUtils.createTempFolder("untitled" + new Random().nextInt(Integer.MAX_VALUE), ".tmp");
178-
DeleteFilesOnShutdown.add(untitledFolder);
179-
180-
INSTANCE = new Base(args);
181-
}
182-
183-
184138
static public void initLogger() {
185139
Handler consoleHandler = new ConsoleLogger();
186140
consoleHandler.setLevel(Level.ALL);
@@ -227,6 +181,47 @@ static public File absoluteFile(String path) {
227181
}
228182

229183
public Base(String[] args) throws Exception {
184+
Thread deleteFilesOnShutdownThread = new Thread(DeleteFilesOnShutdown.INSTANCE);
185+
deleteFilesOnShutdownThread.setName("DeleteFilesOnShutdown");
186+
Runtime.getRuntime().addShutdownHook(deleteFilesOnShutdownThread);
187+
188+
BaseNoGui.initLogger();
189+
190+
initLogger();
191+
192+
BaseNoGui.initPlatform();
193+
194+
BaseNoGui.getPlatform().init();
195+
196+
BaseNoGui.initPortableFolder();
197+
198+
BaseNoGui.initParameters(args);
199+
200+
splashScreenHelper.splashText(tr("Loading configuration..."));
201+
202+
BaseNoGui.initVersion();
203+
204+
// Use native popups so they don't look so crappy on osx
205+
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
206+
207+
// Don't put anything above this line that might make GUI,
208+
// because the platform has to be inited properly first.
209+
210+
// setup the theme coloring fun
211+
Theme.init();
212+
System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true"));
213+
214+
// Set the look and feel before opening the window
215+
try {
216+
BaseNoGui.getPlatform().setLookAndFeel();
217+
} catch (Exception e) {
218+
// ignore
219+
}
220+
221+
// Create a location for untitled sketches
222+
untitledFolder = FileUtils.createTempFolder("untitled" + new Random().nextInt(Integer.MAX_VALUE), ".tmp");
223+
DeleteFilesOnShutdown.add(untitledFolder);
224+
230225
BaseNoGui.notifier = new GUIUserNotifier(this);
231226

232227
CommandlineParser parser = new CommandlineParser(args);

0 commit comments

Comments
 (0)