]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/example/chassis/ViewPartExample.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / example / chassis / ViewPartExample.java
index b2ce6dcdba8a2eaf0eef640d92f2370297b91bea..4f542455b9b91f5b3a660fbb223dc4f479b6b9b4 100644 (file)
@@ -1,60 +1,60 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.example.chassis;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.part.ViewPart;\r
-import org.simantics.g2d.canvas.ICanvasContext;\r
-import org.simantics.g2d.canvas.impl.CanvasContext;\r
-import org.simantics.g2d.chassis.ICanvasChassis;\r
-import org.simantics.g2d.chassis.IChassisListener;\r
-import org.simantics.g2d.chassis.SWTChassis;\r
-import org.simantics.g2d.example.TestCanvas;\r
-import org.simantics.utils.threads.AWTThread;\r
-import org.simantics.utils.threads.IThreadWorkQueue;\r
-import org.simantics.utils.threads.ThreadUtils;\r
-\r
-public class ViewPartExample extends ViewPart {\r
-    SWTChassis c;\r
-\r
-    @Override\r
-    public void createPartControl(Composite parent) {\r
-        c = new SWTChassis(parent, 0);\r
-        c.syncPopulate();\r
-\r
-        IThreadWorkQueue thread = AWTThread.getThreadAccess();\r
-        CanvasContext canvasContext = TestCanvas.createTestCanvas(thread);\r
-\r
-        c.setCanvasContext(canvasContext);\r
-\r
-        c.addChassisListener(new IChassisListener() {\r
-            @Override\r
-            public void chassisClosed(ICanvasChassis sender) {\r
-                // Prevent deadlock while disposing which using syncExec would result in. \r
-                ThreadUtils.asyncExec(c.getCanvasContext().getThreadAccess(), new Runnable() {\r
-                    @Override\r
-                    public void run() {\r
-                        ICanvasContext ctx = c.getCanvasContext();\r
-                        c.getAWTComponent().setCanvasContext(null);\r
-                        ctx.dispose();\r
-                    }\r
-                });\r
-            }\r
-        });\r
-    }\r
-\r
-    @Override\r
-    public void setFocus() {\r
-        c.setFocus();\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.example.chassis;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+import org.simantics.g2d.canvas.ICanvasContext;
+import org.simantics.g2d.canvas.impl.CanvasContext;
+import org.simantics.g2d.chassis.ICanvasChassis;
+import org.simantics.g2d.chassis.IChassisListener;
+import org.simantics.g2d.chassis.SWTChassis;
+import org.simantics.g2d.example.TestCanvas;
+import org.simantics.utils.threads.AWTThread;
+import org.simantics.utils.threads.IThreadWorkQueue;
+import org.simantics.utils.threads.ThreadUtils;
+
+public class ViewPartExample extends ViewPart {
+    SWTChassis c;
+
+    @Override
+    public void createPartControl(Composite parent) {
+        c = new SWTChassis(parent, 0);
+        c.syncPopulate();
+
+        IThreadWorkQueue thread = AWTThread.getThreadAccess();
+        CanvasContext canvasContext = TestCanvas.createTestCanvas(thread);
+
+        c.setCanvasContext(canvasContext);
+
+        c.addChassisListener(new IChassisListener() {
+            @Override
+            public void chassisClosed(ICanvasChassis sender) {
+                // Prevent deadlock while disposing which using syncExec would result in. 
+                ThreadUtils.asyncExec(c.getCanvasContext().getThreadAccess(), new Runnable() {
+                    @Override
+                    public void run() {
+                        ICanvasContext ctx = c.getCanvasContext();
+                        c.getAWTComponent().setCanvasContext(null);
+                        ctx.dispose();
+                    }
+                });
+            }
+        });
+    }
+
+    @Override
+    public void setFocus() {
+        c.setFocus();
+    }
+
+}