import org.simantics.plant3d.dialog.ComponentSelectionDialog;
import org.simantics.plant3d.gizmo.TerminalSelectionGizmo;
import org.simantics.plant3d.scenegraph.InlineComponent;
+import org.simantics.plant3d.scenegraph.Nozzle;
import org.simantics.plant3d.scenegraph.P3DRootNode;
import org.simantics.plant3d.scenegraph.PipeRun;
import org.simantics.plant3d.scenegraph.PipelineComponent;
this.component = component;
allowed.clear();
- 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 instanceof Nozzle) {
+ 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);
+ }
}
setEnabled(allowed.size() > 0);
}
package org.simantics.plant3d.editor;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
if (parentElement instanceof P3DRootNode) {
return ((P3DRootNode)parentElement).getChild().toArray();
}
- if (!DEBUG) {
- if (parentElement instanceof PipeRun) {
- return ((PipeRun)parentElement).getSortedChild().toArray();
- }
- } else {
+ if (parentElement instanceof PipeRun) {
+ if (DEBUG) {
+ List<Object> list = new ArrayList<Object>();
+ list.addAll(((PipeRun)parentElement).getControlPoints());
+ list.addAll(((PipeRun)parentElement).getSortedChild());
+ return list.toArray();
+ }
+ return ((PipeRun)parentElement).getSortedChild().toArray();
+ }
+ if (DEBUG) {
if (parentElement instanceof PipelineComponent) {
return new Object[]{((PipelineComponent) parentElement).getControlPoint()};
} else if (parentElement instanceof PipeControlPoint) {
public void setNext(PipelineComponent comp) {
if (next == comp)
return;
- if (comp == null)
- this.next._removeRef(this);
+ if (this.next != null)
+ this.next._removeRef(this);
this.next = comp;
this.syncnext = false;
syncNext();
public void setPrevious(PipelineComponent comp) {
if (previous == comp)
return;
- if (comp == null)
+ if (this.previous != null)
this.previous._removeRef(this);
this.previous = comp;
this.syncprev = false;
public void setBranch0(PipelineComponent comp) {
if (branch0 == comp)
return;
- if (comp == null)
- this.branch0._removeRef(this);
+ if (this.branch0 != null)
+ this.branch0._removeRef(this);
this.branch0 = comp;
this.syncbr0 = false;
syncBranch0();