--- /dev/null
+package org.simantics.processeditor.dialogs;\r
+\r
+import org.eclipse.jface.dialogs.Dialog;\r
+import org.eclipse.jface.dialogs.IDialogConstants;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.KeyEvent;\r
+import org.eclipse.swt.events.KeyListener;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.events.SelectionListener;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.swt.widgets.Text;\r
+\r
+public class FloorConfigureDialog extends Dialog implements KeyListener,SelectionListener {\r
+ \r
+ private boolean floorEnabled = true;\r
+ private double floorHeight = 0.0;\r
+ \r
+ private Text floorHeightText = null;\r
+ private Button floorEnabledButton = null;\r
+ \r
+ public FloorConfigureDialog(Shell shell) {\r
+ super(shell);\r
+ }\r
+ \r
+ @Override\r
+ protected Control createDialogArea(Composite parent) {\r
+ Composite composite = (Composite) super.createDialogArea(parent);\r
+ Label label = new Label(composite, SWT.WRAP);\r
+ label.setText("Configure floor");\r
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
+ | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
+ | GridData.VERTICAL_ALIGN_CENTER);\r
+ \r
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
+ label.setLayoutData(data);\r
+ label.setFont(parent.getFont());\r
+ floorEnabledButton = new Button(composite,SWT.CHECK);\r
+ floorEnabledButton.setText("Enabled");\r
+ label = new Label(composite, SWT.WRAP);\r
+ label.setText("Height");\r
+ label.setLayoutData(data);\r
+ label.setFont(parent.getFont());\r
+ floorHeightText = new Text(composite,SWT.NONE);\r
+ \r
+ \r
+ floorHeightText.addKeyListener(this);\r
+ floorEnabledButton.addSelectionListener(this);\r
+ floorEnabledButton.setSelection(floorEnabled);\r
+ floorHeightText.setText(Double.toString(floorHeight));\r
+ \r
+ return composite;\r
+ }\r
+ \r
+ @Override\r
+ protected void configureShell(Shell newShell) {\r
+ super.configureShell(newShell);\r
+ newShell.setText("Configure floor");\r
+ }\r
+ \r
+ public void keyPressed(KeyEvent e) {\r
+ \r
+ }\r
+ \r
+ public void keyReleased(KeyEvent e) {\r
+ boolean ok = true;\r
+ try {\r
+ floorHeight = Double.parseDouble(floorHeightText.getText()); \r
+ } catch (NumberFormatException err) {\r
+ ok = false;\r
+ }\r
+ if (ok) {\r
+ this.getButton(IDialogConstants.OK_ID).setEnabled(true);\r
+ } else {\r
+ this.getButton(IDialogConstants.OK_ID).setEnabled(false);\r
+ }\r
+ }\r
+ \r
+ public void widgetDefaultSelected(SelectionEvent e) {\r
+ \r
+ }\r
+ \r
+ public void widgetSelected(SelectionEvent e) {\r
+ floorEnabled = floorEnabledButton.getSelection();\r
+ }\r
+\r
+ public boolean isFloorEnabled() {\r
+ return floorEnabled;\r
+ }\r
+\r
+ public double getFloorHeight() {\r
+ return floorHeight;\r
+ }\r
+\r
+}\r
import java.util.Map;\r
\r
import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
import org.eclipse.jface.viewers.ISelection;\r
import org.eclipse.jface.viewers.ISelectionChangedListener;\r
import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.KeyEvent;\r
-import org.eclipse.swt.events.KeyListener;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.events.SelectionListener;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Button;\r
import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
import org.eclipse.ui.IWorkbenchPart;\r
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;\r
import org.simantics.db.Graph;\r
import org.simantics.processeditor.actions.RoutePipeAction;\r
import org.simantics.processeditor.common.ControlPointTools;\r
import org.simantics.processeditor.common.PipingRules;\r
+import org.simantics.processeditor.dialogs.FloorConfigureDialog;\r
import org.simantics.processeditor.scenegraph.NonVisibleNode;\r
import org.simantics.processeditor.scenegraph.PipeComponentNode;\r
import org.simantics.processeditor.scenegraph.PipeRunNode;\r
\r
private Resource plantResource = null;\r
\r
- //private List<AnimationController> animationControllers = new ArrayList<AnimationController>();\r
-\r
private Action configureFloorAction = null;\r
\r
private Geometry floorShape = null;\r
// }\r
}\r
\r
-// protected void stopAnimations() {\r
-// animationSystem.stop();\r
-// }\r
- \r
protected void fillLocalPullDown() {\r
super.fillLocalPullDown();\r
MenuTools.getOrCreate(getMenuID(),"Advanced", menuManager).add(configureFloorAction);\r
PipeRunControlPointQuery query = new PipeRunControlPointQuery(node.getResource());\r
pipeRunQueries.put(node.getResource(), query);\r
node.getGraph().performQuery(query);\r
-// return new SubnodeListener(node) {\r
-// @Override\r
-// public void shapeAdded(IGraphicsNode node) {\r
-// if (node instanceof IGeometryNode) {\r
-// updateGeometry((IGeometryNode)node);\r
-// \r
-// }\r
-// node.setVisible(true);\r
-// }\r
-// };\r
}\r
return new NormalScenegraphQuery(node.getResource());\r
\r
\r
public ProcessEditorSelectionAdapter(ScenegraphAdapter adapter) {\r
super(adapter);\r
- // TODO Auto-generated constructor stub\r
- }\r
+ }\r
\r
@Override\r
public void setEditorSelection() {\r
((ISelectableNode)o).setSelected(false);\r
}\r
}\r
- List<Resource> selected = getSelectedResources();\r
- // TODO : don't know why this code is here, but it seems unnecessary\r
-// for (Resource r : selected) {\r
-// if (!adapter.hasNode(r)) {\r
-// // instantiating a new resource : usin this editor's tc\r
-// Resource resource = graph.getResource(r.getId());\r
-// adapter.addInbound(resource).setSelected(true);\r
-//\r
-// }\r
-// }\r
- \r
}\r
\r
public void setEditorSelection(boolean addShapes) {\r
((ISelectableNode)o).setSelected(false);\r
}\r
}\r
- if (addShapes) {\r
- // TODO : don't know why this code is here, but it seems unnecessary\r
-// List<Resource> selected = getSelectedResources();\r
-// for (Resource r : selected) {\r
-// if (!adapter.hasNode(r)) {\r
-// if (r.isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.EQUIPMENT))) {\r
-// Resource group = GraphicsNodeTools.getModelFromResource(r);\r
-// if (group != null && group.getId() == plant.getResource().getId()) {\r
-//// instantiating a new resource : usin this editor's tc\r
-// Resource resource = graph.getResource(r.getId());\r
-// adapter.addInbound(resource).setSelected(true);\r
-// }\r
-// \r
-// }\r
-// }\r
-// }\r
- }\r
}\r
\r
@Override\r
}\r
}\r
\r
- private class FloorConfigureDialog extends Dialog implements KeyListener,SelectionListener {\r
- \r
- private boolean floorEnabled = true;\r
- private double floorHeight = 0.0;\r
- \r
- private Text floorHeightText = null;\r
- private Button floorEnabledButton = null;\r
- \r
- public FloorConfigureDialog(Shell shell) {\r
- super(shell);\r
- }\r
- \r
- @Override\r
- protected Control createDialogArea(Composite parent) {\r
- Composite composite = (Composite) super.createDialogArea(parent);\r
- Label label = new Label(composite, SWT.WRAP);\r
- label.setText("Configure floor");\r
- GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
- | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
- | GridData.VERTICAL_ALIGN_CENTER);\r
- \r
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
- label.setLayoutData(data);\r
- label.setFont(parent.getFont());\r
- floorEnabledButton = new Button(composite,SWT.CHECK);\r
- floorEnabledButton.setText("Enabled");\r
- label = new Label(composite, SWT.WRAP);\r
- label.setText("Height");\r
- label.setLayoutData(data);\r
- label.setFont(parent.getFont());\r
- floorHeightText = new Text(composite,SWT.NONE);\r
- \r
- \r
- floorHeightText.addKeyListener(this);\r
- floorEnabledButton.addSelectionListener(this);\r
- floorEnabledButton.setSelection(floorEnabled);\r
- floorHeightText.setText(Double.toString(floorHeight));\r
- \r
- return composite;\r
- }\r
- \r
- @Override\r
- protected void configureShell(Shell newShell) {\r
- super.configureShell(newShell);\r
- newShell.setText("Configure floor");\r
- }\r
- \r
- public void keyPressed(KeyEvent e) {\r
- \r
- }\r
- \r
- public void keyReleased(KeyEvent e) {\r
- boolean ok = true;\r
- try {\r
- floorHeight = Double.parseDouble(floorHeightText.getText()); \r
- } catch (NumberFormatException err) {\r
- ok = false;\r
- }\r
- if (ok) {\r
- this.getButton(IDialogConstants.OK_ID).setEnabled(true);\r
- } else {\r
- this.getButton(IDialogConstants.OK_ID).setEnabled(false);\r
- }\r
- }\r
- \r
- public void widgetDefaultSelected(SelectionEvent e) {\r
- \r
- }\r
- \r
- public void widgetSelected(SelectionEvent e) {\r
- floorEnabled = floorEnabledButton.getSelection();\r
- }\r
-\r
- public boolean isFloorEnabled() {\r
- return floorEnabled;\r
- }\r
-\r
- public double getFloorHeight() {\r
- return floorHeight;\r
- }\r
-\r
- }\r
- \r
@Override\r
protected void hookDragAndDrop() {\r
super.hookDragAndDrop();\r