]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java
Prime SCL BindingRegistry to shave ~0.5s from startup
[simantics/platform.git] / bundles / org.simantics.scl.ui / src / org / simantics / scl / ui / browser / LaunchSCLDocumentationBrowser.java
1 package org.simantics.scl.ui.browser;
2
3 import org.eclipse.core.commands.AbstractHandler;
4 import org.eclipse.core.commands.ExecutionEvent;
5 import org.eclipse.core.commands.ExecutionException;
6 import org.eclipse.swt.SWTError;
7 import org.eclipse.swt.layout.FillLayout;
8 import org.eclipse.swt.widgets.Display;
9 import org.eclipse.swt.widgets.Shell;
10 import org.eclipse.ui.PlatformUI;
11
12 public class LaunchSCLDocumentationBrowser extends AbstractHandler {
13
14     @Override
15     public Object execute(ExecutionEvent event) throws ExecutionException {
16         Display display = PlatformUI.getWorkbench().getDisplay();
17         Shell shell = new Shell(display);
18         shell.setText(Messages.LaunchSCLDocumentationBrowser_SCLDocumentationBrowser);
19         shell.setLayout(new FillLayout());
20         SCLDocumentationBrowser browser;
21         try {
22             browser = new SCLDocumentationBrowser(shell);
23         } catch (SWTError e) {
24             System.out.println("Could not instantiate the browser: " + e.getMessage()); //$NON-NLS-1$
25             display.dispose();
26             return null;
27         }
28         browser.setLocation("Prelude"); //$NON-NLS-1$
29         shell.open();
30         
31         return null;
32     }
33
34 }