\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
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
\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