Bug 383882 - Eclipse 4.x adaptation (OverlayWindow)
diff --git a/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/HighlightComposite.java b/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/HighlightComposite.java
index 1a13455..319d336 100644
--- a/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/HighlightComposite.java
+++ b/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/HighlightComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and Others
+ * Copyright (c) 2007, 2014 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -77,8 +77,8 @@
}
getOverlayWindow().getComposite().moveAbove(null);
moveAbove(null);
- setBounds(rect.x, rect.y, Math.max(BORDER_WIDTH, rect.width), Math.max(
- BORDER_WIDTH, rect.height));
+ setBounds(rect.x, rect.y, Math.max(BORDER_WIDTH, rect.width),
+ Math.max(BORDER_WIDTH, rect.height));
setVisible(true);
}
@@ -113,18 +113,21 @@
* the position to be highlighted.
*/
public static void flashRectangle(Rectangle rect) {
- if (null != rect && 0 == suppressRefCount) {
- if (OverlayWindow.getVisible()) {
- OverlayWindow window = getOverlayWindow();
- if (null == instance) {
- instance = new HighlightComposite(window.getComposite(),
- SWT.NONE);
+ try {
+ if (null != rect && 0 == suppressRefCount) {
+ if (OverlayWindow.getVisible()) {
+ OverlayWindow window = getOverlayWindow();
+ if (null == instance) {
+ instance = new HighlightComposite(
+ window.getComposite(), SWT.NONE);
+ }
+ instance.show(rect, ""); //$NON-NLS-1$
+ window.run();
+ } else {
+ AccessibleHilighter.flashRectangle(rect);
}
- instance.show(rect, ""); //$NON-NLS-1$
- window.run();
- } else {
- AccessibleHilighter.flashRectangle(rect);
}
+ } catch (Exception e) {
}
}
diff --git a/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/OverlayWindow.java b/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/OverlayWindow.java
index fadcb47..73285f4 100644
--- a/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/OverlayWindow.java
+++ b/plugins/org.eclipse.actf.util.win32/src/org/eclipse/actf/util/win32/OverlayWindow.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and Others
+ * Copyright (c) 2007, 2014 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -97,7 +97,9 @@
*/
public static OverlayWindow getInstance(int index, boolean create) {
if (index < instance.length) {
- if (create && null == instance[index]) {
+ if (create
+ && (null == instance[index] || instance[index]
+ .getComposite().isDisposed())) {
instance[index] = new OverlayWindow(index);
}
return instance[index];
@@ -166,7 +168,8 @@
ws |= OS.WS_EX_TRANSPARENT;
}
OS.SetWindowLong(control.handle, OS.GWL_EXSTYLE, ws);
- WindowUtil.SetLayeredWindowAttributes(control.handle, control
- .getBackground().handle, (char) 0, WindowUtil.LWA_COLORKEY);
+ WindowUtil.SetLayeredWindowAttributes(control.handle,
+ control.getBackground().handle, (char) 0,
+ WindowUtil.LWA_COLORKEY);
}
}