Commit 9bb0663a authored by Florian Hölzl's avatar Florian Hölzl
Browse files

added transceiver allocation

refs 727
parent 49cdddb1
......@@ -20,6 +20,7 @@ package org.fortiss.af3.deployment.ui.editor;
import static org.fortiss.af3.deployment.utils.DeploymentModelElementFactory.createComponentAllocation;
import static org.fortiss.af3.deployment.utils.DeploymentModelElementFactory.createInputPortAllocation;
import static org.fortiss.af3.deployment.utils.DeploymentModelElementFactory.createOutputPortAllocation;
import static org.fortiss.af3.deployment.utils.DeploymentModelElementFactory.createTransceiverAllocation;
import static org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils.getFirstElement;
import java.util.List;
......@@ -32,8 +33,10 @@ import org.eclipse.swt.widgets.Display;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.Receiver;
import org.fortiss.af3.platform.model.Transceiver;
import org.fortiss.af3.platform.model.Transmitter;
/**
......@@ -43,10 +46,9 @@ import org.fortiss.af3.platform.model.Transmitter;
* @author doebber
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: FFCB12C0595794F7631FEB5CB0A384FC
* @ConQAT.Rating YELLOW Hash: 1E2EE6A0B851C9D710FA59DB896D2125
*/
public class AllocationDefinitionDialogBackend extends
AllocationDefinitionDialogGUI {
public class AllocationDefinitionDialogBackend extends AllocationDefinitionDialogGUI {
/** Stores the list displayed in the left part of the dialog. */
private List<? extends EObject> leftList;
......@@ -92,30 +94,31 @@ public class AllocationDefinitionDialogBackend extends
protected void okPressed() {
EObject left = getFirstElement(getListViewerLeft().getSelection());
EObject right = getFirstElement(getListViewerRight().getSelection());
if (finish(left, right)) {
if(finish(left, right)) {
super.okPressed();
}
}
/** Checks selection for sensible combination and creates allocation object. */
private boolean finish(EObject left, EObject right) {
if (left == null || right == null) {
if(left == null || right == null) {
return false;
}
if (left instanceof Component && right instanceof ExecutionUnit) {
resultAllocation = createComponentAllocation((Component) left,
(ExecutionUnit) right);
if(left instanceof Component && right instanceof ExecutionUnit) {
resultAllocation = createComponentAllocation((Component)left, (ExecutionUnit)right);
return true;
}
if (left instanceof InputPort && right instanceof Receiver) {
resultAllocation = createInputPortAllocation((InputPort) left,
(Receiver) right);
if(left instanceof InputPort && right instanceof Receiver) {
resultAllocation = createInputPortAllocation((InputPort)left, (Receiver)right);
return true;
}
if (left instanceof OutputPort && right instanceof Transmitter) {
resultAllocation = createOutputPortAllocation((OutputPort) left,
(Transmitter) right);
if(left instanceof OutputPort && right instanceof Transmitter) {
resultAllocation = createOutputPortAllocation((OutputPort)left, (Transmitter)right);
return true;
}
if(left instanceof Port && right instanceof Transceiver) {
resultAllocation = createTransceiverAllocation((Port)left, (Transceiver)right);
return true;
}
return false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment