Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2015-08-31 09:47:42 -0400
committerMarvin Mueller2015-09-04 02:58:59 -0400
commitc82504d9ca78f4c4eaf0de5975d0a3a3f81c146a (patch)
tree2196eb8959373db32310f8e7ed0588337819b019
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
-rw-r--r--org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/tooltipComponents.xml7
-rw-r--r--org.eclipse.jubula.documentation/reference/en/docbook/components/concreteToolkit/tooltipComponent/content.xml8
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/MappingListener.java47
3 files changed, 58 insertions, 4 deletions
diff --git a/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/tooltipComponents.xml b/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/tooltipComponents.xml
index a75827b3d..ef9e64eaf 100644
--- a/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/tooltipComponents.xml
+++ b/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/tooltipComponents.xml
@@ -41,6 +41,13 @@
on <emphasis>JavaFX</emphasis> only.
</para>
</listitem>
+ <listitem>
+ <para>
+ This action cannot be used for RCP JFace tooltips since components in JFace tooltips have to be addressed directly.
+ To map the components of a JFace tooltip simply collect the component when the tooltip is showing.
+ Since the tooltip is mostly hiding after mouse movement this can only be done if the object mapping mode is using a key combination.
+ </para>
+ </listitem>
<listitem>
<para>
If the tooltip does not appear in the given time, a component not found error is thrown.
diff --git a/org.eclipse.jubula.documentation/reference/en/docbook/components/concreteToolkit/tooltipComponent/content.xml b/org.eclipse.jubula.documentation/reference/en/docbook/components/concreteToolkit/tooltipComponent/content.xml
index 66b83332d..ec78805d6 100644
--- a/org.eclipse.jubula.documentation/reference/en/docbook/components/concreteToolkit/tooltipComponent/content.xml
+++ b/org.eclipse.jubula.documentation/reference/en/docbook/components/concreteToolkit/tooltipComponent/content.xml
@@ -16,6 +16,14 @@
The user hovers the pointer over an item, without clicking it, and a tooltip may appear — a small "hover box"
with information about the item being hovered over.
</para>
+
+ <para role="warning">
+ JFace tooltips in the RCP toolkit are handled diffently since the tooltip itself is recognized as a component on its own.
+ To collect the tooltip move the mouse pointer over the component which includes the tooltip and
+ wait for it to show up then perform the Object Mapping.
+ You will recognize that two or more components will be collected: the component including the tooltip and the tooltip itself.
+ Since the tooltip is mostly hiding after mouse movement this can only be done if the object mapping mode is using a key combination.
+ </para>
<para><emphasis role="strong">Available Actions</emphasis></para>
<itemizedlist>
<listitem>
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