1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00

Bug 468889 - Support Eclipse older than Mars (tested on Kepler)

Change-Id: I660efe3602e74c3d724707d597a620eda286589c
Signed-off-by: Martin Oberhuber <martin.oberhuber@windriver.com>
This commit is contained in:
Martin Oberhuber 2015-05-31 02:12:30 +02:00
parent 76ac23a87f
commit 4488f6ff37
15 changed files with 1286 additions and 38 deletions

View file

@ -5,12 +5,11 @@ Bundle-SymbolicName: org.eclipse.remote.core;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.eclipse.remote.internal.core.RemoteCorePlugin
Bundle-Vendor: %pluginProvider
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.11.0",
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.100",
org.eclipse.core.filesystem,
org.eclipse.core.resources,
org.eclipse.core.variables,
org.eclipse.debug.core,
org.eclipse.cdt.core.native;bundle-version="5.8.0"
org.eclipse.debug.core
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.remote.core,
org.eclipse.remote.core.exception,
@ -19,4 +18,6 @@ Export-Package: org.eclipse.remote.core,
org.eclipse.remote.internal.core.preferences;x-friends:="org.eclipse.remote.ui"
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.equinox.security.storage
Import-Package: org.eclipse.equinox.security.storage,
org.eclipse.cdt.utils.pty,
org.eclipse.cdt.utils.spawner

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013 IBM Corporation and others.
* Copyright (c) 2013, 2015 IBM Corporation 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
@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - Initial API and implementation
* Martin Oberhuber - [468889] Support Eclipse older than Mars
*******************************************************************************/
package org.eclipse.remote.core;
@ -14,13 +15,44 @@ import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.remote.internal.core.RemoteCorePlugin;
import org.eclipse.remote.internal.core.RemotePath;
import org.eclipse.remote.internal.core.preferences.Preferences;
/**
* Remote services utility methods.
*/
public class RemoteServicesUtils {
/**
* Constructs a new POSIX path from the given string path. The string path
* must represent a valid file system path on a POSIX file system. The path
* is canonicalized and double slashes are removed except at the beginning
* (to handle UNC paths). All forward slashes ('/') are treated as segment
* delimiters. This factory method should be used if the string path is for
* a POSIX file system.
*
* @param path the string path
* @see org.eclipse.core.runtime.Path#forPosix(String)
* @since 2.0
*/
public static IPath posixPath(String path) {
try {
//Use the Mars implementation of Path, see bug 454959
return Path.forPosix(path);
} catch(NoSuchMethodError e) {
//TODO For older Eclipse, use the fallback below. That code should be
//removed when support for Eclipse older than Mars is no longer needed.
}
/** Constant value indicating if the current platform is Windows */
boolean RUNNING_ON_WINDOWS = java.io.File.separatorChar == '\\';
if (! RUNNING_ON_WINDOWS) {
return new Path(path);
} else {
return new RemotePath(path);
}
}
/**
* Convert a UNC path to a URI
*

View file

@ -5,9 +5,9 @@ Bundle-SymbolicName: org.eclipse.remote.jsch.core;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.remote.internal.jsch.core.Activator
Bundle-Vendor: %pluginProvider
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.11.0",
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.100",
org.eclipse.core.filesystem,
org.eclipse.remote.core,
org.eclipse.remote.core;bundle-version="2.0",
org.eclipse.jsch.core,
com.jcraft.jsch,
org.eclipse.equinox.security

View file

@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
* Patrick Tasse - [462418] use stored password on non-preferred password based authentication
* Martin Oberhuber - [468889] Support Eclipse older than Mars
*******************************************************************************/
package org.eclipse.remote.internal.jsch.core;
@ -19,7 +20,6 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jsch.core.IJSchService;
import org.eclipse.osgi.util.NLS;
@ -34,6 +34,7 @@ import org.eclipse.remote.core.IRemoteProcessBuilder;
import org.eclipse.remote.core.IRemoteProcessService;
import org.eclipse.remote.core.IUserAuthenticatorService;
import org.eclipse.remote.core.RemoteConnectionChangeEvent;
import org.eclipse.remote.core.RemoteServicesUtils;
import org.eclipse.remote.core.exception.AddressInUseException;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.core.exception.UnableToForwardPortException;
@ -1020,7 +1021,7 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
*/
@Override
public void setWorkingDirectory(String path) {
if (Path.forPosix(path).isAbsolute()) {
if (RemoteServicesUtils.posixPath(path).isAbsolute()) {
fWorkingDir = path;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* Copyright (c) 2007, 2015 IBM Corporation 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
@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - Initial API and implementation
* Martin Oberhuber - [468889] Support Eclipse older than Mars
*******************************************************************************/
package org.eclipse.remote.internal.jsch.core;
@ -14,11 +15,11 @@ import java.net.URI;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnection.Service;
import org.eclipse.remote.core.IRemoteFileService;
import org.eclipse.remote.core.IRemoteProcessService;
import org.eclipse.remote.core.RemoteServicesUtils;
public class JSchFileManager implements IRemoteFileService {
@ -51,9 +52,9 @@ public class JSchFileManager implements IRemoteFileService {
@Override
public IFileStore getResource(String pathStr) {
IPath path = Path.forPosix(pathStr);
IPath path = RemoteServicesUtils.posixPath(pathStr);
if (!path.isAbsolute()) {
path = Path.forPosix(getBaseDirectory()).append(path);
path = RemoteServicesUtils.posixPath(getBaseDirectory()).append(path);
}
return JschFileStore.getInstance(JSchFileSystem.getURIFor(fConnection.getName(), path.toString()));
}
@ -84,7 +85,7 @@ public class JSchFileManager implements IRemoteFileService {
@Override
public URI toURI(String path) {
return toURI(Path.forPosix(path));
return toURI(RemoteServicesUtils.posixPath(path));
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 IBM Corporation and others.
* Copyright (c) 2007, 2015 IBM Corporation 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
@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
* Roland Schulz, University of Tennessee
* Martin Oberhuber - [468889] Support Eclipse older than Mars
*******************************************************************************/
package org.eclipse.remote.internal.jsch.core;
@ -25,13 +26,13 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteServicesManager;
import org.eclipse.remote.core.RemoteServicesUtils;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.internal.jsch.core.commands.ChildInfosCommand;
import org.eclipse.remote.internal.jsch.core.commands.DeleteCommand;
@ -68,7 +69,7 @@ public class JschFileStore extends FileStore {
private JschFileStore(URI uri) {
fURI = uri;
fRemotePath = Path.forPosix(uri.getPath());
fRemotePath = RemoteServicesUtils.posixPath(uri.getPath());
}
private JSchConnection checkConnection(IProgressMonitor monitor) throws RemoteConnectionException {

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2013 IBM Corporation.
* Copyright (c) 2013, 2015 IBM Corporation 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
@ -7,7 +7,7 @@
*
* Contributors:
* IBM Corporation - Initial Implementation
*
* Martin Oberhuber - [468889] Support Eclipse older than Mars
*****************************************************************************/
package org.eclipse.remote.internal.jsch.core.commands;
@ -28,8 +28,8 @@ import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.provider.FileInfo;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.remote.core.RemoteServicesUtils;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.internal.jsch.core.JSchConnection;
import org.eclipse.remote.internal.jsch.core.messages.Messages;
@ -107,7 +107,7 @@ public abstract class AbstractRemoteCommand<T> {
fMaxWork = max / 1024L;
}
fWorkToDate = 0;
fMonitor.beginTask(Path.forPosix(src).lastSegment(), (int) max);
fMonitor.beginTask(RemoteServicesUtils.posixPath(src).lastSegment(), (int) max);
}
}

View file

@ -5,9 +5,9 @@ Bundle-SymbolicName: org.eclipse.remote.jsch.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.remote.internal.jsch.ui.Activator
Bundle-Vendor: %pluginProvider
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.11.0",
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.100",
org.eclipse.core.filesystem,
org.eclipse.remote.core,
org.eclipse.remote.core;bundle-version="2.0",
org.eclipse.remote.ui,
org.eclipse.remote.jsch.core,
org.eclipse.jsch.core,

View file

@ -8,8 +8,8 @@ Bundle-Vendor: %pluginProvider
Require-Bundle: org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.ui.forms,
org.eclipse.core.runtime;bundle-version="3.11.0",
org.eclipse.remote.core,
org.eclipse.core.runtime;bundle-version="3.9.100",
org.eclipse.remote.core;bundle-version="2.0",
org.eclipse.core.filesystem,
org.eclipse.core.resources,
org.eclipse.ui.trace,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008,2013 IBM Corporation and others.
* Copyright (c) 2008, 2015 IBM Corporation 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
@ -7,6 +7,7 @@
*
* Contributors:
* IBM - Initial API and implementation
* Martin Oberhuber - [468889] Support Eclipse older than Mars
*******************************************************************************/
package org.eclipse.remote.ui.widgets;
@ -21,7 +22,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jface.dialogs.Dialog;
@ -45,6 +45,7 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteFileService;
import org.eclipse.remote.core.IRemoteProcessService;
import org.eclipse.remote.core.RemoteServicesUtils;
import org.eclipse.remote.internal.ui.DeferredFileStore;
import org.eclipse.remote.internal.ui.DeferredFileStoreComparer;
import org.eclipse.remote.internal.ui.PendingUpdateAdapter;
@ -586,15 +587,15 @@ public class RemoteResourceBrowserWidget extends Composite {
*/
private IPath findInitialPath(String cwd, String initialPath) {
if (initialPath != null) {
IPath path = Path.forPosix(initialPath);
IPath path = RemoteServicesUtils.posixPath(initialPath);
if (!path.isAbsolute()) {
path = Path.forPosix(cwd).append(path);
path = RemoteServicesUtils.posixPath(cwd).append(path);
}
if (fFileMgr.getResource(path.toString()).fetchInfo().exists()) {
return path;
}
}
return Path.forPosix(cwd);
return RemoteServicesUtils.posixPath(cwd);
}
/**
@ -702,7 +703,7 @@ public class RemoteResourceBrowserWidget extends Composite {
fRemotePathText.setText(path);
fRemotePathText.setSelection(fRemotePathText.getText().length());
fResources.add(root);
fRootPath = Path.forPosix(path);
fRootPath = RemoteServicesUtils.posixPath(path);
}
}

View file

@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.remote.core.tests;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %pluginProvider
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.11.0",
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.100",
org.junit,
com.jcraft.jsch;bundle-version="0.1.41",
org.eclipse.core.filesystem;bundle-version="1.2.0",

View file

@ -1,6 +1,6 @@
<?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.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>

View file

@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.source=1.7

View file

@ -6,10 +6,10 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.remote.jsch.tests.Activator
Bundle-Vendor: Eclipse PTP
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime;bundle-version="3.11.0",
org.eclipse.core.runtime;bundle-version="3.9.100",
org.eclipse.core.filesystem,
org.eclipse.remote.core,
org.eclipse.remote.jsch.core,
org.junit
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy