diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml index e1589e6fe24da1f23c0da786ae2091f7cea4d728..708b0d2ea4c6e10a6ab0f58fb6b4552bf664e43a 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml @@ -165,6 +165,9 @@ <modelElementClass modelElementClass="org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor"> </modelElementClass> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits"> + </modelElementClass> </modelElementHandler> </extension> <extension @@ -191,6 +194,26 @@ type="org.fortiss.af3.platform.raspberry.model.ActuatorPWM"> </input> </propertySection> + <propertySection + afterSection="org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection" + class="org.fortiss.af3.platform.raspberry.ui.properties.UIDUnitPropertySection" + enablesFor="1" + id="org.fortiss.af3.platform.raspberry.ui.properties.UIDUnitPropertySection" + tab="org.fortiss.tooling.kernel.ui.property.tab.general"> + <input + type="org.fortiss.af3.platform.raspberry.model.brick.UIDUnit"> + </input> + </propertySection> + <propertySection + afterSection="org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection" + class="org.fortiss.af3.platform.raspberry.ui.properties.ActuatorDigitsPropertySection" + enablesFor="1" + id="org.fortiss.af3.platform.raspberry.ui.properties.ActuatorDigitsPropertySection" + tab="org.fortiss.tooling.kernel.ui.property.tab.general"> + <input + type="org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits"> + </input> + </propertySection> </propertySections> </extension> </plugin> diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/ActuatorDigitsPropertySection.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/ActuatorDigitsPropertySection.java new file mode 100644 index 0000000000000000000000000000000000000000..1eaf1b024b4db54d982ef3a8dbdee6307912609c --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/ActuatorDigitsPropertySection.java @@ -0,0 +1,69 @@ +/*--------------------------------------------------------------------------+ +$Id$ +| | +| Copyright 2013 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.af3.platform.raspberry.ui.properties; + +import static org.eclipse.jface.databinding.swt.SWTObservables.observeSelection; +import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue; + +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; +import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits; +import org.fortiss.af3.platform.raspberry.model.brick.BrickPackage; +import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; + +/** + * Property section for {@link ActuatorDigits}s. + * + * @author hoelzl + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating GREEN Hash: 9E768B733BD37201F97399293FA0DFA7 + */ +public class ActuatorDigitsPropertySection extends PropertySectionBase { + /** The actuator model element. */ + private ActuatorDigits actuator; + /** The hex output button. */ + private Button hexOutputFlagButton; + + /** {@inheritDoc} */ + @Override + public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { + super.createControls(parent, tabbedPropertySheetPage); + hexOutputFlagButton = getWidgetFactory().createButton(composite, "", SWT.CHECK); + createFormEntry(hexOutputFlagButton, "Coordinator Unit"); + hexOutputFlagButton.setSelection(false); + } + + /** {@inheritDoc} */ + @Override + protected void setSectionInput(Object input) { + actuator = (ActuatorDigits)input; + } + + /** {@inheritDoc} */ + @Override + public void refresh() { + super.refresh(); + IObservableValue modelObservable = + observeValue(actuator, BrickPackage.Literals.ACTUATOR_DIGITS__SHOW_HEX_VALUE); + dbc.bindValue(observeSelection(hexOutputFlagButton), modelObservable); + } +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/UIDUnitPropertySection.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/UIDUnitPropertySection.java new file mode 100644 index 0000000000000000000000000000000000000000..4816a6da52a9f57d3044346596bca79bf5ddb6d4 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/UIDUnitPropertySection.java @@ -0,0 +1,67 @@ +/*--------------------------------------------------------------------------+ +$Id$ +| | +| Copyright 2013 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.af3.platform.raspberry.ui.properties; + +import static org.eclipse.jface.databinding.swt.SWTObservables.observeText; +import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue; + +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; +import org.fortiss.af3.platform.raspberry.model.brick.BrickPackage; +import org.fortiss.af3.platform.raspberry.model.brick.UIDUnit; +import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; + +/** + * Property section for {@link UIDUnit}s. + * + * @author hoelzl + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating GREEN Hash: 9E768B733BD37201F97399293FA0DFA7 + */ +public class UIDUnitPropertySection extends PropertySectionBase { + /** The unit. */ + private UIDUnit unit; + /** The unique ID widget. */ + private Text uidText; + + /** {@inheritDoc} */ + @Override + public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { + super.createControls(parent, tabbedPropertySheetPage); + uidText = createDecoratedText("UID"); + } + + /** {@inheritDoc} */ + @Override + protected void setSectionInput(Object input) { + unit = (UIDUnit)input; + } + + /** {@inheritDoc} */ + @Override + public void refresh() { + super.refresh(); + IObservableValue modelObservable = + observeValue(unit, BrickPackage.Literals.UID_UNIT__UNIQUE_BRICKLET_ID); + dbc.bindValue(observeText(uidText, SWT.Modify), modelObservable); + } +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java index e3488ad5459c5316a1c21b52ecd2cf6b027eff3c..dd295007c3ca61a81c004b007570880f51b0a1df 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java @@ -31,6 +31,7 @@ import org.fortiss.af3.platform.raspberry.model.RaspberryPi; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationXSensor; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationYSensor; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationZSensor; +import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor; @@ -92,6 +93,11 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(pwm, 0, 0); registerPrototype("PWM_Actuator", pwm, CATEGORY_NAME); + ActuatorDigits digits = RaspberryModelElementFactory.createActuatorDigits(); + setNodePosition(digits, 0, 0); + setConnectorPosition(digits, 0, 0); + registerPrototype("Segment_Digits", digits, BRICK); + Button1 button1 = RaspberryModelElementFactory.createButton1(); setNodePosition(button1, 0, 0); setConnectorPosition(button1, 0, 0); diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 57ac13db00116da2ce7d4ca5c2c5a70296797d0e..af513bc4a23e78db0ee58ff53704f7a38bde9d6f 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -2,25 +2,21 @@ <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model" nsURI="http://www.fortiss.org/af3/platform/raspberry" nsPrefix="org-fortiss-af3-platform-raspberry"> - <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//ExecutionUnit"> + <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ExecutionUnit"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="canCoordinationID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ipAddress" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="coordinatorUnit" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="cycleTime" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="CanBus" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//TransmissionUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="CanConnector" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Transceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Transmitter"> + <eClassifiers xsi:type="ecore:EClass" name="CanBus" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//TransmissionUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="CanConnector" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transceiver"/> + <eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="channelID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ActuatorDigits" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Transmitter"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="showHexValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="uniqueBrickletID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> - </eClassifiers> <eSubpackages name="gamepad" nsURI="http://www.fortiss.org/af3/platform/raspberry/gamepad" nsPrefix="org-fortiss-af3-platform-raspberry-gamepad"> <eClassifiers xsi:type="ecore:EClass" name="GamepadReceiverBase" abstract="true" - eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> <eClassifiers xsi:type="ecore:EClass" name="Button1" eSuperTypes="#//gamepad/GamepadReceiverBase"/> <eClassifiers xsi:type="ecore:EClass" name="Button2" eSuperTypes="#//gamepad/GamepadReceiverBase"/> <eClassifiers xsi:type="ecore:EClass" name="Button3" eSuperTypes="#//gamepad/GamepadReceiverBase"/> @@ -36,16 +32,19 @@ </eSubpackages> <eSubpackages name="brick" nsURI="http://www.fortiss.org/af3/platform/raspberry/brick" nsPrefix="org-fortiss-af3-platform-raspberry"> - <eClassifiers xsi:type="ecore:EClass" name="UIDUnit" abstract="true" eSuperTypes="../../org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement"> + <eClassifiers xsi:type="ecore:EClass" name="UIDUnit" abstract="true" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="uniqueBrickletID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="UltraSonicSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="LaserRangeSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="AccelerationXSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="AccelerationYSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="AccelerationZSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="AngularVelocityXSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="AngularVelocityYSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="AngularVelocityZSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="UltraSonicSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="LaserRangeSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="AccelerationXSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="AccelerationYSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="AccelerationZSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="AngularVelocityXSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="AngularVelocityYSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="AngularVelocityZSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="ActuatorDigits" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter #//brick/UIDUnit"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="showHexValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eClassifiers> </eSubpackages> </ecore:EPackage> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java index a29cc1c53da25ad6dfeb32648602f16a00c52aef..798a89dc7f0d531246f87ab55ea940d46aec6e99 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java @@ -28,6 +28,7 @@ import org.fortiss.af3.platform.raspberry.model.RaspberryPi; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationXSensor; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationYSensor; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationZSensor; +import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor; @@ -84,7 +85,7 @@ public class RaspberryPiCompositor extends LaserRangeSensor.class, AccelerationXSensor.class, AccelerationYSensor.class, AccelerationZSensor.class, AngularVelocityXSensor.class, AngularVelocityYSensor.class, - AngularVelocityZSensor.class); + AngularVelocityZSensor.class, ActuatorDigits.class); if(container != null) { final boolean instanceOfAny = isInstanceOfAny(container, RaspberryPi.class); return instanceOfAny && instanceOfAny2; diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java index 0371ab9a5fcaba0c25af961c3dc922c3e10a731a..8b756a0ad902bdade30fce6ce18c7c67d130815d 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java @@ -27,6 +27,7 @@ import org.fortiss.af3.platform.raspberry.model.RaspberryPiModelFactory; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationXSensor; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationYSensor; import org.fortiss.af3.platform.raspberry.model.brick.AccelerationZSensor; +import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor; import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor; @@ -253,4 +254,14 @@ public class RaspberryModelElementFactory { createConnectorLayout(sensor); return sensor; } + + /** Creates an {@link ActuatorDigits}. */ + public static ActuatorDigits createActuatorDigits() { + ActuatorDigits ad = BrickFactory.eINSTANCE.createActuatorDigits(); + ad.setName("SegmentDigits"); + ad.setUniqueBrickletID(""); + ad.setShowHexValue(false); + createConnectorLayout(ad); + return ad; + } }