Skip to content
Snippets Groups Projects
Commit 048a644a authored by Mayank Chaudhary's avatar Mayank Chaudhary
Browse files

PrototypeProvider added

refs 2507
parent 37832fee
No related branches found
No related tags found
No related merge requests found
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.editor.binding;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.af3.platform.raspberry.ui.editor.CoreStructureEditor;
import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBindingBase;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class CoreStructureEditorBinding extends PlatformComponentStructureEditorBindingBase<Core> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(Core core) {
return CoreStructureEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel(Core core) {
return "Core Structure";
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.editor.binding;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi1;
import org.fortiss.af3.platform.raspberry.ui.editor.RaspberryPi1StructureEditor;
import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBindingBase;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class RaspberryPi1StructureEditorBinding extends
PlatformComponentStructureEditorBindingBase<RaspberryPi1> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(RaspberryPi1 raspberryPi1) {
return RaspberryPi1StructureEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel(RaspberryPi1 raspberryPi1) {
return "RPi1 Structure";
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.editor.binding;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi2;
import org.fortiss.af3.platform.raspberry.ui.editor.RaspberryPi2StructureEditor;
import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBindingBase;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class RaspberryPi2StructureEditorBinding extends
PlatformComponentStructureEditorBindingBase<RaspberryPi2> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(RaspberryPi2 raspberryPi2) {
return RaspberryPi2StructureEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel(RaspberryPi2 raspberryPi2) {
return "RPi2 Structure";
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.editor.binding;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi3;
import org.fortiss.af3.platform.raspberry.ui.editor.RaspberryPi3StructureEditor;
import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBindingBase;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class RaspberryPi3StructureEditorBinding extends
PlatformComponentStructureEditorBindingBase<RaspberryPi3> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(RaspberryPi3 raspberryPi3) {
return RaspberryPi3StructureEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel(RaspberryPi3 raspberryPi3) {
return "RPi3 Structure";
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.prototypes;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createActuator;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createActuatorOut;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createBus;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createBusMasterInterface;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createBusMasterPort;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCANBus;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCANBusMasterInterface;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCANBusMasterPort;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCore;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createRaspberryPi1;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createRaspberryPi2;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createRaspberryPi3;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createSensor;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createSensorIn;
import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.setConnectorPosition;
import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodePosition;
import org.fortiss.af3.platform.raspberry.model.Actuator;
import org.fortiss.af3.platform.raspberry.model.ActuatorOut;
import org.fortiss.af3.platform.raspberry.model.Bus;
import org.fortiss.af3.platform.raspberry.model.BusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.BusMasterPort;
import org.fortiss.af3.platform.raspberry.model.CANBus;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterPort;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi1;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi2;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi3;
import org.fortiss.af3.platform.raspberry.model.Sensor;
import org.fortiss.af3.platform.raspberry.model.SensorIn;
import org.fortiss.tooling.kernel.extension.base.PrototypeProviderBase;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class PrototypeProvider extends PrototypeProviderBase {
/** Stores the category to display for these prototypes */
protected final static String CATEGORY_NAME = "Raspberry Platform";
/** {@inheritDoc} */
@Override
protected void registerPrototypes() {
setupRaspberryPlatform();
}
/**
*
*/
private void setupRaspberryPlatform() {
Actuator actuator = createActuator("Actuator");
setNodePosition(actuator, 0, 0);
setConnectorPosition(actuator, 0, 0);
registerPrototype("Actuator", actuator, CATEGORY_NAME);
ActuatorOut actuatorOut = createActuatorOut("ActuatorOut");
setNodePosition(actuatorOut, 0, 0);
setConnectorPosition(actuator, 0, 0);
registerPrototype("ActuatorOut", actuator, CATEGORY_NAME);
Bus bus = createBus("Bus");
setNodePosition(bus, 0, 0);
setConnectorPosition(bus, 0, 0);
registerPrototype("Bus", bus, CATEGORY_NAME);
BusMasterInterface busMasterInterface = createBusMasterInterface("BusMasterInterface");
setNodePosition(busMasterInterface, 0, 0);
setConnectorPosition(busMasterInterface, 0, 0);
registerPrototype("BusMasterInterface", busMasterInterface, CATEGORY_NAME);
BusMasterPort busMasterPort = createBusMasterPort("BusMasterPort");
setNodePosition(busMasterPort, 0, 0);
setConnectorPosition(busMasterPort, 0, 0);
registerPrototype("BusMasterPort", busMasterPort, CATEGORY_NAME);
CANBus canBus = createCANBus("CANBus");
setNodePosition(canBus, 0, 0);
setConnectorPosition(canBus, 0, 0);
registerPrototype("CANBus", canBus, CATEGORY_NAME);
CANBusMasterInterface canBusMasterInterface =
createCANBusMasterInterface("CANBusMasterInterface");
setNodePosition(canBusMasterInterface, 0, 0);
setConnectorPosition(canBusMasterInterface, 0, 0);
registerPrototype("CANBusMasterInterface", canBusMasterInterface, CATEGORY_NAME);
CANBusMasterPort canBusMasterPort = createCANBusMasterPort("CANBusMasterPort");
setNodePosition(canBusMasterPort, 0, 0);
setConnectorPosition(canBusMasterPort, 0, 0);
registerPrototype("CANBusMasterPort", canBusMasterPort, CATEGORY_NAME);
Core core = createCore("Core");
setNodePosition(core, 0, 0);
setConnectorPosition(core, 0, 0);
registerPrototype("Core", core, CATEGORY_NAME);
RaspberryPi1 raspberryPi1 = createRaspberryPi1("RaspberryPi1");
setNodePosition(raspberryPi1, 0, 0);
setConnectorPosition(raspberryPi1, 0, 0);
registerPrototype("RaspberryPi1", raspberryPi1, CATEGORY_NAME);
RaspberryPi2 raspberryPi2 = createRaspberryPi2("RaspberryPi2");
setNodePosition(raspberryPi2, 0, 0);
setConnectorPosition(raspberryPi2, 0, 0);
registerPrototype("RaspberryPi2", raspberryPi2, CATEGORY_NAME);
RaspberryPi3 raspberryPi3 = createRaspberryPi3("RaspberryPi3");
setNodePosition(raspberryPi3, 0, 0);
setConnectorPosition(raspberryPi3, 0, 0);
registerPrototype("RaspberryPi3", raspberryPi3, CATEGORY_NAME);
Sensor sensor = createSensor("Sensor");
setNodePosition(sensor, 0, 0);
setConnectorPosition(sensor, 0, 0);
registerPrototype("Sensor", sensor, CATEGORY_NAME);
SensorIn sensorIn = createSensorIn("SensorIn");
setNodePosition(sensorIn, 0, 0);
setConnectorPosition(sensorIn, 0, 0);
registerPrototype("SensorIn", sensorIn, CATEGORY_NAME);
}
}
......@@ -17,11 +17,21 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.raspberry.utils;
import org.fortiss.af3.platform.raspberry.model.Actuator;
import org.fortiss.af3.platform.raspberry.model.ActuatorOut;
import org.fortiss.af3.platform.raspberry.model.Bus;
import org.fortiss.af3.platform.raspberry.model.BusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.BusMasterPort;
import org.fortiss.af3.platform.raspberry.model.CANBus;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterPort;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.af3.platform.raspberry.model.ModelFactory;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi1;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi2;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi3;
import org.fortiss.af3.platform.raspberry.model.Sensor;
import org.fortiss.af3.platform.raspberry.model.SensorIn;
import org.fortiss.tooling.base.utils.LayoutModelElementFactory;
/**
......@@ -62,4 +72,80 @@ public class RaspberryModelElementFactory {
return busMasterInterface;
}
/** Creates a Hardware Board. */
public static RaspberryPi1 createRaspberryPi1(String name) {
RaspberryPi1 raspberryPi1 = ModelFactory.eINSTANCE.createRaspberryPi1();
raspberryPi1.setName(name);
LayoutModelElementFactory.createNodeElementLayout(raspberryPi1);
return raspberryPi1;
}
/** Creates a Hardware Board. */
public static RaspberryPi2 createRaspberryPi2(String name) {
RaspberryPi2 raspberryPi2 = ModelFactory.eINSTANCE.createRaspberryPi2();
raspberryPi2.setName(name);
LayoutModelElementFactory.createNodeElementLayout(raspberryPi2);
return raspberryPi2;
}
/** Creates a Hardware Board. */
public static RaspberryPi3 createRaspberryPi3(String name) {
RaspberryPi3 raspberryPi3 = ModelFactory.eINSTANCE.createRaspberryPi3();
raspberryPi3.setName(name);
LayoutModelElementFactory.createNodeElementLayout(raspberryPi3);
return raspberryPi3;
}
/** Creates a Core with a given name. */
public static Core createCore(String name) {
Core core = ModelFactory.eINSTANCE.createCore();
core.setName(name);
LayoutModelElementFactory.createNodeElementLayout(core);
return core;
}
/** Creates a Bus with a given name. */
public static Bus createBus(String name) {
Bus bus = ModelFactory.eINSTANCE.createBus();
bus.setName(name);
LayoutModelElementFactory.createConnectionLayout(bus);
return bus;
}
/** Creates a Bus with a given name. */
public static CANBus createCANBus(String name) {
CANBus canBus = ModelFactory.eINSTANCE.createCANBus();
canBus.setName(name);
LayoutModelElementFactory.createConnectionLayout(canBus);
return canBus;
}
public static Sensor createSensor(String name) {
Sensor sensor = ModelFactory.eINSTANCE.createSensor();
sensor.setName(name);
LayoutModelElementFactory.createNodeElementLayout(sensor);
return sensor;
}
public static SensorIn createSensorIn(String name) {
SensorIn sensorIn = ModelFactory.eINSTANCE.createSensorIn();
sensorIn.setName(name);
LayoutModelElementFactory.createNodeElementLayout(sensorIn);
return sensorIn;
}
public static Actuator createActuator(String name) {
Actuator actuator = ModelFactory.eINSTANCE.createActuator();
actuator.setName(name);
LayoutModelElementFactory.createNodeElementLayout(actuator);
return actuator;
}
public static ActuatorOut createActuatorOut(String name) {
ActuatorOut actuatorOut = ModelFactory.eINSTANCE.createActuatorOut();
actuatorOut.setName(name);
LayoutModelElementFactory.createNodeElementLayout(actuatorOut);
return actuatorOut;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment