X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FModelledWizardPageImpl.java;h=5991a335a0d87071e4ca5dfade43b9b003883499;hp=8e803c97f916ee14842453492141e705ed2a472b;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ModelledWizardPageImpl.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ModelledWizardPageImpl.java index 8e803c97f..5991a335a 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ModelledWizardPageImpl.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ModelledWizardPageImpl.java @@ -1,87 +1,87 @@ -/******************************************************************************* - * Copyright (c) 2012 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.browsing.ui.swt; - -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.simantics.Simantics; -import org.simantics.browsing.ui.swt.stubs.BrowsingResource; -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.exception.DatabaseException; -import org.simantics.db.management.ISessionContext; -import org.simantics.db.request.Read; - -public class ModelledWizardPageImpl implements ModelledWizardPage { - - final private Resource configuration; - - public ModelledWizardPageImpl(Resource configuration) { - this.configuration = configuration; - } - - class Page extends WizardPage { - - final private WidgetSupport support; - - public Page(String title, WidgetSupport support) { - super(title, title, null); - this.support = support; - } - - @Override - public void createControl(Composite parent) { - - try { - - ModelledControl modelledControl = Simantics.getSession().syncRequest(new Read() { - @Override - public ModelledControl perform(ReadGraph graph) throws DatabaseException { - BrowsingResource BRO = BrowsingResource.getInstance(graph); - Resource controlResource = graph.getPossibleObject(configuration, BRO.WizardPage_Control); - return graph.adapt(controlResource, ModelledControl.class); - } - }); - - Control control = modelledControl.create(parent, null, null, support); - - setControl(control); - - } catch (DatabaseException e) { - - e.printStackTrace(); - - } - - } - - } - - public IWizardPage create(ISessionContext context, WidgetSupport support) throws DatabaseException { - - String title = Simantics.getSession().syncRequest(new Read() { - @Override - public String perform(ReadGraph graph) throws DatabaseException { - BrowsingResource br = BrowsingResource.getInstance(graph); - return graph.getPossibleRelatedValue(configuration, br.WizardPage_Title, Bindings.STRING); - } - }); - - return new Page(title, support); - - } - -} +/******************************************************************************* + * Copyright (c) 2012 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.browsing.ui.swt; + +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.simantics.Simantics; +import org.simantics.browsing.ui.swt.stubs.BrowsingResource; +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.exception.DatabaseException; +import org.simantics.db.management.ISessionContext; +import org.simantics.db.request.Read; + +public class ModelledWizardPageImpl implements ModelledWizardPage { + + final private Resource configuration; + + public ModelledWizardPageImpl(Resource configuration) { + this.configuration = configuration; + } + + class Page extends WizardPage { + + final private WidgetSupport support; + + public Page(String title, WidgetSupport support) { + super(title, title, null); + this.support = support; + } + + @Override + public void createControl(Composite parent) { + + try { + + ModelledControl modelledControl = Simantics.getSession().syncRequest(new Read() { + @Override + public ModelledControl perform(ReadGraph graph) throws DatabaseException { + BrowsingResource BRO = BrowsingResource.getInstance(graph); + Resource controlResource = graph.getPossibleObject(configuration, BRO.WizardPage_Control); + return graph.adapt(controlResource, ModelledControl.class); + } + }); + + Control control = modelledControl.create(parent, null, null, support); + + setControl(control); + + } catch (DatabaseException e) { + + e.printStackTrace(); + + } + + } + + } + + public IWizardPage create(ISessionContext context, WidgetSupport support) throws DatabaseException { + + String title = Simantics.getSession().syncRequest(new Read() { + @Override + public String perform(ReadGraph graph) throws DatabaseException { + BrowsingResource br = BrowsingResource.getInstance(graph); + return graph.getPossibleRelatedValue(configuration, br.WizardPage_Title, Bindings.STRING); + } + }); + + return new Page(title, support); + + } + +}