Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/META-INF/MANIFEST.MF10
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java13
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java23
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java27
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlPropertiesTest.java26
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlSnapshotSessionTests.java17
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTestFacility.java18
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelNoProvidersTest.java29
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java28
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java29
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java29
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests2.java22
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java57
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/LTTngToolsFileShell.java3
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/TestCommandShell.java8
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/META-INF/MANIFEST.MF17
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.properties3
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.xml14
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/ControlView.java67
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/Workaround_Bug449362.java60
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java32
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/INewConnectionDialog.java38
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java102
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java11
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java484
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/DeleteHandler.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java66
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java97
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/Messages.java7
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/messages.properties7
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/NullControlService.java143
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java223
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceSessionComponent.java23
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TargetNodePropertySource.java7
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/CommandShell.java377
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/ICommandShell.java22
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/IRemoteSystemProxy.java72
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/InputReader.java61
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/RemoteSystemProxy.java171
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/service/LTTngControlService.java4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control/feature.xml2
-rw-r--r--lttng/org.eclipse.linuxtools.tracing.rcp.product/tracing.product9
-rw-r--r--lttng/org.eclipse.linuxtools.tracing.rcp/feature.xml7
-rw-r--r--lttng/org.eclipse.linuxtools.tracing.rcp/pom.xml1
44 files changed, 1303 insertions, 1164 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/META-INF/MANIFEST.MF
index c631f71d81..ec4df1bc5e 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/META-INF/MANIFEST.MF
@@ -13,14 +13,8 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.linuxtools.lttng2.control.core;bundle-version="3.1.0",
- org.eclipse.linuxtools.lttng2.control.ui;bundle-version="3.1.0"
-Import-Package: org.eclipse.rse.core,
- org.eclipse.rse.core.model,
- org.eclipse.rse.core.subsystems,
- org.eclipse.rse.services.shells,
- org.eclipse.rse.services.terminals,
- org.eclipse.rse.subsystems.files.core,
- org.eclipse.rse.subsystems.files.core.servicesubsystem
+ org.eclipse.linuxtools.lttng2.control.ui;bundle-version="3.1.0",
+ org.eclipse.remote.core
Export-Package: org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs;x-internal:=true,
org.eclipse.linuxtools.internal.lttng2.control.stubs.service;x-internal:=true,
org.eclipse.linuxtools.internal.lttng2.control.stubs.shells;x-internal:=true,
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java
index 50611ca5a2..1b9e0e184a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java
@@ -9,6 +9,7 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Jonathan Rajotte - Support for LTTng 2.6
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
@@ -32,10 +33,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceContr
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.ILttngControlService;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -116,9 +116,8 @@ public class TraceControlCreateSessionTests {
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java
index 2a77d8c477..720e840d85 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -9,6 +9,7 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Alexandre Montplaisir - Port to JUnit4
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
@@ -22,16 +23,16 @@ import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.BaseEventComponent;
@@ -41,10 +42,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceC
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceProviderGroup;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -114,9 +114,8 @@ public class TraceControlKernelProviderTests {
ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java
index 3ae9a82730..23824dcdd9 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java
@@ -9,6 +9,7 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Alexandre Montplaisir - Port to JUnit4
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
@@ -26,13 +27,6 @@ import java.util.List;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.AddContextDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableEventsDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
@@ -40,6 +34,13 @@ import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.AddContextDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableEventsDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
@@ -47,10 +48,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceC
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceProbeEventComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -120,9 +120,8 @@ public class TraceControlKernelSessionTests {
ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlPropertiesTest.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlPropertiesTest.java
index 12e41ce3be..1526024d55 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlPropertiesTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlPropertiesTest.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -9,18 +9,22 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Alexandre Montplaisir - Port to JUnit4
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
@@ -28,6 +32,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BufferType;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.BaseEventComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.KernelProviderComponent;
@@ -47,10 +52,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.property.TraceEve
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.property.TraceProbeEventPropertySource;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.property.TraceSessionPropertySource;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.property.UstProviderPropertySource;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.eclipse.ui.views.properties.IPropertySource;
import org.junit.After;
import org.junit.Test;
@@ -100,15 +104,15 @@ public class TraceControlPropertiesTest {
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, proxy);
root.addChild(node);
node.connect();
+ TraceControlTestFacility.getInstance().waitForConnect(node);
TraceControlTestFacility.getInstance().waitForJobs();
// ------------------------------------------------------------------------
@@ -125,7 +129,7 @@ public class TraceControlPropertiesTest {
assertNotNull(source.getPropertyDescriptors());
assertEquals("myNode", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
- assertEquals("LOCALHOST", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
+ assertEquals("localhost", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
assertEquals(TargetNodeState.CONNECTED.name(), source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_STATE_PROPERTY_ID));
assertEquals("2.1.0", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_VERSION_PROPERTY_ID));
assertNull(source.getPropertyValue("test"));
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlSnapshotSessionTests.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlSnapshotSessionTests.java
index 569de1d086..df0ea9c4cf 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlSnapshotSessionTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlSnapshotSessionTests.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
@@ -23,21 +24,20 @@ import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
-import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
-import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.property.TraceSessionPropertySource;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.junit.After;
@@ -109,9 +109,8 @@ public class TraceControlSnapshotSessionTests {
ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTestFacility.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTestFacility.java
index b7af65fb23..63a1fa3ec1 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTestFacility.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTestFacility.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Ericsson
+ * Copyright (c) 2011, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -17,14 +17,17 @@ import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.ControlView;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerService;
+import org.junit.Assert;
/**
* Singleton class to facilitate the test cases. Creates UML2SD view and loader objects as well as provides
@@ -148,6 +151,19 @@ public class TraceControlTestFacility {
}
/**
+ * Waits for a connection to be connected
+ */
+ public void waitForConnect(TargetNodeComponent node) {
+ for (int i = 1; i < 5000 && node.getTargetNodeState() == TargetNodeState.CONNECTING; i *= 2) {
+ try {
+ Thread.sleep(i);
+ } catch (InterruptedException e) {
+ Assert.fail();
+ }
+ }
+ }
+
+ /**
* Waits for all Eclipse jobs to finish
*/
public void waitForJobs() {
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelNoProvidersTest.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelNoProvidersTest.java
index 76397a0950..5bcf4a0812 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelNoProvidersTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelNoProvidersTest.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -9,6 +9,7 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Alexandre Montplaisir - Port to JUnit4
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
@@ -24,8 +25,8 @@ import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceProviderGroup;
@@ -33,10 +34,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceS
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.UstProviderComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.ILttngControlService;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.LTTngControlService;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.eclipse.swt.graphics.Image;
import org.junit.After;
import org.junit.Before;
@@ -93,34 +93,31 @@ public class TraceControlTreeModelNoProvidersTest {
/**
* Run the TraceControlComponent.
- *
- * @throws Exception
- * This will fail the test
*/
@Test
- public void testTraceControlComponents() throws Exception {
+ public void testTraceControlComponents() {
fProxy.setTestFile(fTestFile);
fProxy.setScenario(SCEN_LIST_INFO_TEST);
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent(TARGET_NODE_NAME, root, host, fProxy);
root.addChild(node);
node.connect();
+ TraceControlTestFacility.getInstance().waitForConnect(node);
TraceControlTestFacility.getInstance().waitForJobs();
// ------------------------------------------------------------------------
// Verify Parameters of TargetNodeComponent
// ------------------------------------------------------------------------
- assertEquals("LOCALHOST", node.getHostName()); // assigned in createLocalHost() above
- assertEquals("LOCALHOST", node.getToolTip()); // assigned in createLocalHost() above
+ assertEquals("localhost", node.getRemoteConnection().getAddress()); // assigned in createLocalHost() above
+ assertEquals("Local", node.getToolTip()); // assigned in createLocalHost() above
Image connectedImage = node.getImage();
assertNotNull(connectedImage);
assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
@@ -130,8 +127,6 @@ public class TraceControlTreeModelNoProvidersTest {
node.setControlService(service);
assertTrue(node.getControlService() instanceof LTTngControlService);
- assertTrue(node.isPassiveCommunicationsListener());
-
// ------------------------------------------------------------------------
// Verify Children of TargetNodeComponent
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java
index e932107845..06715b184e 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -9,6 +9,7 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Alexandre Montplaisir - Port to JUnit4
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
@@ -25,7 +26,6 @@ import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
@@ -33,6 +33,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.BaseEventComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.KernelProviderComponent;
@@ -47,10 +48,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceS
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.UstProviderComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.ILttngControlService;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.LTTngControlService;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.eclipse.swt.graphics.Image;
import org.junit.After;
import org.junit.Before;
@@ -106,34 +106,31 @@ public class TraceControlTreeModelTest {
/**
* Run the TraceControlComponent.
- *
- * @throws Exception
- * This will fail the test
*/
@Test
- public void testTraceControlComponents() throws Exception {
+ public void testTraceControlComponents() {
fProxy.setTestFile(fTestFile);
fProxy.setScenario(SCEN_LIST_INFO_TEST);
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent(TARGET_NODE_NAME, root, host, fProxy);
root.addChild(node);
node.connect();
+ TraceControlTestFacility.getInstance().waitForConnect(node);
TraceControlTestFacility.getInstance().waitForJobs();
// ------------------------------------------------------------------------
// Verify Parameters of TargetNodeComponent
// ------------------------------------------------------------------------
- assertEquals("LOCALHOST", node.getHostName()); // assigned in createLocalHost() above
- assertEquals("LOCALHOST", node.getToolTip()); // assigned in createLocalHost() above
+ assertEquals("localhost", node.getRemoteConnection().getAddress()); // assigned in createLocalHost() above
+ assertEquals("Local", node.getToolTip()); // assigned in createLocalHost() above
Image connectedImage = node.getImage();
assertNotNull(connectedImage);
assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
@@ -143,7 +140,6 @@ public class TraceControlTreeModelTest {
node.setControlService(service);
assertTrue(node.getControlService() instanceof LTTngControlService);
- assertTrue(node.isPassiveCommunicationsListener());
// ------------------------------------------------------------------------
// Verify Children of TargetNodeComponent
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java
index 8d7b0666e9..b5614276a3 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -9,28 +9,31 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Alexandre Montplaisir - Port to JUnit4
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.BaseEventComponent;
@@ -40,10 +43,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceC
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.UstProviderComponent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -113,9 +115,8 @@ public class TraceControlUstProviderTests {
ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
root.addChild(node);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java
index 5fa6c7e54a..7a85486775 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java
@@ -9,11 +9,14 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Alexandre Montplaisir - Port to JUnit4
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URL;
@@ -22,12 +25,6 @@ import java.util.List;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableEventsDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
@@ -37,6 +34,12 @@ import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BufferType;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableEventsDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
@@ -44,10 +47,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceC
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -117,9 +119,8 @@ public class TraceControlUstSessionTests {
ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests2.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests2.java
index 6f13022303..3b75e2c0b1 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests2.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests2.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,6 +8,7 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component;
@@ -21,24 +22,23 @@ import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BufferType;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ChannelInfo;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
-import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
-import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BufferType;
-import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ChannelInfo;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceChannelComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionManager;
+import org.eclipse.remote.core.RemoteServices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -110,10 +110,8 @@ public class TraceControlUstSessionTests2 {
ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = registry.createSystemProfile("myProfile", true);
- IHost host = registry.createLocalHost(profile, "myProfile", "user");
-
+ IRemoteConnectionManager cm = RemoteServices.getLocalServices().getConnectionManager();
+ IRemoteConnection host = cm.getConnection(IRemoteConnectionManager.LOCAL_CONNECTION_NAME);
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
root.addChild(node);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java
index 19de1fcd39..b5ec6516ea 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,20 +8,18 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.stubs.service;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.internal.lttng2.control.stubs.shells.LTTngToolsFileShell;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.ICommandShell;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.IRemoteSystemProxy;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.subsystems.ICommunicationsListener;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.shells.IShellService;
-import org.eclipse.rse.services.terminals.ITerminalService;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.remote.core.IRemoteConnectionChangeListener;
+import org.eclipse.remote.core.IRemoteFileManager;
+import org.eclipse.remote.core.IRemoteProcessBuilder;
@SuppressWarnings("javadoc")
public class TestRemoteSystemProxy implements IRemoteSystemProxy {
@@ -31,40 +29,26 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
private String fScenario = null;
@Override
- public IShellService getShellService() {
+ public IRemoteProcessBuilder getProcessBuilder(String... command) {
return null;
}
@Override
- public ITerminalService getTerminalService() {
+ public IRemoteFileManager getFileServiceSubSystem() {
return null;
}
@Override
- public ISubSystem getShellServiceSubSystem() {
- return null;
- }
-
- @Override
- public ISubSystem getTerminalServiceSubSystem() {
- return null;
- }
- @Override
- public IFileServiceSubSystem getFileServiceSubSystem() {
- return null;
+ public void connect(IProgressMonitor monitor) throws ExecutionException {
}
@Override
- public void connect(IRSECallback callback) throws ExecutionException {
-// System.out.println("in done: proxy connect ");
- if (callback != null) {
- callback.done(Status.OK_STATUS, null);
- }
+ public void disconnect() throws ExecutionException {
+ fShell = null;
}
@Override
- public void disconnect() throws ExecutionException {
- fShell = null;
+ public void dispose() {
}
@Override
@@ -84,11 +68,11 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
}
@Override
- public void addCommunicationListener(ICommunicationsListener listener) {
+ public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
}
@Override
- public void removeCommunicationListener(ICommunicationsListener listener) {
+ public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
}
public void setTestFile(String testFile) {
@@ -103,16 +87,7 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
}
@Override
- public int getPort() {
- return IRemoteSystemProxy.INVALID_PORT_NUMBER;
- }
-
- @Override
- public void setPort(int port) {
- }
-
- @Override
- public boolean isLocal() {
- return false;
+ public boolean isConnected() {
+ return true;
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/LTTngToolsFileShell.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/LTTngToolsFileShell.java
index 3f262b6c04..879beefb57 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/LTTngToolsFileShell.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/LTTngToolsFileShell.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.stubs.shells;
@@ -235,7 +236,7 @@ public class LTTngToolsFileShell extends TestCommandShell {
}
@Override
- public synchronized ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
+ public synchronized ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException {
Map<String, ICommandResult> commands = fScenarioMap.get(fScenario);
String fullCommand = command;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/TestCommandShell.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/TestCommandShell.java
index 998e72eb30..bc31d8e841 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/TestCommandShell.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/shells/TestCommandShell.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,6 +8,7 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.stubs.shells;
@@ -37,11 +38,6 @@ public class TestCommandShell implements ICommandShell {
@Override
public ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException {
- return executeCommand(command, monitor, true);
- }
-
- @Override
- public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
if (fIsConnected) {
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.lttng2.control.ui/META-INF/MANIFEST.MF
index d21353be13..d71a7ac813 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/META-INF/MANIFEST.MF
@@ -17,7 +17,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.linuxtools.tmf.core;bundle-version="3.1.0",
org.eclipse.linuxtools.tmf.ui;bundle-version="3.1.0",
org.eclipse.linuxtools.tmf.ctf.core,
- org.eclipse.linuxtools.ctf.core
+ org.eclipse.linuxtools.ctf.core,
+ org.eclipse.remote.core;bundle-version="1.0.0",
+ org.eclipse.remote.ui;bundle-version="1.1.0",
+ org.eclipse.core.filesystem
Export-Package: org.eclipse.linuxtools.internal.lttng2.control.ui;x-friends:="org.eclipse.linuxtools.lttng2.control.ui.tests",
org.eclipse.linuxtools.internal.lttng2.control.ui.relayd;x-internal:=true,
org.eclipse.linuxtools.internal.lttng2.control.ui.views;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.control.ui.tests,org.eclipse.linuxtools.lttng2.kernel.ui.swtbot.tests",
@@ -31,14 +34,4 @@ Export-Package: org.eclipse.linuxtools.internal.lttng2.control.ui;x-friends:="or
org.eclipse.linuxtools.internal.lttng2.control.ui.views.property;x-friends:="org.eclipse.linuxtools.lttng2.control.ui.tests",
org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote;x-friends:="org.eclipse.linuxtools.lttng2.control.ui.tests",
org.eclipse.linuxtools.internal.lttng2.control.ui.views.service;x-friends:="org.eclipse.linuxtools.lttng2.control.ui.tests"
-Import-Package: com.google.common.collect,
- org.eclipse.rse.core,
- org.eclipse.rse.core.model,
- org.eclipse.rse.core.subsystems,
- org.eclipse.rse.services,
- org.eclipse.rse.services.clientserver.messages,
- org.eclipse.rse.services.files,
- org.eclipse.rse.services.shells,
- org.eclipse.rse.services.terminals,
- org.eclipse.rse.subsystems.files.core.servicesubsystem,
- org.eclipse.rse.subsystems.files.core.subsystems
+Import-Package: com.google.common.collect
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.properties b/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.properties
index 81a564ee79..e6e6b245b1 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.properties
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.properties
@@ -62,9 +62,6 @@ commands.experiment.delete = Delete Experiment
commands.experiment.delete.description = Delete an LTTng Experiment
# LTTng 2.0 trace control commands
-trace.control.rse.system.type.name=LTTng (v2.0)
-trace.control.rse.system.type.description=LTTng Trace Control (v2.0)
-
commands.control.category=LTTng Trace Control Commands
commands.control.category.description=LTTng Trace Control Commands
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.xml b/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.xml
index 9240836ca5..5cee5d2f37 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.xml
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/plugin.xml
@@ -1233,20 +1233,6 @@
</handler>
</extension>
-
- <extension
- point="org.eclipse.rse.core.systemTypes">
- <systemType
- description="%trace.control.rse.system.type.description"
- icon="icons/obj16/systemlttng2.gif"
- iconLive="icons/obj16/systemlttng2-live.gif"
- id="org.eclipse.linuxtools.internal.lttng2.ui.control.systemType"
- label="%trace.control.rse.system.type.name"
- name="org.eclipse.linuxtools.internal.lttng2.ui.control.systemType"
- subsystemConfigurationIds="ssh.shells;ssh.files;ssh.terminals;processes.shell.linux">
- </systemType>
- </extension>
-
<extension
point="org.eclipse.ui.preferencePages">
<page
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/ControlView.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/ControlView.java
index 64f3edd94a..091d5d1d3f 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/ControlView.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/ControlView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
+ * Copyright (c) 2009, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -9,10 +9,14 @@
* Contributors:
* Francois Chouinard - Initial API and implementation
* Bernd Hufmann - Filled with content
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
*******************************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -23,13 +27,19 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponentChangedListener;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceControlContentProvider;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceControlLabelProvider;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceControlRoot;
-import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteServices;
+import org.eclipse.remote.core.RemoteServices;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.progress.UIJob;
@@ -51,6 +61,9 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
*/
public static final String ID = "org.eclipse.linuxtools.internal.lttng2.ui.views.control"; //$NON-NLS-1$
+ private static final String KEY_REMOTE_CONNECTION_NAME = "rc_name_"; //$NON-NLS-1$
+ private static final String KEY_REMOTE_PROVIDER = "rc_id_"; //$NON-NLS-1$
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
@@ -65,6 +78,8 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
*/
private ITraceControlComponent fRoot = null;
+ private List<IRemoteConnection> fInitialConnections;
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
@@ -94,14 +109,60 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
// Create model root
fRoot = new TraceControlRoot();
fRoot.addComponentListener(this);
+ if (fInitialConnections != null) {
+ for (IRemoteConnection rc : fInitialConnections) {
+ TargetNodeComponent node = new TargetNodeComponent(rc.getName(), fRoot, rc);
+ fRoot.addChild(node);
+ }
+ fInitialConnections = null;
+ }
fTreeViewer.setInput(fRoot);
// Create context menu for the tree viewer
createContextMenu();
getSite().setSelectionProvider(fTreeViewer);
+ }
- RSECorePlugin.getTheSystemRegistry(); // to load RSE
+ @Override
+ public void saveState(IMemento memento) {
+ int i = 0;
+ for (ITraceControlComponent cmp : fRoot.getChildren()) {
+ if (cmp instanceof TargetNodeComponent) {
+ IRemoteConnection rc = ((TargetNodeComponent) cmp).getRemoteConnection();
+ memento.putString(KEY_REMOTE_PROVIDER + i, rc.getRemoteServices().getId());
+ memento.putString(KEY_REMOTE_CONNECTION_NAME + i, rc.getName());
+ i++;
+ }
+ }
+ super.saveState(memento);
+ }
+
+
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ if (memento != null) {
+ fInitialConnections = new ArrayList<>();
+ for(int i = 0; ; i++) {
+ String id = memento.getString(KEY_REMOTE_PROVIDER + i);
+ String name = memento.getString(KEY_REMOTE_CONNECTION_NAME + i);
+ if (id == null || name == null) {
+ break;
+ }
+ if (!Workaround_Bug449362.triggerRSEStartup(id)) {
+ // Skip the connection in order to avoid an infinite loop
+ } else {
+ IRemoteServices rs = RemoteServices.getRemoteServices(id);
+ if (rs != null) {
+ IRemoteConnection rc = rs.getConnectionManager().getConnection(name);
+ if (rc != null) {
+ fInitialConnections.add(rc);
+ }
+ }
+ }
+ }
+ }
}
@Override
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/Workaround_Bug449362.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/Workaround_Bug449362.java
new file mode 100644
index 0000000000..494f7e40f6
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/Workaround_Bug449362.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng2.control.ui.views;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ui.IStartup;
+
+/**
+ * Collection of workarounds needed for dealing with the RSE adapter.
+ */
+class Workaround_Bug449362 {
+
+ private static final String RSE_ADAPTER_ID = "org.eclipse.ptp.remote.RSERemoteServices"; //$NON-NLS-1$
+
+ private static boolean fTriggeredRSEStartup = false;
+
+ /**
+ * Trigger the startup of RSE, if necessary.
+ * @param adapterID the id of the adapter that will be initialized
+ * @return <code>false</code> if the startup cannot be triggered, although it should be.
+ */
+ public static boolean triggerRSEStartup(String adapterID) {
+ if (fTriggeredRSEStartup || !RSE_ADAPTER_ID.equals(adapterID)) {
+ return true;
+ }
+
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui.startup"); //$NON-NLS-1$
+ if (ep == null) {
+ return false;
+ }
+ for (IConfigurationElement elem : ep.getConfigurationElements()) {
+ String clazz = elem.getAttribute("class"); //$NON-NLS-1$
+ if (clazz != null && clazz.endsWith("RSEUIStartup")) { //$NON-NLS-1$
+ try {
+ Object ext = elem.createExecutableExtension("class"); //$NON-NLS-1$
+ if (ext instanceof IStartup) {
+ ((IStartup) ext).earlyStartup();
+ fTriggeredRSEStartup = true;
+ return true;
+ }
+ } catch (CoreException e) {
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java
index 9453ce7637..3a31342278 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java
@@ -10,11 +10,13 @@
* Bernd Hufmann - Initial API and implementation
* Bernd Hufmann - Updated for support of LTTng Tools 2.1
* Marc-Andre Laperle - Support for creating a live session
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISessionInfo;
@@ -25,9 +27,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.Target
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionGroup;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.IRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.LTTngControlServiceConstants;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
+import org.eclipse.remote.core.IRemoteFileManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.FocusEvent;
@@ -832,22 +832,16 @@ public class CreateSessionDialog extends TitleAreaDialog implements ICreateSessi
if (!fIsAdvancedEnabled && !fIsLive) {
TargetNodeComponent node = (TargetNodeComponent)fParent.getParent();
IRemoteSystemProxy proxy = node.getRemoteSystemProxy();
- IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
+ IRemoteFileManager fsss = proxy.getFileServiceSubSystem();
if (fsss != null) {
- try {
- IRemoteFile remoteFolder = fsss.getRemoteFileObject(fSessionPath, new NullProgressMonitor());
-
- if (remoteFolder == null) {
- setErrorMessage(Messages.TraceControl_InvalidSessionPathError + " (" + fSessionPath + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- if (remoteFolder.exists()) {
- setErrorMessage(Messages.TraceControl_SessionPathAlreadyExistsError + " (" + fSessionPath + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- } catch (SystemMessageException e) {
- setErrorMessage(Messages.TraceControl_FileSubSystemError + "\n" + e); //$NON-NLS-1$
+ IFileStore remoteFolder = fsss.getResource(fSessionPath);
+ if (remoteFolder == null) {
+ setErrorMessage(Messages.TraceControl_InvalidSessionPathError + " (" + fSessionPath + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ IFileInfo fileInfo = remoteFolder.fetchInfo();
+ if (fileInfo.exists()) {
+ setErrorMessage(Messages.TraceControl_SessionPathAlreadyExistsError + " (" + fSessionPath + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/INewConnectionDialog.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/INewConnectionDialog.java
index 1bdb9a2019..e9232c6c0c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/INewConnectionDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/INewConnectionDialog.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,11 +8,11 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs;
-import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
-import org.eclipse.rse.core.model.IHost;
+import org.eclipse.remote.core.IRemoteConnection;
/**
* <p>
@@ -26,38 +26,12 @@ public interface INewConnectionDialog {
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
- /**
- * @return the connection name (alias).
- */
- String getConnectionName();
-
- /**
- * @return the host name (IP address or DNS name)
- */
- String getHostName();
-
- /**
- * @return port of IP connection to be used
- */
- int getPort();
-
- /**
- * Sets the trace control root
- * @param parent - the trace control parent
- */
- void setTraceControlParent(ITraceControlComponent parent);
-
- /**
- * Sets the available hosts to select.
- * @param hosts - the available hosts
- */
- void setHosts(IHost[] hosts);
/**
- * Set the port of the IP connection to be used.
- * @param port - the IP port to set
+ * Returns the selected connection.
+ * @return the selected connection, or <code>null</code>.
*/
- void setPort(int port);
+ IRemoteConnection getConnection();
// ------------------------------------------------------------------------
// Operations
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java
index 70a9f3cc60..1a843fd51b 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java
@@ -10,14 +10,19 @@
* Bernd Hufmann - Initial API and implementation
* Bernd Hufmann - Added handling of streamed traces
* Marc-Andre Laperle - Use common method to get opened tmf projects
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -27,6 +32,9 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.linuxtools.internal.lttng2.control.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
@@ -34,14 +42,12 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceS
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.IRemoteSystemProxy;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTracesFolder;
import org.eclipse.linuxtools.tmf.ui.project.model.TraceUtils;
-import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
+import org.eclipse.remote.core.IRemoteFileManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -52,8 +58,8 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
/**
* <p>
@@ -184,7 +190,7 @@ public class ImportDialog extends Dialog implements IImportDialog {
try {
createRemoteComposite();
- } catch (SystemMessageException e) {
+ } catch (CoreException e) {
createErrorComposite(parent, e.fillInStackTrace());
return fDialogComposite;
}
@@ -244,15 +250,15 @@ public class ImportDialog extends Dialog implements IImportDialog {
Object[] checked = fFolderViewer.getCheckedElements();
for (int i = 0; i < checked.length; i++) {
- IRemoteFile file = (IRemoteFile) checked[i];
- if (!file.isDirectory() && file.getName().equals(METADATA_FILE_NAME)) {
- IRemoteFile trace = file.getParentRemoteFile();
- IRemoteFile parent = trace.getParentRemoteFile();
+ IFileStore file = (IFileStore) checked[i];
+ if (!file.fetchInfo().isDirectory() && file.getName().equals(METADATA_FILE_NAME)) {
+ IFileStore trace = file.getParent();
+ IFileStore parent = trace.getParent();
String path = fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : fSession.getSessionPath();
path = getUnifiedPath(path);
IPath sessionParentPath = new Path(path).removeLastSegments(1);
- IPath traceParentPath = new Path(parent.getAbsolutePath());
+ IPath traceParentPath = new Path(parent.toURI().getPath());
IPath relativeTracePath = traceParentPath.makeRelativeTo(sessionParentPath);
@@ -303,17 +309,40 @@ public class ImportDialog extends Dialog implements IImportDialog {
*
* @author Bernd Hufmann
*/
- public static class FolderContentProvider extends WorkbenchContentProvider {
+ public static class FolderContentProvider implements ITreeContentProvider {
@Override
public Object[] getChildren(Object o) {
- if (o instanceof IRemoteFile) {
- IRemoteFile element = (IRemoteFile) o;
- // For our purpose, we need folders + files
- if (!element.isDirectory()) {
- return new Object[0];
+ try {
+ IFileStore store = (IFileStore) o;
+ if (store.fetchInfo().isDirectory()) {
+ return store.childStores(EFS.NONE, new NullProgressMonitor());
}
+ } catch (CoreException e) {
}
- return super.getChildren(o);
+ return new Object[0];
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ return ((IFileStore) element).getParent();
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return ((IFileStore) element).fetchInfo().isDirectory();
}
}
@@ -342,7 +371,7 @@ public class ImportDialog extends Dialog implements IImportDialog {
errorText.setLayoutData(new GridData(GridData.FILL_BOTH));
}
- private void createRemoteComposite() throws SystemMessageException{
+ private void createRemoteComposite() throws CoreException {
Group contextGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
contextGroup.setText(Messages.TraceControl_ImportDialogTracesGroupName);
GridLayout layout = new GridLayout(1, true);
@@ -351,12 +380,10 @@ public class ImportDialog extends Dialog implements IImportDialog {
IRemoteSystemProxy proxy = fSession.getTargetNode().getRemoteSystemProxy();
- IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
+ IRemoteFileManager fsss = proxy.getFileServiceSubSystem();
final String path = fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : fSession.getSessionPath();
- final IRemoteFile remoteFolder = fsss.getRemoteFileObject(path, new NullProgressMonitor());
- // make sure that remote directory is read and not cached
- remoteFolder.markStale(true, true);
+ final IFileStore remoteFolder = fsss.getResource(path);
fFolderViewer = new CheckboxTreeViewer(contextGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
GridData data = new GridData(GridData.FILL_BOTH);
@@ -366,22 +393,35 @@ public class ImportDialog extends Dialog implements IImportDialog {
tree.setToolTipText(Messages.TraceControl_ImportDialogTracesTooltip);
fFolderViewer.setContentProvider(new FolderContentProvider());
- fFolderViewer.setLabelProvider(new WorkbenchLabelProvider());
+ fFolderViewer.setLabelProvider(new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((IFileStore) element).getName();
+ }
+ @Override
+ public Image getImage(Object element) {
+ if (((IFileStore) element).fetchInfo().isDirectory()) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ }
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+ }
+ });
fFolderViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
Object elem = event.getElement();
- if (elem instanceof IRemoteFile) {
- IRemoteFile element = (IRemoteFile) elem;
- if (!element.isDirectory()) {
+ if (elem instanceof IFileStore) {
+ IFileStore element = (IFileStore) elem;
+ IFileInfo info = element.fetchInfo();
+ if (!info.isDirectory()) {
// A trick to keep selection of a file in sync with the directory
- boolean p = fFolderViewer.getChecked((element.getParentRemoteFile()));
+ boolean p = fFolderViewer.getChecked((element.getParent()));
fFolderViewer.setChecked(element, p);
} else {
fFolderViewer.setSubtreeChecked(event.getElement(), event.getChecked());
if (!event.getChecked()) {
- fFolderViewer.setChecked(element.getParentRemoteFile(), false);
+ fFolderViewer.setChecked(element.getParent(), false);
}
}
updateOKButtonEnablement();
@@ -390,7 +430,7 @@ public class ImportDialog extends Dialog implements IImportDialog {
});
fFolderViewer.setInput(remoteFolder);
- fFolderChildren = remoteFolder.getContents(RemoteChildrenContentsType.getInstance());
+ fFolderChildren = remoteFolder.childStores(EFS.NONE, new NullProgressMonitor());
// children can be null if there the path doesn't exist. This happens when a trace
// session hadn't been started and no output was created.
setFolderChildrenChecked(true);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java
index 73db884387..3d728b8e7e 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java
@@ -8,11 +8,12 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
/**
* <p>
@@ -29,7 +30,7 @@ public class ImportFileInfo {
/**
* Remote file reference
*/
- private IRemoteFile fRemoteFile;
+ private IFileStore fRemoteFile;
/**
* Local Trace Name
*/
@@ -58,7 +59,7 @@ public class ImportFileInfo {
* @param isOverwrite
* global overwrite flag
*/
- public ImportFileInfo(IRemoteFile file, String traceName, IFolder destinationFolder, boolean isOverwrite) {
+ public ImportFileInfo(IFileStore file, String traceName, IFolder destinationFolder, boolean isOverwrite) {
fRemoteFile = file;
fLocalTraceName = traceName;
fDestinationFolder = destinationFolder;
@@ -101,7 +102,7 @@ public class ImportFileInfo {
/**
* @return the remote file implementation.
*/
- public IRemoteFile getImportFile() {
+ public IFileStore getImportFile() {
return fRemoteFile;
}
@@ -111,7 +112,7 @@ public class ImportFileInfo {
* @param remoteFile
* The remote file implementation.
*/
- public void setRemoteFile(IRemoteFile remoteFile) {
+ public void setRemoteFile(IFileStore remoteFile) {
fRemoteFile = remoteFile;
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java
index 24c6f74f55..9a37496f66 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,35 +8,56 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs;
-import java.util.Arrays;
+import static java.text.MessageFormat.format;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.linuxtools.internal.lttng2.control.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
-import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
-import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.IRemoteSystemProxy;
-import org.eclipse.rse.core.model.IHost;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
+import org.eclipse.remote.core.IRemoteServices;
+import org.eclipse.remote.core.RemoteServices;
+import org.eclipse.remote.ui.IRemoteUIConnectionManager;
+import org.eclipse.remote.ui.IRemoteUIConnectionWizard;
+import org.eclipse.remote.ui.IRemoteUIServices;
+import org.eclipse.remote.ui.RemoteUIServices;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
/**
* <p>
@@ -50,10 +71,85 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
- /**
- * The icon file for this dialog box.
- */
- public static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/target_add.gif"; //$NON-NLS-1$
+ private static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/target_add.gif"; //$NON-NLS-1$
+ private static final String PROVIDERS_ICON_FILE = "icons/obj16/providers.gif"; //$NON-NLS-1$
+ private static final String CONNECTION_ICON_FILE = "icons/obj16/target_connected.gif"; //$NON-NLS-1$
+
+ private static final class ConnectionContentProvider implements ITreeContentProvider {
+ private static final Object[] NO_CHILDREN = {};
+ private static List<IRemoteServices> fProviders;
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ List<Object> children = new ArrayList<>();
+ children.addAll(RemoteServices.getLocalServices().getConnectionManager().getConnections());
+
+ List<IRemoteServices> result = getProviders();
+ children.addAll(result);
+ return children.toArray();
+ }
+
+ private static List<IRemoteServices> getProviders() {
+ if (fProviders == null) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry.getExtensionPoint("org.eclipse.remote.core", "remoteServices"); //$NON-NLS-1$ //$NON-NLS-2$
+ List<IRemoteServices> result = new ArrayList<>();
+ if (extensionPoint != null) {
+ Set<String> handled = new HashSet<>();
+ handled.add(RemoteServices.getLocalServices().getId());
+ for (IConfigurationElement ce : extensionPoint.getConfigurationElements()) {
+ String id = ce.getAttribute("id"); //$NON-NLS-1$
+ if (handled.add(id)) {
+ IRemoteServices service = RemoteServices.getRemoteServices(id);
+ if (service != null) {
+ result.add(service);
+ }
+ }
+ }
+ Collections.sort(result);
+ }
+ fProviders = Collections.unmodifiableList(result);
+ }
+ return fProviders;
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IRemoteServices) {
+ return getConnections((IRemoteServices) parentElement);
+ }
+ return NO_CHILDREN;
+ }
+
+ private static IRemoteConnection[] getConnections(IRemoteServices parentElement) {
+ List<IRemoteConnection> connectionList = parentElement.getConnectionManager().getConnections();
+ IRemoteConnection[] result = connectionList.toArray(new IRemoteConnection[connectionList.size()]);
+ Arrays.sort(result);
+ return result;
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof IRemoteConnection) {
+ return ((IRemoteConnection) element).getRemoteServices();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ }
// ------------------------------------------------------------------------
// Attributes
@@ -61,43 +157,18 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
/**
* The host combo box.
*/
- private CCombo fExistingHostsCombo = null;
- /**
- * The check box button for enabling/disabling the text input.
- */
- private Button fButton = null;
+ private TreeViewer fConnectionTree = null;
/**
- * The text widget for the node name (alias)
+ * The push button for creating a new connection.
*/
- private Text fConnectionNameText = null;
+ private Button fNewButton = null;
/**
- * The text widget for the node address (IP or DNS name)
+ * The push button for editing a connection.
*/
- private Text fHostNameText = null;
- /**
- * The text widget for the IP port
- */
- private Text fPortText = null;
- /**
- * The parent where the new node should be added.
- */
- private ITraceControlComponent fParent;
- /**
- * The node name (alias) string.
- */
- private String fConnectionName = null;
- /**
- * The node address (IP or DNS name) string.
- */
- private String fHostName = null;
- /**
- * The IP port of the connection.
- */
- private int fPort = IRemoteSystemProxy.INVALID_PORT_NUMBER;
- /**
- * Input list of existing RSE hosts available for selection.
- */
- private IHost[] fExistingHosts = new IHost[0];
+ private Button fEditButton = null;
+
+ private IRemoteConnection fConnection;
+
// ------------------------------------------------------------------------
// Constructors
@@ -114,42 +185,6 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
}
// ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- @Override
- public String getConnectionName() {
- return fConnectionName;
- }
-
- @Override
- public String getHostName() {
- return fHostName;
- }
-
- @Override
- public int getPort() {
- return fPort;
- }
-
- @Override
- public void setTraceControlParent(ITraceControlComponent parent) {
- fParent = parent;
- }
-
- @Override
- public void setHosts(IHost[] hosts) {
- if (hosts != null) {
- fExistingHosts = Arrays.copyOf(hosts, hosts.length);
- }
- }
-
- @Override
- public void setPort(int port) {
- fPort = port;
- }
-
- // ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@@ -161,129 +196,185 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
}
@Override
- protected Control createDialogArea(Composite parent) {
+ protected Control createContents(Composite parent) {
+ Control result = super.createContents(parent);
+ fConnectionTree.setAutoExpandLevel(2);
+ fConnectionTree.setInput(this);
+
+ List<IRemoteServices> providers = ConnectionContentProvider.getProviders();
+ if (!providers.isEmpty()) {
+ IRemoteServices provider = providers.get(0);
+ IRemoteConnection[] connections = ConnectionContentProvider.getConnections(provider);
+ if (connections.length > 0) {
+ fConnectionTree.setSelection(new StructuredSelection(connections[0]));
+ } else {
+ fConnectionTree.setSelection(new StructuredSelection(provider));
+ }
+ } else {
+ onSelectionChanged();
+ }
+ return result;
+ }
+ @Override
+ protected Control createDialogArea(Composite parent) {
// Main dialog panel
+ GridData gd;
Composite dialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
dialogComposite.setLayout(layout);
dialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ Label label = new Label(dialogComposite, SWT.NONE);
+ label.setText(Messages.TraceControl_NewNodeExistingConnectionGroupName);
+ label.setLayoutData(gd = new GridData());
+ gd.widthHint = label.computeSize(-1, -1).x + convertWidthInCharsToPixels(4);
// Existing connections group
- Group comboGroup = new Group(dialogComposite, SWT.SHADOW_NONE);
- comboGroup.setText(Messages.TraceControl_NewNodeExistingConnectionGroupName);
- layout = new GridLayout(2, true);
- comboGroup.setLayout(layout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- comboGroup.setLayoutData(data);
-
- fExistingHostsCombo = new CCombo(comboGroup, SWT.READ_ONLY);
- fExistingHostsCombo.setToolTipText(Messages.TraceControl_NewNodeComboToolTip);
- fExistingHostsCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
-
- String items[] = new String[fExistingHosts.length];
- for (int i = 0; i < items.length; i++) {
- items[i] = String.valueOf(fExistingHosts[i].getAliasName() + " - " + fExistingHosts[i].getHostName()); //$NON-NLS-1$
- }
-
- fExistingHostsCombo.setItems(items);
- fExistingHostsCombo.setEnabled(fExistingHosts.length > 0);
-
- // Node information grop
- Group textGroup = new Group(dialogComposite, SWT.SHADOW_NONE);
- layout = new GridLayout(3, true);
- textGroup.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- textGroup.setLayoutData(data);
-
- fButton = new Button(textGroup, SWT.CHECK);
- fButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
- fButton.setText(Messages.TraceControl_NewNodeEditButtonName);
- fButton.setEnabled(fExistingHosts.length > 0);
-
- Label connectionNameLabel = new Label(textGroup, SWT.RIGHT);
- connectionNameLabel.setText(Messages.TraceControl_NewNodeConnectionNameLabel);
- fConnectionNameText = new Text(textGroup, SWT.NONE);
- fConnectionNameText.setToolTipText(Messages.TraceControl_NewNodeConnectionNameTooltip);
- fConnectionNameText.setEnabled(fExistingHosts.length == 0);
-
- Label hostNameLabel = new Label(textGroup, SWT.RIGHT);
- hostNameLabel.setText(Messages.TraceControl_NewNodeHostNameLabel);
- fHostNameText = new Text(textGroup, SWT.NONE);
- fHostNameText.setToolTipText(Messages.TraceControl_NewNodeHostNameTooltip);
- fHostNameText.setEnabled(fExistingHosts.length == 0);
-
- Label portLabel = new Label(textGroup, SWT.RIGHT);
- portLabel.setText(Messages.TraceControl_NewNodePortLabel);
- fPortText = new Text(textGroup, SWT.NONE);
- fPortText.setToolTipText(Messages.TraceControl_NewNodePortTooltip);
- fPortText.setEnabled(fExistingHosts.length == 0);
- fPortText.addVerifyListener(new VerifyListener() {
+ fConnectionTree = new TreeViewer(dialogComposite);
+ fConnectionTree.getTree().setLayoutData(gd = new GridData(SWT.FILL, SWT.FILL, true, true));
+ gd.widthHint = convertWidthInCharsToPixels(40);
+ gd.heightHint = convertHeightInCharsToPixels(10);
+ fConnectionTree.setLabelProvider(new LabelProvider() {
@Override
- public void verifyText(VerifyEvent e) {
- // only numbers are allowed.
- e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+ public String getText(Object element) {
+ if (element instanceof IRemoteConnection) {
+ IRemoteConnection rc = (IRemoteConnection) element;
+ if (rc.getRemoteServices() == RemoteServices.getLocalServices()) {
+ return rc.getName();
+ }
+
+ return format("{0} [{1}]", rc.getName(), rc.getAddress()); //$NON-NLS-1$
+ } else if (element instanceof IRemoteServices) {
+ IRemoteServices rs = (IRemoteServices) element;
+ return rs.getName();
+ }
+ return Messages.TraceControl_UnknownNode;
}
- });
- fButton.addSelectionListener(new SelectionListener() {
@Override
- public void widgetSelected(SelectionEvent e) {
- if (fButton.getSelection()) {
- fExistingHostsCombo.deselectAll();
- fExistingHostsCombo.setEnabled(false);
- fConnectionNameText.setEnabled(true);
- fHostNameText.setEnabled(true);
- fPortText.setEnabled(true);
- } else {
- fExistingHostsCombo.setEnabled(true);
- fConnectionNameText.setEnabled(false);
- fHostNameText.setEnabled(false);
- fPortText.setEnabled(false);
+ public Image getImage(Object element) {
+ if (element instanceof IRemoteConnection) {
+ return Activator.getDefault().loadIcon(CONNECTION_ICON_FILE);
}
+ return Activator.getDefault().loadIcon(PROVIDERS_ICON_FILE);
}
-
+ });
+ fConnectionTree.setContentProvider(new ConnectionContentProvider());
+ fConnectionTree.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
- public void widgetDefaultSelected(SelectionEvent e) {
+ public void selectionChanged(SelectionChangedEvent event) {
+ onSelectionChanged();
+ }
+ });
+ fConnectionTree.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ okPressed();
}
});
- fExistingHostsCombo.addSelectionListener(new SelectionListener() {
+ Composite buttons = new Composite(dialogComposite, SWT.NONE);
+ layout = new GridLayout(3, true);
+ layout.marginHeight = layout.marginWidth = 0;
+ buttons.setLayout(layout);
+ buttons.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
+
+ new Label(buttons, SWT.NONE);
+
+ fEditButton = new Button(buttons, SWT.PUSH);
+ fEditButton.setText(Messages.TraceControl_NewNodeEditButtonName);
+ setButtonLayoutData(fEditButton);
+ fEditButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- int index = fExistingHostsCombo.getSelectionIndex();
- fConnectionNameText.setText(fExistingHosts[index].getAliasName());
- fHostNameText.setText(fExistingHosts[index].getHostName());
- fPortText.setText(""); //$NON-NLS-1$
+ onEditConnection();
}
+ });
+ fNewButton = new Button(buttons, SWT.PUSH);
+ fNewButton.setText(Messages.TraceControl_NewNodeCreateButtonText);
+ setButtonLayoutData(fNewButton);
+ fNewButton.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetDefaultSelected(SelectionEvent e) {
+ public void widgetSelected(SelectionEvent e) {
+ onNewConnection();
}
});
- // layout widgets
- data = new GridData(GridData.FILL_HORIZONTAL);
- fHostNameText.setText("666.666.666.666"); //$NON-NLS-1$
- Point minSize = fHostNameText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- int widthHint = minSize.x + 5;
- data.widthHint = widthHint;
- data.horizontalSpan = 2;
- fConnectionNameText.setLayoutData(data);
+ return dialogComposite;
+ }
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = widthHint;
- data.horizontalSpan = 2;
- fHostNameText.setLayoutData(data);
+ private void onSelectionChanged() {
+ setConnection();
+ getButton(OK).setEnabled(fConnection != null);
+ fEditButton.setEnabled(canEdit(fConnection));
+ fNewButton.setEnabled(getServiceForCreation() != null);
+ }
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = widthHint;
- data.horizontalSpan = 2;
- fPortText.setLayoutData(data);
+ private IRemoteServices getServiceForCreation() {
+ Object o = ((IStructuredSelection) fConnectionTree.getSelection()).getFirstElement();
+ IRemoteServices result = null;
+ if (o instanceof IRemoteServices) {
+ result = (IRemoteServices) o;
+ } else if (o instanceof IRemoteConnection) {
+ result = ((IRemoteConnection) o).getRemoteServices();
+ } else {
+ return null;
+ }
- fHostNameText.setText(""); //$NON-NLS-1$
+ if ((result.getCapabilities() & IRemoteServices.CAPABILITY_ADD_CONNECTIONS) == 0) {
+ return null;
+ }
- return dialogComposite;
+ return result;
+ }
+
+ private static boolean canEdit(IRemoteConnection conn) {
+ if (conn == null) {
+ return false;
+ }
+ IRemoteServices rs = conn.getRemoteServices();
+ return (rs.getCapabilities() & IRemoteServices.CAPABILITY_EDIT_CONNECTIONS) != 0;
+ }
+
+
+ private void onNewConnection() {
+ IRemoteServices rs = getServiceForCreation();
+ if (rs != null) {
+ IRemoteUIServices uiService = RemoteUIServices.getRemoteUIServices(rs);
+ if (uiService != null) {
+ IRemoteUIConnectionWizard wiz = uiService.getUIConnectionManager().getConnectionWizard(getShell());
+ if (wiz != null) {
+ IRemoteConnectionWorkingCopy wc = wiz.open();
+ if (wc != null) {
+ IRemoteConnection conn = wc.save();
+ if (conn != null) {
+ fConnectionTree.refresh();
+ fConnectionTree.setSelection(new StructuredSelection(conn), true);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void onEditConnection() {
+ setConnection();
+ if (fConnection != null) {
+ IRemoteUIServices ui = RemoteUIServices.getRemoteUIServices(fConnection.getRemoteServices());
+ if (ui != null) {
+ IRemoteUIConnectionManager connManager = ui.getUIConnectionManager();
+ if (connManager != null) {
+ IRemoteUIConnectionWizard wiz = connManager.getConnectionWizard(getShell());
+ wiz.setConnection(fConnection.getWorkingCopy());
+ IRemoteConnectionWorkingCopy result = wiz.open();
+ if (result != null) {
+ result.save();
+ fConnectionTree.refresh();
+ }
+ }
+ }
+ }
}
@Override
@@ -294,28 +385,19 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
@Override
protected void okPressed() {
- // Validate input data
- fConnectionName = fConnectionNameText.getText();
- fHostName = fHostNameText.getText();
- fPort = (fPortText.getText().length() > 0) ? Integer.parseInt(fPortText.getText()) : IRemoteSystemProxy.INVALID_PORT_NUMBER;
-
- if (!"".equals(fHostName)) { //$NON-NLS-1$
- // If no node name is specified use the node address as name
- if ("".equals(fConnectionName)) { //$NON-NLS-1$
- fConnectionName = fHostName;
- }
- // Check if node with name already exists in parent
- if(fParent.containsChild(fConnectionName)) {
- MessageDialog.openError(getShell(),
- Messages.TraceControl_NewDialogTitle,
- Messages.TraceControl_AlreadyExistsError + " (" + fConnectionName + ")"); //$NON-NLS-1$//$NON-NLS-2$
- return;
- }
- }
- else {
- return;
+ setConnection();
+ if (fConnection != null) {
+ super.okPressed();
}
- // validation successful -> call super.okPressed()
- super.okPressed();
+ }
+
+ private void setConnection() {
+ Object o = ((IStructuredSelection) fConnectionTree.getSelection()).getFirstElement();
+ fConnection = o instanceof IRemoteConnection ? (IRemoteConnection)o : null;
+ }
+
+ @Override
+ public IRemoteConnection getConnection() {
+ return fConnection;
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/DeleteHandler.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/DeleteHandler.java
index b9437e5838..bb32b176be 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/DeleteHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/DeleteHandler.java
@@ -35,7 +35,6 @@ public class DeleteHandler extends BaseNodeHandler {
try {
ITraceControlComponent root = fTargetNode.getParent();
fTargetNode.removeAllChildren();
- fTargetNode.deregister();
root.removeChild(fTargetNode);
} finally {
fLock.unlock();
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java
index 99ea37c732..185e1ae713 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java
@@ -10,16 +10,23 @@
* Bernd Hufmann - Initial API and implementation
* Bernd Hufmann - Updated for support of streamed traces
* Patrick Tasse - Add support for source location
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.handlers;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -65,10 +72,6 @@ import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceTypeUIUtils;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTracesFolder;
import org.eclipse.linuxtools.tmf.ui.project.model.TraceUtils;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.IFileService;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
@@ -190,19 +193,9 @@ public class ImportHandler extends BaseControlViewHandler {
status.add(TmfTraceTypeUIUtils.setTraceType(file, helper));
}
- try {
- final String scheme = "sftp"; //$NON-NLS-1$
- String host = remoteFile.getImportFile().getHost().getName();
- int port = remoteFile.getImportFile().getParentRemoteFileSubSystem().getConnectorService().getPort();
- String path = remoteFile.getImportFile().getAbsolutePath();
- if (file instanceof IFolder) {
- path += IPath.SEPARATOR;
- }
- URI uri = new URI(scheme, null, host, port, path, null, null);
- String sourceLocation = URIUtil.toUnencodedString(uri);
- file.setPersistentProperty(TmfCommonConstants.SOURCE_LOCATION, sourceLocation);
- } catch (URISyntaxException e) {
- }
+ URI uri = remoteFile.getImportFile().toURI();
+ String sourceLocation = URIUtil.toUnencodedString(uri);
+ file.setPersistentProperty(TmfCommonConstants.SOURCE_LOCATION, sourceLocation);
}
} catch (ExecutionException e) {
status.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ImportFailure, e));
@@ -278,7 +271,7 @@ public class ImportHandler extends BaseControlViewHandler {
private static void downloadTrace(ImportFileInfo trace, IProject project, IProgressMonitor monitor)
throws ExecutionException {
try {
- IRemoteFileSubSystem fsss = trace.getImportFile().getParentRemoteFileSubSystem();
+ IFileStore importRoot = trace.getImportFile();
IFolder traceFolder = project.getFolder(TmfTracesFolder.TRACES_FOLDER_NAME);
if (!traceFolder.exists()) {
@@ -298,26 +291,49 @@ public class ImportHandler extends BaseControlViewHandler {
folder.create(true, true, null);
}
- IRemoteFile[] sources = fsss.list(trace.getImportFile(), IFileService.FILE_TYPE_FILES, new NullProgressMonitor());
+ IFileStore[] sources = importRoot.childStores(EFS.NONE, new NullProgressMonitor());
SubMonitor subMonitor = SubMonitor.convert(monitor, sources.length);
subMonitor.beginTask(Messages.TraceControl_DownloadTask, sources.length);
- for (int i = 0; i < sources.length; i++) {
+ for (IFileStore source : sources) {
if (subMonitor.isCanceled()) {
monitor.setCanceled(true);
return;
}
- String destination = folder.getLocation().addTrailingSeparator().append(sources[i].getName()).toOSString();
- subMonitor.setTaskName(Messages.TraceControl_DownloadTask + ' ' + traceName + '/' + sources[i].getName());
- fsss.download(sources[i], destination, null, subMonitor.newChild(1));
+ SubMonitor childMonitor = subMonitor.newChild(1);
+ IFileInfo info = source.fetchInfo();
+ if (!info.isDirectory()) {
+ IPath destination = folder.getLocation().addTrailingSeparator().append(source.getName());
+ subMonitor.setTaskName(Messages.TraceControl_DownloadTask + ' ' + traceName + '/' + source.getName());
+ try (InputStream in = source.openInputStream(EFS.NONE, new NullProgressMonitor())) {
+ copy(in, destination, childMonitor, info.getLength());
+ }
+ }
}
- } catch (SystemMessageException e) {
+ } catch (IOException e) {
throw new ExecutionException(e.toString(), e);
} catch (CoreException e) {
throw new ExecutionException(e.toString(), e);
}
}
+ private static void copy(InputStream in, IPath destination, SubMonitor monitor, long length) throws IOException {
+ try (OutputStream out = new FileOutputStream(destination.toFile())) {
+ monitor.setWorkRemaining((int) (length / 1024));
+ byte[] buf = new byte[1024 * 16];
+ int counter = 0;
+ for (;;) {
+ int n = in.read(buf);
+ if (n <= 0) {
+ return;
+ }
+ out.write(buf, 0, n);
+ counter = (counter % 1024) + n;
+ monitor.worked(counter / 1024);
+ }
+ }
+ }
+
private static void importLiveTrace(final LttngRelaydConnectionInfo connectionInfo, final IProject project) {
Job job = new Job(Messages.TraceControl_ImportJob) {
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java
index 04bfccea7a..d7da522a23 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java
@@ -9,29 +9,19 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Anna Dushistova(Montavista) - [382684] Allow reusing already defined connections that have Files and Shells subsystems
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.handlers;
-import java.util.ArrayList;
-import java.util.Arrays;
-
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.ControlView;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.INewConnectionDialog;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
-import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
-import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.IRemoteSystemProxy;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -47,15 +37,6 @@ import org.eclipse.ui.PlatformUI;
public class NewConnectionHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * The trace control system type defined for LTTng version 2.0 and later.
- */
- public static final String TRACE_CONTROL_SYSTEM_TYPE = "org.eclipse.linuxtools.internal.lttng2.ui.control.systemType"; //$NON-NLS-1$
-
- // ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
@@ -73,68 +54,24 @@ public class NewConnectionHandler extends BaseControlViewHandler {
return false;
}
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
-
- // get system type definition for LTTng 2.x connection
- IRSESystemType sysType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(TRACE_CONTROL_SYSTEM_TYPE);
-
- // get all hosts for this system type
- IHost[] hosts = getSuitableHosts();
-
// Open dialog box for the node name and address
final INewConnectionDialog dialog = TraceControlDialogFactory.getInstance().getNewConnectionDialog();
- dialog.setTraceControlParent(fRoot);
- dialog.setHosts(hosts);
- dialog.setPort(IRemoteSystemProxy.INVALID_PORT_NUMBER);
if (dialog.open() != Window.OK) {
return null;
}
- String hostName = dialog.getConnectionName();
- String hostAddress = dialog.getHostName();
- int port = dialog.getPort();
-
- // get the singleton RSE registry
- IHost host = null;
-
- for (int i = 0; i < hosts.length; i++) {
- if (hosts[i].getAliasName().equals(hostName)) {
- host = hosts[i];
- break;
- }
- }
-
- if (host == null) {
- // if there's no host then we will create it
- try {
- // create the host object as an SSH Only connection
- host = registry.createHost(
- sysType, //System Type Name
- hostName, //Connection name
- hostAddress, //IP Address
- "Connection to Host"); //description //$NON-NLS-1$
- }
- catch (Exception e) {
- MessageDialog.openError(window.getShell(),
- Messages.TraceControl_EclipseCommandFailure,
- Messages.TraceControl_NewNodeCreationFailure + " (" + hostName + ", " + hostAddress + ")" + ":\n" + e.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- return null;
- }
- }
-
+ IRemoteConnection host = dialog.getConnection();
if (host != null) {
fLock.lock();
try {
// successful creation of host
TargetNodeComponent node = null;
- if (!fRoot.containsChild(hostName)) {
- node = new TargetNodeComponent(hostName, fRoot, host);
- node.setPort(port);
+ if (!fRoot.containsChild(host.getName())) {
+ node = new TargetNodeComponent(host.getName(), fRoot, host);
fRoot.addChild(node);
- }
- else {
- node = (TargetNodeComponent)fRoot.getChild(hostName);
+ } else {
+ node = (TargetNodeComponent)fRoot.getChild(host.getName());
}
node.connect();
@@ -145,26 +82,6 @@ public class NewConnectionHandler extends BaseControlViewHandler {
return null;
}
- private static IHost[] getSuitableHosts() {
- // need shells and files
- ArrayList<IHost> result = new ArrayList<>();
- ArrayList<IHost> shellConnections = new ArrayList<>(
- Arrays.asList(RSECorePlugin.getTheSystemRegistry()
- .getHostsBySubSystemConfigurationCategory("shells"))); //$NON-NLS-1$
-
- for (IHost connection : shellConnections) {
- ISubSystem[] subSystems = connection.getSubSystems();
- for (int i = 0; i < subSystems.length; i++) {
- if (subSystems[i] instanceof IFileServiceSubSystem) {
- result.add(connection);
- break;
- }
- }
- }
-
- return result.toArray(new IHost[result.size()]);
- }
-
@Override
public boolean isEnabled() {
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/Messages.java
index fd5210fa2c..c6d7c4f210 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/Messages.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/Messages.java
@@ -10,6 +10,7 @@
* Bernd Hufmann - Initial API and implementation
* Bernd Hufmann - Updated for support of LTTng Tools 2.1
* Jonathan Rajotte - Updated for basic support of LTTng 2.6 machine interface
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
*******************************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages;
@@ -71,6 +72,8 @@ public final class Messages extends NLS {
public static String TraceControl_RetrieveNodeConfigurationFailure;
public static String TraceControl_ListSessionFailure;
public static String TraceControl_EclipseCommandFailure;
+ public static String TraceControl_NewNodeCreateButtonText;
+
public static String TraceControl_NewNodeCreationFailure;
public static String TraceControl_CreateSessionJob;
public static String TraceControl_CreateSessionFailure;
@@ -292,6 +295,8 @@ public final class Messages extends NLS {
public static String TraceControl_DomainNamePropertyName;
public static String TraceControl_BufferTypePropertyName;
public static String TraceControl_ChannelNamePropertyName;
+ public static String TraceControl_OpenConnectionTo;
+
public static String TraceControl_OverwriteModePropertyName;
public static String TraceControl_SubBufferSizePropertyName;
public static String TraceControl_NbSubBuffersPropertyName;
@@ -333,6 +338,8 @@ public final class Messages extends NLS {
public static String TraceControl_ExecuteScriptBrowseText;
public static String TraceControl_ExecuteScriptSelectLabel;
+ public static String TraceControl_UnknownNode;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/messages.properties
index f826ea3789..2dc687a0d4 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/messages.properties
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/messages/messages.properties
@@ -52,6 +52,7 @@ TraceControl_ListSessionFailure=List sessions failed
TraceControl_RetrieveNodeConfigurationJob=Retrieving Target Node Configuration...
TraceControl_RetrieveNodeConfigurationFailure=Error retrieving node configuration
TraceControl_EclipseCommandFailure=Command failed
+TraceControl_NewNodeCreateButtonText=Create...
TraceControl_NewNodeCreationFailure=Creation of new connection failed
TraceControl_CreateSessionJob=Creating Session...
TraceControl_CreateSessionFailure=Command to create session failed
@@ -94,8 +95,8 @@ TraceControl_RecordSnapshotFailure=Command to snapshot record failed
# Dialogs
TraceControl_NewDialogTitle=New Connection
-TraceControl_NewNodeExistingConnectionGroupName=Existing Connections
-TraceControl_NewNodeEditButtonName=Edit connection information
+TraceControl_NewNodeExistingConnectionGroupName=Select an existing connection, or use a provider to create a new one:
+TraceControl_NewNodeEditButtonName=Edit...
TraceControl_NewNodeComboToolTip=List of existing connections (connection name - host name)
TraceControl_NewNodeConnectionNameLabel=Connection Name
TraceControl_NewNodeConnectionNameTooltip=Alias to be displayed for node to connect to.
@@ -280,6 +281,7 @@ TraceControl_VersionPropertyName=Version
TraceControl_DomainNamePropertyName=Domain Name
TraceControl_BufferTypePropertyName=Buffer type
TraceControl_ChannelNamePropertyName=Channel Name
+TraceControl_OpenConnectionTo=Opening connection to ''{0}''
TraceControl_OverwriteModePropertyName=Overwrite Mode
TraceControl_SubBufferSizePropertyName=Sub Buffer Size
TraceControl_NbSubBuffersPropertyName=Number of Sub Buffers
@@ -319,3 +321,4 @@ TraceControl_ExecuteScriptError=Error executing command script
TraceControl_ExecuteScriptDialogTitle=Select command script
TraceControl_ExecuteScriptBrowseText=Browse...
TraceControl_ExecuteScriptSelectLabel=Select Script
+TraceControl_UnknownNode=<unknown>
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/NullControlService.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/NullControlService.java
new file mode 100644
index 0000000000..9c21b78d0f
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/NullControlService.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IBaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISnapshotInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IUstProviderInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.ILttngControlService;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.LttngVersion;
+import org.osgi.framework.Version;
+
+class NullControlService implements ILttngControlService {
+
+ @Override
+ public LttngVersion getVersion() {
+ return new LttngVersion(Version.emptyVersion.toString());
+ }
+
+ @Override
+ public String getVersionString() {
+ return Version.emptyVersion.toString();
+ }
+
+ @Override
+ public boolean isVersionSupported(String version) {
+ return false;
+ }
+
+ @Override
+ public String[] getSessionNames(IProgressMonitor monitor) throws ExecutionException {
+ return new String[0];
+ }
+
+ @Override
+ public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ return null;
+ }
+
+ @Override
+ public ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ return null;
+ }
+
+ @Override
+ public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<IUstProviderInfo> getUstProvider() throws ExecutionException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public ISessionInfo createSession(ISessionInfo sessionInfo, IProgressMonitor monitor) throws ExecutionException {
+ return null;
+ }
+
+ @Override
+ public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void startSession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void stopSession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void enableProbe(String sessionName, String channelName, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void enableLogLevel(String sessionName, String channelName, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void disableEvent(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public List<String> getContextList(IProgressMonitor monitor) throws ExecutionException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public void addContexts(String sessionName, String channelName, String eventName, boolean isKernel, List<String> contexts, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void calibrate(boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void recordSnapshot(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ }
+
+ @Override
+ public void runCommands(IProgressMonitor monitor, List<String> commands) throws ExecutionException {
+ }
+}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
index 1f3ccb7b8b..84d108c91b 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -9,16 +9,21 @@
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Bernd Hufmann - Updated for support of LTTng Tools 2.1
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl;
+import static java.text.MessageFormat.format;
+
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.control.ui.Activator;
@@ -30,12 +35,9 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.IRemoteSys
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.RemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.ILttngControlService;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.LTTngControlServiceFactory;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.CommunicationsEvent;
-import org.eclipse.rse.core.subsystems.ICommunicationsListener;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionChangeEvent;
+import org.eclipse.remote.core.IRemoteConnectionChangeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
@@ -48,7 +50,7 @@ import org.eclipse.ui.views.properties.IPropertySource;
*
* @author Bernd Hufmann
*/
-public class TargetNodeComponent extends TraceControlComponent implements ICommunicationsListener {
+public class TargetNodeComponent extends TraceControlComponent implements IRemoteConnectionChangeListener {
// ------------------------------------------------------------------------
// Constants
@@ -63,6 +65,8 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
*/
public static final String TARGET_NODE_DISCONNECTED_ICON_FILE = "icons/obj16/target_disconnected.gif"; //$NON-NLS-1$
+ private static final ILttngControlService NULL_CONTROL_SERVICE = new NullControlService();
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
@@ -78,7 +82,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
/**
* The connection implementation.
*/
- private IHost fHost = null;
+ private IRemoteConnection fHost = null;
/**
* The remote proxy implementation.
*/
@@ -103,13 +107,14 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
* @param host - the host connection implementation
* @param proxy - the remote proxy implementation
*/
- public TargetNodeComponent(String name, ITraceControlComponent parent, IHost host, IRemoteSystemProxy proxy) {
+ public TargetNodeComponent(String name, ITraceControlComponent parent, IRemoteConnection host, IRemoteSystemProxy proxy) {
super(name, parent);
setImage(TARGET_NODE_CONNECTED_ICON_FILE);
fDisconnectedImage = Activator.getDefault().loadIcon(TARGET_NODE_DISCONNECTED_ICON_FILE);
fHost = host;
fRemoteProxy = proxy;
- setToolTip(fHost.getHostName());
+ fRemoteProxy.addConnectionChangeListener(this);
+ setToolTip(fHost.getName());
}
/**
@@ -118,10 +123,26 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
* @param parent - the parent of the component
* @param host - the host connection implementation
*/
- public TargetNodeComponent(String name, ITraceControlComponent parent, IHost host) {
+ public TargetNodeComponent(String name, ITraceControlComponent parent, IRemoteConnection host) {
this(name, parent, host, new RemoteSystemProxy(host));
}
+ @Override
+ public void dispose() {
+ fRemoteProxy.removeConnectionChangeListener(this);
+ fRemoteProxy.dispose();
+ disposeControlService();
+ }
+
+ private void disposeControlService() {
+ fService = null;
+ final ICommandShell shell = fShell;
+ if (shell != null) {
+ shell.disconnect();
+ fShell = null;
+ }
+ }
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
@@ -147,7 +168,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
@Override
public ILttngControlService getControlService() {
- return fService;
+ return fService == null ? NULL_CONTROL_SERVICE : fService;
}
@Override
@@ -164,10 +185,10 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
}
/**
- * @return remote host name
+ * @return the remote connection associated with this node
*/
- public String getHostName() {
- return fHost.getHostName();
+ public IRemoteConnection getRemoteConnection() {
+ return fHost;
}
/**
@@ -178,21 +199,6 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
}
/**
- * @return port of IP connection (shell) to be used
- */
- public int getPort() {
- return fRemoteProxy.getPort();
- }
-
- /**
- * Sets the port of the IP connections of the shell
- * @param port - the IP port to set
- */
- public void setPort(int port) {
- fRemoteProxy.setPort(port);
- }
-
- /**
* @return all available sessions.
*/
public TraceSessionComponent[] getSessions() {
@@ -210,7 +216,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
*/
public String getNodeVersion() {
// Control service is null during connection to node
- if (getControlService() != null) {
+ if (getControlService() != NULL_CONTROL_SERVICE) {
return getControlService().getVersionString();
}
return ""; //$NON-NLS-1$
@@ -285,54 +291,68 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
// Operations
// ------------------------------------------------------------------------
- @Override
- public void communicationsStateChange(CommunicationsEvent e) {
- if (e.getState() == CommunicationsEvent.AFTER_DISCONNECT ||
- e.getState() == CommunicationsEvent.CONNECTION_ERROR) {
- handleDisconnected();
- } if ((e.getState() == CommunicationsEvent.AFTER_CONNECT) && (fState != TargetNodeState.CONNECTING)) {
- handleConnected();
- }
- }
-
- @Override
- public boolean isPassiveCommunicationsListener() {
- return true;
- }
-
- @Override
- public void dispose() {
- fRemoteProxy.removeCommunicationListener(this);
- }
-
- /**
- * Method to connect this node component to the remote target node.
- */
- public void connect() {
- if (fState == TargetNodeState.DISCONNECTED) {
- try {
- setTargetNodeState(TargetNodeState.CONNECTING);
- fRemoteProxy.connect(new IRSECallback() {
- @Override
- public void done(IStatus status, Object result) {
- // Note: result might be null!
- if(status.isOK()) {
- handleConnected();
- } else {
- handleDisconnected();
- }
- }
- });
- } catch (Exception e) {
- setTargetNodeState(TargetNodeState.DISCONNECTED);
- Activator.getDefault().logError(Messages.TraceControl_ConnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ @Override
+ public void connectionChanged(IRemoteConnectionChangeEvent e) {
+ if (fState == TargetNodeState.CONNECTING) {
+ return;
+ }
+
+ switch (e.getType()) {
+ case IRemoteConnectionChangeEvent.CONNECTION_CLOSED:
+ case IRemoteConnectionChangeEvent.CONNECTION_ABORTED:
+ handleDisconnected();
+ break;
+ case IRemoteConnectionChangeEvent.CONNECTION_OPENED:
+ handleConnected();
+ break;
+ default:
+ break;
+ }
}
- /**
- * Method to disconnect this node component to the remote target node.
- */
+ /**
+ * Method to connect this node component to the remote target node.
+ */
+ public void connect() {
+ if (fState == TargetNodeState.DISCONNECTED) {
+ try {
+ setTargetNodeState(TargetNodeState.CONNECTING);
+ Job job = new Job(format(Messages.TraceControl_OpenConnectionTo, getName())) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ fRemoteProxy.connect(monitor);
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ConnectionFailure, e);
+ }
+ }
+ };
+ job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ IStatus status = event.getResult();
+ if (status.isOK()) {
+ handleConnected();
+ } else {
+ handleDisconnected();
+ if (status.getSeverity() != IStatus.CANCEL) {
+ Activator.getDefault().getLog().log(status);
+ }
+ }
+ }
+ });
+ job.schedule();
+ } catch (Exception e) {
+ setTargetNodeState(TargetNodeState.DISCONNECTED);
+ Activator.getDefault().logError(Messages.TraceControl_ConnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+ /**
+ * Method to disconnect this node component to the remote target node.
+ */
public void disconnect() {
if (fState == TargetNodeState.CONNECTED) {
try {
@@ -359,11 +379,12 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
// Get provider information from node
TraceProviderGroup providerGroup = new TraceProviderGroup(Messages.TraceControl_ProviderDisplayName, TargetNodeComponent.this);
addChild(providerGroup);
- providerGroup.getProviderFromNode(monitor);
// Get session information from node
TraceSessionGroup sessionGroup = new TraceSessionGroup(Messages.TraceControl_AllSessionsDisplayName, TargetNodeComponent.this);
addChild(sessionGroup);
+
+ providerGroup.getProviderFromNode(monitor);
sessionGroup.getSessionsFromNode(monitor);
} catch (ExecutionException e) {
removeAllChildren();
@@ -385,18 +406,6 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
getConfigurationFromNode();
}
- /**
- * Deregisters host from registry.
- */
- public void deregister() {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- // Don't remove local host because it cannot be recreated by
- // LTTng NewConnection Dialog
- if (!fRemoteProxy.isLocal()) {
- registry.deleteHost(fHost);
- }
- }
-
// ------------------------------------------------------------------------
// Helper function
// ------------------------------------------------------------------------
@@ -406,11 +415,15 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
* @throws ExecutionException
*/
private ILttngControlService createControlService() throws ExecutionException {
- if (fShell == null) {
- fShell = fRemoteProxy.createCommandShell();
- fRemoteProxy.addCommunicationListener(this);
+ if (fService == null) {
+ try {
+ fShell = fRemoteProxy.createCommandShell();
+ fService = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
+ } catch (ExecutionException e) {
+ disposeControlService();
+ throw e;
+ }
}
- fService = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
return fService;
}
@@ -418,13 +431,16 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
* Handles the connected event.
*/
private void handleConnected() {
- setTargetNodeState(TargetNodeState.CONNECTED);
try {
createControlService();
getConfigurationFromNode();
+ // Set connected only after the control service has been created and the jobs for creating the
+ // sub-nodes are scheduled.
+ setTargetNodeState(TargetNodeState.CONNECTED);
} catch (final ExecutionException e) {
// Disconnect only if no control service, otherwise stay connected.
- if (getControlService() == null) {
+ if (getControlService() == NULL_CONTROL_SERVICE) {
+ fState = TargetNodeState.CONNECTED;
disconnect();
}
@@ -447,9 +463,16 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
* Handles the disconnected event.
*/
private void handleDisconnected() {
- removeAllChildren();
+ disposeControlService();
setTargetNodeState(TargetNodeState.DISCONNECTED);
- fShell = null;
- fService = null;
+ removeAllChildren();
+ }
+
+ @Override
+ public void addChild(ITraceControlComponent component) {
+ if (getTargetNodeState() == TargetNodeState.DISCONNECTED) {
+ return;
+ }
+ super.addChild(component);
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceSessionComponent.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceSessionComponent.java
index eee0d7840a..ddbe97c4b2 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceSessionComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceSessionComponent.java
@@ -281,16 +281,19 @@ public class TraceSessionComponent extends TraceControlComponent {
public void getConfigurationFromNode(IProgressMonitor monitor)
throws ExecutionException {
removeAllChildren();
- ISessionInfo oldSessionInfo = fSessionInfo;
- fSessionInfo = getControlService().getSession(getName(), monitor);
- copyLiveInfo(oldSessionInfo);
-
- IDomainInfo[] domains = fSessionInfo.getDomains();
- for (int i = 0; i < domains.length; i++) {
- TraceDomainComponent domainComponent = new TraceDomainComponent(
- domains[i].getName(), this);
- addChild(domainComponent);
- domainComponent.setDomainInfo(domains[i]);
+ ISessionInfo newInfo = getControlService().getSession(getName(), monitor);
+ if (newInfo != null) {
+ ISessionInfo oldSessionInfo = fSessionInfo;
+ fSessionInfo = newInfo;
+ copyLiveInfo(oldSessionInfo);
+
+ IDomainInfo[] domains = fSessionInfo.getDomains();
+ for (int i = 0; i < domains.length; i++) {
+ TraceDomainComponent domainComponent = new TraceDomainComponent(
+ domains[i].getName(), this);
+ addChild(domainComponent);
+ domainComponent.setDomainInfo(domains[i]);
+ }
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TargetNodePropertySource.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TargetNodePropertySource.java
index e552bb919e..d4b6893cf9 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TargetNodePropertySource.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TargetNodePropertySource.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -7,7 +7,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Bernd Hufmann - Initial API and implementation
+ * Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.property;
@@ -100,7 +101,7 @@ public class TargetNodePropertySource extends BasePropertySource {
return fTargetNode.getName();
}
if (TARGET_NODE_ADDRESS_PROPERTY_ID.equals(id)) {
- return fTargetNode.getHostName();
+ return fTargetNode.getRemoteConnection().getAddress();
}
if (TARGET_NODE_STATE_PROPERTY_ID.equals(id)) {
return fTargetNode.getTargetNodeState().name();
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/CommandShell.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/CommandShell.java
index ea6cfa7ce8..886141f041 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/CommandShell.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/CommandShell.java
@@ -9,16 +9,12 @@
* Contributors:
* Patrick Tasse - Initial API and implementation
* Bernd Hufmann - Updated using Executor Framework
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Random;
import java.util.concurrent.Callable;
-import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
@@ -28,15 +24,16 @@ import java.util.concurrent.TimeoutException;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.preferences.ControlPreferences;
-import org.eclipse.rse.services.shells.HostShellProcessAdapter;
-import org.eclipse.rse.services.shells.IHostShell;
-import org.eclipse.rse.services.shells.IShellService;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteProcess;
+import org.eclipse.remote.core.IRemoteProcessBuilder;
/**
* <p>
- * Implementation of remote command execution using RSE's shell service.
+ * Implementation of remote command execution using IRemoteConnection.
* </p>
*
* @author Patrick Tasse
@@ -48,32 +45,19 @@ public class CommandShell implements ICommandShell {
// Constants
// ------------------------------------------------------------------------
- /** Sub-string to be echo'ed when running command in shell, used to indicate that the command has finished running */
- public static final String DONE_MARKUP_STRING = "--RSE:donedonedone:--"; //$NON-NLS-1$
-
- /** Sub-string to be echoed when running a command in shell. */
- public static final String BEGIN_END_TAG = "BEGIN-END-TAG:"; //$NON-NLS-1$
-
- /** Command delimiter for shell */
- public static final String CMD_DELIMITER = "\n"; //$NON-NLS-1$
-
- /** Shell "echo" command */
- public static final String SHELL_ECHO_CMD = " echo "; //$NON-NLS-1$
-
- /** Default command separator */
- public static final char CMD_SEPARATOR = ';';
+ private static final String BEGIN_TAG = "org.eclipse.linuxtools-BEGIN-TAG:"; //$NON-NLS-1$
+ private static final String END_TAG = "org.eclipse.linuxtools-END-TAG:"; //$NON-NLS-1$
+ private static final String RSE_ADAPTER_ID = "org.eclipse.ptp.remote.RSERemoteServices"; //$NON-NLS-1$
+ private static final String SHELL_ECHO_CMD = "echo "; //$NON-NLS-1$
+ private static final char CMD_SEPARATOR = ';';
+ private static final String CMD_RESULT_VAR = " $?"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- private IRemoteSystemProxy fProxy = null;
- private IHostShell fHostShell = null;
- private BufferedReader fInputBufferReader = null;
- private BufferedReader fErrorBufferReader = null;
+ private IRemoteConnection fConnection = null;
private final ExecutorService fExecutor = Executors.newFixedThreadPool(1);
- private boolean fIsConnected = false;
- private final Random fRandom = new Random(System.currentTimeMillis());
- private int fReturnValue;
+ private int fBackedByShell;
// ------------------------------------------------------------------------
// Constructors
@@ -82,11 +66,10 @@ public class CommandShell implements ICommandShell {
/**
* Create a new command shell
*
- * @param proxy
- * The RSE proxy for this shell
+ * @param connection the remote connection for this shell
*/
- public CommandShell(IRemoteSystemProxy proxy) {
- fProxy = proxy;
+ public CommandShell(IRemoteConnection connection) {
+ fConnection = connection;
}
// ------------------------------------------------------------------------
@@ -95,112 +78,43 @@ public class CommandShell implements ICommandShell {
@Override
public void connect() throws ExecutionException {
- IShellService shellService = fProxy.getShellService();
- Process p = null;
- try {
- String[] env = new String[0];
-
- if (fProxy.isLocal()) {
- env = shellService.getHostEnvironment();
- }
-
- fHostShell = shellService.launchShell("", env, new NullProgressMonitor()); //$NON-NLS-1$
- p = new HostShellProcessAdapter(fHostShell);
- } catch (Exception e) {
- throw new ExecutionException(Messages.TraceControl_CommandShellError, e);
- }
- fInputBufferReader = new BufferedReader(new InputStreamReader(p.getInputStream()));
- fErrorBufferReader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
- fIsConnected = true;
}
@Override
public void disconnect() {
- fIsConnected = false;
- try {
- fInputBufferReader.close();
- fErrorBufferReader.close();
- } catch (IOException e) {
- // ignore
- }
+ fExecutor.shutdown();
}
@Override
- public ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException {
- return executeCommand(command, monitor, true);
- }
-
- @Override
- public ICommandResult executeCommand(final String command, final IProgressMonitor monitor, final boolean checkReturnValue) throws ExecutionException {
- if (fIsConnected) {
+ public ICommandResult executeCommand(final String command, final IProgressMonitor monitor) throws ExecutionException {
+ if (fConnection.isOpen()) {
FutureTask<CommandResult> future = new FutureTask<>(new Callable<CommandResult>() {
@Override
- public CommandResult call() throws IOException, CancellationException {
- final ArrayList<String> result = new ArrayList<>();
- final ArrayList<String> errorResult = new ArrayList<>();
-
- synchronized (fHostShell) {
- // Initialize return value which will be updated in isAliasEchoResult()
- fReturnValue = 0;
-
- int startAlias = fRandom.nextInt();
- int endAlias = fRandom.nextInt();
- fHostShell.writeToShell(formatShellCommand(command, startAlias, endAlias));
-
- String nextLine;
- boolean isStartFound = false;
- while ((nextLine = fInputBufferReader.readLine()) != null) {
-
- if (monitor.isCanceled()) {
- flushInput();
- throw new CancellationException();
- }
-
- // check if line contains echoed start alias
- if (isAliasEchoResult(nextLine, startAlias, true)) {
- isStartFound = true;
- continue;
- }
-
- // check if line contains is the end mark-up. This will retrieve also
- // the return value of the actual command.
- if (isAliasEchoResult(nextLine, endAlias, false)) {
- break;
- }
-
- // Ignore line if
- // 1) start hasn't been found or
- // 2) line is an echo of the command or
- // 3) line is an echo of the end mark-up
- if (!isStartFound ||
- isCommandEcho(nextLine, command) ||
- nextLine.contains(getEchoResult(endAlias)))
- {
- continue;
- }
-
- // Now it's time add to the result
- result.add(nextLine);
- }
-
- // Read any left over output
- flushInput();
-
- // Read error stream output when command failed.
- if (fReturnValue != 0) {
- while(fErrorBufferReader.ready()) {
- if ((nextLine = fErrorBufferReader.readLine()) != null) {
- errorResult.add(nextLine);
- }
- }
- // Workaround if error stream is not available and stderr output is written
- // in standard output above. This is true for the SshTerminalShell implementation.
- if (errorResult.isEmpty()) {
- errorResult.addAll(result);
+ public CommandResult call() throws IOException, InterruptedException {
+ if (monitor == null || !monitor.isCanceled()) {
+ final boolean wrapCommand =
+ RSE_ADAPTER_ID.equals(fConnection.getRemoteServices().getId())
+ && isBackedByShell();
+ IRemoteProcess process = startRemoteProcess(wrapCommand, command);
+ InputReader stdout = new InputReader(process.getInputStream());
+ InputReader stderr = new InputReader(process.getErrorStream());
+
+ try {
+ stdout.waitFor(monitor);
+ stderr.waitFor(monitor);
+ if (monitor == null || !monitor.isCanceled()) {
+ return createResult(wrapCommand, process.waitFor(), stdout.toString(), stderr.toString());
}
+ } catch (OperationCanceledException e) {
+ } catch (InterruptedException e) {
+ return new CommandResult(1, new String[0], new String[] {e.getMessage()});
+ } finally {
+ stdout.stop();
+ stderr.stop();
+ process.destroy();
}
}
- return new CommandResult(fReturnValue, result.toArray(new String[result.size()]), errorResult.toArray(new String[errorResult.size()]));
+ return new CommandResult(1, new String[0], new String[] {"cancelled"}); //$NON-NLS-1$
}
});
@@ -214,122 +128,137 @@ public class CommandShell implements ICommandShell {
throw new ExecutionException(Messages.TraceControl_ExecutionCancelled, ex);
} catch (TimeoutException ex) {
throw new ExecutionException(Messages.TraceControl_ExecutionTimeout, ex);
+ } finally {
+ future.cancel(true);
}
}
throw new ExecutionException(Messages.TraceControl_ShellNotConnected, null);
}
+ private IRemoteProcess startRemoteProcess(boolean wrapCommand, String command) throws IOException {
+ String outputCommand = command;
+ if (wrapCommand) {
+ StringBuilder formattedCommand = new StringBuilder();
+ formattedCommand.append(SHELL_ECHO_CMD).append(BEGIN_TAG);
+ formattedCommand.append(CMD_SEPARATOR);
+ formattedCommand.append(command);
+ formattedCommand.append(CMD_SEPARATOR);
+ formattedCommand.append(SHELL_ECHO_CMD).append(END_TAG).append(CMD_RESULT_VAR);
+ outputCommand = formattedCommand.toString();
+ }
+
+ String[] args = outputCommand.trim().split("\\s+"); //$NON-NLS-1$
+ return fConnection.getProcessBuilder(args).start();
+ }
+
+ private boolean isBackedByShell() throws InterruptedException {
+ if (fBackedByShell == 0) {
+ String cmd= SHELL_ECHO_CMD + BEGIN_TAG + CMD_SEPARATOR + SHELL_ECHO_CMD + END_TAG;
+ IRemoteProcessBuilder pb = fConnection.getProcessBuilder(cmd.trim().split("\\s+")); //$NON-NLS-1$
+ pb.redirectErrorStream(true);
+ IRemoteProcess process = null;
+ InputReader reader = null;
+ try {
+ process = pb.start();
+ reader = new InputReader(process.getInputStream());
+ reader.waitFor(new NullProgressMonitor());
+ process.waitFor();
+
+ fBackedByShell = -1;
+ String result= reader.toString();
+ int pos = result.indexOf(BEGIN_TAG, skipEchoBeginTag(result));
+ if (pos >= 0 && result.substring(pos + BEGIN_TAG.length()).trim().startsWith(END_TAG)) {
+ fBackedByShell = 1;
+ }
+ } catch (IOException e) {
+ // On Windows, cannot start built-in echo command
+ fBackedByShell = -1;
+ } finally {
+ if (process != null) {
+ process.destroy();
+ }
+ if (reader != null) {
+ reader.stop();
+ }
+ }
+ }
+ return fBackedByShell == 1;
+ }
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
- /**
- * Flushes the buffer reader
- * @throws IOException
- */
- private void flushInput() throws IOException {
- char[] cbuf = new char[1];
- while (fInputBufferReader.ready()) {
- if (fInputBufferReader.read(cbuf, 0, 1) == -1) {
- break;
- }
+
+ private static CommandResult createResult(boolean isWrapped, int origResult, String origStdout, String origStderr) {
+ final int result;
+ final String stdout, stderr;
+ if (isWrapped) {
+ String[] holder = {origStdout};
+ result = unwrapOutput(holder);
+ stdout = holder[0];
+ // Workaround if error stream is not available and stderr output is written
+ // in standard output above. This is true for the SshTerminalShell implementation.
+ stderr = origStderr.isEmpty() ? stdout : origStderr;
+ } else {
+ result = origResult;
+ stdout = origStdout;
+ stderr = origStderr;
}
+
+ String[] output = splitLines(stdout);
+ String[] error = result == 0 ? null : splitLines(stderr);
+ return new CommandResult(result, output, error);
}
- /**
- * Format the command to be sent into the shell command with start and end marker strings.
- * The start marker is need to know when the actual command output starts. The end marker
- * string is needed so we can tell that end of output has been reached.
- *
- * @param cmd The actual command
- * @param startAlias The command alias for start marker
- * @param endAlias The command alias for end marker
- * @return formatted command string
- */
- private static String formatShellCommand(String cmd, int startAlias, int endAlias) {
- if (cmd == null || cmd.equals("")) { //$NON-NLS-1$
- return cmd;
+ private static String[] splitLines(String output) {
+ if (output == null) {
+ return null;
}
- StringBuffer formattedCommand = new StringBuffer();
- // Make multi-line command.
- // Wrap actual command with start marker and end marker to wrap actual command.
- formattedCommand.append(getEchoCmd(startAlias));
- formattedCommand.append(CMD_DELIMITER);
- formattedCommand.append(cmd);
- formattedCommand.append(CMD_DELIMITER);
- formattedCommand.append(getEchoCmd(endAlias));
- formattedCommand.append(CMD_DELIMITER);
- return formattedCommand.toString();
+ return output.split("\\r?\\n"); //$NON-NLS-1$
}
- /**
- * Creates a echo command line in the format: echo <start tag> <alias> <end tag> $?
- *
- * @param alias The command alias integer to be included in the echoed message.
- * @return the echo command line
- */
- private static String getEchoCmd(int alias) {
- return SHELL_ECHO_CMD + getEchoResult(alias) + "$?"; //$NON-NLS-1$
- }
+ private static int unwrapOutput(String[] outputHolder) {
+ String output = outputHolder[0];
+ int begin = skipEchoBeginTag(output);
+ begin = output.indexOf(BEGIN_TAG, begin);
- /**
- * Creates the expected result for a given command alias:
- * <start tag> <alias> <end tag> $?
- *
- * @param alias The command alias integer to be included in the echoed message.
- * @return the expected echo result
- */
- private static String getEchoResult(int alias) {
- return BEGIN_END_TAG + String.valueOf(alias) + DONE_MARKUP_STRING;
- }
+ if (begin < 0) {
+ outputHolder[0] = ""; //$NON-NLS-1$
+ return 1;
+ }
- /**
- * Verifies if given command line contains a command alias echo result.
- *
- * @param line The output line to test.
- * @param alias The command alias
- * @param checkReturnValue <code>true</code> to retrieve command result (previous command) <code>false</code>
- * @return <code>true</code> if output line is a command alias echo result else <code>false</code>
- */
- private boolean isAliasEchoResult(String line, int alias, boolean checkReturnValue) {
- String expected = getEchoResult(alias);
- if (line.startsWith(expected)) {
- if (!checkReturnValue) {
- try {
- int k = Integer.valueOf(line.substring(expected.length()));
- fReturnValue = k;
- } catch (NumberFormatException e) {
- // do nothing
- }
+ begin += BEGIN_TAG.length();
+ int end = output.indexOf(END_TAG, begin);
+ if (end < 0) {
+ outputHolder[0] = output.substring(begin).trim();
+ return 1;
+ }
+
+ outputHolder[0] = output.substring(begin, end).trim();
+ String tail = output.substring(end + END_TAG.length()).trim();
+ int numEnd;
+ for (numEnd = 0; numEnd < tail.length(); numEnd++) {
+ if (!Character.isDigit(tail.charAt(numEnd))) {
+ break;
}
- return true;
}
- int index = line.indexOf(expected);
- if ((index > 0) && (line.indexOf(SHELL_ECHO_CMD) == -1)) {
- return true;
+ try {
+ return Integer.parseInt(tail.substring(0, numEnd));
+ } catch (NumberFormatException e) {
+ return 1;
}
-
- return false;
}
- /**
- * Verifies if output line is an echo of the given command line. If the
- * output line is longer then the maximum line lengths (e.g. for ssh), the
- * shell adds a line break character. This method takes this in
- * consideration by comparing the command line without any whitespaces.
- *
- * @param line
- * The output line to verify
- * @param cmd
- * The command executed
- * @return <code>true</code> if it's an echoed command line else
- * <code>false</code>
- */
- @SuppressWarnings("nls")
- private static boolean isCommandEcho(String line, String cmd) {
- String s1 = line.replaceAll("\\s","");
- String s2 = cmd.replaceAll("\\s","");
- s2 = s2.replaceAll("(\\*)", "(\\\\*)");
- String patternStr = ".*(" + s2 +")$";
- return s1.matches(patternStr);
+ private static int skipEchoBeginTag(String output) {
+ final String searchFor = SHELL_ECHO_CMD + BEGIN_TAG;
+ int begin = 0;
+ for(;;) {
+ int i= output.indexOf(searchFor, begin);
+ if (i >= begin) {
+ begin = i + searchFor.length();
+ } else {
+ return begin;
+ }
+ }
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/ICommandShell.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/ICommandShell.java
index ea0417c9fb..33b28a8f34 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/ICommandShell.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/ICommandShell.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,6 +8,7 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote;
@@ -49,23 +50,4 @@ public interface ICommandShell {
*/
ICommandResult executeCommand(String command,
IProgressMonitor monitor) throws ExecutionException;
-
- /**
- * Method to execute a command on the command shell.
- *
- * @param command
- * - the command to executed
- * @param monitor
- * - a progress monitor
- * @param checkReturnValue
- * - flag to indicate that the command result should be checked.
- * If false the command result will be always 0.
- * @return the command result
- * @throws ExecutionException
- * If the command fails
- */
- ICommandResult executeCommand(final String command,
- final IProgressMonitor monitor, final boolean checkReturnValue)
- throws ExecutionException;
-
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/IRemoteSystemProxy.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/IRemoteSystemProxy.java
index c91d82a006..5d13ee0f9a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/IRemoteSystemProxy.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/IRemoteSystemProxy.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,16 +8,15 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.subsystems.ICommunicationsListener;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.shells.IShellService;
-import org.eclipse.rse.services.terminals.ITerminalService;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.remote.core.IRemoteConnectionChangeListener;
+import org.eclipse.remote.core.IRemoteFileManager;
+import org.eclipse.remote.core.IRemoteProcessBuilder;
/**
* <p>
@@ -39,61 +38,32 @@ public interface IRemoteSystemProxy {
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
- /**
- * Find the first shell service.
- *
- * @return shell service object, or <code>null</code> if not found.
- */
- IShellService getShellService();
-
- /**
- * Find the first terminal service.
- *
- * @return shell service object, or <code>null</code> if not found.
- */
- ITerminalService getTerminalService();
-
- /**
- * Find the first IShellServiceSubSystem service.
- *
- * @return shell service subsystem, or <code>null</code> if not found.
- */
- ISubSystem getShellServiceSubSystem();
-
- /**
- * Find the first ITerminalServiceSubSystem service.
- *
- * @return shell service subsystem, or <code>null</code> if not found.
- */
- ISubSystem getTerminalServiceSubSystem();
/**
* Finds the File Service Subsystem.
*
* @return file service subsystem, or <code>null</code> if not found.
*/
- IFileServiceSubSystem getFileServiceSubSystem();
+ IRemoteFileManager getFileServiceSubSystem();
/**
- * @return port of IP connection to be used
+ * Returns a remote process builder for remote launching a process.
+ * @param command the command to be executed.
+ * @return the builder, or <code>null</code> if not possible.
*/
- int getPort();
+ IRemoteProcessBuilder getProcessBuilder(String...command);
- /**
- * Sets the port of the IP connection.
- * @param port - the IP port to set
- */
- void setPort(int port);
/**
* Connects the shell service sub system.
+ * @param monitor a monitor to report progress.
*
* @param callback
* - call-back method being called when connection was finished
* @throws ExecutionException
* If the connection fails
*/
- void connect(IRSECallback callback) throws ExecutionException;
+ void connect(IProgressMonitor monitor) throws ExecutionException;
/**
* Disconnects from the shell service sub system.
@@ -104,6 +74,11 @@ public interface IRemoteSystemProxy {
void disconnect() throws ExecutionException;
/**
+ * Disposes the proxy, may close the connection.
+ */
+ void dispose();
+
+ /**
* Creates a command shell.
*
* @return the command shell implementation
@@ -119,7 +94,7 @@ public interface IRemoteSystemProxy {
* @param listener
* - listener to add
*/
- void addCommunicationListener(ICommunicationsListener listener);
+ void addConnectionChangeListener(IRemoteConnectionChangeListener listener);
/**
* Method to remove a communication listener from the connector service
@@ -128,13 +103,10 @@ public interface IRemoteSystemProxy {
* @param listener
* - listener to remove
*/
- void removeCommunicationListener(ICommunicationsListener listener);
+ void removeConnectionChangeListener(IRemoteConnectionChangeListener listener);
/**
- * Checks whether the local host connector service is used or not.
- *
- * @return <code>true</code> if local connection else <false>
- *
+ * @return whether the remote host is currently connected.
*/
- public boolean isLocal();
+ boolean isConnected();
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/InputReader.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/InputReader.java
new file mode 100644
index 0000000000..af73e8292f
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/InputReader.java
@@ -0,0 +1,61 @@
+/**********************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+class InputReader {
+ private final InputStreamReader fReader;
+ private final Thread fThread;
+ private final StringBuilder fResult;
+ private volatile boolean fDone;
+
+ public InputReader(InputStream inputStream) {
+ fResult = new StringBuilder();
+ fReader = new InputStreamReader(inputStream);
+ fThread = new Thread() {
+ @Override
+ public void run() {
+ final char[] buffer = new char[1024];
+ int read;
+ try {
+ while (!fDone && (read = fReader.read(buffer)) > 0) {
+ fResult.append(buffer, 0, read);
+ }
+ } catch (IOException e) {
+ }
+ }
+ };
+ fThread.start();
+ }
+
+ public void waitFor(IProgressMonitor monitor) throws InterruptedException {
+ while (fThread.isAlive() && (monitor == null || !monitor.isCanceled())) {
+ fThread.join(300);
+ }
+ }
+
+ public void stop() {
+ fDone = true;
+ fThread.interrupt();
+ }
+
+ @Override
+ public String toString() {
+ return fResult.toString();
+ }
+
+}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/RemoteSystemProxy.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/RemoteSystemProxy.java
index 8ddc210ea5..a987242682 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/RemoteSystemProxy.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/RemoteSystemProxy.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,21 +8,18 @@
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.subsystems.ICommunicationsListener;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.IService;
-import org.eclipse.rse.services.shells.IShellService;
-import org.eclipse.rse.services.terminals.ITerminalService;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionChangeEvent;
+import org.eclipse.remote.core.IRemoteConnectionChangeListener;
+import org.eclipse.remote.core.IRemoteFileManager;
+import org.eclipse.remote.core.IRemoteProcessBuilder;
+import org.eclipse.remote.core.exception.RemoteConnectionException;
/**
* <p>
@@ -31,13 +28,14 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys
*
* @author Bernd Hufmann
*/
-public class RemoteSystemProxy implements IRemoteSystemProxy {
+public class RemoteSystemProxy implements IRemoteSystemProxy, IRemoteConnectionChangeListener {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- private final IHost fHost;
+ private IRemoteConnection fHost;
+ private boolean fExplicitConnect;
// ------------------------------------------------------------------------
// Constructors
@@ -49,8 +47,9 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
* @param host
* The host of this proxy
*/
- public RemoteSystemProxy(IHost host) {
+ public RemoteSystemProxy(IRemoteConnection host) {
fHost = host;
+ fHost.addConnectionChangeListener(this);
}
// ------------------------------------------------------------------------
@@ -58,146 +57,68 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
// ------------------------------------------------------------------------
@Override
- public IShellService getShellService() {
- ISubSystem ss = getShellServiceSubSystem();
- if (ss != null) {
- return (IShellService)ss.getSubSystemConfiguration().getService(fHost).getAdapter(IShellService.class);
- }
- return null;
- }
-
- @Override
- public ITerminalService getTerminalService() {
- ISubSystem ss = getTerminalServiceSubSystem();
- if (ss != null) {
- return (ITerminalService)ss.getSubSystemConfiguration().getService(fHost).getAdapter(ITerminalService.class);
- }
- return null;
- }
-
- @Override
- public ISubSystem getShellServiceSubSystem() {
- if (fHost == null) {
- return null;
- }
- ISubSystem[] subSystems = fHost.getSubSystems();
- IShellService ssvc = null;
- for (int i = 0; subSystems != null && i < subSystems.length; i++) {
- IService svc = subSystems[i].getSubSystemConfiguration().getService(fHost);
- if (svc!=null) {
- ssvc = (IShellService)svc.getAdapter(IShellService.class);
- if (ssvc != null) {
- return subSystems[i];
- }
- }
- }
- return null;
+ public IRemoteFileManager getFileServiceSubSystem() {
+ return fHost.getFileManager();
}
@Override
- public ISubSystem getTerminalServiceSubSystem() {
- if (fHost == null) {
- return null;
- }
- ISubSystem[] subSystems = fHost.getSubSystems();
- ITerminalService ssvc = null;
- for (int i = 0; subSystems != null && i < subSystems.length; i++) {
- IService svc = subSystems[i].getSubSystemConfiguration().getService(fHost);
- if (svc!=null) {
- ssvc = (ITerminalService)svc.getAdapter(ITerminalService.class);
- if (ssvc != null) {
- return subSystems[i];
- }
- }
- }
- return null;
+ public IRemoteProcessBuilder getProcessBuilder(String...command) {
+ return fHost.getProcessBuilder(command);
}
@Override
- public IFileServiceSubSystem getFileServiceSubSystem() {
- if (fHost == null) {
- return null;
- }
- ISubSystem[] subSystems = fHost.getSubSystems();
- for (int i = 0; subSystems != null && i < subSystems.length; i++) {
- if (subSystems[i] instanceof IFileServiceSubSystem) {
- return (IFileServiceSubSystem)subSystems[i];
+ public void connect(IProgressMonitor monitor) throws ExecutionException {
+ try {
+ if (!fHost.isOpen()) {
+ fExplicitConnect = true;
+ fHost.open(monitor);
}
+ } catch (RemoteConnectionException e) {
+ throw new ExecutionException("Cannot connect " + fHost.getName(), e); //$NON-NLS-1$
}
- return null;
}
@Override
- public int getPort() {
- if (getShellServiceSubSystem() != null) {
- return getShellServiceSubSystem().getConnectorService().getPort();
- }
- return IRemoteSystemProxy.INVALID_PORT_NUMBER;
+ public void disconnect() throws ExecutionException {
+ fHost.close();
}
@Override
- public void setPort(int port) {
- if ((getShellServiceSubSystem() != null) && (port > 0)) {
- getShellServiceSubSystem().getConnectorService().setPort(port);
+ public void dispose() {
+ fHost.removeConnectionChangeListener(this);
+ if (fExplicitConnect) {
+ fHost.close();
}
}
@Override
- public void connect(IRSECallback callback) throws ExecutionException {
- ISubSystem shellSubSystem = getShellServiceSubSystem();
- if (shellSubSystem != null) {
- if (!shellSubSystem.isConnected()) {
- try {
- shellSubSystem.connect(false, callback);
- } catch (OperationCanceledException e) {
- callback.done(Status.CANCEL_STATUS, null);
- }
- catch (Exception e) {
- throw new ExecutionException(e.toString(), e);
- }
- } else {
- callback.done(Status.OK_STATUS, null);
- }
- }
+ public ICommandShell createCommandShell() throws ExecutionException {
+ ICommandShell shell = new CommandShell(fHost);
+ shell.connect();
+ return shell;
}
@Override
- public void disconnect() throws ExecutionException {
- ISubSystem shellSubSystem = getShellServiceSubSystem();
- if (shellSubSystem != null) {
- try {
- shellSubSystem.disconnect();
- } catch (Exception e) {
- throw new ExecutionException(e.toString(), e);
- }
- }
+ public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
+ fHost.addConnectionChangeListener(listener);
}
@Override
- public ICommandShell createCommandShell() throws ExecutionException {
- ICommandShell shell = new CommandShell(this);
- shell.connect();
- return shell;
+ public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
+ fHost.removeConnectionChangeListener(listener);
}
@Override
- public void addCommunicationListener(ICommunicationsListener listener) {
- IConnectorService[] css = fHost.getConnectorServices();
- for (IConnectorService cs : css) {
- cs.addCommunicationsListener(listener);
- }
+ public boolean isConnected() {
+ return fHost.isOpen();
}
@Override
- public void removeCommunicationListener(ICommunicationsListener listener) {
- IConnectorService[] css = fHost.getConnectorServices();
- for (IConnectorService cs : css) {
- cs.removeCommunicationsListener(listener);
+ public void connectionChanged(IRemoteConnectionChangeEvent event) {
+ int type = event.getType();
+ if (type == IRemoteConnectionChangeEvent.CONNECTION_ABORTED ||
+ type == IRemoteConnectionChangeEvent.CONNECTION_CLOSED) {
+ fExplicitConnect = false;
}
}
-
- @Override
- public boolean isLocal() {
- return fHost.getSystemType().isLocal();
- }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/service/LTTngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/service/LTTngControlService.java
index 75a87ab013..123b99c4cf 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/service/LTTngControlService.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/service/LTTngControlService.java
@@ -11,6 +11,7 @@
* Bernd Hufmann - Updated for support of LTTng Tools 2.1
* Simon Delisle - Updated for support of LTTng Tools 2.2
* Marc-Andre Laperle - Support for creating a live session
+ * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.service;
@@ -1562,8 +1563,7 @@ public class LTTngControlService implements ILttngControlService {
ControlCommandLogger.log(command);
}
- ICommandResult result = fCommandShell.executeCommand(
- command.toString(), monitor);
+ ICommandResult result = fCommandShell.executeCommand(command, monitor);
if (ControlPreferences.getInstance().isLoggingEnabled()) {
ControlCommandLogger.log(formatOutput(result));
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control/feature.xml b/lttng/org.eclipse.linuxtools.lttng2.control/feature.xml
index 564f58ab8a..3d752de15f 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control/feature.xml
+++ b/lttng/org.eclipse.linuxtools.lttng2.control/feature.xml
@@ -36,7 +36,7 @@
<import plugin="org.eclipse.linuxtools.tmf.core" version="3.1.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.linuxtools.tmf.ui" version="3.1.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.help"/>
- <import feature="org.eclipse.rse" version="3.1.100" match="greaterOrEqual"/>
+ <import feature="org.eclipse.remote" version="1.1.0" match="greaterOrEqual"/>
</requires>
<plugin
diff --git a/lttng/org.eclipse.linuxtools.tracing.rcp.product/tracing.product b/lttng/org.eclipse.linuxtools.tracing.rcp.product/tracing.product
index ab26e97844..ff470bb13f 100644
--- a/lttng/org.eclipse.linuxtools.tracing.rcp.product/tracing.product
+++ b/lttng/org.eclipse.linuxtools.tracing.rcp.product/tracing.product
@@ -192,9 +192,6 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
<feature id="org.eclipse.linuxtools.lttng2.ust"/>
<feature id="org.eclipse.linuxtools.lttng2.control"/>
<feature id="org.eclipse.equinox.p2.core.feature"/>
- <feature id="org.eclipse.rse.local"/>
- <feature id="org.eclipse.rse.dstore"/>
- <feature id="org.eclipse.rse.telnet"/>
<feature id="org.eclipse.platform"/>
<feature id="org.eclipse.tm.terminal"/>
<feature id="org.eclipse.help"/>
@@ -202,14 +199,9 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
<feature id="org.eclipse.equinox.p2.rcp.feature"/>
<feature id="org.eclipse.equinox.p2.user.ui"/>
<feature id="org.eclipse.linuxtools.tmf"/>
- <feature id="org.eclipse.rse.ssh"/>
- <feature id="org.eclipse.rse.core"/>
- <feature id="org.eclipse.rse.ftp"/>
<feature id="org.eclipse.rcp"/>
<feature id="org.eclipse.e4.rcp"/>
- <feature id="org.eclipse.rse"/>
<feature id="org.eclipse.emf.common"/>
- <feature id="org.eclipse.rse.terminals"/>
<feature id="org.eclipse.equinox.p2.extras.feature"/>
<feature id="org.eclipse.linuxtools.ctf"/>
<feature id="org.eclipse.linuxtools.tmf.ctf"/>
@@ -220,6 +212,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
<feature id="org.eclipse.ecf.filetransfer.ssl.feature"/>
<feature id="org.eclipse.ecf.core.feature"/>
<feature id="org.eclipse.ecf.filetransfer.feature"/>
+ <feature id="org.eclipse.remote"/>
</features>
<configurations>
diff --git a/lttng/org.eclipse.linuxtools.tracing.rcp/feature.xml b/lttng/org.eclipse.linuxtools.tracing.rcp/feature.xml
index 1144a3214b..c7ac3bdfac 100644
--- a/lttng/org.eclipse.linuxtools.tracing.rcp/feature.xml
+++ b/lttng/org.eclipse.linuxtools.tracing.rcp/feature.xml
@@ -82,4 +82,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.ui.trace"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/lttng/org.eclipse.linuxtools.tracing.rcp/pom.xml b/lttng/org.eclipse.linuxtools.tracing.rcp/pom.xml
index 04713ac49e..2ac06d24f3 100644
--- a/lttng/org.eclipse.linuxtools.tracing.rcp/pom.xml
+++ b/lttng/org.eclipse.linuxtools.tracing.rcp/pom.xml
@@ -53,6 +53,7 @@
<plugin id="org.eclipse.equinox.launcher.gtk.linux.x86_64"/>
<plugin id="org.eclipse.equinox.launcher.win32.win32.x86"/>
<plugin id="org.eclipse.ui.cocoa"/>
+ <plugin id="org.eclipse.ui.trace"/>
<plugin id="org.eclipse.core.filesystem.linux.x86"/>
<plugin id="org.eclipse.core.filesystem.linux.x86_64"/>
<plugin id="org.eclipse.core.filesystem.solaris.sparc"/>

Back to the top