Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2015-08-31 13:47:42 +0000
committerMarvin Mueller2015-09-04 06:58:59 +0000
commitc82504d9ca78f4c4eaf0de5975d0a3a3f81c146a (patch)
tree2196eb8959373db32310f8e7ed0588337819b019 /org.eclipse.jubula.rc.swt
parent954cc685cabbd0de764908a8a32ce616bdf6b534 (diff)
downloadorg.eclipse.jubula.core-c82504d9ca78f4c4eaf0de5975d0a3a3f81c146a.tar.gz
org.eclipse.jubula.core-c82504d9ca78f4c4eaf0de5975d0a3a3f81c146a.tar.xz
org.eclipse.jubula.core-c82504d9ca78f4c4eaf0de5975d0a3a3f81c146a.zip
Sprint task - JUB-1260 add support for jface tooltipsv8.1.8.021
Diffstat (limited to 'org.eclipse.jubula.rc.swt')
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/MappingListener.java47
1 files changed, 43 insertions, 4 deletions
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/MappingListener.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/MappingListener.java
index 46901e43a..e4aee8bb7 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/MappingListener.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/MappingListener.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.jubula.rc.swt.listener;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import org.eclipse.jubula.communication.internal.message.ObjectMappedMessage;
@@ -22,8 +24,10 @@ import org.eclipse.jubula.tools.internal.exception.CommunicationException;
import org.eclipse.jubula.tools.internal.objects.IComponentIdentifier;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -110,19 +114,35 @@ public class MappingListener extends AbstractAutSwtEventListener {
if (currComp != null
&& getAcceptor().accept(event) == KeyAcceptor.MAPPING_KEY_COMB) {
try {
- IComponentIdentifier id = ComponentHandler.getIdentifier(
+ Shell toolshell = getTooltipShell();
+ List<IComponentIdentifier> list =
+ new ArrayList<IComponentIdentifier>();
+ if (toolshell != null) {
+ for (Control control : toolshell.getChildren()) {
+ try {
+ list.add(ComponentHandler.getIdentifier(control));
+ } catch (Exception e) {
+ // does not really interest in this point
+ LOG.info("no identifier for: " + control); //$NON-NLS-1$
+ }
+ }
+ }
+
+ IComponentIdentifier id = ComponentHandler.getIdentifier(
currComp);
+ list.add(id);
Map componentProperties = PropertyUtil
.getMapOfComponentProperties(currComp);
- id.setComponentPropertiesMap(componentProperties);
if (LOG.isInfoEnabled()) {
LOG.info("send a message with identifier " //$NON-NLS-1$
+ "for the component '" + id //$NON-NLS-1$
+ "'"); //$NON-NLS-1$
}
+ id.setComponentPropertiesMap(componentProperties);
// send a message with the identifier of the selected component
- ObjectMappedMessage message = new ObjectMappedMessage();
- message.setComponentIdentifier(id);
+ ObjectMappedMessage message = new ObjectMappedMessage();
+ message.setComponentIdentifiers(
+ list.toArray(new IComponentIdentifier[list.size()]));
AUTServer.getInstance().getCommunicator().send(message);
} catch (NoIdentifierForComponentException nifce) {
@@ -134,5 +154,24 @@ public class MappingListener extends AbstractAutSwtEventListener {
// is handled by the AUTServer
}
}
+ }
+
+ /**
+ * This is getting the Tooltip {@link Shell} if it exists. This is not
+ * defintive the Tooltip Shell. We are only looking for a Shell with a
+ * specific Style. It might be that there is also another Shell with these
+ * Styles.
+ *
+ * @return probably the tooltip shell
+ */
+ private Shell getTooltipShell() {
+ Shell toolshell = null;
+ for (Shell shell : Display.getCurrent().getShells()) {
+ if ((shell.getStyle() & (SWT.ON_TOP | SWT.TOOL | SWT.NO_FOCUS))
+ == (SWT.ON_TOP | SWT.TOOL | SWT.NO_FOCUS)) {
+ toolshell = shell;
+ }
+ }
+ return toolshell;
}
} \ No newline at end of file

Back to the top