javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java
equal
deleted
inserted
replaced
62 } |
62 } |
63 int size = fCommands.length + 1; |
63 int size = fCommands.length + 1; |
64 Command[] newList = new Command[size]; |
64 Command[] newList = new Command[size]; |
65 // find the insertion point so that the order is correct |
65 // find the insertion point so that the order is correct |
66 int insertPoint = 0; |
66 int insertPoint = 0; |
67 Display display = Display.getCurrent(); |
|
68 Shell activeShell = display.getActiveShell(); |
67 Shell activeShell = display.getActiveShell(); |
69 Control ctrl = display.getFocusControl(); |
68 Control ctrl = display.getFocusControl(); |
70 while (ctrl != null && ctrl != activeShell) { |
69 while (ctrl != null && ctrl != activeShell) { |
71 if (ctrl == command.control) { |
70 if (ctrl == command.control) { |
72 // Adding a command to focused control increment by one. |
71 // Adding a command to focused control increment by one. |
168 }// CommandCollection |
167 }// CommandCollection |
169 |
168 |
170 private CommandCollection currentCommands; |
169 private CommandCollection currentCommands; |
171 private CommandPresentationStrategy strategy; |
170 private CommandPresentationStrategy strategy; |
172 private Command defaultCommand; |
171 private Command defaultCommand; |
173 |
172 private Display display; |
174 public CommandArranger(){ |
173 |
|
174 public CommandArranger(Display display){ |
175 super(); |
175 super(); |
|
176 this.display = display; |
176 currentCommands = new CommandCollection(); |
177 currentCommands = new CommandCollection(); |
177 strategy = CommandPresentationStrategyWrapper.createStrategy(); |
178 strategy = CommandPresentationStrategyWrapper.createStrategy(); |
178 } |
179 } |
179 |
180 |
180 |
181 |
204 * Called when a new Control gains focus. |
205 * Called when a new Control gains focus. |
205 * |
206 * |
206 * @see Control#qt_swt_event_focusWasGained() |
207 * @see Control#qt_swt_event_focusWasGained() |
207 */ |
208 */ |
208 public void focusedControlChanged(){ |
209 public void focusedControlChanged(){ |
209 Display display = Display.getCurrent(); |
|
210 Control focusControl = display.getFocusControl(); |
210 Control focusControl = display.getFocusControl(); |
211 if (focusControl == focusedControl) { |
211 if (focusControl == focusedControl) { |
212 return; |
212 return; |
213 } |
213 } |
214 focusedControl = focusControl; |
214 focusedControl = focusControl; |
261 */ |
261 */ |
262 public void dispose(){ |
262 public void dispose(){ |
263 strategy.dispose(); |
263 strategy.dispose(); |
264 strategy = null; |
264 strategy = null; |
265 currentCommands = null; |
265 currentCommands = null; |
|
266 display = null; |
266 } |
267 } |
267 /** |
268 /** |
268 * Called when a Command is set default |
269 * Called when a Command is set default |
269 * |
270 * |
270 * @param command |
271 * @param command |