Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/IRemoteProxyManager.java5
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java42
-rw-r--r--profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java20
-rw-r--r--profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTFileProxy.java16
-rw-r--r--profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/RDTProxyManager.java33
5 files changed, 90 insertions, 26 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/IRemoteProxyManager.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/IRemoteProxyManager.java
index 9b63e19a34..1af3ee7ccc 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/IRemoteProxyManager.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/IRemoteProxyManager.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.linuxtools.profiling.launch;
+import java.net.URI;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -18,6 +20,9 @@ public interface IRemoteProxyManager {
String MANAGER_NAME = "manager"; //$NON-NLS-1$
String SCHEME_ID = "scheme"; //$NON-NLS-1$
public IRemoteFileProxy getFileProxy(IProject project) throws CoreException;
+ public IRemoteFileProxy getFileProxy(URI uri) throws CoreException;
public IRemoteCommandLauncher getLauncher(IProject project) throws CoreException;
+ public IRemoteCommandLauncher getLauncher(URI uri) throws CoreException;
public String getOS(IProject project) throws CoreException;
+ public String getOS(URI uri) throws CoreException;
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java
index 4a158f7b84..88732274b3 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java
@@ -69,37 +69,49 @@ public class RemoteProxyManager implements IRemoteProxyManager {
}
return remoteManager;
}
-
- public IRemoteFileProxy getFileProxy(IProject project) throws CoreException {
- URI projectURI = project.getLocationURI();
- String scheme = projectURI.getScheme();
- if (scheme != null && !LocalHost.equals(projectURI.getHost())) {
+
+ public IRemoteFileProxy getFileProxy(URI uri) throws CoreException {
+ String scheme = uri.getScheme();
+ if (scheme != null && !LocalHost.equals(uri.getHost())) {
IRemoteProxyManager manager = getRemoteManager(scheme);
if (manager != null)
- return manager.getFileProxy(project);
+ return manager.getFileProxy(uri);
}
return getLocalFileProxy();
}
-
- public IRemoteCommandLauncher getLauncher(IProject project) throws CoreException {
+
+ public IRemoteFileProxy getFileProxy(IProject project) throws CoreException {
URI projectURI = project.getLocationURI();
- String scheme = projectURI.getScheme();
- if (scheme != null && !LocalHost.equals(projectURI.getHost())) {
+ return getFileProxy(projectURI);
+ }
+
+ public IRemoteCommandLauncher getLauncher(URI uri) throws CoreException {
+ String scheme = uri.getScheme();
+ if (scheme != null && !LocalHost.equals(uri.getHost())) {
IRemoteProxyManager manager = getRemoteManager(scheme);
if (manager != null)
- return manager.getLauncher(project);
+ return manager.getLauncher(uri);
}
return new LocalLauncher();
}
- public String getOS(IProject project) throws CoreException {
+ public IRemoteCommandLauncher getLauncher(IProject project) throws CoreException {
URI projectURI = project.getLocationURI();
- String scheme = projectURI.getScheme();
- if (scheme != null && !LocalHost.equals(projectURI.getHost())) {
+ return getLauncher(projectURI);
+ }
+
+ public String getOS(URI uri) throws CoreException {
+ String scheme = uri.getScheme();
+ if (scheme != null && !LocalHost.equals(uri.getHost())) {
IRemoteProxyManager manager = getRemoteManager(scheme);
if (manager != null)
- return manager.getOS(project);
+ return manager.getOS(uri);
}
return Platform.getOS();
}
+
+ public String getOS(IProject project) throws CoreException {
+ URI projectURI = project.getLocationURI();
+ return getOS(projectURI);
+ }
}
diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java
index dd87b96570..f1dce3e75f 100644
--- a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java
+++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java
@@ -48,7 +48,7 @@ public class RDTCommandLauncher implements IRemoteCommandLauncher {
protected String fErrorMessage = ""; //$NON-NLS-1$
private String lineSeparator;
- private IProject fProject;
+ private URI uri;
/**
* The number of milliseconds to pause between polling.
@@ -63,7 +63,19 @@ public class RDTCommandLauncher implements IRemoteCommandLauncher {
public RDTCommandLauncher(IProject project) {
fProcess = null;
fShowCommand = false;
- fProject = project;
+ uri = project.getLocationURI();
+ lineSeparator = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Creates a new launcher Fills in stderr and stdout output to the given
+ * streams. Streams can be set to <code>null</code>, if output not
+ * required
+ */
+ public RDTCommandLauncher(URI uri) {
+ fProcess = null;
+ fShowCommand = false;
+ this.uri = uri;
lineSeparator = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -74,6 +86,7 @@ public class RDTCommandLauncher implements IRemoteCommandLauncher {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.ICommandLauncher#getErrorMessage()
*/
+ @Override
public String getErrorMessage() {
return fErrorMessage;
}
@@ -113,12 +126,12 @@ public class RDTCommandLauncher implements IRemoteCommandLauncher {
/**
* @see org.eclipse.cdt.core.IRemoteCommandLauncher#execute(IPath, String[], String[], IPath, IProgressMonitor)
*/
+ @Override
public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory, IProgressMonitor monitor) throws CoreException {
try {
// add platform specific arguments (shell invocation)
fCommandArgs = constructCommandArray(commandPath.toOSString(), args);
fShowCommand = true;
- URI uri = fProject.getLocationURI();
IRemoteServices services = PTPRemoteCorePlugin.getDefault().getRemoteServices(uri);
IRemoteConnection connection = services.getConnectionManager().getConnection(uri);
IRemoteFileManager fm = services.getFileManager(connection);
@@ -147,6 +160,7 @@ public class RDTCommandLauncher implements IRemoteCommandLauncher {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IRemoteCommandLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public int waitAndRead(OutputStream output, OutputStream err, IProgressMonitor monitor) {
if (fShowCommand) {
printCommandLine(output);
diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTFileProxy.java b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTFileProxy.java
index d22219631d..093b3f1bda 100644
--- a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTFileProxy.java
+++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTFileProxy.java
@@ -14,15 +14,23 @@ import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin;
public class RDTFileProxy implements IRemoteFileProxy {
private IRemoteFileManager manager;
-
- public RDTFileProxy(IProject project) {
- URI uri = project.getLocationURI();
+
+ private void initialize(URI uri) {
IRemoteServices services = PTPRemoteCorePlugin.getDefault().getRemoteServices(uri);
services.initialize();
IRemoteConnection connection = services.getConnectionManager().getConnection(uri);
manager = services.getFileManager(connection);
}
-
+
+ public RDTFileProxy(URI uri) {
+ initialize(uri);
+ }
+
+ public RDTFileProxy(IProject project) {
+ URI uri = project.getLocationURI();
+ initialize(uri);
+ }
+
@Override
public URI toURI(IPath path) {
return manager.toURI(path);
diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/RDTProxyManager.java b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/RDTProxyManager.java
index 7cdc7241fb..a978a91501 100644
--- a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/RDTProxyManager.java
+++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/RDTProxyManager.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.linuxtools.rdt.proxy;
+import java.net.URI;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.linuxtools.internal.rdt.proxy.RDTCommandLauncher;
@@ -17,26 +19,49 @@ import org.eclipse.linuxtools.internal.rdt.proxy.RDTFileProxy;
import org.eclipse.linuxtools.profiling.launch.IRemoteCommandLauncher;
import org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy;
import org.eclipse.linuxtools.profiling.launch.IRemoteProxyManager;
+import org.eclipse.ptp.remote.core.IRemoteConnection;
+import org.eclipse.ptp.remote.core.IRemoteServices;
+import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin;
public class RDTProxyManager implements IRemoteProxyManager {
@Override
+ public IRemoteFileProxy getFileProxy(URI uri) throws CoreException {
+ return new RDTFileProxy(uri);
+ }
+
+ @Override
public IRemoteFileProxy getFileProxy(IProject project) throws CoreException {
return new RDTFileProxy(project);
}
@Override
+ public IRemoteCommandLauncher getLauncher(URI uri)
+ throws CoreException {
+ return new RDTCommandLauncher(uri);
+ }
+
+ @Override
public IRemoteCommandLauncher getLauncher(IProject project)
throws CoreException {
return new RDTCommandLauncher(project);
}
@Override
+ public String getOS(URI uri) throws CoreException {
+ IRemoteServices services = PTPRemoteCorePlugin.getDefault().getRemoteServices(uri);
+ IRemoteConnection connection = services.getConnectionManager().getConnection(uri);
+ String os = connection.getProperty(IRemoteConnection.OS_NAME_PROPERTY);
+ if (os == null || os.length() == 0)
+ //FIXME: need better way to get this property
+ return "Linux"; //$NON-NLS-1$
+ return os;
+ }
+
+ @Override
public String getOS(IProject project) throws CoreException {
-// URI uri = project.getLocationURI();
-// IRemoteServices services = PTPRemoteCorePlugin.getDefault().getRemoteServices(uri);
-// IRemoteConnection connection = services.getConnectionManager().getConnection(uri);
- return "Linux"; //FIXME: why doesn't getProperty("os.name") work?
+ URI uri = project.getLocationURI();
+ return getOS(uri);
}
}

Back to the top