Commit 56040829 authored by Simon Barner's avatar Simon Barner
Browse files

Use ConnectorCompositorBase

* Direct replacement of code clones with newly introduced base class

Issue-Ref: 3735
Issue-Url: https://af3-developer.fortiss.org/issues/3735

Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 276d2e4f
ArgumentModuleCompositor.java 84cac3d19512af8d100935f2f1644dac5c7d0f59 GREEN ArgumentModuleCompositor.java 84cac3d19512af8d100935f2f1644dac5c7d0f59 GREEN
AssumptionCompositor.java 920076b93fd7792acd0118ae9c057393d430dd42 GREEN AssumptionCompositor.java 37d266a96c858131b73efc15bd5942e108dcfe0c YELLOW
AwayContextCompositor.java 77b274848b89ae61bde8775cb4a97914f0a9067b GREEN AwayContextCompositor.java 7a50f323cdc55f065b8c8f0d6b8b4a12baecc8c5 YELLOW
AwayContractModuleCompositor.java e6c9e7ebe1b15baa282a67cdafedc268ca28235a GREEN AwayContractModuleCompositor.java d8c3f72193e729b31f128db480e9c51dc89e63c6 YELLOW
AwayGoalCompositor.java f6d2c05cdc9689f89b88f7653fefc0480b0b61a7 GREEN AwayGoalCompositor.java 4432c8934746be63dc16374bd923a4e9f3b6d1d0 YELLOW
AwayGoalInContextOfConnectionCompositor.java 49daac2f7b70f9ceb708cb27a78fc190bf3293d2 GREEN AwayGoalInContextOfConnectionCompositor.java 49daac2f7b70f9ceb708cb27a78fc190bf3293d2 GREEN
AwayGoalSupportedByConnectionCompositor.java 05735ae0a9c07c05a7008319fca34bd186e0e8c9 GREEN AwayGoalSupportedByConnectionCompositor.java 05735ae0a9c07c05a7008319fca34bd186e0e8c9 GREEN
AwaySolutionCompositor.java 724f2ec43a814268d29b256c0022ccf31296a838 GREEN AwaySolutionCompositor.java cce1a2056192a8f2c71b5af4dd52ede2982f94d2 YELLOW
ConnectionCompositor.java 7df1a6bea9fd1f269a63c58fe95fed3ac40f12ae GREEN ConnectionCompositor.java 7df1a6bea9fd1f269a63c58fe95fed3ac40f12ae GREEN
ContextCompositor.java 85134ead7c70c68c339b1c04470f7ef1705d4e21 GREEN ContextCompositor.java 0540ee7716235bb96fc48c37ff618d4117a446f5 YELLOW
ContractModuleCompositor.java ac85daf1d00003404bf6ba1d9577590c5df92948 GREEN ContractModuleCompositor.java ac85daf1d00003404bf6ba1d9577590c5df92948 GREEN
GoalCompositor.java fde0cc8da148f5ad65263c999d35507b443697ac GREEN GoalCompositor.java fde0cc8da148f5ad65263c999d35507b443697ac GREEN
GoalInContextOfConnectionCompositor.java 2fb8369eb1f1535a733a72695b32e4dd3aba3438 GREEN GoalInContextOfConnectionCompositor.java 2fb8369eb1f1535a733a72695b32e4dd3aba3438 GREEN
GoalSupportedByCompositor.java 05c3012ed065f91c697f1b94d20ba4c6694fc20f GREEN GoalSupportedByCompositor.java 05c3012ed065f91c697f1b94d20ba4c6694fc20f GREEN
JustificationCompositor.java c3ddf1ea3609753a28f877b1b29ff68d6c3fd552 GREEN JustificationCompositor.java 186c40154203bcf3b94f60b21a6c57d976b4e263 YELLOW
LibraryCompositor.java dd316d3bc94ed2076178b988aca6be4168e61c79 GREEN LibraryCompositor.java dd316d3bc94ed2076178b988aca6be4168e61c79 GREEN
LibraryModulePackageCompositor.java 36146f15fc51c250a3b93886751318fca3693420 GREEN LibraryModulePackageCompositor.java 36146f15fc51c250a3b93886751318fca3693420 GREEN
ModuleSupportedByCompositor.java e182c106b19307adba9a77fb49a62450cef954d4 GREEN ModuleSupportedByCompositor.java e182c106b19307adba9a77fb49a62450cef954d4 GREEN
ModuleSupportedByConnectionCompositor.java c182f31d4cc87e7074e5d75b88424c83258292b2 GREEN ModuleSupportedByConnectionCompositor.java c182f31d4cc87e7074e5d75b88424c83258292b2 GREEN
OptionEntityCompositor.java d0c6750e1751a51f40a39b38b9e4b3f8ed59ec66 GREEN OptionEntityCompositor.java fad7f9647a38a983721d8a41c6ae3268b914bbb5 YELLOW
OptionEntitySupportedByConnectionCompositor.java 6decf7e60cc95084b31c94a6f7b948a942ec096d GREEN OptionEntitySupportedByConnectionCompositor.java 6decf7e60cc95084b31c94a6f7b948a942ec096d GREEN
OptionSupportedByCompositor.java 229fbba0152295fd51811c48aff69d3a8d069531 GREEN OptionSupportedByCompositor.java 229fbba0152295fd51811c48aff69d3a8d069531 GREEN
SafetyArgumentationPackageCompositor.java cab9400a90ecdc6bf6b6de36c2a9fcb0d6aaacf3 GREEN SafetyArgumentationPackageCompositor.java cab9400a90ecdc6bf6b6de36c2a9fcb0d6aaacf3 GREEN
...@@ -25,7 +25,7 @@ SafetyCaseCompositor.java 70cf7e5e6e657bc95d764831a4bbca2e06fbcd65 GREEN ...@@ -25,7 +25,7 @@ SafetyCaseCompositor.java 70cf7e5e6e657bc95d764831a4bbca2e06fbcd65 GREEN
SafetyClaimPatternCompositor.java 032cc9916b3fc9c56d395bbf6dd9a79c294b45d2 GREEN SafetyClaimPatternCompositor.java 032cc9916b3fc9c56d395bbf6dd9a79c294b45d2 GREEN
SafetyClaimPatternsCollectionCompositor.java 28df8f12df83d7f63919b5f59f43bff0e714706b GREEN SafetyClaimPatternsCollectionCompositor.java 28df8f12df83d7f63919b5f59f43bff0e714706b GREEN
SafetyClaimPatternsDatabaseCompositor.java 0d7c8c3a5d480fee584fdd4f0d9a9890ee9e1cf8 GREEN SafetyClaimPatternsDatabaseCompositor.java 0d7c8c3a5d480fee584fdd4f0d9a9890ee9e1cf8 GREEN
SolutionCompositor.java 69d789e20975d20c4b3b948ff235f2933c386814 GREEN SolutionCompositor.java 56abe6009d62aa610a44aa439dda07021aa8c5a2 YELLOW
StrategyCompositor.java 0982fe473816e646146718a6dfd1da06f6613d9d GREEN StrategyCompositor.java 0982fe473816e646146718a6dfd1da06f6613d9d GREEN
StrategyInContextOfConnectionCompositor.java ec535c595f282321631eaa65c73d275e1b8aeacb GREEN StrategyInContextOfConnectionCompositor.java ec535c595f282321631eaa65c73d275e1b8aeacb GREEN
StrategySupportedByCompositor.java 921acc5d8795a27313a51fe434e5de63fc41cb50 GREEN StrategySupportedByCompositor.java 921acc5d8795a27313a51fe434e5de63fc41cb50 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2012 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.safetycases.compose; package org.fortiss.af3.safetycases.compose;
import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny; import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.safetycases.model.Assumption; import org.fortiss.af3.safetycases.model.Assumption;
import org.fortiss.af3.safetycases.model.EntryConnector; import org.fortiss.af3.safetycases.model.EntryConnector;
import org.fortiss.af3.safetycases.model.SafetyCasesConnector; import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.kernel.extension.IElementCompositor; import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/** /**
* {@link IElementCompositor} for {@link Assumption}s. * {@link IElementCompositor} for {@link Assumption}s.
* *
* @author carlan * @author carlan
*/ */
public class AssumptionCompositor extends HierarchicElementCompositorBase<Assumption> { public class AssumptionCompositor extends ConnectorCompositorBase<Assumption> {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public boolean canCompose(Assumption container, EObject contained, public boolean isCorrectElementClass(EObject element) {
IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean compose(Assumption container, EObject contained,
IElementCompositionContext context) {
if(isCorrectElementClass(contained)) {
SafetyCasesConnector port = (SafetyCasesConnector)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
layoutConnectorInRectangle(port, container, ctx.getPosition());
}
container.getConnectors().add(port);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return isInstanceOfAny(element, EntryConnector.class); return isInstanceOfAny(element, EntryConnector.class);
} }
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return isCorrectElementClass(contained);
}
} }
...@@ -16,61 +16,22 @@ ...@@ -16,61 +16,22 @@
package org.fortiss.af3.safetycases.compose; package org.fortiss.af3.safetycases.compose;
import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny; import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.safetycases.model.AwayContext; import org.fortiss.af3.safetycases.model.AwayContext;
import org.fortiss.af3.safetycases.model.EntryConnector; import org.fortiss.af3.safetycases.model.EntryConnector;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase; import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.kernel.extension.IElementCompositor; import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/** /**
* {@link IElementCompositor} for {@link AwayContext}s. * {@link IElementCompositor} for {@link AwayContext}s.
* *
* @author carlan * @author carlan
*/ */
public class AwayContextCompositor extends HierarchicElementCompositorBase<AwayContext> { public class AwayContextCompositor extends ConnectorCompositorBase<AwayContext> {
/** {@inheritDoc} */
@Override
public boolean canCompose(AwayContext container, EObject contained,
IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public boolean compose(AwayContext container, EObject contained, public boolean isCorrectElementClass(EObject element) {
IElementCompositionContext context) {
if(isCorrectElementClass(contained)) {
EntryConnector port = (EntryConnector)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
layoutConnectorInRectangle(port, container, ctx.getPosition());
}
container.getConnectors().add(port);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return isInstanceOfAny(element, EntryConnector.class); return isInstanceOfAny(element, EntryConnector.class);
} }
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return isCorrectElementClass(contained);
}
} }
...@@ -16,68 +16,23 @@ ...@@ -16,68 +16,23 @@
package org.fortiss.af3.safetycases.compose; package org.fortiss.af3.safetycases.compose;
import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny; import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.safetycases.model.AwayContractModule; import org.fortiss.af3.safetycases.model.AwayContractModule;
import org.fortiss.af3.safetycases.model.ContractModule;
import org.fortiss.af3.safetycases.model.EntryConnector; import org.fortiss.af3.safetycases.model.EntryConnector;
import org.fortiss.af3.safetycases.model.ExitConnector; import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
import org.fortiss.af3.safetycases.model.SafetyCasesConnector;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.kernel.extension.IElementCompositor; import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/** /**
* {@link IElementCompositor} for {@link AwayContractModule}s. * {@link IElementCompositor} for {@link AwayContractModule}s.
* *
* @author carlan * @author carlan
*/ */
public class AwayContractModuleCompositor public class AwayContractModuleCompositor extends ConnectorCompositorBase<AwayContractModule> {
extends HierarchicElementCompositorBase<AwayContractModule> {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public boolean canCompose(AwayContractModule container, EObject contained, public boolean isCorrectElementClass(EObject element) {
IElementCompositionContext context) {
if(container.getContainer() instanceof ContractModule) {
return isInstanceOfAny(contained, EntryConnector.class, ExitConnector.class);
}
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean compose(AwayContractModule container, EObject contained,
IElementCompositionContext context) {
if(isCorrectElementClass(contained)) {
SafetyCasesConnector port = (SafetyCasesConnector)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
layoutConnectorInRectangle(port, container, ctx.getPosition());
}
container.getConnectors().add(port);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return isInstanceOfAny(element, EntryConnector.class); return isInstanceOfAny(element, EntryConnector.class);
} }
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return isCorrectElementClass(contained);
}
} }
...@@ -16,67 +16,23 @@ ...@@ -16,67 +16,23 @@
package org.fortiss.af3.safetycases.compose; package org.fortiss.af3.safetycases.compose;
import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny; import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.safetycases.model.AwayGoal; import org.fortiss.af3.safetycases.model.AwayGoal;
import org.fortiss.af3.safetycases.model.ContractModule;
import org.fortiss.af3.safetycases.model.EntryConnector; import org.fortiss.af3.safetycases.model.EntryConnector;
import org.fortiss.af3.safetycases.model.ExitConnector; import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
import org.fortiss.af3.safetycases.model.SafetyCasesConnector;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.kernel.extension.IElementCompositor; import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/** /**
* {@link IElementCompositor} for {@link AwayGoal}s. * {@link IElementCompositor} for {@link AwayGoal}s.
* *
* @author carlan * @author carlan
*/ */
public class AwayGoalCompositor extends HierarchicElementCompositorBase<AwayGoal> { public class AwayGoalCompositor extends ConnectorCompositorBase<AwayGoal> {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public boolean canCompose(AwayGoal container, EObject contained, public boolean isCorrectElementClass(EObject element) {
IElementCompositionContext context) {
if(container.getContainer() instanceof ContractModule) {
return isInstanceOfAny(contained, EntryConnector.class, ExitConnector.class);
}
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean compose(AwayGoal container, EObject contained,
IElementCompositionContext context) {
if(isCorrectElementClass(contained)) {
SafetyCasesConnector port = (SafetyCasesConnector)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
layoutConnectorInRectangle(port, container, ctx.getPosition());
}
container.getConnectors().add(port);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return isInstanceOfAny(element, EntryConnector.class); return isInstanceOfAny(element, EntryConnector.class);
} }
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return isCorrectElementClass(contained);
}
} }
...@@ -16,61 +16,23 @@ ...@@ -16,61 +16,23 @@
package org.fortiss.af3.safetycases.compose; package org.fortiss.af3.safetycases.compose;
import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny; import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.safetycases.model.AwaySolution; import org.fortiss.af3.safetycases.model.AwaySolution;
import org.fortiss.af3.safetycases.model.EntryConnector; import org.fortiss.af3.safetycases.model.EntryConnector;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase; import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.kernel.extension.IElementCompositor; import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/** /**
* {@link IElementCompositor} for {@link AwaySolution}s. * {@link IElementCompositor} for {@link AwaySolution}s.
* *
* @author carlan * @author carlan
*/ */
public class AwaySolutionCompositor extends HierarchicElementCompositorBase<AwaySolution> { public class AwaySolutionCompositor extends ConnectorCompositorBase<AwaySolution> {
/** {@inheritDoc} */
@Override
public boolean canCompose(AwaySolution container, EObject contained,
IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean compose(AwaySolution container, EObject contained,
IElementCompositionContext context) {
if(isCorrectElementClass(contained)) {
EntryConnector port = (EntryConnector)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
layoutConnectorInRectangle(port, container, ctx.getPosition());
}
container.getConnectors().add(port);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** Returns whether the given element is of an acceptable class. */ /** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return isInstanceOfAny(element, EntryConnector.class);
}
/** {@inheritDoc} */
@Override @Override
public boolean canDecompose(EObject contained) { public boolean isCorrectElementClass(EObject element) {
return isCorrectElementClass(contained); return isInstanceOfAny(element, EntryConnector.class);
} }
} }
package org.fortiss.af3.safetycases.compose; package org.fortiss.af3.safetycases.compose;
import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny; import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.safetycases.model.Context; import org.fortiss.af3.safetycases.model.Context;
import org.fortiss.af3.safetycases.model.EntryConnector; import org.fortiss.af3.safetycases.model.EntryConnector;
import org.fortiss.af3.safetycases.model.SafetyCasesConnector; import org.fortiss.tooling.base.compose.ConnectorCompositorBase;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.kernel.extension.IElementCompositor; import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/** /**
* {@link IElementCompositor} for {@link Context}s. * {@link IElementCompositor} for {@link Context}s.
* *
* @author carlan * @author carlan
*/ */
public class ContextCompositor extends HierarchicElementCompositorBase<Context> { public class ContextCompositor extends ConnectorCompositorBase<Context> {
/** {@inheritDoc} */
@Override
public boolean canCompose(Context container, EObject contained,
IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean compose(Context container, EObject contained,
IElementCompositionContext context) {
if(isCorrectElementClass(contained)) {
SafetyCasesConnector port = (SafetyCasesConnector)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
layoutConnectorInRectangle(port, container, ctx.getPosition());
}
container.getConnectors().add(port);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** Returns whether the given element is of an acceptable class. */ /** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return isInstanceOfAny(element, EntryConnector.class);
}
/** {@inheritDoc} */
@Override @Override
public boolean canDecompose(EObject contained) { public boolean isCorrectElementClass(EObject element) {