summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBernd Hufmann2013-03-01 14:47:41 (EST)
committer Bernd Hufmann2013-03-01 15:37:46 (EST)
commitf3ad4663d59cef6627db40f3c640d05fe90c321d (patch)
treedc033850168a018004783c4456c7806280ca9cea
parent0ed615da4c9c371507d869d2576ca3fca7f49fd1 (diff)
downloadorg.eclipse.linuxtools-f3ad4663d59cef6627db40f3c640d05fe90c321d.zip
org.eclipse.linuxtools-f3ad4663d59cef6627db40f3c640d05fe90c321d.tar.gz
org.eclipse.linuxtools-f3ad4663d59cef6627db40f3c640d05fe90c321d.tar.bz2
Improved error handling for connection errors in LTTng control refs/changes/84/10784/2
Change-Id: I4c91fd06433a38a30903b82e762284de36486a26 Signed-off-by: Bernd Hufmann <bhufmann@gmail.com> Reviewed-on: https://git.eclipse.org/r/10784 Tested-by: Hudson CI Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java25
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java7
4 files changed, 33 insertions, 5 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
index cad9d6b..92748f2 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
@@ -43,7 +43,9 @@ final public class Messages extends NLS {
public static String TraceControl_GettingVersionError;
// Commands
+ public static String TraceControl_ErrorTitle;
public static String TraceControl_RetrieveNodeConfigurationJob;
+ public static String TraceControl_RetrieveNodeConfigurationFailure;
public static String TraceControl_ListSessionFailure;
public static String TraceControl_EclipseCommandFailure;
public static String TraceControl_NewNodeCreationFailure;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
index edd565a..52db14d 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
@@ -22,12 +22,14 @@ TraceControl_UnexpectedCommandOutputFormat=Unexpected command output
TraceControl_UnexpectedNameError=Unexpected session name returned
TraceControl_UnexpectedPathError=Unexpected session path returned
-TraceControl_UnsupportedVersionError="Unsupported LTTng Tracer Control version
+TraceControl_UnsupportedVersionError=Unsupported LTTng Tracer Control version
TraceControl_GettingVersionError=Could not get version of LTTng Tracer Control
# Commands
+TraceControl_ErrorTitle=Error
TraceControl_ListSessionFailure=List sessions failed
TraceControl_RetrieveNodeConfigurationJob=Retrieving Target Node Configuration...
+TraceControl_RetrieveNodeConfigurationFailure=Error retrieving node configuration
TraceControl_EclipseCommandFailure=Command failed
TraceControl_NewNodeCreationFailure=Creation of new connection failed
TraceControl_CreateSessionJob=Creating Session...
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
index 48a0e34..2546d7c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
@@ -36,6 +37,8 @@ import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.properties.IPropertySource;
/**
@@ -331,7 +334,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
sessionGroup.getSessionsFromNode(monitor);
} catch (ExecutionException e) {
removeAllChildren();
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_RetrieveNodeConfigurationFailure, e);
}
return Status.OK_STATUS;
@@ -381,8 +384,24 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
try {
createControlService();
getConfigurationFromNode();
- } catch (ExecutionException e) {
- Activator.getDefault().logError(Messages.TraceControl_ListSessionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (final ExecutionException e) {
+ // Disconnect only if no control service, otherwise stay connected.
+ if (getControlService() == null) {
+ disconnect();
+ }
+
+ // Notify user
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ ErrorDialog er = new ErrorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ Messages.TraceControl_ErrorTitle, Messages.TraceControl_RetrieveNodeConfigurationFailure,
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e),
+ IStatus.ERROR);
+ er.open();
+ }
+ });
+ Activator.getDefault().logError(Messages.TraceControl_RetrieveNodeConfigurationFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java
index 130d89e..77d1d85 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java
@@ -79,8 +79,13 @@ public class LTTngControlServiceFactory {
if (ControlPreferences.getInstance().isLoggingEnabled()) {
ControlCommandLogger.log(command);
}
+ ICommandResult result = null;
- ICommandResult result = shell.executeCommand(command, new NullProgressMonitor());
+ try {
+ result = shell.executeCommand(command, new NullProgressMonitor());
+ } catch (ExecutionException e) {
+ throw new ExecutionException(Messages.TraceControl_GettingVersionError + ": " + e); //$NON-NLS-1$
+ }
if (ControlPreferences.getInstance().isLoggingEnabled()) {
ControlCommandLogger.log(LTTngControlService.formatOutput(result));