X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FcomponentTypeEditor%2FLiftPropertiesDialog.java;h=656e2486fd2d569ec248052301c8b9625978c1cf;hb=fd2a6ff5d708baed2bdbaf94e6cd7bcc7b288069;hp=2e120f310540481cd2c8ee07c7b2981e1929b2ea;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java index 2e120f310..656e2486f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java @@ -1,104 +1,104 @@ -/******************************************************************************* - * Copyright (c) 2013 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: - * Semantum Oy - initial API and implementation - *******************************************************************************/ -package org.simantics.modeling.ui.componentTypeEditor; - -import java.util.Map; - -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.layout.GridLayoutFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.simantics.db.Resource; -import org.simantics.modeling.ui.componentTypeEditor.LiftPropertiesDialog.LiftedProperty; -import org.simantics.scl.runtime.tuple.Tuple3; -import org.simantics.ui.workbench.dialogs.ResourceSelectionDialog3; -import org.simantics.utils.datastructures.Pair; - -public class LiftPropertiesDialog extends ResourceSelectionDialog3 { - - private boolean mapProperties = false; - private Button checkbox; - - public static class LiftedProperty extends Tuple3 { - - public LiftedProperty(Resource component, Resource componentType, Resource predicate) { - super(component, componentType, predicate); - } - - public Resource getComponent() { - return (Resource)get(0); - } - - public Resource getComponentType() { - return (Resource)get(1); - } - - public Resource getPredicate() { - return (Resource)get(2); - } - - } - - public LiftPropertiesDialog(Shell shell, - Map> parameter, String title) { - super(shell, parameter, title); - } - - @Override - protected IDialogSettings getBaseDialogSettings() { - return null; - } - - @Override - protected Control createExtendedContentArea(Composite parent) { - Composite c = new Composite(parent, SWT.NONE); - GridDataFactory.fillDefaults().grab(true, false).applyTo(c); - GridLayoutFactory.swtDefaults().numColumns(2).applyTo(c); -// Label l = new Label(c, SWT.NONE); -// l.setText("Map lifted properties into interface"); -// GridDataFactory.fillDefaults().grab(false, false).applyTo(l); - checkbox = new Button(c, SWT.CHECK); - checkbox.setText("Map lifted properties into interface"); - checkbox.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(SelectionEvent e) { - widgetDefaultSelected(e); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - mapProperties = checkbox.getSelection(); - } - }); - GridDataFactory.fillDefaults().grab(true, false).applyTo(checkbox); - return super.createExtendedContentArea(parent); - } - - @Override - public void create() { - super.create(); - checkbox.setFocus(); - } - - public boolean getMapProperties() { - return mapProperties; - } - +/******************************************************************************* + * Copyright (c) 2013 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: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.modeling.ui.componentTypeEditor; + +import java.util.Map; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.simantics.db.Resource; +import org.simantics.modeling.ui.componentTypeEditor.LiftPropertiesDialog.LiftedProperty; +import org.simantics.scl.runtime.tuple.Tuple3; +import org.simantics.ui.workbench.dialogs.ResourceSelectionDialog3; +import org.simantics.utils.datastructures.Pair; + +public class LiftPropertiesDialog extends ResourceSelectionDialog3 { + + private boolean mapProperties = false; + private Button checkbox; + + public static class LiftedProperty extends Tuple3 { + + public LiftedProperty(Resource component, Resource componentType, Resource predicate) { + super(component, componentType, predicate); + } + + public Resource getComponent() { + return (Resource)get(0); + } + + public Resource getComponentType() { + return (Resource)get(1); + } + + public Resource getPredicate() { + return (Resource)get(2); + } + + } + + public LiftPropertiesDialog(Shell shell, + Map> parameter, String title) { + super(shell, parameter, title); + } + + @Override + protected IDialogSettings getBaseDialogSettings() { + return null; + } + + @Override + protected Control createExtendedContentArea(Composite parent) { + Composite c = new Composite(parent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(c); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(c); +// Label l = new Label(c, SWT.NONE); +// l.setText("Map lifted properties into interface"); +// GridDataFactory.fillDefaults().grab(false, false).applyTo(l); + checkbox = new Button(c, SWT.CHECK); + checkbox.setText(Messages.LiftPropertiesDialog_MapLiftedPropertiesIntoInterface); + checkbox.addSelectionListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + mapProperties = checkbox.getSelection(); + } + }); + GridDataFactory.fillDefaults().grab(true, false).applyTo(checkbox); + return super.createExtendedContentArea(parent); + } + + @Override + public void create() { + super.create(); + checkbox.setFocus(); + } + + public boolean getMapProperties() { + return mapProperties; + } + } \ No newline at end of file