-package org.simantics.views.swt;\r
-\r
-import org.eclipse.jface.wizard.IWizardPage;\r
-import org.eclipse.jface.wizard.WizardPage;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.simantics.Simantics;\r
-import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.UniqueRead;\r
-import org.simantics.db.common.utils.Logger;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.db.request.Read;\r
-import org.simantics.views.ontology.ViewsResources;\r
-import org.simantics.views.swt.client.base.SWTRoot;\r
-\r
-public class ModelledWizardPageImpl implements ModelledWizardPage {\r
-\r
- final private Resource configuration;\r
- private SWTRoot root;\r
- \r
- public ModelledWizardPageImpl(Resource configuration) {\r
- this.configuration = configuration;\r
- }\r
- \r
- @Override\r
- public SWTRoot getRoot() {\r
- return root;\r
- }\r
-\r
- class Page extends WizardPage {\r
-\r
- final private Resource runtime;\r
- \r
- public Page(String title, Resource runtime) {\r
- super(title, title, null);\r
- this.runtime = runtime;\r
- }\r
- \r
- @Override\r
- public void createControl(Composite parent) {\r
-\r
- try {\r
-\r
- Resource control = Simantics.getSession().sync(new UniqueRead<Resource>() {\r
- @Override\r
- public Resource perform(ReadGraph graph) throws DatabaseException {\r
- ViewsResources VIEW = ViewsResources.getInstance(graph);\r
- return graph.getPossibleObject(configuration, VIEW.Wizard_Page_Control);\r
- }\r
- });\r
- \r
- SWTViewLoaderProcess process = new SWTViewLoaderProcess(null, null);\r
- root = process.load(control, runtime);\r
- root.createControls(parent);\r
-\r
- setControl(root.getSingleChild());\r
-\r
- } catch (DatabaseException e) {\r
- \r
- e.printStackTrace();\r
- Logger.defaultLogError(e);\r
- \r
- }\r
- \r
- }\r
- \r
- }\r
- \r
- public IWizardPage create(ISessionContext context, WidgetSupport support, Resource runtime) throws DatabaseException {\r
-\r
- String title = Simantics.getSession().syncRequest(new Read<String>() {\r
- @Override\r
- public String perform(ReadGraph graph) throws DatabaseException {\r
- ViewsResources VIEW = ViewsResources.getInstance(graph);\r
- return graph.getPossibleRelatedValue(configuration, VIEW.Wizard_Page_Title, Bindings.STRING);\r
- }\r
- });\r
-\r
- return new Page(title, runtime);\r
- \r
- }\r
- \r
-}\r
+package org.simantics.views.swt;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.simantics.Simantics;
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.UniqueRead;
+import org.simantics.db.common.utils.Logger;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.management.ISessionContext;
+import org.simantics.db.request.Read;
+import org.simantics.views.ontology.ViewsResources;
+import org.simantics.views.swt.client.base.SWTRoot;
+
+public class ModelledWizardPageImpl implements ModelledWizardPage {
+
+ final private Resource configuration;
+ private SWTRoot root;
+
+ public ModelledWizardPageImpl(Resource configuration) {
+ this.configuration = configuration;
+ }
+
+ @Override
+ public SWTRoot getRoot() {
+ return root;
+ }
+
+ class Page extends WizardPage {
+
+ final private Resource runtime;
+
+ public Page(String title, Resource runtime) {
+ super(title, title, null);
+ this.runtime = runtime;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+
+ try {
+
+ Resource control = Simantics.getSession().sync(new UniqueRead<Resource>() {
+ @Override
+ public Resource perform(ReadGraph graph) throws DatabaseException {
+ ViewsResources VIEW = ViewsResources.getInstance(graph);
+ return graph.getPossibleObject(configuration, VIEW.Wizard_Page_Control);
+ }
+ });
+
+ SWTViewLoaderProcess process = new SWTViewLoaderProcess(null, null);
+ root = process.load(control, runtime);
+ root.createControls(parent);
+
+ setControl(root.getSingleChild());
+
+ } catch (DatabaseException e) {
+
+ e.printStackTrace();
+ Logger.defaultLogError(e);
+
+ }
+
+ }
+
+ }
+
+ public IWizardPage create(ISessionContext context, WidgetSupport support, Resource runtime) throws DatabaseException {
+
+ String title = Simantics.getSession().syncRequest(new Read<String>() {
+ @Override
+ public String perform(ReadGraph graph) throws DatabaseException {
+ ViewsResources VIEW = ViewsResources.getInstance(graph);
+ return graph.getPossibleRelatedValue(configuration, VIEW.Wizard_Page_Title, Bindings.STRING);
+ }
+ });
+
+ return new Page(title, runtime);
+
+ }
+
+}