]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Modified fix for focus problems
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 20 May 2010 10:46:02 +0000 (10:46 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 20 May 2010 10:46:02 +0000 (10:46 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@15790 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/DependencyView.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynDiagramEditor.java

index eb347f4188c4f0a3c7e85c1eda7c690046e3590d..4027061f92cde3afa926cf54635edb00c44026ec 100644 (file)
@@ -167,15 +167,10 @@ public class DependencyView extends ViewPart {
 \r
     @Override\r
     public void setFocus() {\r
-        if(component == null || (!component.isDisposed() && !component.forceFocus())) {\r
-            getBaseComposite().getDisplay().asyncExec(new Runnable() {\r
-                @Override\r
-                public void run() {\r
-                    if(!getBaseComposite().isDisposed()) {\r
-                        getBaseComposite().setFocus();    \r
-                    }\r
-                }\r
-            });\r
+        Composite c = getBaseComposite();\r
+        if(c != null && !c.isDisposed()) {\r
+            getBaseComposite().setFocus();\r
+            component.setFocus();\r
         }\r
     }\r
 \r
index ae75799487a4d42740c44f6292ee8cc568ca265b..50575fc5db3cdff45562fb232259592eb93e9209 100644 (file)
@@ -231,7 +231,13 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
                 canvas = new EditorCanvas(editor);\r
                 frame.add(canvas);\r
 \r
-                setFocus();\r
+                getFrameComposite().getDisplay().asyncExec(new Runnable() {  \r
+                    @Override\r
+                    public void run() {\r
+                        setFocus();\r
+                    }\r
+                });\r
+\r
 \r
                 editor.getSelection().addSelectionListener(new ISelectionListener() {\r
 \r
@@ -259,14 +265,11 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
 \r
     @Override\r
     public void setFocus() {     \r
-        if(canvas == null || !canvas.requestFocusInWindow()) {\r
-            getFrameComposite().getDisplay().asyncExec(new Runnable() {\r
-                @Override\r
-                public void run() {\r
-                    if(!getFrameComposite().isDisposed())\r
-                        getFrameComposite().setFocus();                    \r
-                }\r
-            });\r
+        Composite c = getFrameComposite();\r
+        if(c != null && !c.isDisposed()) {\r
+            getFrameComposite().setFocus();\r
+            if(canvas!=null)\r
+                canvas.requestFocus();\r
         }\r
     }\r
 \r