From 32893ff52ffa3e5d7722ae704681656d79cd6d4b Mon Sep 17 00:00:00 2001 From: Mayank Chaudhary <chaudhary@fortiss.org> Date: Wed, 9 Mar 2016 13:34:23 +0000 Subject: [PATCH] GUI added refs 2507 --- .../trunk/META-INF/MANIFEST.MF | 9 ++ .../compose/RaspberryPi1CompositorBase.java | 61 ++++++++++++ .../compose/RaspberryPi2CompositorBase.java | 61 ++++++++++++ .../compose/RaspberryPi3CompositorBase.java | 61 ++++++++++++ ...spberryPlatformArchitectureCompositor.java | 39 ++++++++ .../CoreToBusConnectionCompositor.java | 95 ++++++++++++++++++ ...pberryPi1ToCANBusConnectionCompositor.java | 96 +++++++++++++++++++ ...pberryPi2ToCANBusConnectionCompositor.java | 96 +++++++++++++++++++ ...pberryPi3ToCANBusConnectionCompositor.java | 96 +++++++++++++++++++ .../ui/editor/CoreStructureEditor.java | 47 +++++++++ .../editor/RaspberryPi1StructureEditor.java | 47 +++++++++ .../editor/RaspberryPi2StructureEditor.java | 47 +++++++++ .../editor/RaspberryPi3StructureEditor.java | 47 +++++++++ 13 files changed, 802 insertions(+) create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi1CompositorBase.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi2CompositorBase.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi3CompositorBase.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPlatformArchitectureCompositor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/CoreToBusConnectionCompositor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi1ToCANBusConnectionCompositor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi2ToCANBusConnectionCompositor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi3ToCANBusConnectionCompositor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/CoreStructureEditor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi1StructureEditor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi2StructureEditor.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi3StructureEditor.java diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/META-INF/MANIFEST.MF b/org.fortiss.af3.platform.raspberry.ui/trunk/META-INF/MANIFEST.MF index 03836d23..671a91fa 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/META-INF/MANIFEST.MF +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/META-INF/MANIFEST.MF @@ -11,3 +11,12 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: fortiss GmbH Export-Package: org.fortiss.af3.platform.raspberry.ui +Import-Package: org.fortiss.af3.platform.compose, + org.fortiss.af3.platform.compose.base.hierarchical, + org.fortiss.af3.platform.compose.base.hierarchical.elements, + org.fortiss.af3.platform.model, + org.fortiss.af3.platform.raspberry.compositor, + org.fortiss.af3.platform.raspberry.model, + org.fortiss.af3.platform.raspberry.utils, + org.fortiss.af3.platform.ui.editor, + org.fortiss.af3.platform.utils diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi1CompositorBase.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi1CompositorBase.java new file mode 100644 index 00000000..83df5a76 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi1CompositorBase.java @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------+ +$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.compose; + +import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.isMasterPort; +import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.isPlatformElement; + +import org.eclipse.emf.common.util.EList; +import org.fortiss.af3.platform.compose.base.hierarchical.elements.PlatformElementCompositorBase; +import org.fortiss.af3.platform.model.GenericPlatformUnit; +import org.fortiss.af3.platform.model.IArchitectureDomain; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public abstract class RaspberryPi1CompositorBase<T extends GenericPlatformUnit & IArchitectureDomain> + extends PlatformElementCompositorBase<T> { + + /** {@inheritDoc} */ + @Override + protected boolean canBeAddedAtCurrentLevel(IArchitectureDomain element) { + return isMasterPort(element); + } + + /** {@inheritDoc} */ + @Override + protected boolean canBeDroppedInto(IArchitectureDomain element) { + EList<Class<? extends IArchitectureDomain>> childDomains = + getPlatformCompositionRules().getAdmissibleChildDomains(getEditedObjectClass()); + if(childDomains.isEmpty()) { + return isPlatformElement(element); + } + for(Class<? extends IArchitectureDomain> domain : childDomains) { + if(domain.isAssignableFrom(element.getClass())) { + return isPlatformElement(element); + } + } + + return false; + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi2CompositorBase.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi2CompositorBase.java new file mode 100644 index 00000000..9f215d62 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi2CompositorBase.java @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------+ +$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.compose; + +import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.isMasterPort; +import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.isPlatformElement; + +import org.eclipse.emf.common.util.EList; +import org.fortiss.af3.platform.compose.base.hierarchical.elements.PlatformElementCompositorBase; +import org.fortiss.af3.platform.model.GenericPlatformUnit; +import org.fortiss.af3.platform.model.IArchitectureDomain; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public abstract class RaspberryPi2CompositorBase<T extends GenericPlatformUnit & IArchitectureDomain> + extends PlatformElementCompositorBase<T> { + + /** {@inheritDoc} */ + @Override + protected boolean canBeAddedAtCurrentLevel(IArchitectureDomain element) { + return isMasterPort(element); + } + + /** {@inheritDoc} */ + @Override + protected boolean canBeDroppedInto(IArchitectureDomain element) { + EList<Class<? extends IArchitectureDomain>> childDomains = + getPlatformCompositionRules().getAdmissibleChildDomains(getEditedObjectClass()); + if(childDomains.isEmpty()) { + return isPlatformElement(element); + } + for(Class<? extends IArchitectureDomain> domain : childDomains) { + if(domain.isAssignableFrom(element.getClass())) { + return isPlatformElement(element); + } + } + + return false; + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi3CompositorBase.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi3CompositorBase.java new file mode 100644 index 00000000..728da933 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPi3CompositorBase.java @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------+ +$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.compose; + +import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.isMasterPort; +import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.isPlatformElement; + +import org.eclipse.emf.common.util.EList; +import org.fortiss.af3.platform.compose.base.hierarchical.elements.PlatformElementCompositorBase; +import org.fortiss.af3.platform.model.GenericPlatformUnit; +import org.fortiss.af3.platform.model.IArchitectureDomain; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public abstract class RaspberryPi3CompositorBase<T extends GenericPlatformUnit & IArchitectureDomain> + extends PlatformElementCompositorBase<T> { + + /** {@inheritDoc} */ + @Override + protected boolean canBeAddedAtCurrentLevel(IArchitectureDomain element) { + return isMasterPort(element); + } + + /** {@inheritDoc} */ + @Override + protected boolean canBeDroppedInto(IArchitectureDomain element) { + EList<Class<? extends IArchitectureDomain>> childDomains = + getPlatformCompositionRules().getAdmissibleChildDomains(getEditedObjectClass()); + if(childDomains.isEmpty()) { + return isPlatformElement(element); + } + for(Class<? extends IArchitectureDomain> domain : childDomains) { + if(domain.isAssignableFrom(element.getClass())) { + return isPlatformElement(element); + } + } + + return false; + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPlatformArchitectureCompositor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPlatformArchitectureCompositor.java new file mode 100644 index 00000000..8be63412 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/RaspberryPlatformArchitectureCompositor.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------+ +$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.compose; + +import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.compose.base.hierarchical.PlatformArchitectureCompositorBase; +import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class RaspberryPlatformArchitectureCompositor extends PlatformArchitectureCompositorBase { + + /** {@inheritDoc} */ + @Override + public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() { + return RaspberryPlatformHierarchicalCompositionRules.INSTANCE; + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/CoreToBusConnectionCompositor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/CoreToBusConnectionCompositor.java new file mode 100644 index 00000000..b250e82d --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/CoreToBusConnectionCompositor.java @@ -0,0 +1,95 @@ +/*--------------------------------------------------------------------------+ +$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.compose.connections; + +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.utils.PlatformModelElementFactory.createTransmissionConnection; + +import org.fortiss.af3.platform.model.GenericPlatformUnit; +import org.fortiss.af3.platform.raspberry.model.Bus; +import org.fortiss.af3.platform.raspberry.model.Core; +import org.fortiss.tooling.base.compose.HierarchicElementConnectionCompositorBase; +import org.fortiss.tooling.base.model.element.IConnection; +import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.kernel.extension.data.IConnectionCompositionContext; +import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; +import org.fortiss.tooling.kernel.service.IPersistencyService; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class CoreToBusConnectionCompositor extends + HierarchicElementConnectionCompositorBase<GenericPlatformUnit, Core, Bus> { + + /** {@inheritDoc} */ + @Override + public boolean canConnect(Core source, Bus target, GenericPlatformUnit parent, + IConnectionCompositionContext context) { + + if(source.eContainer() != target.eContainer()) { + return false; + } + return super.canConnect(source, target, parent, context); + } + + /** {@inheritDoc} */ + @Override + public boolean connect(Core source, Bus target, GenericPlatformUnit parent, + IConnectionCompositionContext context) { + IConnector sourceConnector = createEntryConnector(); + avoidDuplicateConnectorName(source, sourceConnector); + + IConnector targetConnector = createExitConnector(); + avoidDuplicateConnectorName(target, targetConnector); + + ITopLevelElement topElement = IPersistencyService.INSTANCE.getTopLevelElementFor(parent); + if(topElement != null) { + topElement.prepareIDs(sourceConnector); + topElement.prepareIDs(targetConnector); + } + createNewSourceDropContext(source, context, sourceConnector); + createNewTargetDropContext(target, context, targetConnector); + + createConnection(sourceConnector, targetConnector, parent, topElement); + return true; + } + + /** {@inheritDoc} */ + @Override + protected IConnector createEntryConnector() { + return createBusMasterPort("BusMasterPort"); + } + + /** {@inheritDoc} */ + @Override + protected IConnector createExitConnector() { + return createBusMasterInterface("BusMasterInterface"); + } + + /** {@inheritDoc} */ + @Override + protected IConnection createConnection() { + return createTransmissionConnection(); + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi1ToCANBusConnectionCompositor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi1ToCANBusConnectionCompositor.java new file mode 100644 index 00000000..6794a4ea --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi1ToCANBusConnectionCompositor.java @@ -0,0 +1,96 @@ +/*--------------------------------------------------------------------------+ +$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.compose.connections; + +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.utils.PlatformModelElementFactory.createTransmissionConnection; + +import org.fortiss.af3.platform.raspberry.model.CANBus; +import org.fortiss.af3.platform.raspberry.model.Core; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi1; +import org.fortiss.tooling.base.compose.HierarchicElementConnectionCompositorBase; +import org.fortiss.tooling.base.model.element.IConnection; +import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.kernel.extension.data.IConnectionCompositionContext; +import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; +import org.fortiss.tooling.kernel.service.IPersistencyService; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class RaspberryPi1ToCANBusConnectionCompositor extends + HierarchicElementConnectionCompositorBase<RaspberryPi1, Core, CANBus> { + + /** {@inheritDoc} */ + @Override + public boolean canConnect(Core source, CANBus target, RaspberryPi1 parent, + IConnectionCompositionContext context) { + + if(source.eContainer() != target.eContainer()) { + return false; + } + return super.canConnect(source, target, parent, context); + } + + /** {@inheritDoc} */ + @Override + public boolean connect(Core source, CANBus target, RaspberryPi1 parent, + IConnectionCompositionContext context) { + IConnector sourceConnector = createEntryConnector(); + avoidDuplicateConnectorName(source, sourceConnector); + + IConnector targetConnector = createExitConnector(); + avoidDuplicateConnectorName(target, targetConnector); + + ITopLevelElement topElement = IPersistencyService.INSTANCE.getTopLevelElementFor(parent); + if(topElement != null) { + topElement.prepareIDs(sourceConnector); + topElement.prepareIDs(targetConnector); + } + createNewSourceDropContext(source, context, sourceConnector); + createNewTargetDropContext(target, context, targetConnector); + + createConnection(sourceConnector, targetConnector, parent, topElement); + return true; + } + + /** {@inheritDoc} */ + @Override + protected IConnector createEntryConnector() { + return createCANBusMasterPort("CANBusMasterPort"); + + } + + /** {@inheritDoc} */ + @Override + protected IConnector createExitConnector() { + return createCANBusMasterInterface("CANBusMasterInterface"); + } + + /** {@inheritDoc} */ + @Override + protected IConnection createConnection() { + return createTransmissionConnection(); + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi2ToCANBusConnectionCompositor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi2ToCANBusConnectionCompositor.java new file mode 100644 index 00000000..97062072 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi2ToCANBusConnectionCompositor.java @@ -0,0 +1,96 @@ +/*--------------------------------------------------------------------------+ +$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.compose.connections; + +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.utils.PlatformModelElementFactory.createTransmissionConnection; + +import org.fortiss.af3.platform.raspberry.model.CANBus; +import org.fortiss.af3.platform.raspberry.model.Core; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi2; +import org.fortiss.tooling.base.compose.HierarchicElementConnectionCompositorBase; +import org.fortiss.tooling.base.model.element.IConnection; +import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.kernel.extension.data.IConnectionCompositionContext; +import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; +import org.fortiss.tooling.kernel.service.IPersistencyService; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class RaspberryPi2ToCANBusConnectionCompositor extends + HierarchicElementConnectionCompositorBase<RaspberryPi2, Core, CANBus> { + + /** {@inheritDoc} */ + @Override + public boolean canConnect(Core source, CANBus target, RaspberryPi2 parent, + IConnectionCompositionContext context) { + + if(source.eContainer() != target.eContainer()) { + return false; + } + return super.canConnect(source, target, parent, context); + } + + /** {@inheritDoc} */ + @Override + public boolean connect(Core source, CANBus target, RaspberryPi2 parent, + IConnectionCompositionContext context) { + IConnector sourceConnector = createEntryConnector(); + avoidDuplicateConnectorName(source, sourceConnector); + + IConnector targetConnector = createExitConnector(); + avoidDuplicateConnectorName(target, targetConnector); + + ITopLevelElement topElement = IPersistencyService.INSTANCE.getTopLevelElementFor(parent); + if(topElement != null) { + topElement.prepareIDs(sourceConnector); + topElement.prepareIDs(targetConnector); + } + createNewSourceDropContext(source, context, sourceConnector); + createNewTargetDropContext(target, context, targetConnector); + + createConnection(sourceConnector, targetConnector, parent, topElement); + return true; + } + + /** {@inheritDoc} */ + @Override + protected IConnector createEntryConnector() { + return createCANBusMasterPort("CANBusMasterPort"); + + } + + /** {@inheritDoc} */ + @Override + protected IConnector createExitConnector() { + return createCANBusMasterInterface("CANBusMasterInterface"); + } + + /** {@inheritDoc} */ + @Override + protected IConnection createConnection() { + return createTransmissionConnection(); + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi3ToCANBusConnectionCompositor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi3ToCANBusConnectionCompositor.java new file mode 100644 index 00000000..db86d2ae --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/compose/connections/RaspberryPi3ToCANBusConnectionCompositor.java @@ -0,0 +1,96 @@ +/*--------------------------------------------------------------------------+ +$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.compose.connections; + +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.utils.PlatformModelElementFactory.createTransmissionConnection; + +import org.fortiss.af3.platform.raspberry.model.CANBus; +import org.fortiss.af3.platform.raspberry.model.Core; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi3; +import org.fortiss.tooling.base.compose.HierarchicElementConnectionCompositorBase; +import org.fortiss.tooling.base.model.element.IConnection; +import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.kernel.extension.data.IConnectionCompositionContext; +import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; +import org.fortiss.tooling.kernel.service.IPersistencyService; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class RaspberryPi3ToCANBusConnectionCompositor extends + HierarchicElementConnectionCompositorBase<RaspberryPi3, Core, CANBus> { + + /** {@inheritDoc} */ + @Override + public boolean canConnect(Core source, CANBus target, RaspberryPi3 parent, + IConnectionCompositionContext context) { + + if(source.eContainer() != target.eContainer()) { + return false; + } + return super.canConnect(source, target, parent, context); + } + + /** {@inheritDoc} */ + @Override + public boolean connect(Core source, CANBus target, RaspberryPi3 parent, + IConnectionCompositionContext context) { + IConnector sourceConnector = createEntryConnector(); + avoidDuplicateConnectorName(source, sourceConnector); + + IConnector targetConnector = createExitConnector(); + avoidDuplicateConnectorName(target, targetConnector); + + ITopLevelElement topElement = IPersistencyService.INSTANCE.getTopLevelElementFor(parent); + if(topElement != null) { + topElement.prepareIDs(sourceConnector); + topElement.prepareIDs(targetConnector); + } + createNewSourceDropContext(source, context, sourceConnector); + createNewTargetDropContext(target, context, targetConnector); + + createConnection(sourceConnector, targetConnector, parent, topElement); + return true; + } + + /** {@inheritDoc} */ + @Override + protected IConnector createEntryConnector() { + return createCANBusMasterPort("CANBusMasterPort"); + + } + + /** {@inheritDoc} */ + @Override + protected IConnector createExitConnector() { + return createCANBusMasterInterface("CANBusMasterInterface"); + } + + /** {@inheritDoc} */ + @Override + protected IConnection createConnection() { + return createTransmissionConnection(); + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/CoreStructureEditor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/CoreStructureEditor.java new file mode 100644 index 00000000..fcfd4841 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/CoreStructureEditor.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------+ +$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; + +import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.model.IArchitectureDomain; +import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.raspberry.model.Core; +import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBase; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class CoreStructureEditor extends PlatformComponentStructureEditorBase<Core> { + + /** {@inheritDoc} */ + @Override + public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() { + return RaspberryPlatformHierarchicalCompositionRules.INSTANCE; + } + + /** {@inheritDoc} */ + @Override + protected Class<? extends IArchitectureDomain> getEditedObjectClass() { + return Core.class; + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi1StructureEditor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi1StructureEditor.java new file mode 100644 index 00000000..b42c5302 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi1StructureEditor.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------+ +$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; + +import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.model.IArchitectureDomain; +import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi1; +import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBase; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class RaspberryPi1StructureEditor extends PlatformComponentStructureEditorBase<RaspberryPi1> { + + /** {@inheritDoc} */ + @Override + public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() { + return RaspberryPlatformHierarchicalCompositionRules.INSTANCE; + } + + /** {@inheritDoc} */ + @Override + protected Class<? extends IArchitectureDomain> getEditedObjectClass() { + return RaspberryPi1.class; + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi2StructureEditor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi2StructureEditor.java new file mode 100644 index 00000000..c227c1e2 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi2StructureEditor.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------+ +$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; + +import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.model.IArchitectureDomain; +import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi2; +import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBase; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class RaspberryPi2StructureEditor extends PlatformComponentStructureEditorBase<RaspberryPi2> { + + /** {@inheritDoc} */ + @Override + public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() { + return RaspberryPlatformHierarchicalCompositionRules.INSTANCE; + } + + /** {@inheritDoc} */ + @Override + protected Class<? extends IArchitectureDomain> getEditedObjectClass() { + return RaspberryPi2.class; + } + +} diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi3StructureEditor.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi3StructureEditor.java new file mode 100644 index 00000000..b81cde2e --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editor/RaspberryPi3StructureEditor.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------+ +$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; + +import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.model.IArchitectureDomain; +import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi3; +import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBase; + +/** + * + * @author chaudhary + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class RaspberryPi3StructureEditor extends PlatformComponentStructureEditorBase<RaspberryPi3> { + + /** {@inheritDoc} */ + @Override + public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() { + return RaspberryPlatformHierarchicalCompositionRules.INSTANCE; + } + + /** {@inheritDoc} */ + @Override + protected Class<? extends IArchitectureDomain> getEditedObjectClass() { + return RaspberryPi3.class; + } + +} -- GitLab