javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java
changeset 35 85266cc22c7f
parent 21 2a9601315dfc
child 47 f40128debb5d
child 78 71ad690e91f5
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java	Thu May 27 12:49:31 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java	Fri Jun 11 13:33:44 2010 +0300
@@ -64,7 +64,6 @@
             Command[] newList = new Command[size];
             // find the insertion point so that the order is correct
             int insertPoint = 0;
-            Display display = Display.getCurrent();
             Shell activeShell = display.getActiveShell();
             Control ctrl = display.getFocusControl();
             while (ctrl != null && ctrl != activeShell) {
@@ -170,9 +169,11 @@
     private CommandCollection currentCommands;
     private CommandPresentationStrategy strategy;
     private Command defaultCommand;
+    private Display display;
 
-    public CommandArranger(){
+    public CommandArranger(Display display){
         super();
+        this.display = display;
         currentCommands = new CommandCollection();
         strategy = CommandPresentationStrategyWrapper.createStrategy();
     }
@@ -206,7 +207,6 @@
      * @see Control#qt_swt_event_focusWasGained()
      */
     public void focusedControlChanged(){
-        Display display = Display.getCurrent();
         Control focusControl = display.getFocusControl();
         if (focusControl == focusedControl) {
             return;
@@ -263,6 +263,7 @@
         strategy.dispose();
         strategy = null;
         currentCommands = null;
+        display = null;
     }
     /**
      * Called when a Command is set default