Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Struckmann2015-09-23 03:27:43 -0400
committerMarvin Mueller2015-09-23 05:40:18 -0400
commitee8a600de4592d59b5ca905189a3c6ef595ca7f2 (patch)
tree672c5bdf128dd290eaa44f5e7ea0d4de5698f09c
parent71aafae928ef39196298ce7415cef8b389ddacdd (diff)
downloadorg.eclipse.jubula.core-ee8a600de4592d59b5ca905189a3c6ef595ca7f2.tar.gz
org.eclipse.jubula.core-ee8a600de4592d59b5ca905189a3c6ef595ca7f2.tar.xz
org.eclipse.jubula.core-ee8a600de4592d59b5ca905189a3c6ef595ca7f2.zip
Sprint task - Fix occurring error while clicking GEF inspector button
-rw-r--r--org.eclipse.jubula.client.inspector.ui/src/org/eclipse/jubula/client/inspector/ui/handlers/ActivateInspectorHandler.java37
1 files changed, 33 insertions, 4 deletions
diff --git a/org.eclipse.jubula.client.inspector.ui/src/org/eclipse/jubula/client/inspector/ui/handlers/ActivateInspectorHandler.java b/org.eclipse.jubula.client.inspector.ui/src/org/eclipse/jubula/client/inspector/ui/handlers/ActivateInspectorHandler.java
index fcf838687..734c71578 100644
--- a/org.eclipse.jubula.client.inspector.ui/src/org/eclipse/jubula/client/inspector/ui/handlers/ActivateInspectorHandler.java
+++ b/org.eclipse.jubula.client.inspector.ui/src/org/eclipse/jubula/client/inspector/ui/handlers/ActivateInspectorHandler.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.jubula.client.inspector.ui.handlers;
+import java.util.List;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
@@ -21,6 +23,7 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jubula.client.core.communication.AUTConnection;
import org.eclipse.jubula.client.inspector.ui.commands.ActivateInspectorResponseCommand;
import org.eclipse.jubula.client.inspector.ui.i18n.Messages;
+import org.eclipse.jubula.client.inspector.ui.provider.sourceprovider.InspectableAutSourceProvider;
import org.eclipse.jubula.client.internal.BaseConnection.NotConnectedException;
import org.eclipse.jubula.client.internal.exceptions.ConnectionException;
import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil;
@@ -43,17 +46,43 @@ public class ActivateInspectorHandler extends AbstractHandler {
public static final String AUT_ID =
"org.eclipse.jubula.client.inspector.ui.commands.parameter.activateInspector.autId"; //$NON-NLS-1$
+ /** last inspected AUT */
+ private static AutIdentifier lastAut = null;
+
/**
- *
* {@inheritDoc}
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final AutIdentifier autId =
- (AutIdentifier)event.getObjectParameterForExecution(AUT_ID);
+ public Object execute(final ExecutionEvent event) {
final String jobName = Messages.UIJobActivateInspector;
Job activateInspectorJob = new Job(jobName) {
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(jobName, IProgressMonitor.UNKNOWN);
+ AutIdentifier autId = null;
+ try {
+ autId = (AutIdentifier)event
+ .getObjectParameterForExecution(AUT_ID);
+ lastAut = autId;
+ } catch (ExecutionException e) {
+ InspectableAutSourceProvider iasp =
+ new InspectableAutSourceProvider();
+ Object inspectableAUTs = iasp.getCurrentState().get(
+ InspectableAutSourceProvider.INSPECTABLE_AUTS);
+ if (inspectableAUTs != null
+ && inspectableAUTs instanceof List) {
+ List auts = (List)inspectableAUTs;
+ if (auts.size() == 1) {
+ Object object = auts.get(0);
+ autId = object instanceof AutIdentifier
+ ? (AutIdentifier)object : null;
+ lastAut = autId;
+ } else if (lastAut != null && auts.contains(lastAut)) {
+ autId = lastAut;
+ }
+ }
+ }
+ if (autId == null) {
+ return Status.CANCEL_STATUS;
+ }
ActivateInspectorMessage message =
new ActivateInspectorMessage();
try {

Back to the top