Skip to contentSkip to conversation

Initial commit for remote proof of concept

PATCH New Ioana Grigoropol 1 participant 1 message Feb 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Initial commit for remote proof of concept

---
 core/org.eclipse.cdt.core/META-INF/MANIFEST.MF     |    1 +
 .../cdt/internal/core/model/CModelManager.java     |   17 +-
 .../pdom/indexer/ProjectIndexerInputAdapter.java   |    2 +-
 core/org.eclipse.cdt.core/plugin.xml               |    1 +
 .../schema/RemoteProxyManager.exsd                 |  114 ++++++++++
 .../src/org/eclipse/cdt/core/CommandLauncher.java  |   31 ++-
 .../core/remoteproxy/IRemoteCommandLauncher.java   |   31 +++
 .../core/remoteproxy/IRemoteFileProxy.java         |   26 +++
 .../core/remoteproxy/IRemoteProxyManager.java      |   23 ++
 .../internal/core/remoteproxy/LocalFileProxy.java  |   54 +++++
 .../internal/core/remoteproxy/LocalLauncher.java   |   62 ++++++
 .../core/remoteproxy/RemoteProxyManager.java       |  112 ++++++++++
 core/org.eclipse.cdt.rdt.proxy/.classpath          |    7 +
 core/org.eclipse.cdt.rdt.proxy/.project            |   28 +++
 .../.settings/org.eclipse.jdt.core.prefs           |    8 +
 .../org.eclipse.cdt.rdt.proxy/META-INF/MANIFEST.MF |   15 ++
 core/org.eclipse.cdt.rdt.proxy/build.properties    |    5 +
 core/org.eclipse.cdt.rdt.proxy/plugin.xml          |   19 ++
 .../src/org/eclipse/cdt/rdt/proxy/Activator.java   |   81 +++++++
 .../org/eclipse/cdt/rdt/proxy/RDTProxyManager.java |   44 ++++
 .../org/eclipse/cdt/rdt/proxy/Resources.properties |   11 +
 .../rdt/internal/rdt/proxy/RDTCommandLauncher.java |  227 +++++++++++++++++++
 .../rdt/internal/rdt/proxy/RDTFileProxy.java       |   51 +++++
 .../internal/rdt/proxy/RemoteProcessClosure.java   |  234 ++++++++++++++++++++
 .../org/eclipse/cdt/debug/core/CDebugUtils.java    |  109 +++++++++
 launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF |    3 +-
 .../cdt/launch/AbstractCLaunchDelegate.java        |  121 +++++++++-
 .../launch/internal/LocalCDILaunchDelegate.java    |   43 +++-
 28 files changed, 1465 insertions(+), 15 deletions(-)
 create mode 100644 core/org.eclipse.cdt.core/schema/RemoteProxyManager.exsd
 create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/IRemoteCommandLauncher.java
 create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/IRemoteFileProxy.java
 create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/IRemoteProxyManager.java
 create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/LocalFileProxy.java
 create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/LocalLauncher.java
 create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/RemoteProxyManager.java
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/.classpath
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/.project
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/.settings/org.eclipse.jdt.core.prefs
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/META-INF/MANIFEST.MF
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/build.properties
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/plugin.xml
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/cdt/rdt/proxy/Activator.java
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/cdt/rdt/proxy/RDTProxyManager.java
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/cdt/rdt/proxy/Resources.properties
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/rdt/internal/rdt/proxy/RDTCommandLauncher.java
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/rdt/internal/rdt/proxy/RDTFileProxy.java
 create mode 100644 core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/rdt/internal/rdt/proxy/RemoteProcessClosure.java
core/org.eclipse.cdt.core/META-INF/MANIFEST.MF +1 -0
index 9130967..adcc8a1 100644
@@ -84,6 +84,7 @@ Export-Package: org.eclipse.cdt.core,
  org.eclipse.cdt.internal.core.pdom.dom.cpp;x-internal:=true,
  org.eclipse.cdt.internal.core.pdom.export;x-internal:=true,
  org.eclipse.cdt.internal.core.pdom.indexer;x-friends:="org.eclipse.cdt.ui",
+ org.eclipse.cdt.internal.core.remoteproxy;x-friends:="org.eclipse.cdt.managedbuilder.core,org.eclipse.cdt.rdt.proxy",
  org.eclipse.cdt.internal.core.resources;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.make.core,org.eclipse.cdt.codan.ui.cxx",
  org.eclipse.cdt.internal.core.settings.model;x-internal:=true,
  org.eclipse.cdt.internal.core.util;x-internal:=true,
core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java +14 -3
index 16deb2d..2c47e7d 100644
@@ -61,6 +61,8 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
 import org.eclipse.cdt.core.settings.model.ICSettingObject;
 import org.eclipse.cdt.internal.core.CCoreInternals;
 import org.eclipse.cdt.internal.core.LocalProjectScope;
+import org.eclipse.cdt.internal.core.remoteproxy.IRemoteFileProxy;
+import org.eclipse.cdt.internal.core.remoteproxy.RemoteProxyManager;
 import org.eclipse.cdt.internal.core.resources.ResourceLookup;
 import org.eclipse.cdt.internal.core.settings.model.CProjectDescription;
 import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
@@ -170,9 +172,9 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
 	 */
 	private HashMap<ICProject, SourceMapper> sourceMappers = new HashMap<ICProject, SourceMapper>();
 
-	public static final IWorkingCopy[] NoWorkingCopy = {};
+	public static final IWorkingCopy[] NoWorkingCopy = new IWorkingCopy[0];
 
-	static volatile CModelManager factory;
+	static volatile CModelManager factory = null;
 
 	private CModelManager() {
 	}
@@ -731,8 +733,17 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
 			}
 		}
 
-		IPath location = file.getLocation();
+//		IPath location = file.getLocation();
 
+		IRemoteFileProxy proxy;
+		try {
+			proxy = RemoteProxyManager.getInstance().getFileProxy(file.getProject());
+		} catch (CoreException e1) {
+			return null;
+		}
+		URI fileLocationURI = file.getLocationURI();
+		IPath location = new Path(proxy.toPath(fileLocationURI));
+		
 		for (BinaryParserConfig parser2 : parsers) {
 			try {
 				IBinaryParser parser = parser2.getBinaryParser();
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerInputAdapter.java +1 -1
index e24dce8..9499771 100644
@@ -318,7 +318,7 @@ public class ProjectIndexerInputAdapter extends IndexerInputAdapter {
 	@Override
 	public FileContent getCodeReader(Object tuo) {
 		ITranslationUnit tu= (ITranslationUnit) tuo;
-		if (tu.getLocation() == null)
+		if (tu.getLocationURI() == null)
 			return null;
 
 		final FileContent reader= FileContent.create(tu);
core/org.eclipse.cdt.core/plugin.xml +1 -0
index bb1125c..6515a15 100644
@@ -673,6 +673,7 @@
    <extension-point id="RefreshExclusionFactory" name="%refreshExclusionFactory.name" schema="schema/RefreshExclusionFactory.exsd"/>
    <extension-point id="LanguageSettingsProvider" name="%LanguageSettingsProvider.name" schema="schema/LanguageSettingsProvider.exsd"/>
    <extension-point id="UNCPathConverter" name="%uncPathConverter.name" schema="schema/UNCPathConverter.exsd"/>
+   <extension-point id="RemoteProxyManager" name="RemoteProxyManager" schema="schema/RemoteProxyManager.exsd"/>
 
    <extension
          point="org.eclipse.cdt.core.templateProcessTypes">
core/org.eclipse.cdt.core/schema/RemoteProxyManager.exsd new file +114 -0

114 lines not on this page · raw message

core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java +30 -1
index a5e0555..5a8b946 100644
@@ -19,6 +19,7 @@ import org.eclipse.cdt.internal.core.Cygwin;
 import org.eclipse.cdt.internal.core.Messages;
 import org.eclipse.cdt.internal.core.ProcessClosure;
 import org.eclipse.cdt.utils.PathUtil;
+import org.eclipse.cdt.utils.pty.PTY;
 import org.eclipse.cdt.utils.spawner.EnvironmentReader;
 import org.eclipse.cdt.utils.spawner.ProcessFactory;
 import org.eclipse.core.resources.IProject;
@@ -45,6 +46,8 @@ public class CommandLauncher implements ICommandLauncher {
 	private Properties fEnvironment = null;
 
 	protected String fErrorMessage = ""; //$NON-NLS-1$
+
+	private String lineSeparator;
 	private IProject fProject;
 
 	/**
@@ -60,6 +63,7 @@ public class CommandLauncher implements ICommandLauncher {
 	public CommandLauncher() {
 		fProcess = null;
 		fShowCommand = false;
+		lineSeparator = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	/* (non-Javadoc)
@@ -157,7 +161,32 @@ public class CommandLauncher implements ICommandLauncher {
 		return null;
 	}
 
-
+	/**
+	 * @since 8.0.1
+	 * @see org.eclipse.cdt.core.ICommandLauncher#execute(IPath, String[], String[], IPath, IProgressMonitor)
+	 */
+	public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory, 
+			boolean usePTY, IProgressMonitor monitor) throws CoreException {
+		try {
+			// add platform specific arguments (shell invocation)
+			fCommandArgs = constructCommandArray(commandPath.toOSString(), args);
+			
+			File file = null;
+			
+			if(changeToDirectory != null)
+				file = changeToDirectory.toFile();
+			
+			if (usePTY && PTY.isSupported())
+				fProcess = ProcessFactory.getFactory().exec(fCommandArgs, env, file, new PTY());
+			else
+				fProcess = ProcessFactory.getFactory().exec(fCommandArgs, env, file);
+			fErrorMessage = ""; //$NON-NLS-1$
+		} catch (IOException e) {
+			setErrorMessage(e.getMessage());
+			fProcess = null;
+		}
+		return fProcess;
+	}
 	/**
 	 * @since 5.1
 	 * @see org.eclipse.cdt.core.ICommandLauncher#execute(IPath, String[], String[], IPath, IProgressMonitor)
core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/IRemoteCommandLauncher.java new file +31 -0
new file mode 100644
index 0000000..09a7d9e
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * 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:
+ *     Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.remoteproxy;
+
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface IRemoteCommandLauncher {
+	
+	public final static int OK = 0;
+	public final static int COMMAND_CANCELED = 1;
+	public final static int ILLEGAL_COMMAND = -1;
+	
+	public Process execute(String commandPath, String[] args, String[] env, String changeToDirectory, IProgressMonitor monitor) throws CoreException;
+	public Process execute(String commandPath, String[] args, String[] env, String changeToDirectory, boolean usePTY, IProgressMonitor monitor) throws CoreException;
+	public int waitAndRead(OutputStream output, OutputStream err, IProgressMonitor monitor);
+	public String getErrorMessage();
+	public String getCommandLine();
+	
+}
\ No newline at end of file
core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/IRemoteFileProxy.java new file +26 -0
new file mode 100644
index 0000000..cac25b3
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * 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:
+ *     Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.remoteproxy;
+
+import java.net.URI;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+
+public interface IRemoteFileProxy {
+	
+	public URI toURI(IPath path);
+	public URI toURI(String path);
+	public String toPath(URI uri);
+	public String getDirectorySeparator();
+	public IFileStore getResource(String path);
+
+}
core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/IRemoteProxyManager.java new file +23 -0
new file mode 100644
index 0000000..cc8c0cd
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * 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:
+ *     Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.remoteproxy;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+public interface IRemoteProxyManager {
+	String EXTENSION_POINT_ID = "RemoteProxyManager"; //$NON-NLS-1$
+	String MANAGER_NAME = "manager"; //$NON-NLS-1$
+	String SCHEME_ID = "scheme"; //$NON-NLS-1$ 
+	public IRemoteFileProxy getFileProxy(IProject project) throws CoreException;
+	public IRemoteCommandLauncher getLauncher(IProject project) throws CoreException;
+	public String getOS(IProject project) throws CoreException;
+}
core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/LocalFileProxy.java new file +54 -0

54 lines not on this page · raw message

core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/LocalLauncher.java new file +62 -0

62 lines not on this page · raw message

core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/remoteproxy/RemoteProxyManager.java new file +112 -0

112 lines not on this page · raw message

core/org.eclipse.cdt.rdt.proxy/.classpath new file +7 -0
new file mode 100644
index 0000000..ad32c83
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
core/org.eclipse.cdt.rdt.proxy/.project new file +28 -0
new file mode 100644
index 0000000..0da1ab2
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.cdt.rdt.proxy</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
core/org.eclipse.cdt.rdt.proxy/.settings/org.eclipse.jdt.core.prefs new file +8 -0
new file mode 100644
index 0000000..b249467
@@ -0,0 +1,8 @@
+#Mon Nov 21 18:56:58 EST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
core/org.eclipse.cdt.rdt.proxy/META-INF/MANIFEST.MF new file +15 -0
new file mode 100644
index 0000000..1242325
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CDT Remote Proxy
+Bundle-SymbolicName: org.eclipse.cdt.rdt.proxy;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.rdt.proxy.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ptp.rdt.core;bundle-version="3.1.100",
+ org.eclipse.ptp.remote.core;bundle-version="5.0.0",
+ org.eclipse.cdt.core;bundle-version="5.4.0",
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.eclipse.core.filesystem;bundle-version="1.3.100",
+ org.eclipse.ui;bundle-version="3.7.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
core/org.eclipse.cdt.rdt.proxy/build.properties new file +5 -0
new file mode 100644
index 0000000..e9863e2
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml
core/org.eclipse.cdt.rdt.proxy/plugin.xml new file +19 -0
new file mode 100644
index 0000000..1c0d7d3
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.cdt.core.RemoteProxyManager">
+      <manager
+            class="org.eclipse.cdt.rdt.proxy.RDTProxyManager"
+            scheme="rse">
+      </manager>
+   </extension>
+   <extension
+         point="org.eclipse.cdt.core.RemoteProxyManager">
+      <manager
+            class="org.eclipse.cdt.rdt.proxy.RDTProxyManager"
+            scheme="remotetools">
+      </manager>
+   </extension>
+
+</plugin>
core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/cdt/rdt/proxy/Activator.java new file +81 -0

81 lines not on this page · raw message

core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/cdt/rdt/proxy/RDTProxyManager.java new file +44 -0

44 lines not on this page · raw message

core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/cdt/rdt/proxy/Resources.properties new file +11 -0
new file mode 100644
index 0000000..dd85f8f
@@ -0,0 +1,11 @@
+#*******************************************************************************
+# Copyright (c) 2011 Red Hat Inc..
+# 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:
+#     Red Hat Incorporated - initial API and implementation
+#*******************************************************************************/
+CommandLauncher.error.commandCanceled=Command canceled
\ No newline at end of file
core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/rdt/internal/rdt/proxy/RDTCommandLauncher.java new file +227 -0

228 lines not on this page · raw message

core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/rdt/internal/rdt/proxy/RDTFileProxy.java new file +51 -0

51 lines not on this page · raw message

core/org.eclipse.cdt.rdt.proxy/src/org/eclipse/rdt/internal/rdt/proxy/RemoteProcessClosure.java new file +234 -0

234 lines not on this page · raw message

debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java +109 -0

133 lines not on this page · raw message

launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF +2 -1
index d3de935..262af36 100644
@@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.cdt.debug.ui;bundle-version="[7.0.0,8.1.0)",
  org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
- org.eclipse.ltk.core.refactoring;bundle-version="[3.5.0,4.0.0)"
+ org.eclipse.ltk.core.refactoring;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.core.filesystem;bundle-version="1.3.100"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Import-Package: com.ibm.icu.text
launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java +119 -2

166 lines not on this page · raw message

launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCDILaunchDelegate.java +36 -7

63 lines not on this page · raw message

Signature · 1 line
1.7.9.5