|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2005, 2008 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2010 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 120-125
Link Here
|
| 120 |
|
120 |
|
| 121 |
private ControlAdapter resizeListener; |
121 |
private ControlAdapter resizeListener; |
| 122 |
|
122 |
|
|
|
123 |
private ToolItem fHelpButton; |
| 124 |
|
| 123 |
/** |
125 |
/** |
| 124 |
* Creates a tray dialog instance. Note that the window will have no visual |
126 |
* Creates a tray dialog instance. Note that the window will have no visual |
| 125 |
* representation (no widgets) until it is told to open. |
127 |
* representation (no widgets) until it is told to open. |
|
Lines 163-168
Link Here
|
| 163 |
sash = null; |
165 |
sash = null; |
| 164 |
Rectangle bounds = shell.getBounds(); |
166 |
Rectangle bounds = shell.getBounds(); |
| 165 |
shell.setBounds(bounds.x + ((getDefaultOrientation() == SWT.RIGHT_TO_LEFT) ? trayWidth : 0), bounds.y, bounds.width - trayWidth, bounds.height); |
167 |
shell.setBounds(bounds.x + ((getDefaultOrientation() == SWT.RIGHT_TO_LEFT) ? trayWidth : 0), bounds.y, bounds.width - trayWidth, bounds.height); |
|
|
168 |
if (fHelpButton != null) { |
| 169 |
fHelpButton.setSelection(false); |
| 170 |
} |
| 166 |
} |
171 |
} |
| 167 |
|
172 |
|
| 168 |
/* (non-Javadoc) |
173 |
/* (non-Javadoc) |
|
Lines 238-247
Link Here
|
| 238 |
cursor.dispose(); |
243 |
cursor.dispose(); |
| 239 |
} |
244 |
} |
| 240 |
}); |
245 |
}); |
| 241 |
ToolItem item = new ToolItem(toolBar, SWT.NONE); |
246 |
fHelpButton = new ToolItem(toolBar, SWT.CHECK); |
| 242 |
item.setImage(image); |
247 |
fHelpButton.setImage(image); |
| 243 |
item.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ |
248 |
fHelpButton.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ |
| 244 |
item.addSelectionListener(new SelectionAdapter() { |
249 |
fHelpButton.addSelectionListener(new SelectionAdapter() { |
| 245 |
public void widgetSelected(SelectionEvent e) { |
250 |
public void widgetSelected(SelectionEvent e) { |
| 246 |
helpPressed(); |
251 |
helpPressed(); |
| 247 |
} |
252 |
} |
|
Lines 328-348
Link Here
|
| 328 |
* then invokes a help event on that widget. |
333 |
* then invokes a help event on that widget. |
| 329 |
*/ |
334 |
*/ |
| 330 |
private void helpPressed() { |
335 |
private void helpPressed() { |
| 331 |
if (getShell() != null) { |
336 |
if (getTray() == null) { |
| 332 |
Control c = getShell().getDisplay().getFocusControl(); |
337 |
if (getShell() != null) { |
| 333 |
while (c != null) { |
338 |
Control c = getShell().getDisplay().getFocusControl(); |
| 334 |
if (c.isListening(SWT.Help)) { |
339 |
while (c != null) { |
| 335 |
c.notifyListeners(SWT.Help, new Event()); |
340 |
if (c.isListening(SWT.Help)) { |
| 336 |
break; |
341 |
c.notifyListeners(SWT.Help, new Event()); |
| 337 |
} |
342 |
break; |
| 338 |
c = c.getParent(); |
343 |
} |
| 339 |
} |
344 |
c = c.getParent(); |
| 340 |
} |
345 |
} |
|
|
346 |
} |
| 347 |
|
| 348 |
} else { |
| 349 |
closeTray(); |
| 350 |
} |
| 341 |
} |
351 |
} |
| 342 |
|
352 |
|
| 343 |
/** |
353 |
/** |
| 344 |
* Constructs the tray's widgets and displays the tray in this dialog. The |
354 |
* Constructs the tray's widgets and displays the tray in this dialog. The |
| 345 |
* dialog's size will be adjusted to accomodate the tray. |
355 |
* dialog's size will be adjusted to accommodate the tray. |
| 346 |
* |
356 |
* |
| 347 |
* @param tray the tray to show in this dialog |
357 |
* @param tray the tray to show in this dialog |
| 348 |
* @throws IllegalStateException if the dialog already has a tray open |
358 |
* @throws IllegalStateException if the dialog already has a tray open |
|
Lines 392-397
Link Here
|
| 392 |
shell.addControlListener (resizeListener); |
402 |
shell.addControlListener (resizeListener); |
| 393 |
|
403 |
|
| 394 |
this.tray = tray; |
404 |
this.tray = tray; |
|
|
405 |
if (fHelpButton != null) { |
| 406 |
fHelpButton.setSelection(true); |
| 407 |
} |
| 395 |
} |
408 |
} |
| 396 |
|
409 |
|
| 397 |
/** |
410 |
/** |