allowed.clear();
if (component instanceof Nozzle) {
- if (component.getNext() == null && component.getPrevious() == null) {
- allowed.add(PositionType.NEXT);
- }
+ if (component.getNext() == null && component.getPrevious() == null) {
+ allowed.add(PositionType.NEXT);
+ }
} else {
- if (component.getNext() == null) {
- allowed.add(PositionType.NEXT);
- }
- if (component.getPrevious() == null) {
- allowed.add(PositionType.PREVIOUS);
- }
- if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){
- allowed.add(PositionType.SPLIT);
- }
+ if (component.getNext() == null) {
+ allowed.add(PositionType.NEXT);
+ }
+ if (component.getPrevious() == null) {
+ allowed.add(PositionType.PREVIOUS);
+ }
+ if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){
+ allowed.add(PositionType.SPLIT);
+ }
}
setEnabled(allowed.size() > 0);
}
@Override
public void run() {
-
+
ComponentSelectionDialog dialog = new ComponentSelectionDialog(Display.getCurrent().getActiveShell(), allowed, component);
if (dialog.open() == ComponentSelectionDialog.CANCEL)
return;
}
public void doInsert(PositionType position) {
- try {
- InsertInstruction inst = new InsertInstruction();
- inst.typeUri = toAdd.getUri();
- inst.angle = angle;
- inst.diameter = diameter;
- inst.length = length;
- inst.turnRadius = turnRadius;
- inst.insertPosition = insertPosition;
- inst.position = position;
- ComponentUtils.addComponent(root, component, inst);
- } catch (Exception e) {
- ExceptionUtils.logAndShowError("Cannot add component", e);
- }
+ try {
+ InsertInstruction inst = new InsertInstruction();
+ inst.typeUri = toAdd.getUri();
+ inst.angle = angle;
+ inst.diameter = diameter;
+ inst.length = length;
+ inst.turnRadius = turnRadius;
+ inst.insertPosition = insertPosition;
+ inst.position = position;
+ ComponentUtils.addComponent(root, component, inst);
+ } catch (Exception e) {
+ ExceptionUtils.logAndShowError("Cannot add component", e);
+ }
// try {
// PipelineComponent newComponent = ComponentUtils.createComponent(root,toAdd.getUri());
// PipeControlPoint newPcp = newComponent.getControlPoint();
@Override
public boolean mouseWheelMoved(MouseWheelEvent e) {
- return getDefaultAction().mouseWheelMoved(e);
+ return getDefaultAction().mouseWheelMoved(e);
}
}