use of com.tagtraum.perf.gcviewer.ctrl.GCModelLoaderController in project GCViewer by chewiebug.
the class GCViewerGuiController method startGui.
/**
* Start graphical user interface and load a log file (resourceName - if not <code>null</code>).
*
* @param gcResource {@link GCResource} to be loaded at startup or <code>null</code>
* @throws InvocationTargetException Some problem trying to start the gui
* @throws InterruptedException Some problem trying to start the gui
*/
public void startGui(final GCResource gcResource) throws InvocationTargetException, InterruptedException {
final GCViewerGui gcViewerGui = new GCViewerGui();
final GCModelLoaderController modelLoaderController = new GCModelLoaderControllerImpl(gcViewerGui);
Runnable guiStarter = new Runnable() {
@Override
public void run() {
new GCViewerGuiBuilder().initGCViewerGui(gcViewerGui, modelLoaderController);
applyPreferences(gcViewerGui, new GCPreferences());
gcViewerGui.addWindowListener(GCViewerGuiController.this);
Thread.setDefaultUncaughtExceptionHandler(new GCViewerUncaughtExceptionHandler(gcViewerGui));
gcViewerGui.setVisible(true);
}
};
SwingUtilities.invokeAndWait(guiStarter);
if (gcResource != null) {
Runnable resourceLoader = new Runnable() {
@Override
public void run() {
modelLoaderController.open(gcResource);
}
};
SwingUtilities.invokeLater(resourceLoader);
}
}
Aggregations