mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
Bug 577097: Format all o.e.remote code to CDT standard
This is applying the per-project code formatting rules that would be applied on save in the JDT editor See also Bug 540373 Change-Id: Ie93f9b640d0f0cfce8711e72fabc87f6a89634fa
This commit is contained in:
parent
8980b1f104
commit
3e9dadd642
178 changed files with 2219 additions and 2134 deletions
|
@ -55,8 +55,7 @@ public abstract class ConsoleAction extends Action {
|
|||
* @param enabled
|
||||
* the enabled state for this action
|
||||
*/
|
||||
protected void setupAction(String text, String tooltip,
|
||||
String image, String enabledImage, String disabledImage,
|
||||
protected void setupAction(String text, String tooltip, String image, String enabledImage, String disabledImage,
|
||||
boolean enabled) {
|
||||
ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
|
||||
setupAction(text, tooltip, image, enabledImage, disabledImage, enabled, imageRegistry);
|
||||
|
@ -78,15 +77,10 @@ public abstract class ConsoleAction extends Action {
|
|||
* @param imageRegistry
|
||||
* the ImageRegistry to retrieve ImageDescriptor for the keys provided
|
||||
*/
|
||||
protected void setupAction(String text, String tooltip,
|
||||
String hoverImage, String enabledImage, String disabledImage,
|
||||
boolean enabled, ImageRegistry imageRegistry) {
|
||||
setupAction(text,
|
||||
tooltip,
|
||||
imageRegistry.getDescriptor(hoverImage),
|
||||
imageRegistry.getDescriptor(enabledImage),
|
||||
imageRegistry.getDescriptor(disabledImage),
|
||||
enabled);
|
||||
protected void setupAction(String text, String tooltip, String hoverImage, String enabledImage,
|
||||
String disabledImage, boolean enabled, ImageRegistry imageRegistry) {
|
||||
setupAction(text, tooltip, imageRegistry.getDescriptor(hoverImage), imageRegistry.getDescriptor(enabledImage),
|
||||
imageRegistry.getDescriptor(disabledImage), enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,9 +97,8 @@ public abstract class ConsoleAction extends Action {
|
|||
* @param enabled
|
||||
* the enabled state for this action
|
||||
*/
|
||||
protected void setupAction(String text, String tooltip,
|
||||
ImageDescriptor hoverImage, ImageDescriptor enabledImage, ImageDescriptor disabledImage,
|
||||
boolean enabled) {
|
||||
protected void setupAction(String text, String tooltip, ImageDescriptor hoverImage, ImageDescriptor enabledImage,
|
||||
ImageDescriptor disabledImage, boolean enabled) {
|
||||
setText(text);
|
||||
setToolTipText(tooltip);
|
||||
setEnabled(enabled);
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.remote.internal.console;
|
||||
|
||||
public interface ImageConsts
|
||||
{
|
||||
public interface ImageConsts {
|
||||
public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
|
||||
public final static String IMAGE_DIR_LOCALTOOL = "clcl16/"; // basic colors - size 16x16 //$NON-NLS-1$
|
||||
public final static String IMAGE_DIR_DLCL = "dlcl16/"; // disabled - size 16x16 //$NON-NLS-1$
|
||||
|
|
|
@ -27,7 +27,8 @@ public class TerminalConsole extends AbstractConsole implements ITerminalConsole
|
|||
private final int index;
|
||||
|
||||
public TerminalConsole(IRemoteConnection connection, int index, String encoding) {
|
||||
super(connection.getName(), Activator.getDefault().getImageRegistry().getDescriptor(ImageConsts.IMAGE_TERMINAL_VIEW));
|
||||
super(connection.getName(),
|
||||
Activator.getDefault().getImageRegistry().getDescriptor(ImageConsts.IMAGE_TERMINAL_VIEW));
|
||||
this.encoding = encoding;
|
||||
this.terminalConnector = new TerminalConsoleConnector(connection);
|
||||
this.index = index;
|
||||
|
|
|
@ -143,11 +143,13 @@ public class TerminalConsoleConnector {
|
|||
|
||||
if (remoteProcess == null) {
|
||||
disconnect();
|
||||
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ConsoleMessages.TerminalConsoleConnector_0);
|
||||
return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
|
||||
ConsoleMessages.TerminalConsoleConnector_0);
|
||||
}
|
||||
|
||||
if (width > 0 || height > 0) {
|
||||
IRemoteProcessTerminalService termService = remoteProcess.getService(IRemoteProcessTerminalService.class);
|
||||
IRemoteProcessTerminalService termService = remoteProcess
|
||||
.getService(IRemoteProcessTerminalService.class);
|
||||
if (termService != null) {
|
||||
termService.setTerminalSize(width, height, 8 * width, 8 * height);
|
||||
}
|
||||
|
@ -202,7 +204,8 @@ public class TerminalConsoleConnector {
|
|||
height = minHeight;
|
||||
synchronized (this) {
|
||||
if (remoteProcess != null) {
|
||||
IRemoteProcessTerminalService termService = remoteProcess.getService(IRemoteProcessTerminalService.class);
|
||||
IRemoteProcessTerminalService termService = remoteProcess
|
||||
.getService(IRemoteProcessTerminalService.class);
|
||||
if (termService != null) {
|
||||
termService.setTerminalSize(width, height, 8 * width, 8 * height);
|
||||
}
|
||||
|
|
|
@ -125,9 +125,7 @@ public class TerminalConsolePage extends Page implements IAdaptable {
|
|||
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
mainComposite.setLayout(new FillLayout());
|
||||
|
||||
tViewCtrl = TerminalViewControlFactory.makeControl(listener,
|
||||
mainComposite,
|
||||
new ITerminalConnector[] {});
|
||||
tViewCtrl = TerminalViewControlFactory.makeControl(listener, mainComposite, new ITerminalConnector[] {});
|
||||
tViewCtrl.setConnector(terminalConsole.getTerminalConnector().newPageConnector());
|
||||
|
||||
try {
|
||||
|
@ -137,9 +135,7 @@ public class TerminalConsolePage extends Page implements IAdaptable {
|
|||
NLS.bind(ConsoleMessages.ENCODING_UNAVAILABLE_1, encoding));
|
||||
Activator.log(status);
|
||||
ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
|
||||
ConsoleMessages.OPEN_CONSOLE_ERROR,
|
||||
ConsoleMessages.ENCODING_UNAVAILABLE_0,
|
||||
status);
|
||||
ConsoleMessages.OPEN_CONSOLE_ERROR, ConsoleMessages.ENCODING_UNAVAILABLE_0, status);
|
||||
}
|
||||
connectTerminalJob.schedule();
|
||||
}
|
||||
|
|
|
@ -60,8 +60,9 @@ public class TerminalConsoleSettingsDialog extends Dialog {
|
|||
|
||||
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
||||
// TODO remove the remote process service once we get command shell available with ssh and local
|
||||
@SuppressWarnings("unchecked") List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting(
|
||||
IRemoteCommandShellService.class, IRemoteProcessService.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting(IRemoteCommandShellService.class,
|
||||
IRemoteProcessService.class);
|
||||
|
||||
remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes);
|
||||
|
||||
|
@ -161,10 +162,12 @@ public class TerminalConsoleSettingsDialog extends Dialog {
|
|||
}
|
||||
|
||||
private IDialogSettings getDialogSettings() {
|
||||
IDialogSettings result = Activator.getDefault().getDialogSettings().getSection(TerminalConsoleSettingsDialog.class.getName());
|
||||
IDialogSettings result = Activator.getDefault().getDialogSettings()
|
||||
.getSection(TerminalConsoleSettingsDialog.class.getName());
|
||||
|
||||
if (result == null) {
|
||||
result = Activator.getDefault().getDialogSettings().addNewSection(TerminalConsoleSettingsDialog.class.getName());
|
||||
result = Activator.getDefault().getDialogSettings()
|
||||
.addNewSection(TerminalConsoleSettingsDialog.class.getName());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -22,12 +22,8 @@ public class ConsoleActionConnect extends ConsoleAction {
|
|||
|
||||
this.console = console;
|
||||
|
||||
setupAction(ActionMessages.CONNECT,
|
||||
ActionMessages.CONNECT,
|
||||
ImageConsts.IMAGE_CLCL_CONNECT,
|
||||
ImageConsts.IMAGE_ELCL_CONNECT,
|
||||
ImageConsts.IMAGE_DLCL_CONNECT,
|
||||
true);
|
||||
setupAction(ActionMessages.CONNECT, ActionMessages.CONNECT, ImageConsts.IMAGE_CLCL_CONNECT,
|
||||
ImageConsts.IMAGE_ELCL_CONNECT, ImageConsts.IMAGE_DLCL_CONNECT, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,18 +17,13 @@ import org.eclipse.remote.internal.console.TerminalConsole;
|
|||
public class ConsoleActionDisconnect extends ConsoleAction {
|
||||
private final TerminalConsole console;
|
||||
|
||||
public ConsoleActionDisconnect(TerminalConsole console)
|
||||
{
|
||||
public ConsoleActionDisconnect(TerminalConsole console) {
|
||||
super(ConsoleActionDisconnect.class.getName());
|
||||
|
||||
this.console = console;
|
||||
|
||||
setupAction(ActionMessages.DISCONNECT,
|
||||
ActionMessages.DISCONNECT,
|
||||
ImageConsts.IMAGE_CLCL_DISCONNECT,
|
||||
ImageConsts.IMAGE_ELCL_DISCONNECT,
|
||||
ImageConsts.IMAGE_DLCL_DISCONNECT,
|
||||
false);
|
||||
setupAction(ActionMessages.DISCONNECT, ActionMessages.DISCONNECT, ImageConsts.IMAGE_CLCL_DISCONNECT,
|
||||
ImageConsts.IMAGE_ELCL_DISCONNECT, ImageConsts.IMAGE_DLCL_DISCONNECT, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,18 +18,13 @@ import org.eclipse.remote.internal.console.TerminalConsolePage;
|
|||
public class ConsoleActionScrollLock extends ConsoleAction {
|
||||
private final TerminalConsolePage page;
|
||||
|
||||
public ConsoleActionScrollLock(TerminalConsolePage page)
|
||||
{
|
||||
public ConsoleActionScrollLock(TerminalConsolePage page) {
|
||||
super(ConsoleActionScrollLock.class.getName(), IAction.AS_RADIO_BUTTON);
|
||||
|
||||
this.page = page;
|
||||
|
||||
setupAction(ActionMessages.SCROLL_LOCK,
|
||||
ActionMessages.SCROLL_LOCK,
|
||||
ImageConsts.IMAGE_CLCL_SCROLL_LOCK,
|
||||
ImageConsts.IMAGE_ELCL_SCROLL_LOCK,
|
||||
ImageConsts.IMAGE_DLCL_SCROLL_LOCK,
|
||||
true);
|
||||
setupAction(ActionMessages.SCROLL_LOCK, ActionMessages.SCROLL_LOCK, ImageConsts.IMAGE_CLCL_SCROLL_LOCK,
|
||||
ImageConsts.IMAGE_ELCL_SCROLL_LOCK, ImageConsts.IMAGE_DLCL_SCROLL_LOCK, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,8 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service
|
|||
* @return local port number
|
||||
* @throws RemoteConnectionException
|
||||
*/
|
||||
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException;
|
||||
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException;
|
||||
|
||||
/**
|
||||
* Forward remote port remotePort to port fwdPort on machine fwdAddress. When a connection is made to remotePort on the remote
|
||||
|
@ -76,7 +77,8 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service
|
|||
* @return remote port number
|
||||
* @throws RemoteConnectionException
|
||||
*/
|
||||
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException;
|
||||
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException;
|
||||
|
||||
/**
|
||||
* Remove the local port forwarding associated with the given port.
|
||||
|
|
|
@ -169,7 +169,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
|||
* @return the service object
|
||||
* @throws CoreException
|
||||
*/
|
||||
public <T extends IRemoteConnection.Service> T getConnectionService(IRemoteConnection connection, Class<T> service) {
|
||||
public <T extends IRemoteConnection.Service> T getConnectionService(IRemoteConnection connection,
|
||||
Class<T> service) {
|
||||
synchronized (connectionServiceDefinitionMap) {
|
||||
IConfigurationElement ce = connectionServiceDefinitionMap.get(service.getName());
|
||||
if (ce != null) {
|
||||
|
@ -216,7 +217,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
|||
IConfigurationElement ce = processServiceDefinitionMap.get(service.getName());
|
||||
if (ce != null) {
|
||||
try {
|
||||
IRemoteProcess.Service.Factory factory = (IRemoteProcess.Service.Factory) ce.createExecutableExtension("factory"); //$NON-NLS-1$
|
||||
IRemoteProcess.Service.Factory factory = (IRemoteProcess.Service.Factory) ce
|
||||
.createExecutableExtension("factory"); //$NON-NLS-1$
|
||||
if (factory != null) {
|
||||
return factory.getService(process, service);
|
||||
}
|
||||
|
@ -356,7 +358,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
|||
connections.remove(conn.getName());
|
||||
connection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_REMOVED);
|
||||
} else {
|
||||
RemoteCorePlugin.log("Wrong class for " + connection.getName() + ", was " + connection.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
RemoteCorePlugin
|
||||
.log("Wrong class for " + connection.getName() + ", was " + connection.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,7 +298,8 @@ public class RemotePath implements IPath, Cloneable {
|
|||
newSegments[myLen + i] = tail.segment(i);
|
||||
}
|
||||
//use my leading separators and the tail's trailing separator
|
||||
RemotePath result = new RemotePath(device, newSegments, (flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
|
||||
RemotePath result = new RemotePath(device, newSegments,
|
||||
(flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
|
||||
String tailFirstSegment = newSegments[myLen];
|
||||
if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
result.canonicalize();
|
||||
|
@ -1070,7 +1071,8 @@ public class RemotePath implements IPath, Cloneable {
|
|||
@Override
|
||||
public IPath setDevice(String value) {
|
||||
if (value != null) {
|
||||
Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) == (value.length() - 1), "Last character should be the device separator"); //$NON-NLS-1$
|
||||
Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) == (value.length() - 1),
|
||||
"Last character should be the device separator"); //$NON-NLS-1$
|
||||
}
|
||||
//return the receiver if the device is the same
|
||||
if (value == device || (value != null && value.equals(device)))
|
||||
|
|
|
@ -83,7 +83,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
|||
for (IExtension ext : point.getExtensions()) {
|
||||
for (IConfigurationElement ce : ext.getConfigurationElements()) {
|
||||
String name = ce.getName();
|
||||
if (name.equals("connectionTypeService") || name.equals("connectionService") || name.equals("processService")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
if (name.equals("connectionTypeService") || name.equals("connectionService") //$NON-NLS-1$//$NON-NLS-2$
|
||||
|| name.equals("processService")) { //$NON-NLS-1$
|
||||
String id = ce.getAttribute("connectionTypeId"); //$NON-NLS-1$
|
||||
RemoteConnectionType services = connectionTypeMap.get(id);
|
||||
if (services != null) {
|
||||
|
@ -95,7 +96,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
|||
|
||||
// Init connection providers
|
||||
for (IRemoteConnectionType connectionType : connectionTypeMap.values()) {
|
||||
IRemoteConnectionProviderService providerService = connectionType.getService(IRemoteConnectionProviderService.class);
|
||||
IRemoteConnectionProviderService providerService = connectionType
|
||||
.getService(IRemoteConnectionProviderService.class);
|
||||
if (providerService != null) {
|
||||
providerService.init();
|
||||
}
|
||||
|
@ -135,7 +137,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
|||
|
||||
@Override
|
||||
@SafeVarargs
|
||||
public final List<IRemoteConnectionType> getConnectionTypesSupporting(Class<? extends IRemoteConnection.Service>... services) {
|
||||
public final List<IRemoteConnectionType> getConnectionTypesSupporting(
|
||||
Class<? extends IRemoteConnection.Service>... services) {
|
||||
List<IRemoteConnectionType> connTypes = new ArrayList<IRemoteConnectionType>();
|
||||
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
|
||||
for (Class<? extends IRemoteConnection.Service> service : services) {
|
||||
|
@ -150,7 +153,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
|||
|
||||
@Override
|
||||
@SafeVarargs
|
||||
public final List<IRemoteConnectionType> getConnectionTypesByService(Class<? extends IRemoteConnectionType.Service>... services) {
|
||||
public final List<IRemoteConnectionType> getConnectionTypesByService(
|
||||
Class<? extends IRemoteConnectionType.Service>... services) {
|
||||
List<IRemoteConnectionType> connTypes = new ArrayList<IRemoteConnectionType>();
|
||||
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
|
||||
for (Class<? extends IRemoteConnectionType.Service> service : services) {
|
||||
|
|
|
@ -28,7 +28,8 @@ import org.osgi.service.prefs.BackingStoreException;
|
|||
*/
|
||||
public final class Preferences {
|
||||
|
||||
private static final IScopeContext[] contexts = new IScopeContext[] { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
|
||||
private static final IScopeContext[] contexts = new IScopeContext[] { DefaultScope.INSTANCE,
|
||||
InstanceScope.INSTANCE };
|
||||
|
||||
private static final int DEFAULT_CONTEXT = 0;
|
||||
private static final int INSTANCE_CONTEXT = 1;
|
||||
|
@ -52,8 +53,8 @@ public final class Preferences {
|
|||
* @return
|
||||
*/
|
||||
public static boolean contains(String name) {
|
||||
return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null || contexts[DEFAULT_CONTEXT].getNode(
|
||||
fQualifier).get(name, null) != null);
|
||||
return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null
|
||||
|| contexts[DEFAULT_CONTEXT].getNode(fQualifier).get(name, null) != null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -124,7 +124,8 @@ public class LocalProcessBuilder extends AbstractRemoteProcessBuilder {
|
|||
|
||||
private IProcessFactory getProcessFactory() {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
IExtensionPoint extensionPoint = registry.getExtensionPoint(RemoteCorePlugin.getUniqueIdentifier(), EXTENSION_POINT_ID);
|
||||
IExtensionPoint extensionPoint = registry.getExtensionPoint(RemoteCorePlugin.getUniqueIdentifier(),
|
||||
EXTENSION_POINT_ID);
|
||||
|
||||
IProcessFactory processFactory = null;
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@ public class ArgumentParser {
|
|||
* string. Allows escaping.
|
||||
*/
|
||||
iterator.next(); // Skip quote
|
||||
quoted_reader: while ((iterator.current() != CharacterIterator.DONE) && (iterator.current() != '"')) {
|
||||
quoted_reader: while ((iterator.current() != CharacterIterator.DONE)
|
||||
&& (iterator.current() != '"')) {
|
||||
char innerChar = iterator.current();
|
||||
switch (innerChar) {
|
||||
case '\\':
|
||||
|
|
|
@ -51,8 +51,9 @@ import com.jcraft.jsch.Session;
|
|||
/**
|
||||
* @since 5.0
|
||||
*/
|
||||
public class JSchConnection implements IRemoteConnectionControlService, IRemoteConnectionPropertyService,
|
||||
IRemotePortForwardingService, IRemoteProcessService, IRemoteConnectionHostService, IRemoteConnectionChangeListener {
|
||||
public class JSchConnection
|
||||
implements IRemoteConnectionControlService, IRemoteConnectionPropertyService, IRemotePortForwardingService,
|
||||
IRemoteProcessService, IRemoteConnectionHostService, IRemoteConnectionChangeListener {
|
||||
// Connection Type ID
|
||||
public static final String JSCH_ID = "org.eclipse.remote.JSch"; //$NON-NLS-1$
|
||||
|
||||
|
@ -130,8 +131,9 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
|||
return (T) jschConnection;
|
||||
}
|
||||
} else if (IRemoteConnectionControlService.class.equals(service)
|
||||
|| IRemoteConnectionPropertyService.class.equals(service) || IRemotePortForwardingService.class.equals(service)
|
||||
|| IRemoteProcessService.class.equals(service) || IRemoteConnectionHostService.class.equals(service)) {
|
||||
|| IRemoteConnectionPropertyService.class.equals(service)
|
||||
|| IRemotePortForwardingService.class.equals(service) || IRemoteProcessService.class.equals(service)
|
||||
|| IRemoteConnectionHostService.class.equals(service)) {
|
||||
return (T) connection.getService(JSchConnection.class);
|
||||
} else {
|
||||
return null;
|
||||
|
@ -230,7 +232,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
|||
}
|
||||
|
||||
@Override
|
||||
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException {
|
||||
if (!isOpen()) {
|
||||
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
|
||||
}
|
||||
|
@ -272,7 +275,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
|||
}
|
||||
|
||||
@Override
|
||||
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException {
|
||||
if (!isOpen()) {
|
||||
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
|
||||
}
|
||||
|
@ -426,7 +430,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
|||
if (proxyConnectionName.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return fRemoteConnection.getConnectionType().getConnection(proxyConnectionName).getService(JSchConnection.class);
|
||||
return fRemoteConnection.getConnectionType().getConnection(proxyConnectionName)
|
||||
.getService(JSchConnection.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -680,12 +685,15 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
|||
IRemoteConnectionWorkingCopy wc = getRemoteConnection().getWorkingCopy();
|
||||
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
|
||||
IUserAuthenticatorService authService = wc.getService(IUserAuthenticatorService.class);
|
||||
Session session = fJSchService.createSession(hostService.getHostname(), hostService.getPort(), hostService.getUsername());
|
||||
Session session = fJSchService.createSession(hostService.getHostname(), hostService.getPort(),
|
||||
hostService.getUsername());
|
||||
session.setUserInfo(new JSchUserInfo(hostService, authService));
|
||||
if (hostService.usePassword()) {
|
||||
session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
|
||||
"password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$
|
||||
} else {
|
||||
session.setConfig("PreferredAuthentications", "publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
|
||||
"publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$
|
||||
}
|
||||
String password = hostService.getPassword();
|
||||
if (!password.isEmpty()) {
|
||||
|
@ -695,11 +703,12 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
|||
fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); // connect without proxy
|
||||
} else {
|
||||
if (getProxyCommand().isEmpty()) {
|
||||
session.setProxy(JSchConnectionProxyFactory.createForwardProxy(getProxyConnection(), progress.newChild(10)));
|
||||
session.setProxy(
|
||||
JSchConnectionProxyFactory.createForwardProxy(getProxyConnection(), progress.newChild(10)));
|
||||
fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10));
|
||||
} else {
|
||||
session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(), getProxyCommand(),
|
||||
progress.newChild(10)));
|
||||
session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(),
|
||||
getProxyCommand(), progress.newChild(10)));
|
||||
session.connect(getTimeout() * 1000); // the fJSchService doesn't pass the timeout correctly
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,8 +97,8 @@ public class JSchConnectionProxyFactory {
|
|||
processBuilder.setPreamble(false);
|
||||
process = processBuilder.start();
|
||||
} else {
|
||||
process = Activator.getService(IRemoteServicesManager.class).getLocalConnectionType().getConnections().get(0).
|
||||
getService(IRemoteProcessService.class).getProcessBuilder(cmd).start();
|
||||
process = Activator.getService(IRemoteServicesManager.class).getLocalConnectionType().getConnections()
|
||||
.get(0).getService(IRemoteProcessService.class).getProcessBuilder(cmd).start();
|
||||
}
|
||||
|
||||
// Wait on command to produce stdout output
|
||||
|
@ -136,8 +136,8 @@ public class JSchConnectionProxyFactory {
|
|||
} else if (bCanceled) {
|
||||
cause = Messages.JSchConnectionProxyFactory_wasCanceled;
|
||||
}
|
||||
throw new IOException(MessageFormat.format(Messages.JSchConnectionProxyFactory_ProxyCommandFailed, command,
|
||||
cause, msg));
|
||||
throw new IOException(MessageFormat.format(Messages.JSchConnectionProxyFactory_ProxyCommandFailed,
|
||||
command, cause, msg));
|
||||
}
|
||||
|
||||
// Dump the stderr to log
|
||||
|
|
|
@ -27,10 +27,12 @@ import com.jcraft.jsch.Channel;
|
|||
import com.jcraft.jsch.ChannelExec;
|
||||
import com.jcraft.jsch.ChannelShell;
|
||||
|
||||
public class JSchProcess implements IRemoteProcessControlService, IRemoteProcessSignalService, IRemoteProcessTerminalService {
|
||||
public class JSchProcess
|
||||
implements IRemoteProcessControlService, IRemoteProcessSignalService, IRemoteProcessTerminalService {
|
||||
@SuppressWarnings("nls")
|
||||
private final String signals[] = new String[] { "", "HUP", "INT", "QUIT", "ILL", "", "ABRT", "", "FPE", "KILL", "", "SEGV", "",
|
||||
"PIPE", "ALRM", "TERM", "", "STOP", "TSTP", "CONT", "", "", "", "", "", "", "", "", "", "", "USR1", "USR2" };
|
||||
private final String signals[] = new String[] { "", "HUP", "INT", "QUIT", "ILL", "", "ABRT", "", "FPE", "KILL", "",
|
||||
"SEGV", "", "PIPE", "ALRM", "TERM", "", "STOP", "TSTP", "CONT", "", "", "", "", "", "", "", "", "", "",
|
||||
"USR1", "USR2" };
|
||||
|
||||
private static int WAIT_TIMEOUT = 1000;
|
||||
private static int refCount = 0;
|
||||
|
|
|
@ -122,8 +122,9 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
|
|||
System.out.println("promptYesNo:" + message); //$NON-NLS-1$
|
||||
}
|
||||
if (userAuthenticatorService != null) {
|
||||
int prompt = userAuthenticatorService.prompt(IUserAuthenticatorService.QUESTION, Messages.AuthInfo_Authentication_message,
|
||||
message, new int[] { IUserAuthenticatorService.YES, IUserAuthenticatorService.NO },
|
||||
int prompt = userAuthenticatorService.prompt(IUserAuthenticatorService.QUESTION,
|
||||
Messages.AuthInfo_Authentication_message, message,
|
||||
new int[] { IUserAuthenticatorService.YES, IUserAuthenticatorService.NO },
|
||||
IUserAuthenticatorService.YES);
|
||||
return prompt == IUserAuthenticatorService.YES;
|
||||
}
|
||||
|
@ -136,8 +137,9 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
|
|||
System.out.println("showMessage:" + message); //$NON-NLS-1$
|
||||
}
|
||||
if (userAuthenticatorService != null) {
|
||||
userAuthenticatorService.prompt(IUserAuthenticatorService.INFORMATION, Messages.AuthInfo_Authentication_message, message,
|
||||
new int[] { IUserAuthenticatorService.OK }, IUserAuthenticatorService.OK);
|
||||
userAuthenticatorService.prompt(IUserAuthenticatorService.INFORMATION,
|
||||
Messages.AuthInfo_Authentication_message, message, new int[] { IUserAuthenticatorService.OK },
|
||||
IUserAuthenticatorService.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,8 @@ public class JschFileStore extends FileStore {
|
|||
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
||||
IRemoteConnectionType connectionType = manager.getConnectionType(fURI);
|
||||
if (connectionType == null) {
|
||||
throw new RemoteConnectionException(NLS.bind(Messages.JschFileStore_No_remote_services_found_for_URI, fURI));
|
||||
throw new RemoteConnectionException(
|
||||
NLS.bind(Messages.JschFileStore_No_remote_services_found_for_URI, fURI));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -136,7 +137,8 @@ public class JschFileStore extends FileStore {
|
|||
|
||||
@Override
|
||||
public IFileStore getChild(String name) {
|
||||
URI uri = JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), fRemotePath.append(name).toString());
|
||||
URI uri = JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI),
|
||||
fRemotePath.append(name).toString());
|
||||
return JschFileStore.getInstance(uri);
|
||||
}
|
||||
|
||||
|
@ -168,7 +170,8 @@ public class JschFileStore extends FileStore {
|
|||
if (fRemotePath.segmentCount() > 0) {
|
||||
parentPath = fRemotePath.removeLastSegments(1).toString();
|
||||
}
|
||||
return JschFileStore.getInstance(JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), parentPath));
|
||||
return JschFileStore
|
||||
.getInstance(JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), parentPath));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -180,7 +183,8 @@ public class JschFileStore extends FileStore {
|
|||
IFileStore parent = getParent();
|
||||
if (parent != null && !parent.fetchInfo(EFS.NONE, subMon.newChild(9)).exists()) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
||||
NLS.bind(Messages.JschFileStore_The_parent_of_directory_does_not_exist, fRemotePath.toString()), null));
|
||||
NLS.bind(Messages.JschFileStore_The_parent_of_directory_does_not_exist, fRemotePath.toString()),
|
||||
null));
|
||||
}
|
||||
if (subMon.isCanceled()) {
|
||||
return this;
|
||||
|
@ -201,11 +205,14 @@ public class JschFileStore extends FileStore {
|
|||
if (!subMon.isCanceled()) {
|
||||
if (!info.exists()) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
||||
NLS.bind(Messages.JschFileStore_The_directory_could_not_be_created, fRemotePath.toString()), null));
|
||||
NLS.bind(Messages.JschFileStore_The_directory_could_not_be_created, fRemotePath.toString()),
|
||||
null));
|
||||
}
|
||||
if (!info.isDirectory()) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
||||
NLS.bind(Messages.JschFileStore_A_file_of_name_already_exists, fRemotePath.toString()), null));
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
|
||||
EFS.ERROR_WRONG_TYPE,
|
||||
NLS.bind(Messages.JschFileStore_A_file_of_name_already_exists, fRemotePath.toString()),
|
||||
null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,8 @@ public abstract class AbstractRemoteCommand<T> {
|
|||
taskName.append(fPrefix);
|
||||
}
|
||||
if (fWorkPercentFactor < 0) {
|
||||
taskName.append(MessageFormat.format(Messages.AbstractRemoteCommand_format1, new Object[] { workToDate, size }));
|
||||
taskName.append(MessageFormat.format(Messages.AbstractRemoteCommand_format1,
|
||||
new Object[] { workToDate, size }));
|
||||
} else {
|
||||
Double workPercent = Double.valueOf(fWorkPercentFactor * fWorkToDate);
|
||||
taskName.append(MessageFormat.format(Messages.AbstractRemoteCommand_format2,
|
||||
|
@ -300,8 +301,8 @@ public abstract class AbstractRemoteCommand<T> {
|
|||
return convertToFileInfo(path.lastSegment(), path.removeLastSegments(1), attrs, monitor);
|
||||
}
|
||||
|
||||
protected IFileInfo convertToFileInfo(final String name, final IPath parentPath, SftpATTRS attrs, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException {
|
||||
protected IFileInfo convertToFileInfo(final String name, final IPath parentPath, SftpATTRS attrs,
|
||||
IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
SubMonitor progress = SubMonitor.convert(monitor, 10);
|
||||
FileInfo fileInfo = new FileInfo(name);
|
||||
fileInfo.setExists(true);
|
||||
|
|
|
@ -56,8 +56,10 @@ public class GetInputStreamCommand extends AbstractRemoteCommand<InputStream> {
|
|||
|
||||
@Override
|
||||
public InputStream call() throws JSchException, SftpException, IOException {
|
||||
return newChannel().get(fRemotePath.toString(), new CommandProgressMonitor(
|
||||
NLS.bind(Messages.GetInputStreamCommand_Receiving, fRemotePath.toString()), getProgressMonitor()));
|
||||
return newChannel().get(fRemotePath.toString(),
|
||||
new CommandProgressMonitor(
|
||||
NLS.bind(Messages.GetInputStreamCommand_Receiving, fRemotePath.toString()),
|
||||
getProgressMonitor()));
|
||||
}
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -50,10 +50,8 @@ public class GetOutputStreamCommand extends AbstractRemoteCommand<OutputStream>
|
|||
if ((fOptions & EFS.APPEND) != 0) {
|
||||
mode = ChannelSftp.APPEND;
|
||||
}
|
||||
getChannel().put(
|
||||
input,
|
||||
fRemotePath.toString(),
|
||||
new CommandProgressMonitor(NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()),
|
||||
getChannel().put(input, fRemotePath.toString(), new CommandProgressMonitor(
|
||||
NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()),
|
||||
getProgressMonitor()), mode);
|
||||
input.close();
|
||||
} finally {
|
||||
|
|
|
@ -53,7 +53,8 @@ public class PutInfoCommand extends AbstractRemoteCommand<Void> {
|
|||
return null;
|
||||
}
|
||||
|
||||
private void chmod(final int permissions, final String path, IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
private void chmod(final int permissions, final String path, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException {
|
||||
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
||||
SftpCallable<Void> c = new SftpCallable<Void>() {
|
||||
@Override
|
||||
|
@ -69,7 +70,8 @@ public class PutInfoCommand extends AbstractRemoteCommand<Void> {
|
|||
}
|
||||
}
|
||||
|
||||
private void setMTime(final int mtime, final String path, IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
private void setMTime(final int mtime, final String path, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException {
|
||||
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
||||
SftpCallable<Void> c = new SftpCallable<Void>() {
|
||||
@Override
|
||||
|
|
|
@ -90,8 +90,8 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService {
|
|||
display.syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message,
|
||||
promptType, buttons, defaultResponseIndex);
|
||||
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */,
|
||||
message, promptType, buttons, defaultResponseIndex);
|
||||
retval[0] = dialog.open();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -246,8 +246,8 @@ public class JSchConnectionPage extends WizardPage {
|
|||
|
||||
fPasswordButton.setSelection(JSchConnection.DEFAULT_IS_PASSWORD);
|
||||
fPublicKeyButton.setSelection(!JSchConnection.DEFAULT_IS_PASSWORD);
|
||||
controls.setTabList(
|
||||
new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton, fPasswordText });
|
||||
controls.setTabList(new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton,
|
||||
fPasswordText });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -312,7 +312,8 @@ public class JSchConnectionPage extends WizardPage {
|
|||
lblConnection.setText(Messages.JSchConnectionPage_SelectConnection);
|
||||
|
||||
fProxyConnectionWidget = new RemoteConnectionWidget(proxyComp, SWT.NONE, null, 0);
|
||||
fProxyConnectionWidget.filterConnections(IRemoteConnectionHostService.class, IRemotePortForwardingService.class);
|
||||
fProxyConnectionWidget.filterConnections(IRemoteConnectionHostService.class,
|
||||
IRemotePortForwardingService.class);
|
||||
|
||||
Label lblCommand = new Label(proxyComp, SWT.WRAP);
|
||||
lblCommand.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
@ -384,7 +385,8 @@ public class JSchConnectionPage extends WizardPage {
|
|||
: Boolean.parseBoolean(useLoginShellStr);
|
||||
fUseLoginShellButton.setSelection(useLoginShell);
|
||||
String loginShellStr = fConnection.getAttribute(JSchConnection.LOGIN_SHELL_COMMAND_ATTR);
|
||||
fLoginShellText.setText(loginShellStr.isEmpty() ? JSchConnection.DEFAULT_LOGIN_SHELL_COMMAND : loginShellStr);
|
||||
fLoginShellText
|
||||
.setText(loginShellStr.isEmpty() ? JSchConnection.DEFAULT_LOGIN_SHELL_COMMAND : loginShellStr);
|
||||
fProxyCommandText.setText(fConnection.getAttribute(JSchConnection.PROXYCOMMAND_ATTR));
|
||||
JSchConnection proxyConn = fConnection.getService(JSchConnection.class).getProxyConnection();
|
||||
if (proxyConn == null) {
|
||||
|
@ -520,7 +522,8 @@ public class JSchConnectionPage extends WizardPage {
|
|||
fConnection.setAttribute(JSchConnection.TIMEOUT_ATTR, fTimeoutText.getText().trim());
|
||||
fConnection.setAttribute(JSchConnection.PORT_ATTR, fPortText.getText().trim());
|
||||
fConnection.setAttribute(JSchConnection.PROXYCOMMAND_ATTR, fProxyCommandText.getText().trim());
|
||||
fConnection.setAttribute(JSchConnection.USE_LOGIN_SHELL_ATTR, Boolean.toString(fUseLoginShellButton.getSelection()));
|
||||
fConnection.setAttribute(JSchConnection.USE_LOGIN_SHELL_ATTR,
|
||||
Boolean.toString(fUseLoginShellButton.getSelection()));
|
||||
fConnection.setAttribute(JSchConnection.LOGIN_SHELL_COMMAND_ATTR, fLoginShellText.getText().trim());
|
||||
IRemoteConnection proxyConnection = fProxyConnectionWidget.getConnection();
|
||||
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
||||
|
|
|
@ -11,8 +11,7 @@ Export-Package: org.eclipse.remote.internal.proxy.core;x-friends:="org.eclipse.r
|
|||
org.eclipse.remote.internal.proxy.core.messages;x-friends:="org.eclipse.remote.proxy.ui"
|
||||
Bundle-Localization: plugin
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Import-Package:
|
||||
com.jcraft.jsch,
|
||||
Import-Package: com.jcraft.jsch,
|
||||
org.eclipse.core.filesystem,
|
||||
org.eclipse.core.filesystem.provider,
|
||||
org.eclipse.core.runtime,
|
||||
|
|
|
@ -69,7 +69,6 @@ public class Activator extends Plugin {
|
|||
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
|
|
|
@ -46,10 +46,9 @@ import com.jcraft.jsch.ChannelShell;
|
|||
/**
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ProxyConnection implements IRemoteConnectionControlService,
|
||||
IRemoteConnectionChangeListener, IRemoteProcessService,
|
||||
IRemoteCommandShellService, IRemoteConnectionHostService,
|
||||
IRemoteConnectionPropertyService {
|
||||
public class ProxyConnection
|
||||
implements IRemoteConnectionControlService, IRemoteConnectionChangeListener, IRemoteProcessService,
|
||||
IRemoteCommandShellService, IRemoteConnectionHostService, IRemoteConnectionPropertyService {
|
||||
// Connection Type ID
|
||||
public static final String JSCH_ID = "org.eclipse.remote.Proxy"; //$NON-NLS-1$
|
||||
|
||||
|
@ -120,8 +119,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
|||
}
|
||||
} else if (IRemoteConnectionControlService.class.equals(service)
|
||||
|| IRemoteConnectionPropertyService.class.equals(service)
|
||||
|| IRemoteConnectionHostService.class.equals(service)
|
||||
|| IRemoteProcessService.class.equals(service)
|
||||
|| IRemoteConnectionHostService.class.equals(service) || IRemoteProcessService.class.equals(service)
|
||||
|| IRemoteCommandShellService.class.equals(service)
|
||||
|| IRemoteConnectionPropertyService.class.equals(service)) {
|
||||
return (T) connection.getService(ProxyConnection.class);
|
||||
|
@ -281,7 +279,8 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
|||
}
|
||||
}
|
||||
}.start();
|
||||
ExecCommand cmd = new ExecCommand(this, command, getEnv(), getWorkingDirectory(), false, false, chanA.getId(), chanB.getId(), chanC.getId());
|
||||
ExecCommand cmd = new ExecCommand(this, command, getEnv(), getWorkingDirectory(), false, false,
|
||||
chanA.getId(), chanB.getId(), chanC.getId());
|
||||
cmd.getResult(monitor);
|
||||
DataInputStream status = new DataInputStream(chanC.getInputStream());
|
||||
int stat = status.readInt();
|
||||
|
|
|
@ -163,7 +163,8 @@ public class ProxyConnectionBootstrap {
|
|||
@Override
|
||||
public boolean process(Context context) throws IOException {
|
||||
context.getMonitor().subTask(Messages.ProxyConnectionBootstrap_3);
|
||||
String bundleName = "org.eclipse.remote.proxy.server." + context.getOSName() + "." + context.getOSArch(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String bundleName = "org.eclipse.remote.proxy.server." + context.getOSName() + "." //$NON-NLS-1$//$NON-NLS-2$
|
||||
+ context.getOSArch();
|
||||
Bundle serverBundle = Platform.getBundle(bundleName);
|
||||
if (serverBundle == null) {
|
||||
throw new IOException(NLS.bind(Messages.ProxyConnectionBootstrap_2, bundleName));
|
||||
|
@ -240,7 +241,8 @@ public class ProxyConnectionBootstrap {
|
|||
jSchService = Activator.getService(IJSchService.class);
|
||||
}
|
||||
|
||||
public StreamChannelManager run(IRemoteConnection connection, IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
public StreamChannelManager run(IRemoteConnection connection, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException {
|
||||
SubMonitor subMon = SubMonitor.convert(monitor, 20);
|
||||
try {
|
||||
final Channel chan = openChannel(connection, subMon.newChild(10));
|
||||
|
@ -268,7 +270,8 @@ public class ProxyConnectionBootstrap {
|
|||
if (context.getState() != States.START) {
|
||||
context.writer.write("exit\n"); //$NON-NLS-1$
|
||||
context.writer.flush();
|
||||
throw new RemoteConnectionException(NLS.bind(Messages.ProxyConnectionBootstrap_7, context.getErrorMessage()));
|
||||
throw new RemoteConnectionException(
|
||||
NLS.bind(Messages.ProxyConnectionBootstrap_7, context.getErrorMessage()));
|
||||
}
|
||||
new Thread("server error stream") { //$NON-NLS-1$
|
||||
@Override
|
||||
|
@ -290,17 +293,21 @@ public class ProxyConnectionBootstrap {
|
|||
}
|
||||
}
|
||||
|
||||
private Channel openChannel(IRemoteConnection connection, IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
private Channel openChannel(IRemoteConnection connection, IProgressMonitor monitor)
|
||||
throws RemoteConnectionException {
|
||||
IRemoteConnectionWorkingCopy wc = connection.getWorkingCopy();
|
||||
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
|
||||
IUserAuthenticatorService authService = wc.getService(IUserAuthenticatorService.class);
|
||||
try {
|
||||
session = jSchService.createSession(hostService.getHostname(), hostService.getPort(), hostService.getUsername());
|
||||
session = jSchService.createSession(hostService.getHostname(), hostService.getPort(),
|
||||
hostService.getUsername());
|
||||
session.setUserInfo(new JSchUserInfo(hostService, authService));
|
||||
if (hostService.usePassword()) {
|
||||
session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
|
||||
"password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$
|
||||
} else {
|
||||
session.setConfig("PreferredAuthentications", "publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
|
||||
"publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$
|
||||
}
|
||||
String password = hostService.getPassword();
|
||||
if (!password.isEmpty()) {
|
||||
|
|
|
@ -145,7 +145,8 @@ public class ProxyFileStore extends FileStore {
|
|||
|
||||
@Override
|
||||
public IFileStore getChild(String name) {
|
||||
URI uri = ProxyFileSystem.getURIFor(ProxyFileSystem.getConnectionNameFor(fURI), fRemotePath.append(name).toString());
|
||||
URI uri = ProxyFileSystem.getURIFor(ProxyFileSystem.getConnectionNameFor(fURI),
|
||||
fRemotePath.append(name).toString());
|
||||
return getInstance(uri);
|
||||
}
|
||||
|
||||
|
@ -214,8 +215,8 @@ public class ProxyFileStore extends FileStore {
|
|||
NLS.bind(Messages.ProxyFileStore_4, fRemotePath.toString()), null));
|
||||
}
|
||||
if (!info.isDirectory()) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
||||
NLS.bind(Messages.ProxyFileStore_5, fRemotePath.toString()), null));
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
|
||||
EFS.ERROR_WRONG_TYPE, NLS.bind(Messages.ProxyFileStore_5, fRemotePath.toString()), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,8 +100,9 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
|||
job = new Job("process executor") { //$NON-NLS-1$
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(), redirectErrorStream(), append,
|
||||
streams.get(0).getId(), streams.get(1).getId(), streams.get(2).getId());
|
||||
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(),
|
||||
redirectErrorStream(), append, streams.get(0).getId(), streams.get(1).getId(),
|
||||
streams.get(2).getId());
|
||||
try {
|
||||
cmd.getResult(monitor);
|
||||
} catch (ProxyException e) {
|
||||
|
|
|
@ -81,4 +81,3 @@ public abstract class AbstractCommand<T> implements Callable<T> {
|
|||
this.connection = conn;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ public class ExecCommand extends AbstractCommand<Void> {
|
|||
private final int ioChan;
|
||||
private final int errChan;
|
||||
|
||||
public ExecCommand(ProxyConnection conn, List<String> command, Map<String, String> env, String directory, boolean redirect, boolean appendEnv,
|
||||
int cmdChan, int ioChan, int errChan) {
|
||||
public ExecCommand(ProxyConnection conn, List<String> command, Map<String, String> env, String directory,
|
||||
boolean redirect, boolean appendEnv, int cmdChan, int ioChan, int errChan) {
|
||||
super(conn);
|
||||
this.out = new DataOutputStream(conn.getCommandChannel().getOutputStream());
|
||||
this.in = new DataInputStream(conn.getCommandChannel().getInputStream());
|
||||
|
|
|
@ -69,7 +69,6 @@ public class Activator extends Plugin {
|
|||
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||
public class StreamChannelManager implements Runnable {
|
||||
public interface IChannelListener {
|
||||
public void newChannel(StreamChannel chan);
|
||||
|
||||
public void closeChannel(StreamChannel chan);
|
||||
}
|
||||
|
||||
|
@ -281,7 +282,6 @@ public class StreamChannelManager implements Runnable {
|
|||
chan.disconnectInput();
|
||||
break;
|
||||
|
||||
|
||||
case CMD_CLOSE_OUTPUT:
|
||||
/*
|
||||
* Received a command to close the output side of the channel.
|
||||
|
@ -341,8 +341,10 @@ public class StreamChannelManager implements Runnable {
|
|||
private final static int SERVER_ID_MASK = 1 << 15;
|
||||
private final static int MAX_CHANNELS = SERVER_ID_MASK >> 1;
|
||||
|
||||
private final Map<Integer, StreamChannel> channels = (Map<Integer, StreamChannel>) Collections.synchronizedMap(new HashMap<Integer,StreamChannel>());
|
||||
private final List<IChannelListener> listeners = (List<IChannelListener>)Collections.synchronizedList(new ArrayList<IChannelListener>());
|
||||
private final Map<Integer, StreamChannel> channels = (Map<Integer, StreamChannel>) Collections
|
||||
.synchronizedMap(new HashMap<Integer, StreamChannel>());
|
||||
private final List<IChannelListener> listeners = (List<IChannelListener>) Collections
|
||||
.synchronizedList(new ArrayList<IChannelListener>());
|
||||
|
||||
private Set<Short> usedIds = new HashSet<>();
|
||||
private int nextUnusedChannelId;
|
||||
|
@ -455,7 +457,8 @@ public class StreamChannelManager implements Runnable {
|
|||
|
||||
synchronized void sendTransmitCmd(StreamChannel chan, byte buf[], int off, int len) throws IOException {
|
||||
if (running && chan.isOpen()) {
|
||||
debugPrint("send cmd=TRANSMIT id="+chan.getId()+" len="+len + " off=" + off + " buflen="+buf.length);
|
||||
debugPrint(
|
||||
"send cmd=TRANSMIT id=" + chan.getId() + " len=" + len + " off=" + off + " buflen=" + buf.length);
|
||||
sender.sendTransmitCmd(chan.getId(), buf, off, len);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ public class Application implements IApplication {
|
|||
ByteBuffer b = ByteBuffer.allocate(4);
|
||||
b.putInt(Protocol.MAGIC);
|
||||
System.out.write(b.array());
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
server.start();
|
||||
server.waitFor();
|
||||
|
|
|
@ -97,7 +97,6 @@ public class CommandServer implements Runnable {
|
|||
cmdOut.flush();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO replace with dynamic dispatcher
|
||||
*/
|
||||
|
@ -200,6 +199,7 @@ public class CommandServer implements Runnable {
|
|||
}
|
||||
return new ServerShellCommand(cmdChan, ioChan);
|
||||
}
|
||||
|
||||
private AbstractServerCommand cmdGetCwd(DataInputStream in) throws ProxyException, IOException {
|
||||
int chanId = in.readByte();
|
||||
StreamChannel chan = server.getChannel(chanId);
|
||||
|
|
|
@ -21,7 +21,6 @@ public class Server {
|
|||
private StreamChannel cmdChannel;
|
||||
private Map<Integer, StreamChannel> auxChannel = Collections.synchronizedMap(new HashMap<Integer, StreamChannel>());
|
||||
|
||||
|
||||
public void start() {
|
||||
final StreamChannelManager mux = new StreamChannelManager(System.in, System.out);
|
||||
mux.setServer(true);
|
||||
|
|
|
@ -122,7 +122,8 @@ public abstract class AbstractServerExecCommand extends AbstractServerCommand {
|
|||
out.write(buf, 0, n);
|
||||
out.flush();
|
||||
}
|
||||
if (n < 0) break;
|
||||
if (n < 0)
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Finish
|
||||
|
@ -177,7 +178,8 @@ public abstract class AbstractServerExecCommand extends AbstractServerCommand {
|
|||
|
||||
private Process proc;
|
||||
|
||||
public AbstractServerExecCommand(List<String> command, Map<String, String> env, String directory, boolean redirect, boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) {
|
||||
public AbstractServerExecCommand(List<String> command, Map<String, String> env, String directory, boolean redirect,
|
||||
boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) {
|
||||
this.command = command;
|
||||
this.env = env;
|
||||
this.directory = directory;
|
||||
|
|
|
@ -59,7 +59,8 @@ public class ServerExecCommand extends AbstractServerExecCommand {
|
|||
// Not supported
|
||||
}
|
||||
|
||||
public ServerExecCommand(List<String> command, Map<String, String> env, String directory, boolean redirect, boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) {
|
||||
public ServerExecCommand(List<String> command, Map<String, String> env, String directory, boolean redirect,
|
||||
boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) {
|
||||
super(command, env, directory, redirect, appendEnv, cmdChan, ioChan, errChan);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,8 @@ public class ServerGetInputStreamCommand extends AbstractServerCommand {
|
|||
|
||||
public void exec() throws ProxyException {
|
||||
try {
|
||||
InputStream in = new BufferedInputStream(EFS.getStore(uri).openInputStream(options, new NullProgressMonitor()));
|
||||
InputStream in = new BufferedInputStream(
|
||||
EFS.getStore(uri).openInputStream(options, new NullProgressMonitor()));
|
||||
startForwarder(in, out);
|
||||
} catch (Exception e) {
|
||||
throw new ProxyException(e.getMessage());
|
||||
|
|
|
@ -73,7 +73,8 @@ public class ServerGetOutputStreamCommand extends AbstractServerCommand {
|
|||
|
||||
public void exec() throws ProxyException {
|
||||
try {
|
||||
OutputStream out = new BufferedOutputStream(EFS.getStore(uri).openOutputStream(options, new NullProgressMonitor()));
|
||||
OutputStream out = new BufferedOutputStream(
|
||||
EFS.getStore(uri).openOutputStream(options, new NullProgressMonitor()));
|
||||
startForwarder(in, out);
|
||||
} catch (CoreException e) {
|
||||
throw new ProxyException(e.getMessage());
|
||||
|
|
|
@ -25,12 +25,17 @@ public class ServerGetPropertiesCommand extends AbstractServerCommand {
|
|||
public void run() {
|
||||
try {
|
||||
Map<String, String> props = new HashMap<String, String>();
|
||||
props.put(IRemoteConnection.FILE_SEPARATOR_PROPERTY, System.getProperty(IRemoteConnection.FILE_SEPARATOR_PROPERTY));
|
||||
props.put(IRemoteConnection.PATH_SEPARATOR_PROPERTY, System.getProperty(IRemoteConnection.PATH_SEPARATOR_PROPERTY));
|
||||
props.put(IRemoteConnection.LINE_SEPARATOR_PROPERTY, System.getProperty(IRemoteConnection.LINE_SEPARATOR_PROPERTY));
|
||||
props.put(IRemoteConnection.USER_HOME_PROPERTY, System.getProperty(IRemoteConnection.USER_HOME_PROPERTY));
|
||||
props.put(IRemoteConnection.FILE_SEPARATOR_PROPERTY,
|
||||
System.getProperty(IRemoteConnection.FILE_SEPARATOR_PROPERTY));
|
||||
props.put(IRemoteConnection.PATH_SEPARATOR_PROPERTY,
|
||||
System.getProperty(IRemoteConnection.PATH_SEPARATOR_PROPERTY));
|
||||
props.put(IRemoteConnection.LINE_SEPARATOR_PROPERTY,
|
||||
System.getProperty(IRemoteConnection.LINE_SEPARATOR_PROPERTY));
|
||||
props.put(IRemoteConnection.USER_HOME_PROPERTY,
|
||||
System.getProperty(IRemoteConnection.USER_HOME_PROPERTY));
|
||||
props.put(IRemoteConnection.OS_NAME_PROPERTY, System.getProperty(IRemoteConnection.OS_NAME_PROPERTY));
|
||||
props.put(IRemoteConnection.OS_VERSION_PROPERTY, System.getProperty(IRemoteConnection.OS_VERSION_PROPERTY));
|
||||
props.put(IRemoteConnection.OS_VERSION_PROPERTY,
|
||||
System.getProperty(IRemoteConnection.OS_VERSION_PROPERTY));
|
||||
props.put(IRemoteConnection.OS_ARCH_PROPERTY, System.getProperty(IRemoteConnection.OS_ARCH_PROPERTY));
|
||||
props.put(IRemoteConnection.LOCALE_CHARMAP_PROPERTY, System.getProperty("file.encoding")); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ public class ServerPutInfoCommand extends AbstractServerCommand {
|
|||
|
||||
public void exec() throws ProxyException {
|
||||
try {
|
||||
EFS.getStore(uri).putInfo(info, options, new NullProgressMonitor());;
|
||||
EFS.getStore(uri).putInfo(info, options, new NullProgressMonitor());
|
||||
;
|
||||
} catch (CoreException e) {
|
||||
throw new ProxyException(e.getMessage());
|
||||
}
|
||||
|
|
|
@ -2,4 +2,3 @@ bin.includes = META-INF/,\
|
|||
proxy.server.tar.gz,\
|
||||
plugin.properties,\
|
||||
about.html
|
||||
|
|
@ -115,6 +115,7 @@ public class MultiplexServerTests extends TestCase {
|
|||
|
||||
new Thread("stderr") {
|
||||
private byte[] buf = new byte[1024];
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int n;
|
||||
|
@ -135,7 +136,8 @@ public class MultiplexServerTests extends TestCase {
|
|||
|
||||
StreamChannelManager mpxClnt = startMpxClient(proc.getInputStream(), proc.getOutputStream());
|
||||
|
||||
List<StreamChannel> channels = runChannelTest(mpxClnt, clntReaders, clntWriters, clntSentBufs, clntRecvBufs);
|
||||
List<StreamChannel> channels = runChannelTest(mpxClnt, clntReaders, clntWriters, clntSentBufs,
|
||||
clntRecvBufs);
|
||||
|
||||
for (int i = 0; i < NUM_CHANS; i++) {
|
||||
clntWriters[i].join();
|
||||
|
@ -159,7 +161,8 @@ public class MultiplexServerTests extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private List<StreamChannel> runChannelTest(StreamChannelManager mpx, Thread[] readers, Thread[] writers, final StringBuffer[] sentBufs, final StringBuffer[] recvBufs) throws IOException {
|
||||
private List<StreamChannel> runChannelTest(StreamChannelManager mpx, Thread[] readers, Thread[] writers,
|
||||
final StringBuffer[] sentBufs, final StringBuffer[] recvBufs) throws IOException {
|
||||
List<StreamChannel> channels = new ArrayList<StreamChannel>();
|
||||
for (int i = 0; i < NUM_CHANS; i++) {
|
||||
StreamChannel chan = mpx.openChannel(); // needs to be in same thread as reader
|
||||
|
|
|
@ -147,7 +147,6 @@ public class MultiplexTests extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void testChannels() {
|
||||
try {
|
||||
final PipedInputStream inClnt = new PipedInputStream();
|
||||
|
@ -173,7 +172,8 @@ public class MultiplexTests extends TestCase {
|
|||
|
||||
StreamChannelManager mpxClnt = startMpxClient(inClnt, outClnt);
|
||||
|
||||
List<StreamChannel> channels = runChannelTest(mpxClnt, testers, clntReaders, clntWriters, clntSentBufs, clntRecvBufs);
|
||||
List<StreamChannel> channels = runChannelTest(mpxClnt, testers, clntReaders, clntWriters, clntSentBufs,
|
||||
clntRecvBufs);
|
||||
|
||||
// Make sure all the testers have finished
|
||||
for (int i = 0; i < NUM_THREADS; i++) {
|
||||
|
@ -204,7 +204,9 @@ public class MultiplexTests extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private List<StreamChannel> runChannelTest(final StreamChannelManager mpx, final Thread[] testers, final Thread[][] readers, final Thread[][] writers, final List<List<Integer>> sentBufs, final List<List<Integer>> recvBufs) throws IOException {
|
||||
private List<StreamChannel> runChannelTest(final StreamChannelManager mpx, final Thread[] testers,
|
||||
final Thread[][] readers, final Thread[][] writers, final List<List<Integer>> sentBufs,
|
||||
final List<List<Integer>> recvBufs) throws IOException {
|
||||
final List<StreamChannel> channels = new ArrayList<StreamChannel>();
|
||||
for (int i = 0; i < NUM_THREADS; i++) {
|
||||
final int thread = i;
|
||||
|
@ -214,9 +216,11 @@ public class MultiplexTests extends TestCase {
|
|||
try {
|
||||
for (int j = 0; j < NUM_CHANS_PER_THREAD; j++) {
|
||||
StreamChannel chan = mpx.openChannel();
|
||||
ChanReader reader = new ChanReader(chan, recvBufs.get(thread * NUM_CHANS_PER_THREAD + j), "clnt reader thread=" + thread + " chan=" + chan.getId());
|
||||
ChanReader reader = new ChanReader(chan, recvBufs.get(thread * NUM_CHANS_PER_THREAD + j),
|
||||
"clnt reader thread=" + thread + " chan=" + chan.getId());
|
||||
readers[thread][j] = new Thread(reader, reader.getName());
|
||||
ChanWriter writer = new ChanWriter(chan, sentBufs.get(thread * NUM_CHANS_PER_THREAD + j), "clnt writer thread=" + thread + " chan=" + chan.getId());
|
||||
ChanWriter writer = new ChanWriter(chan, sentBufs.get(thread * NUM_CHANS_PER_THREAD + j),
|
||||
"clnt writer thread=" + thread + " chan=" + chan.getId());
|
||||
writers[thread][j] = new Thread(writer, writer.getName());
|
||||
readers[thread][j].start();
|
||||
writers[thread][j].start();
|
||||
|
@ -238,7 +242,8 @@ public class MultiplexTests extends TestCase {
|
|||
return mpx;
|
||||
}
|
||||
|
||||
private StreamChannelManager startMpxServer(InputStream in, OutputStream out, final Thread[] rws) throws IOException {
|
||||
private StreamChannelManager startMpxServer(InputStream in, OutputStream out, final Thread[] rws)
|
||||
throws IOException {
|
||||
final StreamChannelManager mpx = new StreamChannelManager(in, out);
|
||||
mpx.setServer(true);
|
||||
mpx.addListener(new IChannelListener() {
|
||||
|
|
|
@ -30,7 +30,8 @@ public class ProxyUserAuthenticator implements IUserAuthenticatorService {
|
|||
IRemoteConnectionHostService hostService = conn.getService(IRemoteConnectionHostService.class);
|
||||
if (hostService != null) {
|
||||
try {
|
||||
prompter = new UserInfoPrompter(new JSch().getSession(hostService.getUsername(), hostService.getHostname()));
|
||||
prompter = new UserInfoPrompter(
|
||||
new JSch().getSession(hostService.getUsername(), hostService.getHostname()));
|
||||
} catch (JSchException e) {
|
||||
// Not allowed
|
||||
}
|
||||
|
@ -85,8 +86,8 @@ public class ProxyUserAuthenticator implements IUserAuthenticatorService {
|
|||
}
|
||||
|
||||
display.syncExec(() -> {
|
||||
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message,
|
||||
promptType, buttons, defaultResponseIndex);
|
||||
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */,
|
||||
message, promptType, buttons, defaultResponseIndex);
|
||||
retval[0] = dialog.open();
|
||||
});
|
||||
return promptResponses[retval[0]];
|
||||
|
|
|
@ -226,8 +226,8 @@ public class ProxyConnectionPage extends WizardPage {
|
|||
|
||||
fPasswordButton.setSelection(ProxyConnection.DEFAULT_USE_PASSWORD);
|
||||
fPublicKeyButton.setSelection(!ProxyConnection.DEFAULT_USE_PASSWORD);
|
||||
controls.setTabList(
|
||||
new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton, fPasswordText });
|
||||
controls.setTabList(new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton,
|
||||
fPasswordText });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -322,7 +322,8 @@ public class ProxyConnectionPage extends WizardPage {
|
|||
: Boolean.parseBoolean(useDefaultServerStr);
|
||||
fDefaultServerButton.setSelection(useDefaultServer);
|
||||
String serverCommandStr = fConnection.getAttribute(ProxyConnection.SERVER_COMMAND_ATTR);
|
||||
fServerCommandText.setText(serverCommandStr.isEmpty() ? ProxyConnection.DEFAULT_SERVER_COMMAND : serverCommandStr);
|
||||
fServerCommandText
|
||||
.setText(serverCommandStr.isEmpty() ? ProxyConnection.DEFAULT_SERVER_COMMAND : serverCommandStr);
|
||||
|
||||
} else {
|
||||
fConnectionName.setText(fInitialName);
|
||||
|
@ -438,10 +439,12 @@ public class ProxyConnectionPage extends WizardPage {
|
|||
fConnection.setAttribute(ProxyConnection.USERNAME_ATTR, fUserText.getText().trim());
|
||||
fConnection.setSecureAttribute(ProxyConnection.PASSWORD_ATTR, fPasswordText.getText().trim());
|
||||
fConnection.setSecureAttribute(ProxyConnection.PASSPHRASE_ATTR, fPassphraseText.getText().trim());
|
||||
fConnection.setAttribute(ProxyConnection.USE_PASSWORD_ATTR, Boolean.toString(fPasswordButton.getSelection()));
|
||||
fConnection.setAttribute(ProxyConnection.USE_PASSWORD_ATTR,
|
||||
Boolean.toString(fPasswordButton.getSelection()));
|
||||
fConnection.setAttribute(ProxyConnection.TIMEOUT_ATTR, fTimeoutText.getText().trim());
|
||||
fConnection.setAttribute(ProxyConnection.PORT_ATTR, fPortText.getText().trim());
|
||||
fConnection.setAttribute(ProxyConnection.USE_DEFAULT_SERVER_ATTR, Boolean.toString(fDefaultServerButton.getSelection()));
|
||||
fConnection.setAttribute(ProxyConnection.USE_DEFAULT_SERVER_ATTR,
|
||||
Boolean.toString(fDefaultServerButton.getSelection()));
|
||||
fConnection.setAttribute(ProxyConnection.SERVER_COMMAND_ATTR, fServerCommandText.getText().trim());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ public class SerialPortCommandShell implements IRemoteProcess {
|
|||
serialPort.open();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void destroy() {
|
||||
if (serialPort.isOpen()) {
|
||||
|
|
|
@ -69,10 +69,14 @@ public class SerialPortConnection implements ISerialPortService, IRemoteCommandS
|
|||
if (portName != null) {
|
||||
serialPort = new SerialPort(portName);
|
||||
try {
|
||||
serialPort.setBaudRate(BaudRate.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(BAUD_RATE_ATTR))));
|
||||
serialPort.setByteSize(ByteSize.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(BYTE_SIZE_ATTR))));
|
||||
serialPort.setParity(Parity.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(PARITY_ATTR))));
|
||||
serialPort.setStopBits(StopBits.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(STOP_BITS_ATTR))));
|
||||
serialPort.setBaudRate(
|
||||
BaudRate.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(BAUD_RATE_ATTR))));
|
||||
serialPort.setByteSize(
|
||||
ByteSize.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(BYTE_SIZE_ATTR))));
|
||||
serialPort.setParity(
|
||||
Parity.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(PARITY_ATTR))));
|
||||
serialPort.setStopBits(
|
||||
StopBits.fromStringIndex(Integer.parseInt(remoteConnection.getAttribute(STOP_BITS_ATTR))));
|
||||
} catch (IOException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ public class Activator extends Plugin {
|
|||
if (exception instanceof CoreException) {
|
||||
log(((CoreException) exception).getStatus());
|
||||
} else {
|
||||
log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), exception.getLocalizedMessage(), exception));
|
||||
log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), exception.getLocalizedMessage(),
|
||||
exception));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ public class SerialPortConnectionBlock {
|
|||
private boolean isComplete;
|
||||
private List<SerialBlockUpdateListener> listeners = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
* Creates the UI elements for the SerialPortConnectionBlock
|
||||
*
|
||||
|
@ -188,7 +187,6 @@ public class SerialPortConnectionBlock {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.swt.widgets.Control;
|
|||
import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||
import org.eclipse.ui.dialogs.PropertyPage;
|
||||
|
||||
|
||||
public class SerialPortConnectionPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
|
||||
|
||||
protected SerialPortConnectionBlock block;
|
||||
|
@ -53,7 +52,6 @@ public class SerialPortConnectionPropertyPage extends PropertyPage implements IW
|
|||
else
|
||||
workingCopy = null;
|
||||
|
||||
|
||||
block.createBlock(comp, workingCopy);
|
||||
return comp;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,7 @@ package org.eclipse.remote.telnet.core;
|
|||
* interface. The meanings of these constants are defined in the various TELNET RFCs
|
||||
* (RFC 854 to RFC 861, and others).
|
||||
*/
|
||||
interface TelnetCodes
|
||||
{
|
||||
interface TelnetCodes {
|
||||
/** Command code: Subnegotiation End. */
|
||||
static final byte TELNET_SE = (byte) 240;
|
||||
|
||||
|
@ -77,7 +76,6 @@ interface TelnetCodes
|
|||
/** Command code: SEND. */
|
||||
static final byte TELNET_SEND = 1;
|
||||
|
||||
|
||||
/** Option code: Transmit Binary option. */
|
||||
static final byte TELNET_OPTION_TRANSMIT_BINARY = 0;
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.eclipse.remote.core.IRemoteProcess;
|
|||
import org.eclipse.remote.core.RemoteConnectionChangeEvent;
|
||||
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
||||
|
||||
public class TelnetConnection implements IRemoteConnectionControlService, IRemoteCommandShellService, IRemoteConnectionHostService,
|
||||
IRemoteConnectionChangeListener {
|
||||
public class TelnetConnection implements IRemoteConnectionControlService, IRemoteCommandShellService,
|
||||
IRemoteConnectionHostService, IRemoteConnectionChangeListener {
|
||||
public static int DEFAULT_PORT = 23;
|
||||
public static int DEFAULT_TIMEOUT = 0; // Infinite
|
||||
|
||||
|
@ -53,7 +53,8 @@ public class TelnetConnection implements IRemoteConnectionControlService, IRemot
|
|||
public <T extends Service> T getService(IRemoteConnection remoteConnection, Class<T> service) {
|
||||
if (TelnetConnection.class.equals(service)) {
|
||||
return (T) new TelnetConnection(remoteConnection);
|
||||
} else if (IRemoteConnectionControlService.class.equals(service) || IRemoteConnectionHostService.class.equals(service)
|
||||
} else if (IRemoteConnectionControlService.class.equals(service)
|
||||
|| IRemoteConnectionHostService.class.equals(service)
|
||||
|| IRemoteCommandShellService.class.equals(service)) {
|
||||
return (T) remoteConnection.getService(TelnetConnection.class);
|
||||
}
|
||||
|
|
|
@ -550,8 +550,8 @@ class TelnetOption implements TelnetCodes {
|
|||
//
|
||||
// IAC SB TERMINAL-TYPE IS x t e r m IAC SE
|
||||
|
||||
byte[] terminalTypeData = { TELNET_IAC, TELNET_SB, TELNET_OPTION_TERMINAL_TYPE, TELNET_IS, (byte) 'x', (byte) 't',
|
||||
(byte) 'e', (byte) 'r', (byte) 'm', TELNET_IAC, TELNET_SE };
|
||||
byte[] terminalTypeData = { TELNET_IAC, TELNET_SB, TELNET_OPTION_TERMINAL_TYPE, TELNET_IS, (byte) 'x',
|
||||
(byte) 't', (byte) 'e', (byte) 'r', (byte) 'm', TELNET_IAC, TELNET_SE };
|
||||
|
||||
try {
|
||||
outputStream.write(terminalTypeData);
|
||||
|
|
|
@ -349,7 +349,8 @@ public class TelnetProtocol extends Thread implements TelnetCodes {
|
|||
// A "socket closed" exception is normal here. It's caused by the
|
||||
// user clicking the disconnect button on the Terminal view toolbar.
|
||||
|
||||
if (message != null && !message.equalsIgnoreCase("Socket closed") && !message.equalsIgnoreCase("Connection reset")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (message != null && !message.equalsIgnoreCase("Socket closed") //$NON-NLS-1$
|
||||
&& !message.equalsIgnoreCase("Connection reset")) { //$NON-NLS-1$
|
||||
Logger.logException(ex);
|
||||
}
|
||||
|
||||
|
@ -592,7 +593,8 @@ public class TelnetProtocol extends Thread implements TelnetCodes {
|
|||
// of 255, it is necessary to double this byte in accordance
|
||||
// the general TELNET rules."
|
||||
|
||||
if (nextSubnegotiationByteIndex > 0 && receivedSubnegotiation[nextSubnegotiationByteIndex - 1] == TELNET_IAC) {
|
||||
if (nextSubnegotiationByteIndex > 0
|
||||
&& receivedSubnegotiation[nextSubnegotiationByteIndex - 1] == TELNET_IAC) {
|
||||
// The last input byte we received in this
|
||||
// subnegotiation was IAC, so this is a double IAC. Leave the previous IAC
|
||||
// in the receivedSubnegotiation[] array and drop the current
|
||||
|
@ -645,7 +647,8 @@ public class TelnetProtocol extends Thread implements TelnetCodes {
|
|||
|
||||
int subnegotiatedOption = receivedSubnegotiation[0] & 0xFF;
|
||||
|
||||
localOptions[subnegotiatedOption].handleSubnegotiation(receivedSubnegotiation, nextSubnegotiationByteIndex);
|
||||
localOptions[subnegotiatedOption].handleSubnegotiation(receivedSubnegotiation,
|
||||
nextSubnegotiationByteIndex);
|
||||
} else {
|
||||
Logger.log("NOT CALLING handleSubnegotiation() BECAUSE OF ERRORS!"); //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ public class Activator extends Plugin {
|
|||
if (e instanceof CoreException) {
|
||||
log(((CoreException) e).getStatus());
|
||||
} else {
|
||||
log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), IStatus.ERROR, e.getLocalizedMessage(), e));
|
||||
log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), IStatus.ERROR, e.getLocalizedMessage(),
|
||||
e));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,8 @@ public final class Logger implements DebugOptionsListener {
|
|||
public static final void logException(Exception ex) {
|
||||
// log in eclipse error log
|
||||
if (Activator.getDefault() != null) {
|
||||
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, ex.getMessage(), ex));
|
||||
Activator.getDefault().getLog()
|
||||
.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, ex.getMessage(), ex));
|
||||
} else {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
/*
|
||||
* Provides tests to several scenarios but they should be
|
||||
* executed manually (i.e. browse and click OK)
|
||||
|
@ -105,6 +106,7 @@ public class RemoteResourceBrowserTest {
|
|||
public static void tearDown() throws RemoteConnectionException {
|
||||
fConnectionType.removeConnection(fRemoteConnection);
|
||||
}
|
||||
|
||||
/*
|
||||
* Select any file.
|
||||
*/
|
||||
|
@ -119,6 +121,7 @@ public class RemoteResourceBrowserTest {
|
|||
assertNotNull(expectedResource);
|
||||
assertTrue(!expectedResource.fetchInfo().isDirectory());
|
||||
}
|
||||
|
||||
/*
|
||||
* Select any directory.
|
||||
*/
|
||||
|
@ -133,6 +136,7 @@ public class RemoteResourceBrowserTest {
|
|||
assertNotNull(expectedResource);
|
||||
assertTrue(expectedResource.fetchInfo().isDirectory());
|
||||
}
|
||||
|
||||
/*
|
||||
* Select either file or directory.
|
||||
*/
|
||||
|
@ -145,6 +149,7 @@ public class RemoteResourceBrowserTest {
|
|||
expectedResource = browser.getResource();
|
||||
assertNotNull(expectedResource);
|
||||
}
|
||||
|
||||
/*
|
||||
* Select more than one resource.
|
||||
*/
|
||||
|
@ -158,6 +163,7 @@ public class RemoteResourceBrowserTest {
|
|||
assertNotNull(expectedResources);
|
||||
assertTrue(expectedResources.size() > 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Select to local connection and select a directory.
|
||||
*/
|
||||
|
@ -174,6 +180,7 @@ public class RemoteResourceBrowserTest {
|
|||
assertNotNull(expectedResource);
|
||||
assertEquals(expectedResource.getFileSystem().getScheme(), "file");
|
||||
}
|
||||
|
||||
/*
|
||||
* Initial path set.
|
||||
*/
|
||||
|
@ -187,6 +194,7 @@ public class RemoteResourceBrowserTest {
|
|||
browser.setInitialPath(initialPath);
|
||||
browser.open();
|
||||
}
|
||||
|
||||
/*
|
||||
* Show connections.
|
||||
* Don't show hidden check box and new folder button.
|
||||
|
|
|
@ -67,7 +67,8 @@ public class DeferredFileStore implements IDeferredWorkbenchAdapter, IAdaptable
|
|||
IFileInfo[] childInfos = fFileStore.childInfos(EFS.NONE, monitor);
|
||||
for (IFileInfo info : childInfos) {
|
||||
if (!(fExcludeHidden && info.getName().startsWith("."))) { //$NON-NLS-1$
|
||||
children.add(new DeferredFileStore(fFileStore.getChild(info.getName()), info, fExcludeHidden, this));
|
||||
children.add(
|
||||
new DeferredFileStore(fFileStore.getChild(info.getName()), info, fExcludeHidden, this));
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
|
|
@ -192,7 +192,8 @@ public class RemoteTreeContentManager {
|
|||
* @param monitor
|
||||
* progress monitor
|
||||
*/
|
||||
protected void replaceChildren(final Object parent, final Object[] children, final int offset, IProgressMonitor monitor) {
|
||||
protected void replaceChildren(final Object parent, final Object[] children, final int offset,
|
||||
IProgressMonitor monitor) {
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -49,9 +49,12 @@ public class RemoteUIImages {
|
|||
public static final ImageDescriptor DESC_ELCL_UP_NAV = createManaged(T_ELCL, "up_nav.gif", IMG_ELCL_UP_NAV); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_DLCL_UP_NAV = createManaged(T_DLCL, "up_nav.gif", IMG_ELCL_UP_NAV); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_OVR_SYMLINK = createManaged(T_OVR, "symlink_ovr.gif", IMG_OVR_SYMLINK); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_ELCL_NEW_FOLDER = createManaged(T_ELCL, "new_folder.gif", IMG_ELCL_NEW_FOLDER); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_DLCL_NEW_FOLDER = createManaged(T_DLCL, "new_folder.gif", IMG_DLCL_NEW_FOLDER); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_DEFAULT_TYPE = createManaged(ICONS_PATH.append("console.png"), IMG_DEFAULT_TYPE); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_ELCL_NEW_FOLDER = createManaged(T_ELCL, "new_folder.gif", //$NON-NLS-1$
|
||||
IMG_ELCL_NEW_FOLDER);
|
||||
public static final ImageDescriptor DESC_DLCL_NEW_FOLDER = createManaged(T_DLCL, "new_folder.gif", //$NON-NLS-1$
|
||||
IMG_DLCL_NEW_FOLDER);
|
||||
public static final ImageDescriptor DESC_DEFAULT_TYPE = createManaged(ICONS_PATH.append("console.png"), //$NON-NLS-1$
|
||||
IMG_DEFAULT_TYPE);
|
||||
|
||||
/**
|
||||
* Returns the image managed under the given key in this registry.
|
||||
|
|
|
@ -68,7 +68,8 @@ public class RemoteUIPlugin extends AbstractUIPlugin {
|
|||
* @since 5.0
|
||||
*/
|
||||
public static void log(Throwable e) {
|
||||
log(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), IStatus.ERROR, Messages.PTPRemoteUIPlugin_3, e));
|
||||
log(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), IStatus.ERROR,
|
||||
Messages.PTPRemoteUIPlugin_3, e));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,8 @@ public class ServicePropertyTester extends PropertyTester {
|
|||
String serviceName = (String) args[0];
|
||||
try {
|
||||
Class<?> service = Class.forName(serviceName);
|
||||
return connection.getConnectionType().hasService((Class<IRemoteConnectionType.Service>) service);
|
||||
return connection.getConnectionType()
|
||||
.hasService((Class<IRemoteConnectionType.Service>) service);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
|
@ -35,14 +36,16 @@ public class ServicePropertyTester extends PropertyTester {
|
|||
} else if (property.equals("canDelete")) { //$NON-NLS-1$
|
||||
return connection.getConnectionType().canRemove();
|
||||
} else if (property.equals("canOpen")) { //$NON-NLS-1$
|
||||
IRemoteConnectionControlService controlService = connection.getService(IRemoteConnectionControlService.class);
|
||||
IRemoteConnectionControlService controlService = connection
|
||||
.getService(IRemoteConnectionControlService.class);
|
||||
if (controlService != null) {
|
||||
return !connection.isOpen();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("canClose")) { //$NON-NLS-1$
|
||||
IRemoteConnectionControlService controlService = connection.getService(IRemoteConnectionControlService.class);
|
||||
IRemoteConnectionControlService controlService = connection
|
||||
.getService(IRemoteConnectionControlService.class);
|
||||
if (controlService != null) {
|
||||
return connection.isOpen();
|
||||
} else {
|
||||
|
|
|
@ -112,7 +112,8 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
IRemoteConnection connection = getOriginalIfClean((IRemoteConnection) element);
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return connection.isOpen() ? Messages.ConnectionsPreferencePage_open : Messages.ConnectionsPreferencePage_closed;
|
||||
return connection.isOpen() ? Messages.ConnectionsPreferencePage_open
|
||||
: Messages.ConnectionsPreferencePage_closed;
|
||||
case 1:
|
||||
return connection.getName();
|
||||
case 2:
|
||||
|
@ -229,8 +230,8 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
*/
|
||||
private void addConnection() {
|
||||
if (fIsDirty) {
|
||||
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions, null,
|
||||
Messages.ConnectionsPreferencePage_There_are_unsaved_changes, MessageDialog.QUESTION,
|
||||
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions,
|
||||
null, Messages.ConnectionsPreferencePage_There_are_unsaved_changes, MessageDialog.QUESTION,
|
||||
new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
|
||||
if (dialog.open() == 1) {
|
||||
return;
|
||||
|
@ -524,9 +525,11 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
if (conn instanceof IRemoteConnectionWorkingCopy) {
|
||||
IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) conn;
|
||||
if (wc.isDirty()) {
|
||||
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions,
|
||||
null, Messages.ConnectionsPreferencePage_This_connection_contains_unsaved_changes,
|
||||
MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
|
||||
MessageDialog dialog = new MessageDialog(getShell(),
|
||||
Messages.ConnectionsPreferencePage_Confirm_Actions, null,
|
||||
Messages.ConnectionsPreferencePage_This_connection_contains_unsaved_changes,
|
||||
MessageDialog.QUESTION,
|
||||
new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
|
||||
if (dialog.open() == 1) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RemoteDevelopmentPreferencePage extends FieldEditorPreferencePage i
|
|||
namesAndValues.add(nameAndValue);
|
||||
}
|
||||
addField(new ComboFieldEditor(IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID,
|
||||
Messages.RemoteDevelopmentPreferencePage_Default_connection_type, namesAndValues.toArray(new String[namesAndValues
|
||||
.size()][2]), getFieldEditorParent()));
|
||||
Messages.RemoteDevelopmentPreferencePage_Default_connection_type,
|
||||
namesAndValues.toArray(new String[namesAndValues.size()][2]), getFieldEditorParent()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,8 @@ import org.eclipse.swt.widgets.Shell;
|
|||
public abstract class AbstractRemoteUIConnectionService implements IRemoteUIConnectionService {
|
||||
|
||||
@Override
|
||||
public void openConnectionWithProgress(final Shell shell, IRunnableContext context, final IRemoteConnection connection) {
|
||||
public void openConnectionWithProgress(final Shell shell, IRunnableContext context,
|
||||
final IRemoteConnection connection) {
|
||||
if (!connection.isOpen()) {
|
||||
IRunnableWithProgress op = new IRunnableWithProgress() {
|
||||
@Override
|
||||
|
@ -60,12 +61,12 @@ public abstract class AbstractRemoteUIConnectionService implements IRemoteUIConn
|
|||
}
|
||||
} catch (InvocationTargetException e) {
|
||||
ErrorDialog.openError(shell, Messages.AbstractRemoteUIConnectionManager_Connection_Error,
|
||||
Messages.AbstractRemoteUIConnectionManager_Could_not_open_connection, new Status(IStatus.ERROR,
|
||||
RemoteUIPlugin.PLUGIN_ID, e.getCause().getMessage()));
|
||||
Messages.AbstractRemoteUIConnectionManager_Could_not_open_connection,
|
||||
new Status(IStatus.ERROR, RemoteUIPlugin.PLUGIN_ID, e.getCause().getMessage()));
|
||||
} catch (InterruptedException e) {
|
||||
ErrorDialog.openError(shell, Messages.AbstractRemoteUIConnectionManager_Connection_Error,
|
||||
Messages.AbstractRemoteUIConnectionManager_Could_not_open_connection, new Status(IStatus.ERROR,
|
||||
RemoteUIPlugin.PLUGIN_ID, e.getMessage()));
|
||||
Messages.AbstractRemoteUIConnectionManager_Could_not_open_connection,
|
||||
new Status(IStatus.ERROR, RemoteUIPlugin.PLUGIN_ID, e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ public class RemoteConnectionsLabelProvider extends LabelProvider {
|
|||
String closedId = "closed." + type.getId(); //$NON-NLS-1$
|
||||
Image closedImage = RemoteUIPlugin.getDefault().getImageRegistry().get(closedId);
|
||||
if (closedImage == null) {
|
||||
final Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEC_FIELD_ERROR);
|
||||
final Image errorImage = PlatformUI.getWorkbench().getSharedImages()
|
||||
.getImage(ISharedImages.IMG_DEC_FIELD_ERROR);
|
||||
ImageDescriptor desc = new CompositeImageDescriptor() {
|
||||
@Override
|
||||
protected Point getSize() {
|
||||
|
|
|
@ -218,8 +218,8 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException,
|
||||
InterruptedException {
|
||||
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
|
||||
throws InvocationTargetException, InterruptedException {
|
||||
fProgressMonitor.attachToCancelComponent(null);
|
||||
fProgressMonitor.getParent().setVisible(true);
|
||||
try {
|
||||
|
|
|
@ -186,7 +186,8 @@ public class RemoteDirectoryWidget extends Composite {
|
|||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
if (conn.hasService(IRemoteFileService.class) && conn.getConnectionType().hasService(IRemoteUIConnectionService.class)
|
||||
if (conn.hasService(IRemoteFileService.class)
|
||||
&& conn.getConnectionType().hasService(IRemoteUIConnectionService.class)
|
||||
&& conn.getConnectionType().hasService(IRemoteUIFileService.class) && !conn.equals(fRemoteConnection)) {
|
||||
fRemoteConnection = conn;
|
||||
String path = getSavedPath();
|
||||
|
@ -225,7 +226,8 @@ public class RemoteDirectoryWidget extends Composite {
|
|||
|
||||
private String getSavedPath() {
|
||||
if (fRemoteConnection != null) {
|
||||
return previousSelections.get(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName()); //$NON-NLS-1$
|
||||
return previousSelections
|
||||
.get(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName()); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -265,7 +267,8 @@ public class RemoteDirectoryWidget extends Composite {
|
|||
|
||||
private void setSavedPath(String path) {
|
||||
if (fRemoteConnection != null) {
|
||||
previousSelections.put(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName(), path); //$NON-NLS-1$
|
||||
previousSelections.put(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName(), //$NON-NLS-1$
|
||||
path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,8 @@ public class RemoteFileWidget extends Composite {
|
|||
|
||||
private String getSavedPath() {
|
||||
if (fRemoteConnection != null) {
|
||||
return fPreviousSelections.get(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName()); //$NON-NLS-1$
|
||||
return fPreviousSelections
|
||||
.get(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName()); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -241,7 +242,8 @@ public class RemoteFileWidget extends Composite {
|
|||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
if (conn.hasService(IRemoteFileService.class) && conn.getConnectionType().hasService(IRemoteUIConnectionService.class)
|
||||
if (conn.hasService(IRemoteFileService.class)
|
||||
&& conn.getConnectionType().hasService(IRemoteUIConnectionService.class)
|
||||
&& conn.getConnectionType().hasService(IRemoteUIFileService.class) && !conn.equals(fRemoteConnection)) {
|
||||
fRemoteConnection = conn;
|
||||
String path = getSavedPath();
|
||||
|
@ -284,7 +286,8 @@ public class RemoteFileWidget extends Composite {
|
|||
|
||||
private void setSavedPath(String path) {
|
||||
if (fRemoteConnection != null) {
|
||||
fPreviousSelections.put(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName(), path); //$NON-NLS-1$
|
||||
fPreviousSelections.put(fRemoteConnection.getConnectionType().getId() + "." + fRemoteConnection.getName(), //$NON-NLS-1$
|
||||
path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -322,8 +322,8 @@ public class RemoteResourceBrowserWidget extends Composite {
|
|||
fTreeViewer.refresh(element);
|
||||
Object[] children = element.getChildren(null);
|
||||
for (Object child : children) {
|
||||
if (child instanceof DeferredFileStore
|
||||
&& newPath.equals(((DeferredFileStore) child).getFileStore().getName())) {
|
||||
if (child instanceof DeferredFileStore && newPath
|
||||
.equals(((DeferredFileStore) child).getFileStore().getName())) {
|
||||
fTreeViewer.deferSelection(new StructuredSelection(child));
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +535,8 @@ public class RemoteResourceBrowserWidget extends Composite {
|
|||
@Override
|
||||
public void run() {
|
||||
ErrorDialog.openError(getShell(), Messages.RemoteResourceBrowserWidget_New_Folder,
|
||||
Messages.RemoteResourceBrowserWidget_Unable_to_create_new_folder, e.getStatus());
|
||||
Messages.RemoteResourceBrowserWidget_Unable_to_create_new_folder,
|
||||
e.getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -544,8 +545,9 @@ public class RemoteResourceBrowserWidget extends Composite {
|
|||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
DelayedInputDialog dialog = new DelayedInputDialog(getShell(), Messages.RemoteResourceBrowserWidget_1,
|
||||
Messages.RemoteResourceBrowserWidget_2, basePath.getName(), new IInputValidator() {
|
||||
DelayedInputDialog dialog = new DelayedInputDialog(getShell(),
|
||||
Messages.RemoteResourceBrowserWidget_1, Messages.RemoteResourceBrowserWidget_2,
|
||||
basePath.getName(), new IInputValidator() {
|
||||
@Override
|
||||
public String isValid(String newText) {
|
||||
if (!newText.equals("")) { //$NON-NLS-1$
|
||||
|
@ -577,7 +579,8 @@ public class RemoteResourceBrowserWidget extends Composite {
|
|||
@Override
|
||||
public void run() {
|
||||
ErrorDialog.openError(getShell(), Messages.RemoteResourceBrowserWidget_New_Folder,
|
||||
Messages.RemoteResourceBrowserWidget_Unable_to_create_new_folder, e.getStatus());
|
||||
Messages.RemoteResourceBrowserWidget_Unable_to_create_new_folder,
|
||||
e.getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue