Author: rob.stryker(a)jboss.com
Date: 2012-08-07 07:30:18 -0400 (Tue, 07 Aug 2012)
New Revision: 42878
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerToolTip.java
Log:
JBIDE-11858 respond to shell closing
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerToolTip.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerToolTip.java 2012-08-07
11:29:48 UTC (rev 42877)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerToolTip.java 2012-08-07
11:30:18 UTC (rev 42878)
@@ -26,6 +26,8 @@
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
@@ -71,41 +73,41 @@
public void keyPressed(KeyEvent e) {
if (e == null)
return;
- if( handleEscape )
- handleEscape(e);
- if( handlef6)
- handlef6(e);
+ if( handleEscape && e.keyCode == SWT.ESC)
+ handleEscape();
+ if( handlef6 && e.keyCode == SWT.F6)
+ handlef6();
}
- protected void handleEscape(KeyEvent e) {
- if (e.keyCode == SWT.ESC) {
- if (FOCUSSED_TOOLTIP != null) {
- FOCUSSED_TOOLTIP.dispose();
- FOCUSSED_TOOLTIP = null;
- tooltipSelection = null;
- }
- activate();
- }
+ public void keyReleased(KeyEvent e) {
}
- protected void handlef6(KeyEvent e) {
- if (e.keyCode == SWT.F6) {
- // We have no focussed window, and we DO have a selection to show in focus
- if (FOCUSSED_TOOLTIP == null && tooltipSelection != null) {
- deactivate();
- hide();
- createFocusedTooltip(tree);
- }
- }
+ };
+ protected void handleEscape() {
+ if (FOCUSSED_TOOLTIP != null) {
+ FOCUSSED_TOOLTIP.dispose();
+ FOCUSSED_TOOLTIP = null;
+ tooltipSelection = null;
}
- public void keyReleased(KeyEvent e) {
+ activate();
+ }
+ protected void handlef6() {
+ // We have no focussed window, and we DO have a selection to show in focus
+ if (FOCUSSED_TOOLTIP == null && tooltipSelection != null) {
+ deactivate();
+ hide();
+ createFocusedTooltip(tree);
}
- };
+ }
public void createFocusedTooltip(final Control control) {
final Shell stickyTooltip = new Shell(control.getShell(), SWT.ON_TOP | SWT.TOOL
| SWT.NO_FOCUS);
stickyTooltip.setLayout(new FillLayout());
stickyTooltip.setBackground(stickyTooltip.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- stickyTooltip.addKeyListener(new CustomKeyListener(true, false));
+ stickyTooltip.addShellListener(new ShellAdapter() {
+ public void shellClosed(ShellEvent e) {
+ handleEscape();
+ }
+ });
control.getDisplay().asyncExec(new Runnable() {
public void run() {
Event event = new Event();
Show replies by date