]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/3d/branches/dev@8675 ac1ea38d...
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 19 Jan 2009 09:36:34 +0000 (09:36 +0000)
committerluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 19 Jan 2009 09:36:34 +0000 (09:36 +0000)
org.simantics.proconf.processeditor/src/org/simantics/processeditor/dialogs/FloorConfigureDialog.java [new file with mode: 0644]
org.simantics.proconf.processeditor/src/org/simantics/processeditor/views/ProcessEditor.java

diff --git a/org.simantics.proconf.processeditor/src/org/simantics/processeditor/dialogs/FloorConfigureDialog.java b/org.simantics.proconf.processeditor/src/org/simantics/processeditor/dialogs/FloorConfigureDialog.java
new file mode 100644 (file)
index 0000000..22b9100
--- /dev/null
@@ -0,0 +1,99 @@
+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
index 8681125e3f9df8059d77c17e74e632b5387df865..cab340f58440ce735aa21fa4e33acb083e0f6970 100644 (file)
@@ -17,23 +17,10 @@ import java.util.List;
 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
@@ -51,6 +38,7 @@ import org.simantics.processeditor.actions.InsertNozzleAction;
 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
@@ -84,8 +72,6 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
     \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
@@ -146,10 +132,6 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
 //        }\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
@@ -181,16 +163,6 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
                    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
@@ -499,8 +471,7 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
        \r
         public ProcessEditorSelectionAdapter(ScenegraphAdapter adapter) {\r
                        super(adapter);\r
-                       // TODO Auto-generated constructor stub\r
-               }\r
+        }\r
 \r
            @Override\r
            public void setEditorSelection() {\r
@@ -513,17 +484,6 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
                                ((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
@@ -537,23 +497,6 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
                                ((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
@@ -570,89 +513,6 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
            }\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