[jbosstools-commits] JBoss Tools SVN: r42877 - branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Aug 7 07:29:48 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-08-07 07:29:48 -0400 (Tue, 07 Aug 2012)
New Revision: 42877

Modified:
   branches/jbosstools-3.3.x/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: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerToolTip.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerToolTip.java	2012-08-07 10:43:18 UTC (rev 42876)
+++ branches/jbosstools-3.3.x/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)
@@ -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();



More information about the jbosstools-commits mailing list