diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/TerminalConsoleUtility.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/TerminalConsoleUtility.java index ff532694f83..9dc662f86eb 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/TerminalConsoleUtility.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/TerminalConsoleUtility.java @@ -19,7 +19,7 @@ import org.eclipse.ui.console.IConsole; /** * A collection of public API utility methods to open consoles to * IRemoteConnection objects - * + * * @since 1.1 */ public class TerminalConsoleUtility { @@ -33,7 +33,7 @@ public class TerminalConsoleUtility { /** * Open a specific IRemoteConnection and encoding combination. - * + * * @param connection * @param encoding */ @@ -43,7 +43,7 @@ public class TerminalConsoleUtility { /** * Find an existing console for the given IRemoteConnection - * + * * @param connection * @return */ diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/ConsoleAction.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/ConsoleAction.java index 2dadfc2d0cb..f3b4189711c 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/ConsoleAction.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/ConsoleAction.java @@ -23,7 +23,7 @@ public abstract class ConsoleAction extends Action { /** * @param id - * The action id + * The action id */ public ConsoleAction(String id) { this(id, 0); @@ -31,9 +31,9 @@ public abstract class ConsoleAction extends Action { /** * @param id - * The action id + * The action id * @param style - * one of AS_PUSH_BUTTON, AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_RADIO_BUTTON, + * one of AS_PUSH_BUTTON, AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_RADIO_BUTTON, * and AS_UNSPECIFIED */ public ConsoleAction(String id, int style) { @@ -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); diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/IConsoleActionFactory.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/IConsoleActionFactory.java index 7f935c33051..9264341a47e 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/IConsoleActionFactory.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/console/actions/IConsoleActionFactory.java @@ -16,15 +16,15 @@ import org.eclipse.core.runtime.IAdaptable; * @since 1.1 */ public interface IConsoleActionFactory { - /** + /** * Returns an implementation of ConsoleAction - * + * * @param actionId - * The id of the action being requested + * The id of the action being requested * @param connectionType * The connection type of the terminal console * @param adapter - * An adapter to get relevant objects for use by the ConsoleAction being created (eg. IRemoteConnection) + * An adapter to get relevant objects for use by the ConsoleAction being created (eg. IRemoteConnection) * @return an implementation of ConsoleAction */ public ConsoleAction createAction(String actionId, String connectionType, IAdaptable adapter); diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/Activator.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/Activator.java index c6e10de8c36..07dca56ca23 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/Activator.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/Activator.java @@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -102,10 +102,10 @@ public class Activator extends AbstractUIPlugin { imageRegistry.put(entry.getKey(), imageDescriptor); } } - + /** * Create log entry from an IStatus - * + * * @param status * status to log */ @@ -115,7 +115,7 @@ public class Activator extends AbstractUIPlugin { /** * Create log entry from a string - * + * * @param msg * message to log */ @@ -125,7 +125,7 @@ public class Activator extends AbstractUIPlugin { /** * Create log entry from a Throwable - * + * * @param e * throwable to log */ diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/ImageConsts.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/ImageConsts.java index a20dcabcb39..3e24bee9953 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/ImageConsts.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/ImageConsts.java @@ -19,34 +19,33 @@ *******************************************************************************/ package org.eclipse.remote.internal.console; -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$ - public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size 16x16 //$NON-NLS-1$ - public final static String IMAGE_DIR_VIEW = "cview16/"; // views //$NON-NLS-1$ - public final static String IMAGE_DIR_EVIEW = "eview16/"; // views //$NON-NLS-1$ +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$ + public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size 16x16 //$NON-NLS-1$ + public final static String IMAGE_DIR_VIEW = "cview16/"; // views //$NON-NLS-1$ + public final static String IMAGE_DIR_EVIEW = "eview16/"; // views //$NON-NLS-1$ - public static final String IMAGE_NEW_TERMINAL = "TerminalViewNewTerminal"; //$NON-NLS-1$ - public static final String IMAGE_TERMINAL_VIEW = "TerminalView"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$ + public static final String IMAGE_NEW_TERMINAL = "TerminalViewNewTerminal"; //$NON-NLS-1$ + public static final String IMAGE_TERMINAL_VIEW = "TerminalView"; //$NON-NLS-1$ + public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$ + public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$ + public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$ + public static final String IMAGE_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_REMOVE = "ImageDlclRemove"; //$NON-NLS-1$ + public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$ + public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$ + public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$ + public static final String IMAGE_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$ + public static final String IMAGE_DLCL_REMOVE = "ImageDlclRemove"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_REMOVE = "ImageElclRemove"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_COMMAND_INPUT_FIELD = "ImageClclCommandInputField";//$NON-NLS-1$ - public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$ - public static final String IMAGE_DLCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$ - } + public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$NON-NLS-1$ + public static final String IMAGE_ELCL_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$ + public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$NON-NLS-1$ + public static final String IMAGE_ELCL_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$ + public static final String IMAGE_ELCL_REMOVE = "ImageElclRemove"; //$NON-NLS-1$ + public static final String IMAGE_CLCL_COMMAND_INPUT_FIELD = "ImageClclCommandInputField";//$NON-NLS-1$ + public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$ + public static final String IMAGE_DLCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$ +} diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsole.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsole.java index 18eb0d22c71..62d375e86ea 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsole.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsole.java @@ -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; @@ -45,7 +46,7 @@ public class TerminalConsole extends AbstractConsole implements ITerminalConsole public int getIndex() { return index; } - + public synchronized void setState(TerminalState terminalState) { StringBuffer nameBuff = new StringBuffer(getConnection().getName()); if (index > 0) { diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleConnector.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleConnector.java index 76366a39575..bd64d540311 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleConnector.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleConnector.java @@ -140,14 +140,16 @@ public class TerminalConsoleConnector { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e); } } - + 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); } diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleExtensionManager.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleExtensionManager.java index f9cbdb6e9f9..0b04a6c5465 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleExtensionManager.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleExtensionManager.java @@ -45,7 +45,7 @@ public class TerminalConsoleExtensionManager { List list = actions.get(id); return list == null ? new ArrayList() : list; } - + public IConsoleActionFactory getFactory(String id) { return factories.get(id); } diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsolePage.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsolePage.java index 338e0d003dd..01baa8cc883 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsolePage.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsolePage.java @@ -99,9 +99,9 @@ public class TerminalConsolePage extends Page implements IAdaptable { toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this)); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole)); - + toolBarManager.insertAfter(TOOLBAR_GROUP_ID, new GroupMarker(CONTRIBUTIONS_GROUP_ID)); - + addToolbarContributions(toolBarManager); } @@ -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(); } diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleSettingsDialog.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleSettingsDialog.java index 5e8fdc9dd7b..c5777f3a7ab 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleSettingsDialog.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/TerminalConsoleSettingsDialog.java @@ -40,7 +40,7 @@ public class TerminalConsoleSettingsDialog extends Dialog { private static final String CONNECTION_TYPE = "connectionType"; //$NON-NLS-1$ private static final String CONNECTION_NAME = "connectionName"; //$NON-NLS-1$ private static final String ENCODING = "encoding"; //$NON-NLS-1$ - + private RemoteConnectionWidget remoteConnWidget; private Combo encodingCombo; private String selectedEncoding; @@ -60,11 +60,12 @@ 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 connTypes = manager.getConnectionTypesSupporting( - IRemoteCommandShellService.class, IRemoteProcessService.class); + @SuppressWarnings("unchecked") + List connTypes = manager.getConnectionTypesSupporting(IRemoteCommandShellService.class, + IRemoteProcessService.class); remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes); - + IDialogSettings settings = getDialogSettings(); String initialId = settings.get(CONNECTION_TYPE); String initialName = settings.get(CONNECTION_NAME); @@ -100,7 +101,7 @@ public class TerminalConsoleSettingsDialog extends Dialog { return composite; } - private List getEncodings(){ + private List getEncodings() { List encodings = new ArrayList<>(2); encodings.add("ISO-8859-1"); //$NON-NLS-1$ encodings.add("UTF-8"); //$NON-NLS-1$ @@ -159,18 +160,20 @@ public class TerminalConsoleSettingsDialog extends Dialog { validateDialog(); } } - + 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; - + } - + @Override public int open() { int rc = super.open(); @@ -184,5 +187,5 @@ public class TerminalConsoleSettingsDialog extends Dialog { } return rc; } - + } diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionConnect.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionConnect.java index a830e8099e7..75f2c39762a 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionConnect.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionConnect.java @@ -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 diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionDisconnect.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionDisconnect.java index 3bece3b02ee..7eae164e3bc 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionDisconnect.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionDisconnect.java @@ -16,19 +16,14 @@ 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 diff --git a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionScrollLock.java b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionScrollLock.java index 19c4596d787..ac65a60f113 100644 --- a/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionScrollLock.java +++ b/remote/org.eclipse.remote.console/src/org/eclipse/remote/internal/console/actions/ConsoleActionScrollLock.java @@ -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 diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/AbstractRemoteProcessBuilder.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/AbstractRemoteProcessBuilder.java index 785966472e1..6c591c4937b 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/AbstractRemoteProcessBuilder.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/AbstractRemoteProcessBuilder.java @@ -21,7 +21,7 @@ import org.eclipse.remote.internal.core.RemoteProcess; /** * Abstract base class for remote process builders. Implementors can use this class to provide a default implementation of a remote * process builder. - * + * * @since 5.0 */ public abstract class AbstractRemoteProcessBuilder implements IRemoteProcessBuilder { @@ -122,7 +122,7 @@ public abstract class AbstractRemoteProcessBuilder implements IRemoteProcessBuil public IRemoteConnection getRemoteConnection() { return fConnection; } - + /** * @since 4.0 */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteCommandShellService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteCommandShellService.java index 1f85e18a5e7..bd35dacdb21 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteCommandShellService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteCommandShellService.java @@ -15,7 +15,7 @@ import java.io.IOException; /** * A service that provides a command shell on a remote. This is mainly used by * Terminal views. - * + * * @since 2.0 */ public interface IRemoteCommandShellService extends IRemoteConnection.Service { @@ -25,14 +25,14 @@ public interface IRemoteCommandShellService extends IRemoteConnection.Service { * system. The flags may be used to modify behavior of the remote process. These flags may only be supported by specific types * of remote service providers. Clients can use {@link IRemoteProcessBuilder#getSupportedFlags()} to find out the flags * supported by the service provider. - * + * *
 	 * Current flags are:
 	 *   {@link IRemoteProcessBuilder#NONE}			- disable any flags
 	 *   {@link IRemoteProcessBuilder#ALLOCATE_PTY}	- allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)
 	 *   {@link IRemoteProcessBuilder#FORWARD_X11}	- enable X11 forwarding (RFC-4254 Sec. 6.3)
 	 * 
- * + * * @param flags * bitwise-or of flags * @return remote process object diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnection.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnection.java index a71ec76a47f..d4ed4de67c5 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnection.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnection.java @@ -20,13 +20,13 @@ import org.eclipse.remote.core.exception.RemoteConnectionException; * open in which case the close does nothing. Connections have properties which are values that * describe the connection and are discovered. Connections also have attributes which are * client specified values that control the connection. - * + * * @noimplement This interface is not intended to be implemented by clients. */ public interface IRemoteConnection { /** * The interface that is extend by services provided for this remote connection. - * + * * @since 2.0 */ interface Service { @@ -52,7 +52,7 @@ public interface IRemoteConnection { /** * Get the connection type of this connection - * + * * @return connection type * @since 2.0 */ @@ -60,14 +60,14 @@ public interface IRemoteConnection { /** * Get unique name for this connection. - * + * * @return connection name */ public String getName(); /** * Get the service for this remote connection that implements the given interface. - * + * * @param service * the interface the required service must implements * @return the desired service or null if there is no such service available @@ -78,7 +78,7 @@ public interface IRemoteConnection { /** * Does this connection support the given service. - * + * * @param service * The service to be tested * @return true if this connection supports the service @@ -88,7 +88,7 @@ public interface IRemoteConnection { /** * Open the connection. Must be called before the connection can be used. - * + * * @param monitor * the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done() * on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot @@ -104,14 +104,14 @@ public interface IRemoteConnection { /** * Test if the connection is open. - * + * * @return true if connection is open. */ public boolean isOpen(); /** * Gets the remote system property indicated by the specified key. The connection must be open prior to calling this method. - * + * * @param key * the name of the property * @return the string value of the property, or null if no property has that key @@ -120,9 +120,9 @@ public interface IRemoteConnection { /** * Get an attribute for a connection. - * + * * NOTE: the attributes do not include any security related information (e.g. passwords, keys, etc.) - * + * * @param key * @return the attribute value, or empty string if not defined. * @since 2.0 @@ -131,7 +131,7 @@ public interface IRemoteConnection { /** * Get an attribute that is stored in secure storage, such as passwords. - * + * * @param key * @return the attribute value, or empty string if not defined. * @since 2.0 @@ -140,21 +140,21 @@ public interface IRemoteConnection { /** * Return a working copy to allow setting and changing of attributes. - * + * * @return working copy of remote */ public IRemoteConnectionWorkingCopy getWorkingCopy(); /** * Register a listener that will be notified when this connection's status changes. - * + * * @param listener */ public void addConnectionChangeListener(IRemoteConnectionChangeListener listener); /** * Remove a listener that will be notified when this connection's status changes. - * + * * @param listener */ public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener); @@ -162,7 +162,7 @@ public interface IRemoteConnection { /** * Notify all listeners when this connection's status changes. See {{@link RemoteConnectionChangeEvent} for a list of event * types. - * + * * @param event * event type indicating the nature of the event */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionChangeListener.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionChangeListener.java index 30c340b942f..017d74b49a0 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionChangeListener.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionChangeListener.java @@ -23,7 +23,7 @@ public interface IRemoteConnectionChangeListener extends EventListener { /** * Notifies this listener that the status of a connection has changed. - * + * * @param event * the connection change event * @since 2.0 diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionControlService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionControlService.java index 14d74c4818a..d69d78e72e6 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionControlService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionControlService.java @@ -16,14 +16,14 @@ import org.eclipse.remote.core.exception.RemoteConnectionException; /** * A service to control and report on the state of a connection, open or closed. * Connections that do not provide this service are always assumed to be opened. - * + * * @since 2.0 */ public interface IRemoteConnectionControlService extends IRemoteConnection.Service { /** * Open the connection. Must be called before the connection can be used. - * + * * @param monitor * the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done() * on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot @@ -39,7 +39,7 @@ public interface IRemoteConnectionControlService extends IRemoteConnection.Servi /** * Test if the connection is open. - * + * * @return true if connection is open. */ public boolean isOpen(); diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionHostService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionHostService.java index 927fe545311..1c456a32746 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionHostService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionHostService.java @@ -12,43 +12,43 @@ package org.eclipse.remote.core; /** * A service to obtain host specific information. - * + * * @since 2.0 */ public interface IRemoteConnectionHostService extends IRemoteConnection.Service { /** * Obtain the hostname associated with this connection. - * + * * @return hostname */ String getHostname(); /** * Obtain the port associated with this connection - * + * * @return port */ int getPort(); /** * Obtain the timeout used when establishing the connection. - * + * * @return timeout */ int getTimeout(); - + /** * Get the pass phrase associated with this connection. - * + * * @return pass phrase * @since 3.0 */ String getPassphrase(); - + /** * Get the password associated with this connection. - * + * * @return password * @since 3.0 */ @@ -56,22 +56,22 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Get the value of the use password authentication flag. If true, the connection will try using a password first. - * + * * @return use password authentication flag * @since 3.0 */ boolean usePassword(); - + /** * Obtain the flag that indicates a login shell should be started once the connection is established - * + * * @return login shell flag */ boolean useLoginShell(); /** * Obtain the username associated with this connection. - * + * * @return */ String getUsername(); @@ -79,7 +79,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the hostname associated with this connection. Note, this method can only be used for an * IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param hostname * new hostname for connection */ @@ -88,7 +88,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the pass phrase associated with this connection. Note, this method can only be used for an * IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param passphrase */ void setPassphrase(String passphrase); @@ -96,7 +96,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the password associated with this connection. Note, this method can only be used for an * IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param password * new password for connection */ @@ -105,7 +105,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the port used for the connection. Note, this method can only be used forh an * IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param port * new port for connection */ @@ -114,7 +114,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the timeout used when establishing the connection. A timeout of 0 means infinite. Note, this method can only be used * for an IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param timeout * new timeout value */ @@ -123,7 +123,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the flag indicating a login shell should be stated for this connection. Note, this method can only be used * for an IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param useLogingShell * true to start a login shell */ @@ -132,7 +132,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the connection to try password authentication first. Note, this method can only be used for an * IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param usePassword * use password authentication */ @@ -141,7 +141,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service /** * Set the username associated with this connection. Note, this method can only be used for an * IRemoteConnectionWorkingCopy and will have no effect otherwise. - * + * * @param username * new username for connection */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionPropertyService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionPropertyService.java index 062178fa712..f9e6e82e442 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionPropertyService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionPropertyService.java @@ -13,10 +13,10 @@ package org.eclipse.remote.core; /** * A connection property is some descriptive information that's discovered about the connection. * This service provides property values for a connection. - * + * * Examples include: *
- * os.name			Operating system name 
+ * os.name			Operating system name
  * os.arch			Operating system architecture
  * os.version		Operating system version
  * file.separator	File separator ("/" on UNIX)
@@ -24,14 +24,14 @@ package org.eclipse.remote.core;
  * line.separator	Line separator ("\n" on UNIX)
  * user.home		Home directory
  * 
- * + * * @since 2.0 */ public interface IRemoteConnectionPropertyService extends IRemoteConnection.Service { /** * Gets the remote system property indicated by the specified key. The connection must be open prior to calling this method. - * + * * @param key * the name of the property * @return the string value of the property, or null if no property has that key diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionProviderService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionProviderService.java index f1d07ffdf05..b460a322f41 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionProviderService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionProviderService.java @@ -15,7 +15,7 @@ package org.eclipse.remote.core; * and removing services. For example, the Local connection type needs to be able * to ensure the Local connection is created, or adapters to other target management * systems may prefer to let those systems manage the connections. - * + * * @since 2.0 */ public interface IRemoteConnectionProviderService extends IRemoteConnectionType.Service { diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionType.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionType.java index 02d155a1c72..4c6577cabeb 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionType.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionType.java @@ -20,14 +20,14 @@ import org.eclipse.remote.core.exception.RemoteConnectionException; * A remote connection type manages a list of connections that implement the same services. * Services may be registered on the individual connections, or at the connection type level * for service that apply to all connections of this type. - * + * * @noimplement This interface is not intended to be implemented by clients. * @since 2.0 */ public interface IRemoteConnectionType { /** * The interface that is extend by services provided for this remote services implementation. - * + * * @since 2.0 */ interface Service { @@ -41,56 +41,56 @@ public interface IRemoteConnectionType { /** * Get the remote services manager. This is a convenient way to get back * to the root. - * + * * @return remote services manager */ IRemoteServicesManager getRemoteServicesManager(); /** * Get unique ID of this service. Can be used as a lookup key. - * + * * @return unique ID */ String getId(); /** * Get display name of this service. - * + * * @return display name */ String getName(); /** * Get the EFS scheme provided by this service. - * + * * @return display name */ String getScheme(); /** * Can you add new connections of this type using the API. - * + * * @return can add */ boolean canAdd(); /** * Can you edit connections of this type, i.e. create working copies. - * + * * @return can edit */ boolean canEdit(); /** * Can you remove connections of this type using the API. - * + * * @return can remove */ boolean canRemove(); /** * Get the service for this remote services implementation that implements the given interface. - * + * * @param service * the interface the required service must implements * @return the desired service or null if there is no such service available @@ -101,7 +101,7 @@ public interface IRemoteConnectionType { /** * Does this connection type support the given service. - * + * * @param service * the service to be tested * @return true if this connection type supports this service @@ -110,14 +110,14 @@ public interface IRemoteConnectionType { /** * Return the list of connection type services supported by this type. - * + * * @return connection type services */ List getServices(); /** * Do connections created by this connection type support the given service. - * + * * @param service * the service to be tested * @return true if connections created by this connection type support this service @@ -126,14 +126,14 @@ public interface IRemoteConnectionType { /** * Return the list of connection services supported by connections of this type. - * + * * @return connection services */ List getConnectionServices(); - + /** * Do processes created by this connection type support the given service. - * + * * @param service * the service to be tested * @return true if processes created by this connection type support this service @@ -142,14 +142,14 @@ public interface IRemoteConnectionType { /** * Return the list of process services supported by connections of this type. - * + * * @return process services */ List getProcessServices(); /** * Gets the remote connection corresponding to the supplied name. - * + * * @param name * name of the connection (as returned by {@link IRemoteConnection#getName()}) * @return remote connection or null if no connection exists @@ -158,7 +158,7 @@ public interface IRemoteConnectionType { /** * Gets the remote connection corresponding to the supplied URI. - * + * * @param uri * URI containing a schema for this remote connection * @return remote connection or null if no connection exists or the schema @@ -169,7 +169,7 @@ public interface IRemoteConnectionType { /** * Get all the connections for this service provider. - * + * * @return connections that we know about */ List getConnections(); @@ -177,10 +177,10 @@ public interface IRemoteConnectionType { /** * Creates a new remote connection named with supplied name. The connection attributes will be the default for the * implementation. - * + * * Returns a working copy of the remote connection. Callers must call {@link IRemoteConnectionWorkingCopy#save()} before the * connection can be used. - * + * * @param name * name of the connection * @return a new connection working copy with the supplied name @@ -192,7 +192,7 @@ public interface IRemoteConnectionType { /** * Remove a connection and all resources associated with it. - * + * * @param connection * connection to remove * @throws RemoteConnectionException diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionWorkingCopy.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionWorkingCopy.java index ad4e269c4db..fda3959447e 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionWorkingCopy.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteConnectionWorkingCopy.java @@ -22,14 +22,14 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection { /** * Returns the original connection this working copy was created from. * Returns null if this is a new connection. - * + * * @return original connection */ public IRemoteConnection getOriginal(); /** * Returns whether this connection has been modified since it was last saved or created. - * + * * @return true if the connection has been modified */ public boolean isDirty(); @@ -37,15 +37,15 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection { /** * Saves this working copy to its original connection and returns a handle to the resulting connection. Has no effect if this * connection does not need saving. - * + * * @return saved connection - * @throws RemoteConnectionException + * @throws RemoteConnectionException */ public IRemoteConnection save() throws RemoteConnectionException; /** * Set the name for this connection - * + * * @param name */ public void setName(String name); @@ -53,7 +53,7 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection { /** * Set an implementation dependent attribute for the connection. Attributes keys supported by the connection can be obtained * using {@link #getAttributes()}. Attributes are persisted along with connection information. - * + * * @param key * attribute key * @param value @@ -63,7 +63,7 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection { /** * Set an attribute such as a password that's stored in secure storage. - * + * * @param key * @param value * @since 2.0 diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteFileService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteFileService.java index 33ad6512794..0c9c2cb5346 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteFileService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteFileService.java @@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IPath; /** * Interface for managing files on a remote system. - * + * * @since 2.0 */ public interface IRemoteFileService extends IRemoteConnection.Service { @@ -25,11 +25,11 @@ public interface IRemoteFileService extends IRemoteConnection.Service { /** * Get the resource associated with path. IFileStore can then be used to * perform operations on the file. - * + * * The remote connection does not need to be open to use this method, but * subsequent operations on the IFileStore that access the underlying remote * filesystem may require the connection to be open. - * + * * @param path * path to resource * @return the file store representing the remote path @@ -38,21 +38,21 @@ public interface IRemoteFileService extends IRemoteConnection.Service { /** * Get the base directory to be used for relative paths. - * + * * @return base directory */ String getBaseDirectory(); /** * Set the base directory to be used for relative paths.. - * + * * @param path new base directory */ void setBaseDirectory(String path); /** * Gets the directory separator on the target system. - * + * * @return String */ String getDirectorySeparator(); @@ -60,9 +60,9 @@ public interface IRemoteFileService extends IRemoteConnection.Service { /** * Convert URI to a remote path. This path is suitable for direct file * operations on the remote system. - * + * * The remote connection does not need to be open to use this method. - * + * * @return IPath representing the remote path */ String toPath(URI uri); @@ -70,9 +70,9 @@ public interface IRemoteFileService extends IRemoteConnection.Service { /** * Convert remote path to equivalent URI. This URI is suitable for EFS * operations on the local system. - * + * * The remote connection does not need to be open to use this method. - * + * * @param path * path on remote system * @return URI representing path on remote system, or null if the path is @@ -83,9 +83,9 @@ public interface IRemoteFileService extends IRemoteConnection.Service { /** * Convert string representation of a remote path to equivalent URI. This * URI is suitable for EFS operations on the local system. - * + * * The remote connection does not need to be open to use this method. - * + * * @param path * path on remote system * @return URI representing path on remote system, or null if the path is diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePortForwardingService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePortForwardingService.java index fb436b230b9..83d0fd26a2e 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePortForwardingService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePortForwardingService.java @@ -16,7 +16,7 @@ import org.eclipse.remote.core.exception.RemoteConnectionException; /** * A connection service for setting up port forwarding between the host and the remote. * This is a feature provided by SSH. - * + * * @since 2.0 */ public interface IRemotePortForwardingService extends IRemoteConnection.Service { @@ -24,7 +24,7 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service /** * Forward local port localPort to remote port fwdPort on remote machine fwdAddress. If this IRemoteConnection is not to * fwdAddress, the port will be routed via the connection machine to fwdAddress. - * + * * @param localPort * local port to forward * @param fwdAddress @@ -39,19 +39,20 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service * Forward a local port to remote port fwdPort on remote machine fwdAddress. The local port is chosen dynamically and returned * by the method. If this IRemoteConnection is not to fwdAddress, the port will be routed via the connection machine to * fwdAddress. - * + * * @param fwdAddress * @param fwdPort * @param monitor * @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 * machine, it is forwarded via this IRemoteConnection to fwdPort on machine fwdAddress. - * + * * @param remotePort * remote port to forward * @param fwdAddress @@ -66,21 +67,22 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service * Forward a remote port to port fwdPort on remote machine fwdAddress. The remote port is chosen dynamically and returned by the * method. When a connection is made to this port on the remote machine, it is forwarded via this IRemoteConnection to fwdPort * on machine fwdAddress. - * + * * If fwdAddress is the empty string ("") then the fwdPort will be bound to any address on all interfaces. Note that this * requires enabling the GatewayPort sshd option on some systems. - * + * * @param fwdAddress * @param fwdPort * @param monitor * @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. - * + * * @param port * forwarded port * @throws RemoteConnectionException @@ -90,7 +92,7 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service /** * Remove the remote port forwarding associated with the given port. - * + * * @param port * forwarded port * @throws RemoteConnectionException diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePreferenceConstants.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePreferenceConstants.java index c18b9742415..da377846103 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePreferenceConstants.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemotePreferenceConstants.java @@ -12,14 +12,14 @@ package org.eclipse.remote.core; /** * Preference constants that can be used to check the default remote service provider preference. - * + * * @since 6.0 */ public interface IRemotePreferenceConstants { /** * Preference setting for the default connection type. Clients can check this preference to see if a default provider * has been set, and if so, what the provider ID is. - * + * * @since 2.0 */ public static final String PREF_CONNECTION_TYPE_ID = "connectionTypeId"; //$NON-NLS-1$ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcess.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcess.java index 243c7701104..ca73c99b18a 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcess.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcess.java @@ -19,7 +19,7 @@ import java.io.OutputStream; public interface IRemoteProcess { /** * The interface that is extend by services provided for this remote connection. - * + * * @since 2.0 */ interface Service { @@ -37,17 +37,17 @@ public interface IRemoteProcess { /** * Returns the exit value for the process - * + * * @return the exit value */ int exitValue(); /** * Gets the error output stream of the process - * + * * Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the * calling thread does not read the corresponding output or error streams. - * + * * @return the output stream connected to the standard * error of the process */ @@ -55,10 +55,10 @@ public interface IRemoteProcess { /** * Gets an InputStream which can be used to read the standard output stream of the process - * + * * Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the * calling thread does not read the corresponding input or error streams. - * + * * @return the input stream connected to the standard * output of the process */ @@ -66,7 +66,7 @@ public interface IRemoteProcess { /** * Gets an output stream which can be used to write to the standard input stream of the process - * + * * @return the output stream connected to the standard * input of the process */ @@ -74,7 +74,7 @@ public interface IRemoteProcess { /** * Get the service for this remote process that implements the given interface. - * + * * @param service * the interface the required service must implements * @return the desired service or null if there is no such service available @@ -84,7 +84,7 @@ public interface IRemoteProcess { /** * Does this remote process support the given service. - * + * * @param service * The service to be tested * @return true if this connection supports the service @@ -94,10 +94,10 @@ public interface IRemoteProcess { /** * Wait until the process has terminated - * + * * Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the * calling thread does not read the corresponding input or error streams. - * + * * @return the exit value of the process * @throws InterruptedException * if the current thread is @@ -107,17 +107,17 @@ public interface IRemoteProcess { /** * Check if the remote process has completed. - * + * * Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the * calling thread does not read the corresponding input or error streams. - * + * * @return true if remote process has completed */ boolean isCompleted(); /** * Get the connection that is used by this process - * + * * @return connection used by this process * @since 2.0 */ @@ -125,7 +125,7 @@ public interface IRemoteProcess { /** * Get the process builder used to create this process - * + * * @return process builder used to create this process * @since 2.0 */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessBuilder.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessBuilder.java index a80d4ff6596..70518aebc30 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessBuilder.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessBuilder.java @@ -29,14 +29,14 @@ public interface IRemoteProcessBuilder { /** * Flag to request allocation of a pseudo-terminal for the process (RFC-4254 * Sec. 6.2) - * + * * @since 5.0 */ public static int ALLOCATE_PTY = 0x01; /** * Flag to request X11 forwarding (RFC-4254 Sec. 6.3) - * + * * @since 5.0 */ public static int FORWARD_X11 = 0x02; @@ -47,17 +47,17 @@ public interface IRemoteProcessBuilder { * @since 3.0 */ public static int APPEND_ENVIRONMENT = 0x03; - + /** * Returns this process builder's operating system program and arguments. - * + * * @return a list containing the program and arguments */ List command(); /** * Sets this process builder's operating system program and arguments. - * + * * @param command * @return This process builder */ @@ -65,7 +65,7 @@ public interface IRemoteProcessBuilder { /** * Sets this process builder's operating system program and arguments. - * + * * @param command * @return this process builder */ @@ -73,14 +73,14 @@ public interface IRemoteProcessBuilder { /** * Returns this process builder's working directory. - * + * * @return an IFileStore reference to the working directory */ IFileStore directory(); /** * Sets this process builder's working directory. - * + * * @param directory * @return This process builder */ @@ -89,14 +89,14 @@ public interface IRemoteProcessBuilder { /** * Returns a string map view of this process builder's environment. The * returned map behaves in the same manner as described in {@link java.lang.ProcessBuilder#environment()}. - * + * * @return the process builder's environment */ Map environment(); /** * Get the flags that are supported by this process builder. - * + * * @return bitwise-or of the supported flags * @since 5.0 */ @@ -105,14 +105,14 @@ public interface IRemoteProcessBuilder { /** * Tells whether this process builder merges standard error and standard * output. - * + * * @return true if standard error and standard output will be merged */ boolean redirectErrorStream(); /** * Sets this process builder's redirectErrorStream property. - * + * * @param redirectErrorStream * @return This process builder */ @@ -120,7 +120,7 @@ public interface IRemoteProcessBuilder { /** * Starts a new process using the attributes of this process builder. - * + * * @return remote process object * @throws IOException */ @@ -132,14 +132,14 @@ public interface IRemoteProcessBuilder { * may only be supported by specific types of remote service providers. * Clients can use {@link #getSupportedFlags()} to find out the flags * supported by the service provider. - * + * *
 	 * Current flags are:
 	 *   NONE			- disable any flags
 	 *   ALLOCATE_PTY	- allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)
 	 *   FORWARD_X11	- enable X11 forwarding (RFC-4254 Sec. 6.3)
 	 * 
- * + * * @param flags * bitwise-or of flags to use when starting process * @return remote process object @@ -150,7 +150,7 @@ public interface IRemoteProcessBuilder { /** * Get the connection that will be used by this process builder to create remote processes. - * + * * @return connection used to create remote processes * @since 2.0 */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessControlService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessControlService.java index 65b2d4beed7..5cb05b27e77 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessControlService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessControlService.java @@ -15,7 +15,7 @@ import java.io.OutputStream; /** * A service to control and report on the state of a process. - * + * * @since 2.0 */ public interface IRemoteProcessControlService extends IRemoteProcess.Service { @@ -26,14 +26,14 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service { /** * Returns the exit value for the process - * + * * @return the exit value */ public int exitValue(); /** * Gets the error output stream of the process - * + * * @return the output stream connected to the standard * error of the process */ @@ -41,7 +41,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service { /** * Gets an InputStream which can be used to read the standard output stream of the process - * + * * @return the input stream connected to the standard * output of the process */ @@ -49,7 +49,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service { /** * Gets an output stream which can be used to write to the standard input stream of the process - * + * * @return the output stream connected to the standard * input of the process */ @@ -57,7 +57,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service { /** * Wait until the process has terminated - * + * * @return the exit value of the process * @throws InterruptedException * if the current thread is @@ -67,7 +67,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service { /** * Check if the remote process has completed - * + * * @return true if remote process has completed */ public boolean isCompleted(); diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessService.java index 9647c948a2e..bef59568aec 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessService.java @@ -15,21 +15,21 @@ import java.util.Map; /** * A connection service for starting up processes on a remote. - * + * * @since 2.0 */ public interface IRemoteProcessService extends IRemoteConnection.Service { /** * Returns an unmodifiable string map view of the remote environment. The connection must be open prior to calling this method. - * + * * @return the remote environment */ public Map getEnv(); /** * Returns the value of an environment variable. The connection must be open prior to calling this method. - * + * * @param name * name of the environment variable * @return value of the environment variable or null if the variable is not defined @@ -38,24 +38,24 @@ public interface IRemoteProcessService extends IRemoteConnection.Service { /** * Get a process builder for creating remote processes - * + * * @return process builder or null if connection is not open */ public IRemoteProcessBuilder getProcessBuilder(List command); /** * Get a process builder for creating remote processes - * + * * @return process builder or null if connection is not open */ public IRemoteProcessBuilder getProcessBuilder(String... command); /** * Get the working directory. Relative paths will be resolved using this path. - * + * * The remote connection does not need to be open to use this method, however a default directory path, rather than the actual * working directory, may be returned in this case. - * + * * @return String representing the current working directory */ public String getWorkingDirectory(); @@ -63,9 +63,9 @@ public interface IRemoteProcessService extends IRemoteConnection.Service { /** * Set the working directory while the connection is open. The working directory will revert to the default when the connection * is closed then subsequently reopened. - * + * * Relative paths will be resolved using this path. The path must be valid and absolute for any changes to be made. - * + * * @param path * String representing the current working directory * @since 4.0 diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessSignalService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessSignalService.java index af09b3a3599..d0f84e74f38 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessSignalService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessSignalService.java @@ -14,7 +14,7 @@ import org.eclipse.remote.core.exception.RemoteConnectionException; /** * A service abstraction for signals. - * + * * @since 2.0 */ public interface IRemoteProcessSignalService extends IRemoteProcess.Service { @@ -37,7 +37,7 @@ public interface IRemoteProcessSignalService extends IRemoteProcess.Service { /** * Send a signal to the remote process. - * + * * @param signal * signal to send. * @throws RemoteConnectionException diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessTerminalService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessTerminalService.java index 6c34a207ecd..a47f55ce0f3 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessTerminalService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteProcessTerminalService.java @@ -12,14 +12,14 @@ package org.eclipse.remote.core; /** * A service abstraction for remote terminals. - * + * * @since 2.0 */ public interface IRemoteProcessTerminalService extends IRemoteProcess.Service { /** * Change the terminal window dimension interactively. Refer to RFC 4254 6.7. Window Dimension Change Message. The character/row * dimensions override the pixel dimensions (when nonzero). Pixel dimensions refer to the drawable area of the window. - * + * * @param cols * terminal width in characters * @param rows diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteResource.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteResource.java index 40cfaf69d68..78ff09feef9 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteResource.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteResource.java @@ -19,9 +19,9 @@ import org.eclipse.core.runtime.IProgressMonitor; /** * Abstraction of a remote resource. There are currently two types of remote resources: fully remote and synchronized. This * interface provides a common mechanism for accessing resource information from either type. - * + * * Usage: - * + * * * IRemoteResource remoteRes = (IRemoteResource)resource.getAdapter(IRemoteResource.class); * if (remoteRes != null) { @@ -29,26 +29,26 @@ import org.eclipse.core.runtime.IProgressMonitor; * ... * } * - * + * * @author greg * @since 6.0 - * + * */ public interface IRemoteResource { /** * Get the active location URI of the resource in the remote project. Returns null if the URI can't be obtained (@see * {@link IResource#getLocationURI()}). - * + * * For fully remote projects, this is just the URI of the remote resource. For synchronized projects, this is the URI of the * resource from the active synchronization target. - * + * * @return URI or null if URI can't be obtained */ public URI getActiveLocationURI(); /** * Get the platform resource corresponding to the remote resource - * + * * @return IResource */ public IResource getResource(); @@ -57,7 +57,7 @@ public interface IRemoteResource { * Synchronize the resource with the underlying filesystem. Performs a refresh for local and remote projects, but causes * synchronized projects to attempt to synchronize with their remote files. May synchronize more than just the single resource. * Blocks until the refresh has completed, so callers should use a job if necessary. - * + * * @param monitor * progress monitor to cancel refresh * @throws CoreException @@ -67,7 +67,7 @@ public interface IRemoteResource { /** * Set the platform resource - * + * * @param resource * platform resource corresponding to this remote resource */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteServicesManager.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteServicesManager.java index 4cb6185ae48..06a70f0785c 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteServicesManager.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IRemoteServicesManager.java @@ -17,7 +17,7 @@ import java.util.List; * The main entry point into the remote services system. The remote services manager * is an OSGi service. It provides a list of connection types and the global * list of all connections. - * + * * @noimplement This interface is not intended to be implemented by clients. * @since 2.0 */ @@ -25,7 +25,7 @@ public interface IRemoteServicesManager { /** * Get the connection type identified by the id - * + * * @param id * id of the connection type * @return connection type or null if the service can not be found @@ -35,7 +35,7 @@ public interface IRemoteServicesManager { /** * Get the connection type that provides connections to locations identified by * the URI. - * + * * @param uri * uri of locations to be accessed * @return the connection type that can be used to access the locations @@ -45,14 +45,14 @@ public interface IRemoteServicesManager { /** * Return the connection type used to access local resources. - * + * * @return the local services */ IRemoteConnectionType getLocalConnectionType(); /** * Returns the list of all connection types including the local services. - * + * * @return all connection types */ List getAllConnectionTypes(); @@ -61,7 +61,7 @@ public interface IRemoteServicesManager { * Returns the list of all connection types that support connections that provide specific services. The connections * can provide additional services that are not included in the list, so this just guarantees the minimum set of services that * will be supported. - * + * * @param services * services provided by connections supported by this connection type * @return compatible connection types @@ -72,7 +72,7 @@ public interface IRemoteServicesManager { /** * Returns the list of all connection types that provide specific services. The connection types can provide additional services * that are not included in the list, so this just guarantees the minimum set of services that will be supported. - * + * * @param services * services provided by this connection type * @return compatible connection types @@ -82,21 +82,21 @@ public interface IRemoteServicesManager { /** * Returns the list of connection types except for the local connection type. - * + * * @return all connection types that are really remote */ List getRemoteConnectionTypes(); /** * Returns the list of all known remote connections. - * + * * @return all remote connections */ List getAllRemoteConnections(); /** * Add a global connection change listener that receives events for all connections. - * + * * @param listener * global connection change listener to be added */ @@ -104,7 +104,7 @@ public interface IRemoteServicesManager { /** * Remove the global connection change listener. - * + * * @param listener * global connection change listener to be removed */ @@ -113,7 +113,7 @@ public interface IRemoteServicesManager { /** * Used by connections and other components to notify the global connection * change listeners of events. - * + * * @param event * connection change event */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IUserAuthenticatorService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IUserAuthenticatorService.java index 75cf3935439..a6fbfac8110 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IUserAuthenticatorService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/IUserAuthenticatorService.java @@ -17,7 +17,7 @@ import java.net.PasswordAuthentication; /** * Allow clients to provide their own user interface for connection authentication. - * + * * @since 2.0 */ public interface IUserAuthenticatorService extends IRemoteConnection.Service { @@ -73,7 +73,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service { * into returned object. Implementors are allowed to * save user names and passwords. The user should be prompted for * user name and password if there is no saved one. - * + * * @param username * The initial username, or null if there is no initial username * @param message @@ -85,7 +85,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service { * Prompts the user for a number values using text fields. The labels are provided in * the prompt array. Implementors will return the entered values, or null if * the user cancels the prompt. - * + * * @param destination * the destination in the format like username@hostname:port * @param name @@ -104,7 +104,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service { * Prompts for additional information regarding this authentication * request. A default implementation of this method should return the defaultResponse, * whereas alternate implementations could prompt the user with a dialog. - * + * * @param promptType * one of the following values: *
    diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteConnectionChangeEvent.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteConnectionChangeEvent.java index d4b8f22739f..03edbe01b46 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteConnectionChangeEvent.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteConnectionChangeEvent.java @@ -67,7 +67,7 @@ public class RemoteConnectionChangeEvent { /** * Get the connection that has changed. - * + * * @return IRemoteConnection */ public IRemoteConnection getConnection() { @@ -77,9 +77,9 @@ public class RemoteConnectionChangeEvent { /** * Returns the type of event being reported. This type * is obtained by bitwise OR'ing the event types together. - * + * * {@link #CONNECTION_CLOSED} {@link #CONNECTION_OPENED} {@link #CONNECTION_ABORTED} {@link #CONNECTION_RENAMED} - * + * * @return a bitwise OR of event type constants */ public int getType() { diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteProcessAdapter.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteProcessAdapter.java index bce6208afb7..940f0016989 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteProcessAdapter.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteProcessAdapter.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -15,9 +15,9 @@ import java.io.OutputStream; /** * Utility class to adapt an IRemoteProcess to a java.lang.Process - * + * * @author crecoskie - * + * */ public class RemoteProcessAdapter extends Process { diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteServicesUtils.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteServicesUtils.java index 0fc43fde6d1..ae752618340 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteServicesUtils.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/RemoteServicesUtils.java @@ -49,12 +49,12 @@ public class RemoteServicesUtils { /** * Convert a UNC path to a URI - * + * * Maps the UNC server component to a connection known by one of the remote service implementations. It is assumed that the * server component is of the form "[connection_type_id:]connection_name". If the "connection_type_id:" part is omitted then the * current connection type preference is used by default. If no preference is set, then each implementation is tried until * a matching connection name is found. - * + * * @param path * UNC path * @return corresponding URI or null if not a valid path diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/AddressInUseException.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/AddressInUseException.java index 183923902d5..afa299fa3f7 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/AddressInUseException.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/AddressInUseException.java @@ -13,7 +13,7 @@ package org.eclipse.remote.core.exception; /** * Exception thrown when a connection address is already in use. - * + * */ public class AddressInUseException extends RemoteConnectionException { private static final long serialVersionUID = 1771839754428411610L; diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/ConnectionExistsException.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/ConnectionExistsException.java index 6bf3fb1255c..d59abf00402 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/ConnectionExistsException.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/ConnectionExistsException.java @@ -14,7 +14,7 @@ package org.eclipse.remote.core.exception; * Thrown when trying to add a connection with the same name as an existing * connection, or when trying to rename a connection to the same name as an * existing connection. - * + * * @since 2.0 */ public class ConnectionExistsException extends RemoteConnectionException { diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/UnableToForwardPortException.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/UnableToForwardPortException.java index 0e33f3135df..43845bc2cde 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/UnableToForwardPortException.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/exception/UnableToForwardPortException.java @@ -16,7 +16,7 @@ package org.eclipse.remote.core.exception; */ public class UnableToForwardPortException extends RemoteConnectionException { /** - * + * */ private static final long serialVersionUID = -5814772755700213717L; diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/launch/IRemoteLaunchConfigService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/launch/IRemoteLaunchConfigService.java index db4592a3223..d6b2939cf3d 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/launch/IRemoteLaunchConfigService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/core/launch/IRemoteLaunchConfigService.java @@ -18,14 +18,14 @@ import org.eclipse.remote.core.IRemoteConnection; * Manages and persists the mapping between launch configurations and * remote connections that they run on. Each launch configuration has an * active remote connection. - * + * * @since 2.0 */ public interface IRemoteLaunchConfigService { /** * Sets the active remote connection for the given launch configuration. - * + * * @param launchConfig launch configuration * @param connection active remote connection */ @@ -41,10 +41,10 @@ public interface IRemoteLaunchConfigService { /** * For a given launch configuration type, get the remote connection that was last * used by a launch configuration of that type. - * - * This is used for new launch configurations with the assumption that the user + * + * This is used for new launch configurations with the assumption that the user * will want to use the same remote connection. - * + * * @param launchConfigType launch configuration type * @return last active remote configuration */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnection.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnection.java index d19fd3dd0ea..306d8495e53 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnection.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnection.java @@ -83,7 +83,7 @@ public class RemoteConnection implements IRemoteConnection { /** * Called from working copy when name has changed. - * + * * @param name * the new name */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnectionType.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnectionType.java index e1d9881c828..f900a79fb5c 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnectionType.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteConnectionType.java @@ -61,13 +61,13 @@ public class RemoteConnectionType implements IRemoteConnectionType { // capabilities, default is true for all of these String canAddStr = ce.getAttribute("canAdd"); //$NON-NLS-1$ canAdd = canAddStr != null ? Boolean.parseBoolean(canAddStr) : true; - + String canEditStr = ce.getAttribute("canEdit"); //$NON-NLS-1$ canEdit = canEditStr != null ? Boolean.parseBoolean(canEditStr) : true; - + String canRemoveStr = ce.getAttribute("canRemove"); //$NON-NLS-1$ canRemove = canRemoveStr != null ? Boolean.parseBoolean(canRemoveStr) : true; - + // load up existing connections try { for (String nodeName : getPreferenceNode().childrenNames()) { @@ -123,7 +123,7 @@ public class RemoteConnectionType implements IRemoteConnectionType { } @Override - public T getService(Class service) { + public T getService(Class service) { synchronized (serviceDefinitionMap) { @SuppressWarnings("unchecked") T obj = (T) serviceMap.get(service); @@ -161,7 +161,7 @@ public class RemoteConnectionType implements IRemoteConnectionType { /** * Called from the connection to get a service object for that connection. - * + * * @param connection * the connection to which the service applies * @param service @@ -169,7 +169,8 @@ public class RemoteConnectionType implements IRemoteConnectionType { * @return the service object * @throws CoreException */ - public T getConnectionService(IRemoteConnection connection, Class service) { + public T getConnectionService(IRemoteConnection connection, + Class service) { synchronized (connectionServiceDefinitionMap) { IConfigurationElement ce = connectionServiceDefinitionMap.get(service.getName()); if (ce != null) { @@ -203,7 +204,7 @@ public class RemoteConnectionType implements IRemoteConnectionType { /** * Called from the remote process to get a service object for that process. - * + * * @param process * the process to which the service applies * @param service @@ -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); } @@ -245,7 +247,7 @@ public class RemoteConnectionType implements IRemoteConnectionType { /** * Called from the remote service manager to register a service extension for * this remote services implementation - * + * * @param ce * the extension element defining the service */ @@ -267,7 +269,7 @@ public class RemoteConnectionType implements IRemoteConnectionType { /** * Signal connection has been added. - * + * * @since 2.0 */ protected void connectionAdded(final IRemoteConnection connection) { @@ -278,7 +280,7 @@ public class RemoteConnectionType implements IRemoteConnectionType { /** * Signal a connection is about to be removed. - * + * * @since 2.0 */ protected void connectionRemoved(final IRemoteConnection connection) { @@ -296,7 +298,7 @@ public class RemoteConnectionType implements IRemoteConnectionType { @Override public IRemoteConnection getConnection(URI uri) { - synchronized (connections) { + synchronized (connections) { IRemoteConnection connection = connections.get(uri.getAuthority()); if (connection != null) { return connection; @@ -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$ } } } diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteCorePlugin.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteCorePlugin.java index c7b93d2809f..9445fb0589a 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteCorePlugin.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteCorePlugin.java @@ -35,7 +35,7 @@ public class RemoteCorePlugin extends Plugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static RemoteCorePlugin getDefault() { @@ -54,7 +54,7 @@ public class RemoteCorePlugin extends Plugin { /** * Logs the specified status with this plug-in's log. - * + * * @param status * status to log */ @@ -64,7 +64,7 @@ public class RemoteCorePlugin extends Plugin { /** * Logs an internal error with the specified message. - * + * * @param message * the error message to log */ @@ -74,7 +74,7 @@ public class RemoteCorePlugin extends Plugin { /** * Logs an internal error with the specified throwable - * + * * @param e * the exception to be logged */ @@ -84,7 +84,7 @@ public class RemoteCorePlugin extends Plugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteDebugOptions.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteDebugOptions.java index a7853357bb1..97e55dfd14f 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteDebugOptions.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteDebugOptions.java @@ -78,7 +78,7 @@ public class RemoteDebugOptions implements DebugOptionsListener { /** * Prints the given message to System.out and to the OSGi tracing (if enabled) - * + * * @param message * the message or null */ @@ -88,7 +88,7 @@ public class RemoteDebugOptions implements DebugOptionsListener { /** * Prints the given message to System.out and to the OSGi tracing (if enabled) - * + * * @param option * the option to determine if tracing is displayed * @param message diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemotePath.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemotePath.java index 822156d5cc1..def14261cb8 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemotePath.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemotePath.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Patrick Tasse - Add extra constructor to Path class (bug 454959) @@ -18,12 +18,12 @@ import java.util.Arrays; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IPath; -/** +/** * The Eclipse Mars implementation of org.eclipse.core.runtime.Path. * * Cloned from org.eclipse.equinox.common. This class should be removed when * Eclipse older than Mars no longer needs to be supported. - * + * * @see org.eclipse.core.runtime.Path * @noextend This class is not intended to be subclassed by clients. */ @@ -70,10 +70,10 @@ public class RemotePath implements IPath, Cloneable { /** flags indicating separators (has leading, is UNC, has trailing, is for Windows) */ private int flags; - /** + /** * Constructs a new path from the given string path. * The string path must represent a valid file system path - * on the local file system. + * on the local 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, and any @@ -88,7 +88,7 @@ public class RemotePath implements IPath, Cloneable { return new RemotePath(pathString); } - /** + /** * Constructs a new path from the given path string. * The path string must have been produced by a previous * call to IPath.toPortableString. @@ -164,10 +164,10 @@ public class RemotePath implements IPath, Cloneable { // not allowed } - /** + /** * Constructs a new path from the given string path. * The string path must represent a valid file system path - * on the local file system. + * on the local 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, and any @@ -182,7 +182,7 @@ public class RemotePath implements IPath, Cloneable { this(fullPath, RUNNING_ON_WINDOWS); } - /** + /** * Constructs a new path from the given device id and string path. * The given string path must be valid. * The path is canonicalized and double slashes are removed except @@ -204,7 +204,7 @@ public class RemotePath implements IPath, Cloneable { initialize(device, path, RUNNING_ON_WINDOWS); } - /** + /** * Constructs a new path from the given string path. The string path must * represent a valid file system path on the specified file system. The path * is canonicalized and double slashes are removed except at the beginning @@ -238,7 +238,7 @@ public class RemotePath implements IPath, Cloneable { * Private constructor. */ private RemotePath(String device, String[] segments, int flags) { - // no segment validations are done for performance reasons + // no segment validations are done for performance reasons this.segments = segments; this.device = device; //hash code is cached in all but the bottom four bits of the flags field @@ -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(); @@ -383,7 +384,7 @@ public class RemotePath implements IPath, Cloneable { String segment = segments[i]; if (segment.equals("..")) { //$NON-NLS-1$ if (stackPointer == 0) { - // if the stack is empty we are going out of our scope + // if the stack is empty we are going out of our scope // so we need to accumulate segments. But only if the original // path is relative. If it is absolute then we can't go any higher than // root so simply toss the .. references. @@ -530,7 +531,7 @@ public class RemotePath implements IPath, Cloneable { if (firstPosition == 1 && len > 1 && (path.charAt(1) == SEPARATOR)) firstPosition = 2; int lastPosition = (path.charAt(len - 1) != SEPARATOR) ? len - 1 : len - 2; - // for non-empty paths, the number of segments is + // for non-empty paths, the number of segments is // the number of slashes plus 1, ignoring any leading // and trailing slashes int next = firstPosition; @@ -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))) diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteResourceFactory.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteResourceFactory.java index 668bd7a7547..caaee7ff566 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteResourceFactory.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteResourceFactory.java @@ -17,9 +17,9 @@ import org.eclipse.remote.core.IRemoteResource; /** * Factory to create an IRemoteResource - * + * * @author greg - * + * */ public class RemoteResourceFactory { private final IConfigurationElement fConfigElement; @@ -30,7 +30,7 @@ public class RemoteResourceFactory { /** * Get the remote resource associated with the platform resource. - * + * * @return IRemoteResource */ public IRemoteResource getRemoteResource(IResource resource) { diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteServicesManager.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteServicesManager.java index da437f6d131..0be9b5acd73 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteServicesManager.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/RemoteServicesManager.java @@ -35,7 +35,7 @@ import org.osgi.service.prefs.Preferences; /** * The implementation for the remote services manager service. - * + * */ public class RemoteServicesManager implements IRemoteServicesManager { @@ -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 getConnectionTypesSupporting(Class... services) { + public final List getConnectionTypesSupporting( + Class... services) { List connTypes = new ArrayList(); for (IRemoteConnectionType connType : getAllConnectionTypes()) { for (Class service : services) { @@ -150,7 +153,8 @@ public class RemoteServicesManager implements IRemoteServicesManager { @Override @SafeVarargs - public final List getConnectionTypesByService(Class... services) { + public final List getConnectionTypesByService( + Class... services) { List connTypes = new ArrayList(); for (IRemoteConnectionType connType : getAllConnectionTypes()) { for (Class service : services) { diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/launch/RemoteLaunchConfigService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/launch/RemoteLaunchConfigService.java index 5b2ce2316a2..3e71db08388 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/launch/RemoteLaunchConfigService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/launch/RemoteLaunchConfigService.java @@ -19,12 +19,12 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService { private Preferences getPreferences(String node) { return InstanceScope.INSTANCE.getNode(RemoteCorePlugin.getUniqueIdentifier()).node(node); } - + private IRemoteConnection getRemoteConnection(String remoteId) { if (remoteId == null) { return null; } - + String[] ids = remoteId.split(":"); //$NON-NLS-1$ if (ids.length < 2) { return null; @@ -35,7 +35,7 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService { if (connectionType == null) { return null; } - + return connectionType.getConnection(ids[1]); } @@ -49,7 +49,7 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService { RemoteCorePlugin.log(e.getStatus()); } } - + @Override public IRemoteConnection getActiveConnection(ILaunchConfiguration launchConfig) { String remoteId = getPreferences(REMOTE_LAUNCH_CONFIG).get(launchConfig.getName(), null); diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/PreferenceInitializer.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/PreferenceInitializer.java index 2c724d6f4e0..f8cfdb17cad 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/PreferenceInitializer.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/PreferenceInitializer.java @@ -16,7 +16,7 @@ import org.eclipse.remote.core.IRemotePreferenceConstants; /** * Class used to initialize default preference values. - * + * * @since 6.0 */ public class PreferenceInitializer extends AbstractPreferenceInitializer { diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/Preferences.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/Preferences.java index 377a7d221c1..d4ede9a9f0d 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/Preferences.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/preferences/Preferences.java @@ -22,13 +22,14 @@ import org.osgi.service.prefs.BackingStoreException; /** * Convenience class to facilitate using the new {@link IEclipsePreferences} story. Adapted from * org.eclipse.debug.internal.core.Preferences. - * + * * @since 5.0 * @noinstantiate This class is not intended to be instantiated by clients. */ 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; @@ -37,7 +38,7 @@ public final class Preferences { /** * Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope} - * + * * @param listener */ public static void addPreferenceChangeListener(IPreferenceChangeListener listener) { @@ -47,23 +48,23 @@ public final class Preferences { /** * Returns whether the named preference is know in the preference store. - * + * * @param name * @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); } /** * Returns the value in the preference store for the given key. If the key * is not defined then return the default value. Use the canonical scope * lookup order for finding the preference value. - * + * * @param key * @param defaultvalue - * + * * @return the value of the preference or the given default value */ public static boolean getBoolean(String key) { @@ -74,10 +75,10 @@ public final class Preferences { * Returns the value in the preference store for the given key. If the key * is not defined then return the default value. Use the canonical scope * lookup order for finding the preference value. - * + * * @param key * @param defaultvalue - * + * * @return the value of the preference or the given default value */ public static byte[] getByteArray(String key) { @@ -88,10 +89,10 @@ public final class Preferences { * Returns the default boolean value stored in the {@link DefaultScope} for * the given key or the specified default value if the key does not appear * in the {@link DefaultScope} - * + * * @param key * @param defaultvalue - * + * * @return the boolean value set in the {@link DefaultScope} for the given * key, or the specified default value. */ @@ -103,10 +104,10 @@ public final class Preferences { * Returns the default byte array value stored in the {@link DefaultScope} for the given key or the specified default value if * the key does not * appear in the {@link DefaultScope} - * + * * @param key * @param defaultvalue - * + * * @return the byte array value set in the {@link DefaultScope} for the * given key, or the specified default value. */ @@ -118,10 +119,10 @@ public final class Preferences { * Returns the default double value stored in the {@link DefaultScope} for * the given key or the specified default value if the key does not appear * in the {@link DefaultScope} - * + * * @param key * @param defaultvalue - * + * * @return the double value set in the {@link DefaultScope} for the given * key, or the specified default value. */ @@ -133,10 +134,10 @@ public final class Preferences { * Returns the default float value stored in the {@link DefaultScope} for * the given key or the specified default value if the key does not appear * in the {@link DefaultScope} - * + * * @param key * @param defaultvalue - * + * * @return the float value set in the {@link DefaultScope} for the given * key, or the specified default value. */ @@ -148,10 +149,10 @@ public final class Preferences { * Returns the default integer value stored in the {@link DefaultScope} for * the given key or the specified default value if the key does not appear * in the {@link DefaultScope} - * + * * @param key * @param defaultvalue - * + * * @return the integer value set in the {@link DefaultScope} for the given * key, or the specified default value. */ @@ -163,10 +164,10 @@ public final class Preferences { * Returns the default long value stored in the {@link DefaultScope} for the * given key or the specified default value if the key does not appear in * the {@link DefaultScope} - * + * * @param key * @param defaultvalue - * + * * @return the long value set in the {@link DefaultScope} for the given key, * or the specified default value. */ @@ -178,10 +179,10 @@ public final class Preferences { * Returns the default string value stored in the {@link DefaultScope} for * the given key or the specified default value if the key does not appear * in the {@link DefaultScope} - * + * * @param key * @param defaultvalue - * + * * @return the string value set in the {@link DefaultScope} for the given * key, or the specified default value. */ @@ -193,10 +194,10 @@ public final class Preferences { * Returns the value in the preference store for the given key. If the key * is not defined then return the default value. Use the canonical scope * lookup order for finding the preference value. - * + * * @param key * @param defaultvalue - * + * * @return the value of the preference or the given default value */ public static double getDouble(String key) { @@ -207,11 +208,11 @@ public final class Preferences { * Returns the value in the preference store for the given key. If the key * is not defined then return the default value. Use the canonical scope * lookup order for finding the preference value. - * + * * @param fQualifier * @param key * @param defaultvalue - * + * * @return the value of the preference or the given default value */ public static float getFloat(String key) { @@ -222,11 +223,11 @@ public final class Preferences { * Returns the value in the preference store for the given key. If the key * is not defined then return the default value. Use the canonical scope * lookup order for finding the preference value. - * + * * @param fQualifier * @param key * @param defaultvalue - * + * * @return the value of the preference or the given default value */ public static int getInt(String key) { @@ -237,10 +238,10 @@ public final class Preferences { * Returns the value in the preference store for the given key. If the key * is not defined then return the default value. Use the canonical scope * lookup order for finding the preference value. - * + * * @param key * @param defaultvalue - * + * * @return the value of the preference or the given default value */ public static long getLong(String key) { @@ -251,10 +252,10 @@ public final class Preferences { * Returns the value in the preference store for the given key. If the key * is not defined then return the default value. Use the canonical scope * lookup order for finding the preference value. - * + * * @param key * @param defaultvalue - * + * * @return the value of the preference or the given default value */ public static String getString(String key) { @@ -263,7 +264,7 @@ public final class Preferences { /** * Returns true if the named preference has the default value. - * + * * @param name * @return */ @@ -279,7 +280,7 @@ public final class Preferences { /** * Removes the given preference listener from the {@link DefaultScope} and * the {@link InstanceScope} - * + * * @param listener */ public static void removePreferenceChangeListener(IPreferenceChangeListener listener) { @@ -302,7 +303,7 @@ public final class Preferences { /** * Sets a boolean preference in the {@link InstanceScope}. - * + * * @param key * the key * @param value @@ -314,7 +315,7 @@ public final class Preferences { /** * Sets a byte array preference in the {@link InstanceScope}. - * + * * @param key * the key * @param value @@ -326,7 +327,7 @@ public final class Preferences { /** * Sets a boolean in the {@link DefaultScope} - * + * * @param key * the key * @param value @@ -338,7 +339,7 @@ public final class Preferences { /** * Sets a byte array in the {@link DefaultScope} - * + * * @param key * the key * @param value @@ -350,7 +351,7 @@ public final class Preferences { /** * Sets a double in the {@link DefaultScope} - * + * * @param key * the key * @param value @@ -362,7 +363,7 @@ public final class Preferences { /** * Sets a float in the {@link DefaultScope} - * + * * @param key * the key * @param value @@ -374,7 +375,7 @@ public final class Preferences { /** * Sets a integer in the {@link DefaultScope} - * + * * @param key * the key * @param value @@ -386,7 +387,7 @@ public final class Preferences { /** * Sets a long in the {@link DefaultScope} - * + * * @param key * the key * @param value @@ -398,7 +399,7 @@ public final class Preferences { /** * Sets a string in the {@link DefaultScope} - * + * * @param key * the key * @param value @@ -410,7 +411,7 @@ public final class Preferences { /** * Sets a double preference in the {@link InstanceScope}. - * + * * @param key * the key * @param value @@ -422,7 +423,7 @@ public final class Preferences { /** * Sets a float preference in the {@link InstanceScope}. - * + * * @param key * the key * @param value @@ -434,7 +435,7 @@ public final class Preferences { /** * Sets a integer preference in the {@link InstanceScope}. - * + * * @param key * the key * @param value @@ -446,7 +447,7 @@ public final class Preferences { /** * Sets a long preference in the {@link InstanceScope}. - * + * * @param key * the key * @param value @@ -458,7 +459,7 @@ public final class Preferences { /** * Sets a string preference in the {@link InstanceScope}. - * + * * @param key * the key * @param value @@ -472,7 +473,7 @@ public final class Preferences { * Sets the given preference to its default value. This is done by removing * any set value from the {@link InstanceScope}. Has no effect if the given * key is null. - * + * * @param key * the key for the preference */ diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalCommandShellService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalCommandShellService.java index 433d76e6541..44e47f50d2e 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalCommandShellService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalCommandShellService.java @@ -41,7 +41,7 @@ public class LocalCommandShellService implements IRemoteCommandShellService { return null; } } - + @Override public IRemoteConnection getRemoteConnection() { return connection; diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalConnectionProviderService.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalConnectionProviderService.java index 71128b744fb..0abf29fa9d9 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalConnectionProviderService.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalConnectionProviderService.java @@ -19,9 +19,9 @@ import org.eclipse.remote.internal.core.RemoteCorePlugin; public class LocalConnectionProviderService implements IRemoteConnectionProviderService { private static final String localConnectionName = Messages.LocalConnectionProviderService_LocalConnectionName; - + private IRemoteConnectionType connectionType; - + public static class Factory implements IRemoteConnectionType.Service.Factory { @SuppressWarnings("unchecked") @Override @@ -32,7 +32,7 @@ public class LocalConnectionProviderService implements IRemoteConnectionProvider return null; } } - + public LocalConnectionProviderService(IRemoteConnectionType connectionType) { this.connectionType = connectionType; } diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcess.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcess.java index f930e576f7a..cc3b3000345 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcess.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcess.java @@ -60,7 +60,7 @@ public class LocalProcess implements IRemoteProcessControlService, IRemoteProces /** * Thread to merge stdout and stderr. Keeps refcount so that output stream * is not closed too early. - * + * */ private class ProcOutputMerger implements Runnable { private final static int BUF_SIZE = 8192; diff --git a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcessBuilder.java b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcessBuilder.java index 7801577693c..5736ad803dc 100644 --- a/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcessBuilder.java +++ b/remote/org.eclipse.remote.core/src/org/eclipse/remote/internal/core/services/local/LocalProcessBuilder.java @@ -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; diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/Activator.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/Activator.java index 4a7bd5a6992..3a1ff880f70 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/Activator.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/Activator.java @@ -20,7 +20,7 @@ public class Activator extends Plugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { @@ -29,7 +29,7 @@ public class Activator extends Plugin { /** * Get unique identifier - * + * * @return * @since 5.0 */ @@ -42,7 +42,7 @@ public class Activator extends Plugin { /** * Logs the specified status with this plug-in's log. - * + * * @param status * status to log */ @@ -52,7 +52,7 @@ public class Activator extends Plugin { /** * Logs an internal error with the specified message. - * + * * @param message * the error message to log */ @@ -62,7 +62,7 @@ public class Activator extends Plugin { /** * Logs an internal error with the specified throwable - * + * * @param e * the exception to be logged */ @@ -80,7 +80,7 @@ public class Activator extends Plugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/ArgumentParser.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/ArgumentParser.java index 3fa3515ee4c..c9341c20cf5 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/ArgumentParser.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/ArgumentParser.java @@ -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 '\\': diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java index 54488b9e394..48b74220a18 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java @@ -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); } /** @@ -442,7 +447,7 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC * Open an sftp command channel to the remote host. This channel is for commands that do not require any * state being preserved and should not be closed. Long running commands (such as get/put) should use a separate channel * obtained via {#link #newSftpChannel()}. - * + * * Always use the second session if available. * * @return sftp channel @@ -458,7 +463,7 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC /** * Open a channel for long running commands. This channel should be closed when the command is completed. - * + * * @return sftp channel * @throws RemoteConnectionException * if a channel could not be opened @@ -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 } } diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnectionProxyFactory.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnectionProxyFactory.java index 4a49961a8e3..a69150823dd 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnectionProxyFactory.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnectionProxyFactory.java @@ -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 diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java index 74f82965068..3e29c1e5d7b 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java @@ -1,15 +1,15 @@ /******************************************************************************** * Copyright (c) 2006, 2007 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 + * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * + * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * Kushal Munir (IBM) - moved to internal package @@ -34,7 +34,7 @@ import org.eclipse.core.runtime.IPath; public class JSchFileSystem extends FileSystem { /** * Return the connection name encoded in the URI. - * + * * @param uri * URI specifying a remote tools connection * @return name of the connection or null if the URI is invalid @@ -46,7 +46,7 @@ public class JSchFileSystem extends FileSystem { /** * Return an URI uniquely naming a remote tools remote resource. - * + * * @param connectionName * remote tools connection name * @param path diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcess.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcess.java index ce1b3734fc8..3434d4a557b 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcess.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcess.java @@ -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; @@ -147,7 +149,7 @@ public class JSchProcess implements IRemoteProcessControlService, IRemoteProcess @Override public int exitValue() { - if(!isCompleted()) { + if (!isCompleted()) { throw new IllegalThreadStateException(Messages.JSchProcess_exitValue_exception_msg); } return fChannel.getExitStatus(); diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java index a2b409709f4..f1153de0182 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java @@ -118,10 +118,10 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder { /* * There are two possibilities: - * + * * 1. Some environment variables have changed values, or new variables have been added. In this case we just want to * send send the changed values rather than all the variables. - * + * * 2. Some of the existing variables have been removed. In this case, we need to resend the entire environment variable * list. */ diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchUserInfo.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchUserInfo.java index 0d29a645a49..13948d43118 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchUserInfo.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchUserInfo.java @@ -30,11 +30,11 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive { private final IRemoteConnectionHostService hostService; private IUserAuthenticatorService userAuthenticatorService; - + public JSchUserInfo(IRemoteConnectionHostService hostService) { this.hostService = hostService; } - + public JSchUserInfo(IRemoteConnectionHostService hostService, IUserAuthenticatorService userAuthenticatorService) { this(hostService); this.userAuthenticatorService = userAuthenticatorService; @@ -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); } } } diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java index 9a1fa333ac4..57cb2ee2609 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java @@ -46,7 +46,7 @@ import org.eclipse.remote.internal.jsch.core.messages.Messages; public class JschFileStore extends FileStore { /** * Public factory method for obtaining JschFileStore instances. - * + * * @param uri * URI to get a fileStore for * @return an JschFileStore instance for the URI. @@ -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); } @@ -147,7 +149,7 @@ public class JschFileStore extends FileStore { /** * Utility routing to get the file name from an absolute path. - * + * * @param path * path to extract file name from * @return last segment of path, or the full path if it is root @@ -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)); } } } diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/AbstractRemoteCommand.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/AbstractRemoteCommand.java index ae41cd153a9..989300f84fb 100755 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/AbstractRemoteCommand.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/AbstractRemoteCommand.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - Initial Implementation * Martin Oberhuber - [468889] Support Eclipse older than Mars @@ -43,7 +43,7 @@ import com.jcraft.jsch.SftpProgressMonitor; /** * @author greg - * + * */ public abstract class AbstractRemoteCommand { protected static class CommandProgressMonitor implements SftpProgressMonitor { @@ -80,7 +80,8 @@ public abstract class AbstractRemoteCommand { 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 { 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); diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/ExecCommand.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/ExecCommand.java index 8e8fb3b2573..d0922e048c4 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/ExecCommand.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/ExecCommand.java @@ -48,7 +48,7 @@ public class ExecCommand extends AbstractRemoteCommand { if (getProgressMonitor().isCanceled()) { return ""; //$NON-NLS-1$ } - if (getChannel().getExitStatus()!=0) { + if (getChannel().getExitStatus() != 0) { throw new RemoteConnectionException(err.toString()); } return stream.toString(); diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetInputStreamCommand.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetInputStreamCommand.java index de0da0dc00d..a0dfe385cbc 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetInputStreamCommand.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetInputStreamCommand.java @@ -19,7 +19,7 @@ import com.jcraft.jsch.SftpException; * The JSch implementation does not support multiple streams open on a single channel, so we must create a new channel for each * subsequent stream. This has the problem that there are usually only a limited number of channels that can be opened * simultaneously, so it is possible that this call will fail unless the open streams are closed first. - * + * * This code will use the initial (command) channel first, or if that is already being used, will open a new stream. It must be * careful not to close the command stream as other threads may still be using it. */ @@ -56,8 +56,10 @@ public class GetInputStreamCommand extends AbstractRemoteCommand { @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 { diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetOutputStreamCommand.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetOutputStreamCommand.java index 3102fe6ac40..c5431796d9f 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetOutputStreamCommand.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/GetOutputStreamCommand.java @@ -50,11 +50,9 @@ public class GetOutputStreamCommand extends AbstractRemoteCommand if ((fOptions & EFS.APPEND) != 0) { mode = ChannelSftp.APPEND; } - getChannel().put( - input, - fRemotePath.toString(), - new CommandProgressMonitor(NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()), - getProgressMonitor()), mode); + getChannel().put(input, fRemotePath.toString(), new CommandProgressMonitor( + NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()), + getProgressMonitor()), mode); input.close(); } finally { fIsClosed = true; diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/PutInfoCommand.java b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/PutInfoCommand.java index 51afafe5d1b..97f6f49122c 100644 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/PutInfoCommand.java +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/commands/PutInfoCommand.java @@ -53,7 +53,8 @@ public class PutInfoCommand extends AbstractRemoteCommand { 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 c = new SftpCallable() { @Override @@ -69,7 +70,8 @@ public class PutInfoCommand extends AbstractRemoteCommand { } } - 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 c = new SftpCallable() { @Override diff --git a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/messages/messages.properties b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/messages/messages.properties index b2e09f36222..3b320ed3b74 100755 --- a/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/messages/messages.properties +++ b/remote/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/messages/messages.properties @@ -4,7 +4,7 @@ # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html -# +# # Contributors: # IBM Corporation - initial implementation ############################################################################### @@ -14,8 +14,8 @@ AbstractRemoteCommand_Get_symlink_target=Get symlink target AbstractRemoteCommand_Operation_cancelled_by_user=Operation cancelled by user AuthInfo_Authentication_message=Authentication Message ExecCommand_Exec_command=Executing command "{0}" -GetInputStreamCommand_Receiving=Receiving {0}: -GetOutputStreamCommand_Sending=Sending {0}: +GetInputStreamCommand_Receiving=Receiving {0}: +GetOutputStreamCommand_Sending=Sending {0}: JSchConnection_0=Connection canceled by user JSchConnection_Connection_was_cancelled=Connection was cancelled JSchConnection_connectionNotOpen=Connection is not open diff --git a/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/Activator.java b/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/Activator.java index 6198498b999..6e3e9c35f75 100644 --- a/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/Activator.java +++ b/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/Activator.java @@ -14,7 +14,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + /** * The constructor */ @@ -42,7 +42,7 @@ public class Activator extends AbstractUIPlugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/ProcessTests.java b/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/ProcessTests.java index e9cc5353593..e0f59c211d1 100644 --- a/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/ProcessTests.java +++ b/remote/org.eclipse.remote.jsch.tests/src/org/eclipse/remote/jsch/tests/ProcessTests.java @@ -175,7 +175,7 @@ public class ProcessTests extends TestCase { public void testExitValue() { IRemoteProcessService processService = fRemoteConnection.getService(IRemoteProcessService.class); assertNotNull(processService); - IRemoteProcessBuilder builder = processService.getProcessBuilder(new String[]{"sleep","60"}); //$NON-NLS-1$ + IRemoteProcessBuilder builder = processService.getProcessBuilder(new String[] { "sleep", "60" }); //$NON-NLS-1$ assertNotNull(builder); IRemoteProcess rp = null; try { @@ -189,7 +189,7 @@ public class ProcessTests extends TestCase { try { p.exitValue(); fail("Process has not exited. Should throws an IllegalThreadStateException exception"); - } catch(IllegalThreadStateException e) { + } catch (IllegalThreadStateException e) { e.printStackTrace(); } } diff --git a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/Activator.java b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/Activator.java index def2f47c2fd..5767eed2d3c 100644 --- a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/Activator.java +++ b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/Activator.java @@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { @@ -32,7 +32,7 @@ public class Activator extends AbstractUIPlugin { /** * Get unique identifier - * + * * @return * @since 5.0 */ @@ -45,7 +45,7 @@ public class Activator extends AbstractUIPlugin { /** * Logs the specified status with this plug-in's log. - * + * * @param status * status to log */ @@ -55,7 +55,7 @@ public class Activator extends AbstractUIPlugin { /** * Logs an internal error with the specified message. - * + * * @param message * the error message to log */ @@ -65,7 +65,7 @@ public class Activator extends AbstractUIPlugin { /** * Logs an internal error with the specified throwable - * + * * @param e * the exception to be logged */ @@ -83,7 +83,7 @@ public class Activator extends AbstractUIPlugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchFileSystemContributor.java b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchFileSystemContributor.java index 4c208b2e12e..06f52dff865 100644 --- a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchFileSystemContributor.java +++ b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchFileSystemContributor.java @@ -1,15 +1,15 @@ /******************************************************************************** * Copyright (c) 2002, 2008 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 + * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * + * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * Kushal Munir (IBM) - moved to internal package. * Martin Oberhuber (Wind River) - [181917] EFS Improvements: Avoid unclosed Streams, diff --git a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java index f3fba2db58f..76df4b6fa9e 100644 --- a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java +++ b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java @@ -25,7 +25,7 @@ import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; public class JSchUserAuthenticator implements IUserAuthenticatorService { - + private final IRemoteConnection remoteConnection; private UserInfoPrompter prompter; @@ -44,7 +44,7 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService { public IRemoteConnection getRemoteConnection() { return remoteConnection; } - + @Override public PasswordAuthentication prompt(String username, String message) { if (prompter.promptPassword(message)) { @@ -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(); } }); @@ -105,7 +105,7 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService { } return display; } - + public static class Factory implements IRemoteConnection.Service.Factory { @Override @SuppressWarnings("unchecked") diff --git a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/messages/messages.properties b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/messages/messages.properties index d8aa8faf09b..3d79be7c67c 100755 --- a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/messages/messages.properties +++ b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/messages/messages.properties @@ -4,7 +4,7 @@ # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html -# +# # Contributors: # IBM Corporation - initial implementation ############################################################################### diff --git a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java index d1aa0a8ce3d..fb4982ed311 100755 --- a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java +++ b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java @@ -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); diff --git a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionWizard.java b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionWizard.java index 3383f1e4440..ac19ebe91d8 100755 --- a/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionWizard.java +++ b/remote/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionWizard.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - Initial Implementation * diff --git a/remote/org.eclipse.remote.proxy.core/META-INF/MANIFEST.MF b/remote/org.eclipse.remote.proxy.core/META-INF/MANIFEST.MF index 61e7276ab28..ae9dac9f373 100644 --- a/remote/org.eclipse.remote.proxy.core/META-INF/MANIFEST.MF +++ b/remote/org.eclipse.remote.proxy.core/META-INF/MANIFEST.MF @@ -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, diff --git a/remote/org.eclipse.remote.proxy.core/build.properties b/remote/org.eclipse.remote.proxy.core/build.properties index d86ac1333c4..3cfb999b414 100644 --- a/remote/org.eclipse.remote.proxy.core/build.properties +++ b/remote/org.eclipse.remote.proxy.core/build.properties @@ -6,5 +6,5 @@ bin.includes = META-INF/,\ plugin.properties,\ about.html,\ bootstrap.sh - + diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/Activator.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/Activator.java index 46162ec5871..ec8cce8cd81 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/Activator.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/Activator.java @@ -19,7 +19,7 @@ public class Activator extends Plugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { @@ -28,7 +28,7 @@ public class Activator extends Plugin { /** * Get unique identifier - * + * * @return * @since 5.0 */ @@ -41,7 +41,7 @@ public class Activator extends Plugin { /** * Logs the specified status with this plug-in's log. - * + * * @param status * status to log */ @@ -51,7 +51,7 @@ public class Activator extends Plugin { /** * Logs an internal error with the specified message. - * + * * @param message * the error message to log */ @@ -61,7 +61,7 @@ public class Activator extends Plugin { /** * Logs an internal error with the specified throwable - * + * * @param e * the exception to be logged */ @@ -69,7 +69,6 @@ public class Activator extends Plugin { log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e)); } - /** * The constructor */ @@ -78,7 +77,7 @@ public class Activator extends Plugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnection.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnection.java index a862c32051e..fa160aa3eb5 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnection.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnection.java @@ -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$ @@ -73,7 +72,7 @@ public class ProxyConnection implements IRemoteConnectionControlService, private StreamChannelManager channelMux; private StreamChannel commandChannel; private boolean isOpen; - + private final IRemoteConnection fRemoteConnection; private final Map fEnv = new HashMap<>(); @@ -119,10 +118,9 @@ public class ProxyConnection implements IRemoteConnectionControlService, return (T) conn; } } else if (IRemoteConnectionControlService.class.equals(service) - || IRemoteConnectionPropertyService.class.equals(service) - || IRemoteConnectionHostService.class.equals(service) - || IRemoteProcessService.class.equals(service) - || IRemoteCommandShellService.class.equals(service) + || IRemoteConnectionPropertyService.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); } else { @@ -169,7 +167,7 @@ public class ProxyConnection implements IRemoteConnectionControlService, fRemoteConnection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_OPENED); } } - + private void initialize(IProgressMonitor monitor) throws RemoteConnectionException { SubMonitor subMon = SubMonitor.convert(monitor, 30); fWorkingDir = getCwd(subMon.newChild(10)); @@ -194,7 +192,7 @@ public class ProxyConnection implements IRemoteConnectionControlService, throw new RemoteConnectionException(e.getMessage()); } } - + private Map loadEnv(IProgressMonitor monitor) throws RemoteConnectionException { try { GetEnvCommand cmd = new GetEnvCommand(this); @@ -203,7 +201,7 @@ public class ProxyConnection implements IRemoteConnectionControlService, throw new RemoteConnectionException(e.getMessage()); } } - + private Map loadProperties(IProgressMonitor monitor) throws RemoteConnectionException { try { GetPropertiesCommand cmd = new GetPropertiesCommand(this); @@ -212,22 +210,22 @@ public class ProxyConnection implements IRemoteConnectionControlService, throw new RemoteConnectionException(e.getMessage()); } } - + public Map getEnv() { return Collections.unmodifiableMap(fEnv); } - + public StreamChannel getCommandChannel() { return commandChannel; } - + public StreamChannel openChannel() throws IOException { return channelMux.openChannel(); } - + private StringBuffer stdout = new StringBuffer(); private StringBuffer stderr = new StringBuffer(); - + @SuppressWarnings("unused") private String executeSshCommand(ChannelShell shell, String command) throws RemoteConnectionException { try { @@ -246,7 +244,7 @@ public class ProxyConnection implements IRemoteConnectionControlService, throw new RemoteConnectionException(e.getMessage()); } } - + @SuppressWarnings("unused") private String executeCommand(List command, IProgressMonitor monitor) throws ProxyException { try { @@ -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(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionBootstrap.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionBootstrap.java index 03b2aa2017e..393c252268a 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionBootstrap.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionBootstrap.java @@ -45,68 +45,68 @@ public class ProxyConnectionBootstrap { private final IJSchService jSchService; private Session session; private ChannelExec exec; - + private class Context { private State state; private String osName; private String osArch; private String errorMessage; - + private final SubMonitor monitor; private final BufferedReader reader; private final BufferedWriter writer; - + public Context(BufferedReader reader, BufferedWriter writer, IProgressMonitor monitor) { this.reader = reader; this.writer = writer; this.monitor = SubMonitor.convert(monitor); setState(States.INIT); } - - State getState() { - return state; - } - - SubMonitor getMonitor() { - return monitor; - } - - void setState(State state) { - this.state = state; - } - - String getOSName() { - return osName; - } - - void setOSName(String osName) { - this.osName = osName; - } - - String getOSArch() { - return osArch; - } - - void setOSArch(String osArch) { - this.osArch = osArch; - } - - void setErrorMessage(String message) { - this.errorMessage = message; - } - - String getErrorMessage() { - return errorMessage; - } + + State getState() { + return state; + } + + SubMonitor getMonitor() { + return monitor; + } + + void setState(State state) { + this.state = state; + } + + String getOSName() { + return osName; + } + + void setOSName(String osName) { + this.osName = osName; + } + + String getOSArch() { + return osArch; + } + + void setOSArch(String osArch) { + this.osArch = osArch; + } + + void setErrorMessage(String message) { + this.errorMessage = message; + } + + String getErrorMessage() { + return errorMessage; + } } - + private interface State { - /** - * @return true to keep processing, false to read more data. - */ - boolean process(Context context) throws IOException; + /** + * @return true to keep processing, false to read more data. + */ + boolean process(Context context) throws IOException; } - + private enum States implements State { INIT { @Override @@ -145,7 +145,7 @@ public class ProxyConnectionBootstrap { return true; case "fail": //$NON-NLS-1$ context.setErrorMessage(parts[1]); - System.out.println("fail:"+parts[1]); //$NON-NLS-1$ + System.out.println("fail:" + parts[1]); //$NON-NLS-1$ return false; case "debug": //$NON-NLS-1$ System.err.println(line); @@ -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)); @@ -187,7 +188,7 @@ public class ProxyConnectionBootstrap { return true; case "fail": //$NON-NLS-1$ context.setErrorMessage(parts[1]); - System.out.println("fail:"+parts[1]); //$NON-NLS-1$ + System.out.println("fail:" + parts[1]); //$NON-NLS-1$ return false; case "debug": //$NON-NLS-1$ System.err.println(line); @@ -201,7 +202,7 @@ public class ProxyConnectionBootstrap { } return false; } - + private boolean downloadFile(File file, BufferedWriter writer, IProgressMonitor monitor) { SubMonitor subMon = SubMonitor.convert(monitor, 10); try { @@ -235,12 +236,13 @@ public class ProxyConnectionBootstrap { } } } - + public 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 @@ -277,7 +280,7 @@ public class ProxyConnectionBootstrap { BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getExtInputStream())); String line; while ((line = reader.readLine()) != null) { - System.err.println("server: "+ line); //$NON-NLS-1$ + System.err.println("server: " + line); //$NON-NLS-1$ } } catch (IOException e) { // Ignore and terminate thread @@ -289,18 +292,22 @@ public class ProxyConnectionBootstrap { throw new RemoteConnectionException(e.getMessage()); } } - - 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()) { diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionProviderService.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionProviderService.java index 3eb5869c757..90f61761a95 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionProviderService.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyConnectionProviderService.java @@ -14,7 +14,7 @@ import org.eclipse.remote.core.IRemoteConnectionType.Service; public class ProxyConnectionProviderService implements IRemoteConnectionProviderService { private IRemoteConnectionType connectionType; - + public static class Factory implements IRemoteConnectionType.Service.Factory { @SuppressWarnings("unchecked") @Override @@ -25,7 +25,7 @@ public class ProxyConnectionProviderService implements IRemoteConnectionProvider return null; } } - + public ProxyConnectionProviderService(IRemoteConnectionType connectionType) { this.connectionType = connectionType; } diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileStore.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileStore.java index 2f3dc8f2a9a..b4be04941e1 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileStore.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileStore.java @@ -42,7 +42,7 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public class ProxyFileStore extends FileStore { /** * Public factory method for obtaining ProxyFileStore instances. - * + * * @param uri * URI to get a fileStore for * @return an ProxyFileStore instance for the URI. @@ -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); } @@ -156,7 +157,7 @@ public class ProxyFileStore extends FileStore { /** * Utility routing to get the file name from an absolute path. - * + * * @param path * path to extract file name from * @return last segment of path, or the full path if it is root @@ -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)); } } } diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileSystem.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileSystem.java index 9f7d0e4490f..03ccfa7c7c5 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileSystem.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyFileSystem.java @@ -1,7 +1,7 @@ /******************************************************************************** * Copyright (c) 2016 Oak Ridge National Laboratory and others. * 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 + * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html ********************************************************************************/ @@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IPath; public class ProxyFileSystem extends FileSystem { /** * Return the connection name encoded in the URI. - * + * * @param uri * URI specifying a remote tools connection * @return name of the connection or null if the URI is invalid @@ -30,7 +30,7 @@ public class ProxyFileSystem extends FileSystem { /** * Return an URI uniquely naming a remote tools remote resource. - * + * * @param connectionName * remote tools connection name * @param path diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcess.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcess.java index aa97b5e3e54..d373bacc42b 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcess.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcess.java @@ -23,7 +23,7 @@ import org.eclipse.remote.proxy.protocol.core.StreamChannel; public class ProxyProcess implements IRemoteProcessControlService, IRemoteProcessTerminalService { private IRemoteProcess remoteProcess; - + private final StreamChannel stdIOChan; private final StreamChannel stdErrChan; private final StreamChannel controlChan; @@ -33,7 +33,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces private volatile int exitValue; private volatile boolean isCompleted; - + public static class Factory implements IRemoteProcess.Service.Factory { @SuppressWarnings("unchecked") @Override @@ -51,7 +51,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces protected ProxyProcess(IRemoteProcess process) { remoteProcess = process; - ProxyProcessBuilder builder = (ProxyProcessBuilder)process.getProcessBuilder(); + ProxyProcessBuilder builder = (ProxyProcessBuilder) process.getProcessBuilder(); List streams = builder.getStreams(); controlChan = streams.get(0); stdIOChan = streams.get(1); @@ -60,7 +60,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces resultStream = new DataInputStream(controlChan.getInputStream()); isCompleted = false; exitValue = 0; - + cmdThread = new Thread("process result reader") { //$NON-NLS-1$ @Override public void run() { @@ -91,7 +91,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces }; cmdThread.start(); } - + @Override public void destroy() { try { @@ -113,7 +113,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces @Override public InputStream getErrorStream() { if (stdErrChan == null) { - return new InputStream() { + return new InputStream() { @Override public int read() throws IOException { return -1; diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcessBuilder.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcessBuilder.java index 352d4cf422e..010825e3f5e 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcessBuilder.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/ProxyProcessBuilder.java @@ -32,7 +32,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder { private final ProxyConnection proxyConnection; private Map remoteEnv; private List streams = new ArrayList<>(); - + public ProxyProcessBuilder(ProxyConnection connection, List command) { super(connection.getRemoteConnection(), command); proxyConnection = connection; @@ -45,13 +45,13 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder { public ProxyProcessBuilder(ProxyConnection connection, String... command) { this(connection, Arrays.asList(command)); } - + /** * Constructor for creating command shell * @param connection */ public ProxyProcessBuilder(ProxyConnection connection) { - super(connection.getRemoteConnection(), (List)null); + super(connection.getRemoteConnection(), (List) null); proxyConnection = connection; redirectErrorStream(true); } @@ -75,9 +75,9 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder { if (conn == null) { throw new IOException(Messages.ProxyProcessBuilder_0); } - + Job job; - + final List cmdArgs = command(); if (cmdArgs != null) { if (cmdArgs.size() < 1) { @@ -90,18 +90,19 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder { if (remoteEnv != null) { env.putAll(remoteEnv); } - + final boolean append = (flags & IRemoteProcessBuilder.APPEND_ENVIRONMENT) != 0 || remoteEnv == null; - + streams.add(conn.openChannel()); streams.add(conn.openChannel()); streams.add(conn.openChannel()); - + 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) { @@ -116,7 +117,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder { */ streams.add(conn.openChannel()); streams.add(conn.openChannel()); - + job = new Job("process executor") { //$NON-NLS-1$ @Override protected IStatus run(IProgressMonitor monitor) { @@ -130,7 +131,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder { } }; } - + job.schedule(); try { job.join(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/AbstractCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/AbstractCommand.java index dec2d98c77c..82f631161c0 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/AbstractCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/AbstractCommand.java @@ -81,4 +81,3 @@ public abstract class AbstractCommand implements Callable { this.connection = conn; } } - diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ChildInfosCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ChildInfosCommand.java index 3e6af47c3f0..d0152d891b7 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ChildInfosCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ChildInfosCommand.java @@ -34,19 +34,19 @@ public class ChildInfosCommand extends AbstractCommand { public IFileInfo[] call() throws ProxyException { try { final StreamChannel chan = openChannel(); - + out.writeByte(Protocol.PROTO_COMMAND); out.writeShort(Protocol.CMD_CHILDINFOS); out.writeByte(chan.getId()); out.writeUTF(path); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); throw new ProxyException(errMsg); } - + DataInputStream resultStream = new DataInputStream(chan.getInputStream()); int length = resultStream.readInt(); SerializableFileInfo sInfo = new SerializableFileInfo(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/DeleteCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/DeleteCommand.java index bd7463c8f16..72bd787cc1d 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/DeleteCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/DeleteCommand.java @@ -37,7 +37,7 @@ public class DeleteCommand extends AbstractCommand { out.writeInt(options); out.writeUTF(path); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ExecCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ExecCommand.java index c03decd2e73..eecc2288a1c 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ExecCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ExecCommand.java @@ -30,8 +30,8 @@ public class ExecCommand extends AbstractCommand { private final int ioChan; private final int errChan; - public ExecCommand(ProxyConnection conn, List command, Map env, String directory, boolean redirect, boolean appendEnv, - int cmdChan, int ioChan, int errChan) { + public ExecCommand(ProxyConnection conn, List command, Map 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()); @@ -65,7 +65,7 @@ public class ExecCommand extends AbstractCommand { out.writeBoolean(redirect); out.writeBoolean(appendEnv); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/FetchInfoCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/FetchInfoCommand.java index 06163711351..614e14ac452 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/FetchInfoCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/FetchInfoCommand.java @@ -34,19 +34,19 @@ public class FetchInfoCommand extends AbstractCommand { public IFileInfo call() throws ProxyException { try { final StreamChannel chan = openChannel(); - + out.writeByte(Protocol.PROTO_COMMAND); out.writeShort(Protocol.CMD_FETCHINFO); out.writeByte(chan.getId()); out.writeUTF(path); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); throw new ProxyException(errMsg); } - + DataInputStream resultStream = new DataInputStream(chan.getInputStream()); SerializableFileInfo info = new SerializableFileInfo(); info.readObject(resultStream); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetCwdCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetCwdCommand.java index 99a373cae13..546eb3be82d 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetCwdCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetCwdCommand.java @@ -31,18 +31,18 @@ public class GetCwdCommand extends AbstractCommand { try { final StreamChannel chan = openChannel(); DataInputStream resultStream = new DataInputStream(chan.getInputStream()); - + out.writeByte(Protocol.PROTO_COMMAND); out.writeShort(Protocol.CMD_GETCWD); out.writeByte(chan.getId()); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); throw new ProxyException(errMsg); } - + String cwd = resultStream.readUTF(); chan.close(); return cwd; diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetEnvCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetEnvCommand.java index 773f39f3f42..e5dcde45544 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetEnvCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetEnvCommand.java @@ -33,18 +33,18 @@ public class GetEnvCommand extends AbstractCommand> { try { final StreamChannel chan = openChannel(); DataInputStream resultStream = new DataInputStream(chan.getInputStream()); - + out.writeByte(Protocol.PROTO_COMMAND); out.writeShort(Protocol.CMD_GETENV); out.writeByte(chan.getId()); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); throw new ProxyException(errMsg); } - + int len = resultStream.readInt(); Map env = new HashMap(len); for (int i = 0; i < len; i++) { diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetInputStreamCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetInputStreamCommand.java index b93b695b729..fb4a8a58052 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetInputStreamCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetInputStreamCommand.java @@ -36,20 +36,20 @@ public class GetInputStreamCommand extends AbstractCommand { public InputStream call() throws ProxyException { try { StreamChannel chan = openChannel(); - + out.writeByte(Protocol.PROTO_COMMAND); out.writeShort(Protocol.CMD_GETINPUTSTREAM); out.writeByte(chan.getId()); out.writeInt(options); out.writeUTF(path); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); throw new ProxyException(errMsg); } - + return new BufferedInputStream(chan.getInputStream()); } catch (IOException e) { throw new ProxyException(e.getMessage()); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetOutputStreamCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetOutputStreamCommand.java index c1fc27719bd..5b5d41d541b 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetOutputStreamCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetOutputStreamCommand.java @@ -43,13 +43,13 @@ public class GetOutputStreamCommand extends AbstractCommand { out.writeInt(options); out.writeUTF(path); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); throw new ProxyException(errMsg); } - + return new BufferedOutputStream(chan.getOutputStream()); } catch (IOException e) { throw new ProxyException(e.getMessage()); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetPropertiesCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetPropertiesCommand.java index ad77868ad45..d31b8ba25d2 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetPropertiesCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/GetPropertiesCommand.java @@ -33,18 +33,18 @@ public class GetPropertiesCommand extends AbstractCommand> { try { final StreamChannel chan = openChannel(); DataInputStream resultStream = new DataInputStream(chan.getInputStream()); - + out.writeByte(Protocol.PROTO_COMMAND); out.writeShort(Protocol.CMD_GETPROPERTIES); out.writeByte(chan.getId()); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); throw new ProxyException(errMsg); } - + int len = resultStream.readInt(); Map props = new HashMap(len); for (int i = 0; i < len; i++) { diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/MkdirCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/MkdirCommand.java index eebb748f543..949ce0789bd 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/MkdirCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/MkdirCommand.java @@ -37,7 +37,7 @@ public class MkdirCommand extends AbstractCommand { out.writeInt(options); out.writeUTF(path); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/PutInfoCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/PutInfoCommand.java index d4a61492c08..cf4a6914fa0 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/PutInfoCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/PutInfoCommand.java @@ -43,7 +43,7 @@ public class PutInfoCommand extends AbstractCommand { SerializableFileInfo sInfo = new SerializableFileInfo(info); sInfo.writeObject(out); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ShellCommand.java b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ShellCommand.java index 66a10884142..93e5082181b 100644 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ShellCommand.java +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/commands/ShellCommand.java @@ -37,7 +37,7 @@ public class ShellCommand extends AbstractCommand { out.writeByte(cmdChan); out.writeByte(ioChan); out.flush(); - + byte res = in.readByte(); if (res != Protocol.PROTO_OK) { String errMsg = in.readUTF(); diff --git a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/messages/messages.properties b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/messages/messages.properties index d96b42bbd0c..b528d647781 100755 --- a/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/messages/messages.properties +++ b/remote/org.eclipse.remote.proxy.core/src/org/eclipse/remote/internal/proxy/core/messages/messages.properties @@ -4,7 +4,7 @@ # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html -# +# # Contributors: # IBM Corporation - initial implementation ############################################################################### @@ -15,8 +15,8 @@ AbstractRemoteCommand_Get_symlink_target=Get symlink target AbstractRemoteCommand_Operation_cancelled_by_user=Operation cancelled by user AuthInfo_Authentication_message=Authentication Message ExecCommand_Exec_command=Executing command "{0}" -GetInputStreamCommand_Receiving=Receiving {0}: -GetOutputStreamCommand_Sending=Sending {0}: +GetInputStreamCommand_Receiving=Receiving {0}: +GetOutputStreamCommand_Sending=Sending {0}: JSchConnection_0=Connection canceled by user JSchConnection_Connection_was_cancelled=Connection was cancelled JSchConnection_connectionNotOpen=Connection is not open diff --git a/remote/org.eclipse.remote.proxy.protocol.core/build.properties b/remote/org.eclipse.remote.proxy.protocol.core/build.properties index 47b4c86905e..12db5fead30 100644 --- a/remote/org.eclipse.remote.proxy.protocol.core/build.properties +++ b/remote/org.eclipse.remote.proxy.protocol.core/build.properties @@ -4,5 +4,5 @@ bin.includes = META-INF/,\ .,\ plugin.properties,\ about.html - + diff --git a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/internal/proxy/protocol/core/Activator.java b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/internal/proxy/protocol/core/Activator.java index ec612de817f..b0a3d71ecfa 100644 --- a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/internal/proxy/protocol/core/Activator.java +++ b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/internal/proxy/protocol/core/Activator.java @@ -19,7 +19,7 @@ public class Activator extends Plugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { @@ -28,7 +28,7 @@ public class Activator extends Plugin { /** * Get unique identifier - * + * * @return * @since 5.0 */ @@ -41,7 +41,7 @@ public class Activator extends Plugin { /** * Logs the specified status with this plug-in's log. - * + * * @param status * status to log */ @@ -51,7 +51,7 @@ public class Activator extends Plugin { /** * Logs an internal error with the specified message. - * + * * @param message * the error message to log */ @@ -61,7 +61,7 @@ public class Activator extends Plugin { /** * Logs an internal error with the specified throwable - * + * * @param e * the exception to be logged */ @@ -69,7 +69,6 @@ public class Activator extends Plugin { log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e)); } - /** * The constructor */ @@ -78,7 +77,7 @@ public class Activator extends Plugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/Protocol.java b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/Protocol.java index 0e7257e9d26..7ab049f5c21 100644 --- a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/Protocol.java +++ b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/Protocol.java @@ -9,27 +9,27 @@ package org.eclipse.remote.proxy.protocol.core; public class Protocol { public static final int MAGIC = 0xAFFA; - - public final static byte PROTO_COMMAND = 1; - public final static byte PROTO_SHUTDOWN = 2; - public final static byte PROTO_ERROR = 126; - public final static byte PROTO_OK = 0; - - public final static short CmdBase = 100; - - public final static short CMD_EXEC = CmdBase + 1; - public final static short CMD_SHELL = CmdBase + 2; - public final static short CMD_GETCWD = CmdBase + 3; - public final static short CMD_GETENV = CmdBase + 4; - public final static short CMD_CHILDINFOS = CmdBase + 5; - public final static short CMD_DELETE = CmdBase + 6; - public final static short CMD_FETCHINFO = CmdBase + 7; - public final static short CMD_GETINPUTSTREAM = CmdBase + 8; - public final static short CMD_GETOUTPUTSTREAM = CmdBase + 9; - public final static short CMD_MKDIR = CmdBase + 10; - public final static short CMD_PUTINFO = CmdBase + 11; - public final static short CMD_GETPROPERTIES = CmdBase + 12; - + + public final static byte PROTO_COMMAND = 1; + public final static byte PROTO_SHUTDOWN = 2; + public final static byte PROTO_ERROR = 126; + public final static byte PROTO_OK = 0; + + public final static short CmdBase = 100; + + public final static short CMD_EXEC = CmdBase + 1; + public final static short CMD_SHELL = CmdBase + 2; + public final static short CMD_GETCWD = CmdBase + 3; + public final static short CMD_GETENV = CmdBase + 4; + public final static short CMD_CHILDINFOS = CmdBase + 5; + public final static short CMD_DELETE = CmdBase + 6; + public final static short CMD_FETCHINFO = CmdBase + 7; + public final static short CMD_GETINPUTSTREAM = CmdBase + 8; + public final static short CMD_GETOUTPUTSTREAM = CmdBase + 9; + public final static short CMD_MKDIR = CmdBase + 10; + public final static short CMD_PUTINFO = CmdBase + 11; + public final static short CMD_GETPROPERTIES = CmdBase + 12; + /** * @since 2.0 */ diff --git a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/SerializableFileInfo.java b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/SerializableFileInfo.java index 22c2488adf7..1598d25bbfe 100644 --- a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/SerializableFileInfo.java +++ b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/SerializableFileInfo.java @@ -18,16 +18,16 @@ import org.eclipse.core.filesystem.provider.FileInfo; public class SerializableFileInfo implements Serializable { private static final long serialVersionUID = -1986643088683154145L; - + private IFileInfo info; - + public SerializableFileInfo() { } public SerializableFileInfo(IFileInfo info) { setIFileInfo(info); } - + public void setIFileInfo(IFileInfo info) { this.info = info; } @@ -35,7 +35,7 @@ public class SerializableFileInfo implements Serializable { public IFileInfo getIFileInfo() { return info; } - + public void writeObject(DataOutputStream out) throws IOException { out.writeUTF(info.getName()); boolean symlink = info.getAttribute(EFS.ATTRIBUTE_SYMLINK); @@ -60,7 +60,7 @@ public class SerializableFileInfo implements Serializable { public void readObject(DataInputStream in) throws IOException { FileInfo newInfo = new FileInfo(); - + try { newInfo.setName(in.readUTF()); boolean symlink = in.readBoolean(); @@ -84,7 +84,7 @@ public class SerializableFileInfo implements Serializable { } catch (IOException e) { newInfo.setError(IFileInfo.IO_ERROR); } - + setIFileInfo(newInfo); } } diff --git a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannel.java b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannel.java index b124fed2b4e..f60e8c0c42e 100644 --- a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannel.java +++ b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannel.java @@ -16,350 +16,350 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class StreamChannel { - public static final int CAPACITY = 8192; - - private class ChannelInputStream extends InputStream { - private final Lock lock = new ReentrantLock(); - private final Condition cond = lock.newCondition(); - private final StreamChannel channel; - - private int currentPos; - private int currentSize; - private boolean connected = true; - private int inputRequestCount; - private byte[] buffer = new byte[CAPACITY]; - - public ChannelInputStream(StreamChannel channel) { + public static final int CAPACITY = 8192; + + private class ChannelInputStream extends InputStream { + private final Lock lock = new ReentrantLock(); + private final Condition cond = lock.newCondition(); + private final StreamChannel channel; + + private int currentPos; + private int currentSize; + private boolean connected = true; + private int inputRequestCount; + private byte[] buffer = new byte[CAPACITY]; + + public ChannelInputStream(StreamChannel channel) { this.channel = channel; } - @Override - public synchronized int read() throws IOException { - byte[] b = new byte[1]; - if (read(b, 0, 1) != 1) { - return -1; - } - return b[0] & 0xff; - } - - @Override - public int available() throws IOException { - lock.lock(); - try { - return currentSize - currentPos; - } finally { - lock.unlock(); - } - } + @Override + public synchronized int read() throws IOException { + byte[] b = new byte[1]; + if (read(b, 0, 1) != 1) { + return -1; + } + return b[0] & 0xff; + } - public synchronized int read(byte b[], int off, int len) throws IOException { - if (len <= 0) { - return 0; - } - int moreSpace; - lock.lock(); - try { - if (currentPos >= currentSize) { - currentPos = currentSize = 0; - } else if (currentPos >= CAPACITY/2) { - System.arraycopy(buffer, currentPos, buffer, 0, currentSize - currentPos); - currentSize -= currentPos; - currentPos = 0; - } - int freeSpace = CAPACITY - currentSize; - moreSpace = Math.max(freeSpace - inputRequestCount, 0); - } finally { - lock.unlock(); - } - if (moreSpace > 0) { - mux.sendRequestCmd(StreamChannel.this, moreSpace); - } - lock.lock(); - try { - inputRequestCount += moreSpace; - while (currentPos >= currentSize && connected) { - try { - cond.await(); - } catch (InterruptedException e) { - } - } - if (!connected && currentPos >= currentSize) { - return -1; - } + @Override + public int available() throws IOException { + lock.lock(); + try { + return currentSize - currentPos; + } finally { + lock.unlock(); + } + } - int available = currentSize - currentPos; - if (len < available) { - System.arraycopy(buffer, currentPos, b, off, len); - currentPos += len; - return len; - } else { - System.arraycopy(buffer, currentPos, b, off, available); - currentPos = currentSize = 0; - return available; - } - } finally { - lock.unlock(); - } - } - - @Override - public void close() throws IOException { - channel.closeOutput(); - disconnect(); - } + public synchronized int read(byte b[], int off, int len) throws IOException { + if (len <= 0) { + return 0; + } + int moreSpace; + lock.lock(); + try { + if (currentPos >= currentSize) { + currentPos = currentSize = 0; + } else if (currentPos >= CAPACITY / 2) { + System.arraycopy(buffer, currentPos, buffer, 0, currentSize - currentPos); + currentSize -= currentPos; + currentPos = 0; + } + int freeSpace = CAPACITY - currentSize; + moreSpace = Math.max(freeSpace - inputRequestCount, 0); + } finally { + lock.unlock(); + } + if (moreSpace > 0) { + mux.sendRequestCmd(StreamChannel.this, moreSpace); + } + lock.lock(); + try { + inputRequestCount += moreSpace; + while (currentPos >= currentSize && connected) { + try { + cond.await(); + } catch (InterruptedException e) { + } + } + if (!connected && currentPos >= currentSize) { + return -1; + } - void receive(byte[] buf, int len) throws IOException { - lock.lock(); - try { - if (currentPos > 0 && (CAPACITY - currentSize) < len) { - System.arraycopy(buffer, currentPos, buffer, 0, currentSize - currentPos); - currentSize -= currentPos; - currentPos = 0; - } - if (CAPACITY - currentSize < len) { - throw new IOException("Receive buffer overflow"); - } - System.arraycopy(buf, 0, buffer, currentSize, len); - currentSize += len; - inputRequestCount -= len; - cond.signalAll(); - } finally { - lock.unlock(); - } - } + int available = currentSize - currentPos; + if (len < available) { + System.arraycopy(buffer, currentPos, b, off, len); + currentPos += len; + return len; + } else { + System.arraycopy(buffer, currentPos, b, off, available); + currentPos = currentSize = 0; + return available; + } + } finally { + lock.unlock(); + } + } - void disconnect() { - lock.lock(); - try { - connected = false; - cond.signalAll(); - } finally { - lock.unlock(); - } - } - - boolean isConnected() { - lock.lock(); - try { - return connected; - } finally { - lock.unlock(); - } - } - } - - private class ChannelOutputStream extends OutputStream { - private final Lock lock = new ReentrantLock(); - private final Condition cond = lock.newCondition(); - private final StreamChannel channel; - - private int currentPos; - private byte[] buffer = new byte[CAPACITY]; - private boolean connected = true; - private int outputRequestCount; - - public ChannelOutputStream(StreamChannel channel) { + @Override + public void close() throws IOException { + channel.closeOutput(); + disconnect(); + } + + void receive(byte[] buf, int len) throws IOException { + lock.lock(); + try { + if (currentPos > 0 && (CAPACITY - currentSize) < len) { + System.arraycopy(buffer, currentPos, buffer, 0, currentSize - currentPos); + currentSize -= currentPos; + currentPos = 0; + } + if (CAPACITY - currentSize < len) { + throw new IOException("Receive buffer overflow"); + } + System.arraycopy(buf, 0, buffer, currentSize, len); + currentSize += len; + inputRequestCount -= len; + cond.signalAll(); + } finally { + lock.unlock(); + } + } + + void disconnect() { + lock.lock(); + try { + connected = false; + cond.signalAll(); + } finally { + lock.unlock(); + } + } + + boolean isConnected() { + lock.lock(); + try { + return connected; + } finally { + lock.unlock(); + } + } + } + + private class ChannelOutputStream extends OutputStream { + private final Lock lock = new ReentrantLock(); + private final Condition cond = lock.newCondition(); + private final StreamChannel channel; + + private int currentPos; + private byte[] buffer = new byte[CAPACITY]; + private boolean connected = true; + private int outputRequestCount; + + public ChannelOutputStream(StreamChannel channel) { this.channel = channel; } - @Override - public synchronized void write(int b) throws IOException { - while (currentPos >= CAPACITY) { - send(); - } - buffer[currentPos++] = (byte)b; - } + @Override + public synchronized void write(int b) throws IOException { + while (currentPos >= CAPACITY) { + send(); + } + buffer[currentPos++] = (byte) b; + } - @Override - public synchronized void flush() throws IOException { - while (currentPos > 0) { - send(); - } - } + @Override + public synchronized void flush() throws IOException { + while (currentPos > 0) { + send(); + } + } - @Override - public synchronized void write(byte[] b, int off, int len) throws IOException { - if (len <= 0) { - return; - } - if (len <= CAPACITY - currentPos) { - System.arraycopy(b, off, buffer, currentPos, len); - currentPos += len; - return; - } - flush(); - int canSend; - while (true) { - lock.lock(); - try { - while ((canSend = outputRequestCount) == 0 && connected) { - try { - cond.await(); - } catch (InterruptedException e) { - } - } - if (!connected) { - throw new IOException("channel closed"); - } - } finally { - lock.unlock(); - } + @Override + public synchronized void write(byte[] b, int off, int len) throws IOException { + if (len <= 0) { + return; + } + if (len <= CAPACITY - currentPos) { + System.arraycopy(b, off, buffer, currentPos, len); + currentPos += len; + return; + } + flush(); + int canSend; + while (true) { + lock.lock(); + try { + while ((canSend = outputRequestCount) == 0 && connected) { + try { + cond.await(); + } catch (InterruptedException e) { + } + } + if (!connected) { + throw new IOException("channel closed"); + } + } finally { + lock.unlock(); + } - if (canSend < len) { - mux.sendTransmitCmd(StreamChannel.this, b, off, canSend); - off += canSend; - len -= canSend; - lock.lock(); - outputRequestCount -= canSend; - lock.unlock(); - } else { - mux.sendTransmitCmd(StreamChannel.this, b, off, len); - lock.lock(); - outputRequestCount -= len; - lock.unlock(); - break; - } - } - } - - void send() throws IOException { - int canSend; - lock.lock(); - try { - while ((canSend = outputRequestCount) == 0 && connected) { - try { - cond.await(); - } catch (InterruptedException e) { - } - } - if (!connected) { - throw new IOException("channel closed"); - } - } finally { - lock.unlock(); - } - if (canSend < currentPos) { - mux.sendTransmitCmd(StreamChannel.this, buffer, 0, canSend); - currentPos -= canSend; - System.arraycopy(buffer, canSend, buffer, 0, currentPos); - lock.lock(); - outputRequestCount -= canSend; - lock.unlock(); - } else { - mux.sendTransmitCmd(StreamChannel.this, buffer, 0, currentPos); - lock.lock(); - outputRequestCount -= currentPos; - lock.unlock(); - currentPos = 0; - } - } + if (canSend < len) { + mux.sendTransmitCmd(StreamChannel.this, b, off, canSend); + off += canSend; + len -= canSend; + lock.lock(); + outputRequestCount -= canSend; + lock.unlock(); + } else { + mux.sendTransmitCmd(StreamChannel.this, b, off, len); + lock.lock(); + outputRequestCount -= len; + lock.unlock(); + break; + } + } + } - @Override - public void close() throws IOException { - flush(); - channel.closeInput(); - disconnect(); - } - - void request(int len) { - lock.lock(); - outputRequestCount += len; - cond.signalAll(); - lock.unlock(); - } - - void disconnect() { - lock.lock(); - try { - connected = false; - cond.signalAll(); - } finally { - lock.unlock(); - } - } - - boolean isConnected() { - lock.lock(); - try { - return connected; - } finally { - lock.unlock(); - } - - } - } + void send() throws IOException { + int canSend; + lock.lock(); + try { + while ((canSend = outputRequestCount) == 0 && connected) { + try { + cond.await(); + } catch (InterruptedException e) { + } + } + if (!connected) { + throw new IOException("channel closed"); + } + } finally { + lock.unlock(); + } + if (canSend < currentPos) { + mux.sendTransmitCmd(StreamChannel.this, buffer, 0, canSend); + currentPos -= canSend; + System.arraycopy(buffer, canSend, buffer, 0, currentPos); + lock.lock(); + outputRequestCount -= canSend; + lock.unlock(); + } else { + mux.sendTransmitCmd(StreamChannel.this, buffer, 0, currentPos); + lock.lock(); + outputRequestCount -= currentPos; + lock.unlock(); + currentPos = 0; + } + } - private final StreamChannelManager mux; - private final int channelId; - private final ChannelInputStream min = new ChannelInputStream(this); - private final ChannelOutputStream mout = new ChannelOutputStream(this); - - private boolean open; + @Override + public void close() throws IOException { + flush(); + channel.closeInput(); + disconnect(); + } - public StreamChannel(StreamChannelManager mux, int id) { - this.mux = mux; - channelId = id; - open = true; - } + void request(int len) { + lock.lock(); + outputRequestCount += len; + cond.signalAll(); + lock.unlock(); + } - public int getId() { - return channelId; - } - - public InputStream getInputStream() { - return min; - } - - public OutputStream getOutputStream() { - return mout; - } - - public boolean isOpen() { - return open; - } - - public void close() throws IOException { - mux.sendCloseCmd(this); - } - - void receive(byte[] buf, int len) throws IOException { - min.receive(buf, len); - } - - void request(int len) { - mout.request(len); - } - - void disconnect() { - min.disconnect(); - mout.disconnect(); - } - - void setClosed() { - open = false; - } - - void disconnectInput() { - min.disconnect(); - } - - void disconnectOutput() { - mout.disconnect(); - } - - void closeInput() throws IOException { - mux.sendCloseInputCmd(this); - } - - void closeOutput() throws IOException { - mux.sendCloseOutputCmd(this); - } - - boolean isInputConnected() { - return min.isConnected(); - } - - boolean isOutputConnected() { - return mout.isConnected(); - } + void disconnect() { + lock.lock(); + try { + connected = false; + cond.signalAll(); + } finally { + lock.unlock(); + } + } + + boolean isConnected() { + lock.lock(); + try { + return connected; + } finally { + lock.unlock(); + } + + } + } + + private final StreamChannelManager mux; + private final int channelId; + private final ChannelInputStream min = new ChannelInputStream(this); + private final ChannelOutputStream mout = new ChannelOutputStream(this); + + private boolean open; + + public StreamChannel(StreamChannelManager mux, int id) { + this.mux = mux; + channelId = id; + open = true; + } + + public int getId() { + return channelId; + } + + public InputStream getInputStream() { + return min; + } + + public OutputStream getOutputStream() { + return mout; + } + + public boolean isOpen() { + return open; + } + + public void close() throws IOException { + mux.sendCloseCmd(this); + } + + void receive(byte[] buf, int len) throws IOException { + min.receive(buf, len); + } + + void request(int len) { + mout.request(len); + } + + void disconnect() { + min.disconnect(); + mout.disconnect(); + } + + void setClosed() { + open = false; + } + + void disconnectInput() { + min.disconnect(); + } + + void disconnectOutput() { + mout.disconnect(); + } + + void closeInput() throws IOException { + mux.sendCloseInputCmd(this); + } + + void closeOutput() throws IOException { + mux.sendCloseOutputCmd(this); + } + + boolean isInputConnected() { + return min.isConnected(); + } + + boolean isOutputConnected() { + return mout.isConnected(); + } } diff --git a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannelManager.java b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannelManager.java index 4b31d566e45..af97d6af59b 100644 --- a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannelManager.java +++ b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/StreamChannelManager.java @@ -28,299 +28,299 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; public class StreamChannelManager implements Runnable { - public interface IChannelListener { - public void newChannel(StreamChannel chan); - public void closeChannel(StreamChannel chan); - } - - private class Sender implements Runnable { - private OutputStream out; - private BlockingQueue queue = new LinkedBlockingQueue(); - private boolean running = true; - - public Sender(OutputStream out) { - this.out = out; - } - - public void sendOpenCmd(int id) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - data.writeByte(CMD_OPEN); - data.writeByte(id); - try { - queue.put(bytes); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void sendTransmitCmd(int id, byte buf[], int off, int len) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - data.writeByte(CMD_TRANSMIT); - data.writeByte(id); - data.writeInt(len); - data.write(buf, off, len); - try { - queue.put(bytes); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + public interface IChannelListener { + public void newChannel(StreamChannel chan); - public void sendCloseCmd(int id) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - data.writeByte(CMD_CLOSE); - data.writeByte(id); - try { - queue.put(bytes); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void sendCloseAckCmd(int id) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - data.writeByte(CMD_CLOSEACK); - data.writeByte(id); - try { - queue.put(bytes); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void sendRequestCmd(int id, int len) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - data.writeByte(CMD_REQUEST); - data.writeByte(id); - data.writeInt(len); - try { - queue.put(bytes); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void sendCloseInputCmd(int id) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - data.writeByte(CMD_CLOSE_INPUT); - data.writeByte(id); - try { - queue.put(bytes); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void sendCloseOutputCmd(int id) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - data.writeByte(CMD_CLOSE_OUTPUT); - data.writeByte(id); - try { - queue.put(bytes); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void shutdown() { - running = false; - try { - queue.put(new ByteArrayOutputStream()); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + public void closeChannel(StreamChannel chan); + } + + private class Sender implements Runnable { + private OutputStream out; + private BlockingQueue queue = new LinkedBlockingQueue(); + private boolean running = true; + + public Sender(OutputStream out) { + this.out = out; + } + + public void sendOpenCmd(int id) throws IOException { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + data.writeByte(CMD_OPEN); + data.writeByte(id); + try { + queue.put(bytes); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void sendTransmitCmd(int id, byte buf[], int off, int len) throws IOException { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + data.writeByte(CMD_TRANSMIT); + data.writeByte(id); + data.writeInt(len); + data.write(buf, off, len); + try { + queue.put(bytes); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void sendCloseCmd(int id) throws IOException { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + data.writeByte(CMD_CLOSE); + data.writeByte(id); + try { + queue.put(bytes); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void sendCloseAckCmd(int id) throws IOException { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + data.writeByte(CMD_CLOSEACK); + data.writeByte(id); + try { + queue.put(bytes); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void sendRequestCmd(int id, int len) throws IOException { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + data.writeByte(CMD_REQUEST); + data.writeByte(id); + data.writeInt(len); + try { + queue.put(bytes); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void sendCloseInputCmd(int id) throws IOException { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + data.writeByte(CMD_CLOSE_INPUT); + data.writeByte(id); + try { + queue.put(bytes); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void sendCloseOutputCmd(int id) throws IOException { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + data.writeByte(CMD_CLOSE_OUTPUT); + data.writeByte(id); + try { + queue.put(bytes); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void shutdown() { + running = false; + try { + queue.put(new ByteArrayOutputStream()); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void run() { + try { + while (running) { + ByteArrayOutputStream bytes = queue.take(); + if (bytes != null) { + bytes.writeTo(out); + out.flush(); + } + } + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } - @Override - public void run() { - try { - while (running) { - ByteArrayOutputStream bytes = queue.take(); - if (bytes != null) { - bytes.writeTo(out); - out.flush(); - } - } - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - } - private boolean isMyChannel(int id) { return !(isServer ^ ((id & SERVER_ID_MASK) == SERVER_ID_MASK)); } - - private class Receiver implements Runnable { - private DataInputStream dataIn; - - public Receiver(InputStream in) { - this.dataIn = new DataInputStream(in); - } + + private class Receiver implements Runnable { + private DataInputStream dataIn; + + public Receiver(InputStream in) { + this.dataIn = new DataInputStream(in); + } @Override - public void run() { - StreamChannel chan; - running = true; - try { - while (true) { - debugPrint("start read"); - int cmd = dataIn.readByte() & 0xff; - int id = dataIn.readByte() & 0xff; - - switch (cmd) { - case CMD_OPEN: - debugPrint("received cmd=OPEN id="+id); - chan = channels.get(id); - if (chan != null) { - throw new IOException("Channel already exists"); - } - if (!isServer && (id & SERVER_ID_MASK) != SERVER_ID_MASK) { - throw new IOException("Client received invalid server channel id: " + id); - } - if (isServer && (id & SERVER_ID_MASK) == SERVER_ID_MASK) { - throw new IOException("Server received invalid client channel id: " + id); - } - chan = new StreamChannel(StreamChannelManager.this, id); - channels.put(id, chan); - newChannelCallback(chan); - break; - - case CMD_CLOSE: - /* - * Received a command to close the channel. - * Clean up channel and free channel ID if we allocated it. - */ - debugPrint("received cmd=CLOSE id="+id); - chan = channels.get(id); - if (chan == null) { - throw new IOException("CLOSE: Invalid channel id: " + id); - } - chan.disconnect(); - if (chan.isOpen()) { - sendCloseAckCmd(chan); - } - closeChannelCallback(chan); - channels.remove(id); - if (isMyChannel(id)) { - freeId(id); - } - break; - - case CMD_CLOSEACK: - /* - * Received acknowledgement for our close command. - * Clean up channel and free channel ID if we allocated it. - */ - debugPrint("received cmd=CLOSEACK id="+id); - chan = channels.get(id); - if (chan == null) { - throw new IOException("CLOSEACK: Invalid channel id"); - } - if (chan.isOpen()) { - throw new IOException("Channel is still open"); - } - chan.disconnect(); - channels.remove(id); - if (isMyChannel(id)) { - freeId(id); - } - break; - - case CMD_TRANSMIT: - debugPrint("received cmd=TRANSMIT id="+id); - chan = channels.get(id); - if (chan == null) { - throw new IOException("TRANSMIT: Invalid channel id: " + id); - } - int len = dataIn.readInt(); - byte[] buf = new byte[len]; - dataIn.readFully(buf, 0, len); - chan.receive(buf, len); - break; - - case CMD_REQUEST: - chan = channels.get(id); - if (chan == null) { - throw new IOException("REQUEST: Invalid channel id: " + id); - } - int req = dataIn.readInt(); - debugPrint("received cmd=REQUEST id="+id+ " len="+req); - chan.request(req); - break; - - case CMD_CLOSE_INPUT: - /* - * Received a command to close the input side of the channel. - */ - debugPrint("received cmd=CLOSE_INPUT id="+id); - chan = channels.get(id); - if (chan == null) { - throw new IOException("CLOSE: Invalid channel id: " + id); - } - chan.disconnectInput(); - break; + public void run() { + StreamChannel chan; + running = true; + try { + while (true) { + debugPrint("start read"); + int cmd = dataIn.readByte() & 0xff; + int id = dataIn.readByte() & 0xff; + + switch (cmd) { + case CMD_OPEN: + debugPrint("received cmd=OPEN id=" + id); + chan = channels.get(id); + if (chan != null) { + throw new IOException("Channel already exists"); + } + if (!isServer && (id & SERVER_ID_MASK) != SERVER_ID_MASK) { + throw new IOException("Client received invalid server channel id: " + id); + } + if (isServer && (id & SERVER_ID_MASK) == SERVER_ID_MASK) { + throw new IOException("Server received invalid client channel id: " + id); + } + chan = new StreamChannel(StreamChannelManager.this, id); + channels.put(id, chan); + newChannelCallback(chan); + break; + + case CMD_CLOSE: + /* + * Received a command to close the channel. + * Clean up channel and free channel ID if we allocated it. + */ + debugPrint("received cmd=CLOSE id=" + id); + chan = channels.get(id); + if (chan == null) { + throw new IOException("CLOSE: Invalid channel id: " + id); + } + chan.disconnect(); + if (chan.isOpen()) { + sendCloseAckCmd(chan); + } + closeChannelCallback(chan); + channels.remove(id); + if (isMyChannel(id)) { + freeId(id); + } + break; + + case CMD_CLOSEACK: + /* + * Received acknowledgement for our close command. + * Clean up channel and free channel ID if we allocated it. + */ + debugPrint("received cmd=CLOSEACK id=" + id); + chan = channels.get(id); + if (chan == null) { + throw new IOException("CLOSEACK: Invalid channel id"); + } + if (chan.isOpen()) { + throw new IOException("Channel is still open"); + } + chan.disconnect(); + channels.remove(id); + if (isMyChannel(id)) { + freeId(id); + } + break; + + case CMD_TRANSMIT: + debugPrint("received cmd=TRANSMIT id=" + id); + chan = channels.get(id); + if (chan == null) { + throw new IOException("TRANSMIT: Invalid channel id: " + id); + } + int len = dataIn.readInt(); + byte[] buf = new byte[len]; + dataIn.readFully(buf, 0, len); + chan.receive(buf, len); + break; + + case CMD_REQUEST: + chan = channels.get(id); + if (chan == null) { + throw new IOException("REQUEST: Invalid channel id: " + id); + } + int req = dataIn.readInt(); + debugPrint("received cmd=REQUEST id=" + id + " len=" + req); + chan.request(req); + break; + + case CMD_CLOSE_INPUT: + /* + * Received a command to close the input side of the channel. + */ + debugPrint("received cmd=CLOSE_INPUT id=" + id); + chan = channels.get(id); + if (chan == null) { + throw new IOException("CLOSE: Invalid channel id: " + id); + } + chan.disconnectInput(); + break; + + case CMD_CLOSE_OUTPUT: + /* + * Received a command to close the output side of the channel. + */ + debugPrint("received cmd=CLOSE_OUTPUT id=" + id); + chan = channels.get(id); + if (chan == null) { + throw new IOException("CLOSE: Invalid channel id: " + id); + } + chan.disconnectOutput(); + break; + + default: + synchronized (System.err) { + System.err.print("invalid command: " + dump_byte((byte) cmd) + dump_byte((byte) id)); + } + try { + while (true) { + byte b = dataIn.readByte(); + System.err.print(dump_byte(b)); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + throw new IOException("Invalid command: " + cmd); + } + } + } catch (EOFException e) { + // Finish + } catch (Exception e) { + e.printStackTrace(); + debugPrint("run got exception:" + e.getMessage()); + } finally { + debugPrint("shutting down manager"); + StreamChannelManager.this.shutdown(); + } + } - - case CMD_CLOSE_OUTPUT: - /* - * Received a command to close the output side of the channel. - */ - debugPrint("received cmd=CLOSE_OUTPUT id="+id); - chan = channels.get(id); - if (chan == null) { - throw new IOException("CLOSE: Invalid channel id: " + id); - } - chan.disconnectOutput(); - break; - - default: - synchronized (System.err) { - System.err.print("invalid command: "+ dump_byte((byte)cmd) + dump_byte((byte)id)); - } - try { - while (true) { - byte b = dataIn.readByte(); - System.err.print(dump_byte(b)); - } - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - throw new IOException("Invalid command: " + cmd); - } - } - } catch (EOFException e) { - // Finish - } catch (Exception e) { - e.printStackTrace(); - debugPrint("run got exception:" + e.getMessage()); - } finally { - debugPrint("shutting down manager"); - StreamChannelManager.this.shutdown(); - } - } - public void shutdown() { try { dataIn.close(); @@ -328,235 +328,238 @@ public class StreamChannelManager implements Runnable { // Ignore } } - } - - private final static int CMD_OPEN = 0xA1; // Open a new channel - private final static int CMD_CLOSE = 0xA2; // Close a channel; acknowledgement required - private final static int CMD_CLOSEACK = 0xA3; // Channel close acknowledgement - private final static int CMD_REQUEST = 0xA4; // Request buffer space - private final static int CMD_TRANSMIT = 0xA5; // Transmit a buffer - private final static int CMD_CLOSE_INPUT = 0xA6; // Close input side of the channel; no acknowledgement required - private final static int CMD_CLOSE_OUTPUT = 0xA7; // Close output side of the channel; no acknowledgement required - - private final static int SERVER_ID_MASK = 1 << 15; - private final static int MAX_CHANNELS = SERVER_ID_MASK >> 1; - - private final Map channels = (Map) Collections.synchronizedMap(new HashMap()); - private final List listeners = (List)Collections.synchronizedList(new ArrayList()); - - private Set usedIds = new HashSet<>(); - private int nextUnusedChannelId; - private boolean isServer; + } - private volatile boolean running = true; - - private Sender sender; - private Receiver receiver; - - private boolean debug = false; - - public StreamChannelManager(InputStream in, OutputStream out) { - sender = new Sender(new BufferedOutputStream(out)); - receiver = new Receiver(new BufferedInputStream(in)); - } + private final static int CMD_OPEN = 0xA1; // Open a new channel + private final static int CMD_CLOSE = 0xA2; // Close a channel; acknowledgement required + private final static int CMD_CLOSEACK = 0xA3; // Channel close acknowledgement + private final static int CMD_REQUEST = 0xA4; // Request buffer space + private final static int CMD_TRANSMIT = 0xA5; // Transmit a buffer + private final static int CMD_CLOSE_INPUT = 0xA6; // Close input side of the channel; no acknowledgement required + private final static int CMD_CLOSE_OUTPUT = 0xA7; // Close output side of the channel; no acknowledgement required - /** - * Clients allocate IDs with leading bit 0 - * Servers allocate IDs with leading bit 1 - * - * Reuse an ID if it is not longer being used. - * - * @return new ID - */ - synchronized int newId() throws IOException { - if (!usedIds.isEmpty()) { - Short id = usedIds.iterator().next(); - usedIds.remove(id); - debugPrint("recover id="+id); - return id; - } - int nextId = nextUnusedChannelId; - if (nextUnusedChannelId++ > (MAX_CHANNELS - 1)) { - throw new IOException("Maximum number of channels exceeded"); - } - return nextId | (isServer ? SERVER_ID_MASK : 0); - } - - synchronized void freeId(int id) { - debugPrint("free id="+id); - usedIds.add((short)id); - } - - void dump_buf(String pref, byte[] b, int off, int len) { - System.err.print(pref + ": "); - for (int i = off; i < len+off; i++) { - if (b[i] <= 32 || b[i] > 126) { - System.err.print(String.format(" 0x%02x ", b[i])); - } else { - System.err.print((char)b[i]); - } - } - System.err.println(); - } - - public boolean isServer() { - return isServer; - } - - public void setServer(boolean server) { - isServer = server; - } - - public void addListener(IChannelListener listener) { - if (!listeners.contains(listener)) { - listeners.add(listener); - } - } - - public void removeListener(IChannelListener listener) { - if (listeners.contains(listener)) { - listeners.remove(listener); - } - } - - protected void newChannelCallback(StreamChannel chan) { - for (IChannelListener listener : listeners.toArray(new IChannelListener[listeners.size()])) { - listener.newChannel(chan); - } - } - - protected void closeChannelCallback(StreamChannel chan) { - for (IChannelListener listener : listeners.toArray(new IChannelListener[listeners.size()])) { - listener.closeChannel(chan); - } - } + private final static int SERVER_ID_MASK = 1 << 15; + private final static int MAX_CHANNELS = SERVER_ID_MASK >> 1; - public String dump_byte(byte b) { - if (b <= 32 || b > 126) { - return String.format(" 0x%02x ", b); - } - - return String.valueOf((char)b); - } - - public StreamChannel openChannel() throws IOException { - if (!running) { - throw new IOException("Multiplexer is not running"); - } - - StreamChannel chan = new StreamChannel(this, newId()); - channels.put(chan.getId(), chan); - - debugPrint("send cmd=OPEN id="+chan.getId()); - sender.sendOpenCmd(chan.getId()); + private final Map channels = (Map) Collections + .synchronizedMap(new HashMap()); + private final List listeners = (List) Collections + .synchronizedList(new ArrayList()); - return chan; - } + private Set usedIds = new HashSet<>(); + private int nextUnusedChannelId; + private boolean isServer; - 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); - sender.sendTransmitCmd(chan.getId(), buf, off, len); - } - } + private volatile boolean running = true; - synchronized void sendCloseCmd(StreamChannel chan) throws IOException { - if (running && chan.isOpen()) { - debugPrint("send cmd=CLOSE id="+chan.getId()); - chan.disconnect(); - sender.sendCloseCmd(chan.getId()); - chan.setClosed(); - } - } - - synchronized void sendCloseAckCmd(StreamChannel chan) throws IOException { - if (running && chan.isOpen()) { - debugPrint("send cmd=CLOSEACK id="+chan.getId()); - sender.sendCloseAckCmd(chan.getId()); - chan.setClosed(); - } - } - - synchronized void sendRequestCmd(StreamChannel chan, int len) throws IOException { - if (running && chan.isOpen()) { - debugPrint("send cmd=REQUEST id="+chan.getId()+" len="+len); - sender.sendRequestCmd(chan.getId(), len); - } - } - - synchronized void sendCloseInputCmd(StreamChannel chan) throws IOException { - if (running && chan.isOpen()) { - if (!chan.isOutputConnected()) { - sendCloseCmd(chan); - } else { - debugPrint("send cmd=CLOSE_INPUT id="+chan.getId()); - sender.sendCloseInputCmd(chan.getId()); - } - } - } + private Sender sender; + private Receiver receiver; - synchronized void sendCloseOutputCmd(StreamChannel chan) throws IOException { - if (running && chan.isOpen()) { - if (!chan.isInputConnected()) { - sendCloseCmd(chan); - } else { - debugPrint("send cmd=CLOSE_OUTPUT id="+chan.getId()); - sender.sendCloseOutputCmd(chan.getId()); - } - } - } - - public void debugPrint(String x) { - if (debug) { - synchronized (System.err) { - System.err.println(x); - } - } - } - - public void shutdown() { - if (!running) { - return; - } - running = false; - - synchronized (channels) { - for (StreamChannel c : channels.values()) { - c.disconnect(); - } - } - channels.clear(); - - sender.shutdown(); - receiver.shutdown(); - debugPrint("chan mpx stopped"); - // Should in and out be closed also? - } + private boolean debug = false; - private String asString(int v) { - switch (v) { - case CMD_OPEN: - return "OPEN"; + public StreamChannelManager(InputStream in, OutputStream out) { + sender = new Sender(new BufferedOutputStream(out)); + receiver = new Receiver(new BufferedInputStream(in)); + } - case CMD_CLOSE: - return "CLOSE"; + /** + * Clients allocate IDs with leading bit 0 + * Servers allocate IDs with leading bit 1 + * + * Reuse an ID if it is not longer being used. + * + * @return new ID + */ + synchronized int newId() throws IOException { + if (!usedIds.isEmpty()) { + Short id = usedIds.iterator().next(); + usedIds.remove(id); + debugPrint("recover id=" + id); + return id; + } + int nextId = nextUnusedChannelId; + if (nextUnusedChannelId++ > (MAX_CHANNELS - 1)) { + throw new IOException("Maximum number of channels exceeded"); + } + return nextId | (isServer ? SERVER_ID_MASK : 0); + } - case CMD_CLOSEACK: - return "CLOSEACK"; + synchronized void freeId(int id) { + debugPrint("free id=" + id); + usedIds.add((short) id); + } - case CMD_TRANSMIT: - return "TRANSMIT"; - - case CMD_REQUEST: - return "REQUEST"; - } - return ""; - } + void dump_buf(String pref, byte[] b, int off, int len) { + System.err.print(pref + ": "); + for (int i = off; i < len + off; i++) { + if (b[i] <= 32 || b[i] > 126) { + System.err.print(String.format(" 0x%02x ", b[i])); + } else { + System.err.print((char) b[i]); + } + } + System.err.println(); + } + + public boolean isServer() { + return isServer; + } + + public void setServer(boolean server) { + isServer = server; + } + + public void addListener(IChannelListener listener) { + if (!listeners.contains(listener)) { + listeners.add(listener); + } + } + + public void removeListener(IChannelListener listener) { + if (listeners.contains(listener)) { + listeners.remove(listener); + } + } + + protected void newChannelCallback(StreamChannel chan) { + for (IChannelListener listener : listeners.toArray(new IChannelListener[listeners.size()])) { + listener.newChannel(chan); + } + } + + protected void closeChannelCallback(StreamChannel chan) { + for (IChannelListener listener : listeners.toArray(new IChannelListener[listeners.size()])) { + listener.closeChannel(chan); + } + } + + public String dump_byte(byte b) { + if (b <= 32 || b > 126) { + return String.format(" 0x%02x ", b); + } + + return String.valueOf((char) b); + } + + public StreamChannel openChannel() throws IOException { + if (!running) { + throw new IOException("Multiplexer is not running"); + } + + StreamChannel chan = new StreamChannel(this, newId()); + channels.put(chan.getId(), chan); + + debugPrint("send cmd=OPEN id=" + chan.getId()); + sender.sendOpenCmd(chan.getId()); + + return chan; + } + + 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); + sender.sendTransmitCmd(chan.getId(), buf, off, len); + } + } + + synchronized void sendCloseCmd(StreamChannel chan) throws IOException { + if (running && chan.isOpen()) { + debugPrint("send cmd=CLOSE id=" + chan.getId()); + chan.disconnect(); + sender.sendCloseCmd(chan.getId()); + chan.setClosed(); + } + } + + synchronized void sendCloseAckCmd(StreamChannel chan) throws IOException { + if (running && chan.isOpen()) { + debugPrint("send cmd=CLOSEACK id=" + chan.getId()); + sender.sendCloseAckCmd(chan.getId()); + chan.setClosed(); + } + } + + synchronized void sendRequestCmd(StreamChannel chan, int len) throws IOException { + if (running && chan.isOpen()) { + debugPrint("send cmd=REQUEST id=" + chan.getId() + " len=" + len); + sender.sendRequestCmd(chan.getId(), len); + } + } + + synchronized void sendCloseInputCmd(StreamChannel chan) throws IOException { + if (running && chan.isOpen()) { + if (!chan.isOutputConnected()) { + sendCloseCmd(chan); + } else { + debugPrint("send cmd=CLOSE_INPUT id=" + chan.getId()); + sender.sendCloseInputCmd(chan.getId()); + } + } + } + + synchronized void sendCloseOutputCmd(StreamChannel chan) throws IOException { + if (running && chan.isOpen()) { + if (!chan.isInputConnected()) { + sendCloseCmd(chan); + } else { + debugPrint("send cmd=CLOSE_OUTPUT id=" + chan.getId()); + sender.sendCloseOutputCmd(chan.getId()); + } + } + } + + public void debugPrint(String x) { + if (debug) { + synchronized (System.err) { + System.err.println(x); + } + } + } + + public void shutdown() { + if (!running) { + return; + } + running = false; + + synchronized (channels) { + for (StreamChannel c : channels.values()) { + c.disconnect(); + } + } + channels.clear(); + + sender.shutdown(); + receiver.shutdown(); + debugPrint("chan mpx stopped"); + // Should in and out be closed also? + } + + private String asString(int v) { + switch (v) { + case CMD_OPEN: + return "OPEN"; + + case CMD_CLOSE: + return "CLOSE"; + + case CMD_CLOSEACK: + return "CLOSEACK"; + + case CMD_TRANSMIT: + return "TRANSMIT"; + + case CMD_REQUEST: + return "REQUEST"; + } + return ""; + } @Override public void run() { - debugPrint("mux starting"); - new Thread(sender, "mux sender").start(); - receiver.run(); + debugPrint("mux starting"); + new Thread(sender, "mux sender").start(); + receiver.run(); } } diff --git a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/exceptions/ProxyException.java b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/exceptions/ProxyException.java index b64890a6e6d..64a7fb83e77 100644 --- a/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/exceptions/ProxyException.java +++ b/remote/org.eclipse.remote.proxy.protocol.core/src/org/eclipse/remote/proxy/protocol/core/exceptions/ProxyException.java @@ -11,7 +11,7 @@ public class ProxyException extends Exception { private static final long serialVersionUID = 1L; - public ProxyException(String message) { - super(message); - } + public ProxyException(String message) { + super(message); + } } diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Application.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Application.java index 0e83990049a..7e0dbbcb468 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Application.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Application.java @@ -20,13 +20,14 @@ public class Application implements IApplication { private Server server = new Server(); public Object start(IApplicationContext context) throws Exception { - String[] args = (String[])context.getArguments().get(IApplicationContext.APPLICATION_ARGS); + String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); for (String arg : args) { if (arg.equals("-magic")) { //$NON-NLS-1$ ByteBuffer b = ByteBuffer.allocate(4); b.putInt(Protocol.MAGIC); System.out.write(b.array()); - }; + } + ; } server.start(); server.waitFor(); diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/CommandServer.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/CommandServer.java index e600a47c471..603821aef50 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/CommandServer.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/CommandServer.java @@ -40,14 +40,14 @@ public class CommandServer implements Runnable { private DataOutputStream cmdOut; private boolean running = true; private StreamChannel chan; - + public CommandServer(StreamChannel chan, Server server) { this.chan = chan; this.server = server; this.cmdIn = new DataInputStream(chan.getInputStream()); this.cmdOut = new DataOutputStream(chan.getOutputStream()); } - + public void run() { new Thread("cmd reader") { //$NON-NLS-1$ @Override @@ -64,11 +64,11 @@ public class CommandServer implements Runnable { sendErrorResult(e.getMessage()); } break; - + case Protocol.PROTO_SHUTDOWN: running = false; break; - + default: System.err.println("Invalid protocol ID: " + proto); break; @@ -85,35 +85,34 @@ public class CommandServer implements Runnable { } }.start(); } - + private void sendOKResult() throws IOException { cmdOut.writeByte(Protocol.PROTO_OK); cmdOut.flush(); } - + private void sendErrorResult(String error) throws IOException { cmdOut.writeByte(Protocol.PROTO_ERROR); cmdOut.writeUTF(error); cmdOut.flush(); } - /** * TODO replace with dynamic dispatcher */ private void dispatchCommand(DataInputStream in) throws ProxyException, IOException { AbstractServerCommand serverCmd; - + short cmd = in.readShort(); switch (cmd) { case Protocol.CMD_CHILDINFOS: serverCmd = cmdChildInfos(in); break; - + case Protocol.CMD_DELETE: serverCmd = cmdDelete(in); break; - + case Protocol.CMD_EXEC: serverCmd = cmdExec(in); break; @@ -125,11 +124,11 @@ public class CommandServer implements Runnable { case Protocol.CMD_FETCHINFO: serverCmd = cmdFetchInfo(in); break; - + case Protocol.CMD_GETCWD: serverCmd = cmdGetCwd(in); break; - + case Protocol.CMD_GETENV: serverCmd = cmdGetEnv(in); break; @@ -141,7 +140,7 @@ public class CommandServer implements Runnable { case Protocol.CMD_GETOUTPUTSTREAM: serverCmd = cmdGetOutputStream(in); break; - + case Protocol.CMD_GETPROPERTIES: serverCmd = cmdGetProperties(in); break; @@ -149,19 +148,19 @@ public class CommandServer implements Runnable { case Protocol.CMD_MKDIR: serverCmd = cmdMkdir(in); break; - + case Protocol.CMD_PUTINFO: serverCmd = cmdPutInfo(in); break; - + default: System.err.println("Invalid command ID: " + cmd); throw new ProxyException("Invalid command ID: " + cmd); //$NON-NLS-1$ } - + serverCmd.exec(); } - + private AbstractServerCommand cmdExec(DataInputStream in) throws ProxyException, IOException { int cmdChanId = in.readByte(); int ioChanId = in.readByte(); @@ -183,7 +182,7 @@ public class CommandServer implements Runnable { boolean appendEnv = in.readBoolean(); StreamChannel cmdChan = server.getChannel(cmdChanId); StreamChannel ioChan = server.getChannel(ioChanId); - StreamChannel errChan= server.getChannel(errChanId); + StreamChannel errChan = server.getChannel(errChanId); if (cmdChan == null || ioChan == null || errChan == null) { throw new ProxyException("Unable to locate channels for command"); //$NON-NLS-1$ } @@ -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); @@ -208,7 +208,7 @@ public class CommandServer implements Runnable { } return new ServerGetCwdCommand(chan); } - + private AbstractServerCommand cmdGetEnv(DataInputStream in) throws ProxyException, IOException { int chanId = in.readByte(); StreamChannel chan = server.getChannel(chanId); @@ -217,7 +217,7 @@ public class CommandServer implements Runnable { } return new ServerGetEnvCommand(chan); } - + private AbstractServerCommand cmdGetProperties(DataInputStream in) throws ProxyException, IOException { int chanId = in.readByte(); StreamChannel chan = server.getChannel(chanId); @@ -226,7 +226,7 @@ public class CommandServer implements Runnable { } return new ServerGetPropertiesCommand(chan); } - + private AbstractServerCommand cmdChildInfos(DataInputStream in) throws ProxyException, IOException { int chanId = in.readByte(); StreamChannel chan = server.getChannel(chanId); @@ -246,7 +246,7 @@ public class CommandServer implements Runnable { String path = in.readUTF(); return new ServerFetchInfoCommand(chan, path); } - + private AbstractServerCommand cmdGetInputStream(DataInputStream in) throws ProxyException, IOException { int chanId = in.readByte(); StreamChannel chan = server.getChannel(chanId); @@ -257,7 +257,7 @@ public class CommandServer implements Runnable { String path = in.readUTF(); return new ServerGetInputStreamCommand(chan, options, path); } - + private AbstractServerCommand cmdGetOutputStream(DataInputStream in) throws ProxyException, IOException { int chanId = in.readByte(); StreamChannel chan = server.getChannel(chanId); @@ -280,7 +280,7 @@ public class CommandServer implements Runnable { String path = in.readUTF(); return new ServerMkdirCommand(options, path); } - + private AbstractServerCommand cmdPutInfo(DataInputStream in) throws ProxyException, IOException { int options = in.readInt(); String path = in.readUTF(); diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Server.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Server.java index 19fbdbea4b3..bb62ff4a8e3 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Server.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/Server.java @@ -20,8 +20,7 @@ public class Server { private Thread serverThread; private StreamChannel cmdChannel; private Map auxChannel = Collections.synchronizedMap(new HashMap()); - - + public void start() { final StreamChannelManager mux = new StreamChannelManager(System.in, System.out); mux.setServer(true); @@ -46,7 +45,7 @@ public class Server { System.err.println("closeChannel: " + chan.getId()); auxChannel.remove(chan.getId()); } - + }); serverThread = new Thread(mux) { @Override @@ -58,12 +57,12 @@ public class Server { }; serverThread.start(); } - + public StreamChannel getChannel(int id) { - System.err.println("getChannel: "+id); + System.err.println("getChannel: " + id); return auxChannel.get(id); } - + public void waitFor() { if (running && serverThread != null) { try { diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/AbstractServerExecCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/AbstractServerExecCommand.java index 9fc61b1d259..ce2c78514a8 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/AbstractServerExecCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/AbstractServerExecCommand.java @@ -27,7 +27,7 @@ import org.eclipse.remote.proxy.protocol.core.StreamChannel; import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public abstract class AbstractServerExecCommand extends AbstractServerCommand { - + private class CommandRunner implements Runnable { @Override public void run() { @@ -72,7 +72,7 @@ public abstract class AbstractServerExecCommand extends AbstractServerCommand { } } } - + private class ProcMonitor implements Runnable { @Override public void run() { @@ -94,17 +94,17 @@ public abstract class AbstractServerExecCommand extends AbstractServerCommand { } } } - + private class Forwarder implements Runnable { private final InputStream in; private final OutputStream out; private final String name; - + private boolean running = true; - - private final Lock lock = new ReentrantLock(); - private final Condition cond = lock.newCondition(); - + + private final Lock lock = new ReentrantLock(); + private final Condition cond = lock.newCondition(); + public Forwarder(String name, InputStream in, OutputStream out) { this.name = name; this.in = new BufferedInputStream(in); @@ -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 @@ -141,11 +142,11 @@ public abstract class AbstractServerExecCommand extends AbstractServerCommand { lock.unlock(); } } - + public String getName() { return name; } - + public synchronized void waitFor() { lock.lock(); try { @@ -161,68 +162,69 @@ public abstract class AbstractServerExecCommand extends AbstractServerCommand { } } } - + private final List command; private final Map env; private final boolean redirect; private final boolean appendEnv; private final String directory; - + private final InputStream stdinChan; private final OutputStream stdoutChan; private final OutputStream stderrChan; - + private final DataInputStream cmdStream; private final DataOutputStream resultStream; private Process proc; - public AbstractServerExecCommand(List command, Map env, String directory, boolean redirect, boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) { + public AbstractServerExecCommand(List command, Map env, String directory, boolean redirect, + boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) { this.command = command; this.env = env; this.directory = directory; this.redirect = redirect; this.appendEnv = appendEnv; - + this.stdinChan = ioChan.getInputStream(); this.stdoutChan = ioChan.getOutputStream(); - + this.stderrChan = errChan != null ? errChan.getOutputStream() : this.stdoutChan; - + this.resultStream = new DataOutputStream(cmdChan.getOutputStream()); this.cmdStream = new DataInputStream(cmdChan.getInputStream()); } protected abstract Process doRun() throws IOException; - + protected abstract void doKill(Process proc); - + protected abstract void doSetTerminalSize(Process proc, int col, int rows); protected List getCommand() { return command; } - - protected Map getEnv() { + + protected Map getEnv() { return env; } - + protected boolean isRedirect() { return redirect; } - + protected boolean isAppendEnv() { return appendEnv; } - + protected String getDirectory() { return directory; } - + public void exec() throws ProxyException { new Thread(new CommandRunner()).start(); } - + private Forwarder startForwarder(String name, InputStream in, OutputStream out) { Forwarder forwarder = new Forwarder(name, in, out); Thread thread = new Thread(forwarder, forwarder.getName()); diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerChildInfosCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerChildInfosCommand.java index 7f471e1da34..6c5cadd9f23 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerChildInfosCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerChildInfosCommand.java @@ -21,10 +21,10 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public class ServerChildInfosCommand extends AbstractServerCommand { private IFileInfo[] infos; - + private final URI uri; private final OutputStream out; - + private class CommandRunner implements Runnable { @Override public void run() { @@ -42,7 +42,7 @@ public class ServerChildInfosCommand extends AbstractServerCommand { } } } - + public ServerChildInfosCommand(StreamChannel chan, String path) { this.out = chan.getOutputStream(); this.uri = URI.create("file:" + path); //$NON-NLS-1$ diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerDeleteCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerDeleteCommand.java index a259e779187..a9ba781201f 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerDeleteCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerDeleteCommand.java @@ -17,7 +17,7 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public class ServerDeleteCommand extends AbstractServerCommand { private final int options; private final URI uri; - + public ServerDeleteCommand(int options, String path) { this.options = options; this.uri = URI.create("file:" + path); //$NON-NLS-1$ diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerExecCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerExecCommand.java index f56a64188a6..47ea525b539 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerExecCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerExecCommand.java @@ -21,7 +21,7 @@ import org.eclipse.remote.proxy.protocol.core.StreamChannel; public class ServerExecCommand extends AbstractServerExecCommand { public Process doRun() throws IOException { System.err.print("exec: "); - for (String arg:getCommand()) { + for (String arg : getCommand()) { System.err.print(arg + " "); } System.err.println(); @@ -38,7 +38,7 @@ public class ServerExecCommand extends AbstractServerExecCommand { } } } - } catch (UnsupportedOperationException | IllegalArgumentException e) { + } catch (UnsupportedOperationException | IllegalArgumentException e) { // Leave environment untouched } File dir = new File(getDirectory()); @@ -48,18 +48,19 @@ public class ServerExecCommand extends AbstractServerExecCommand { builder.redirectErrorStream(isRedirect()); return builder.start(); } - + protected void doKill(Process proc) { if (proc.isAlive()) { proc.destroyForcibly(); } } - + protected void doSetTerminalSize(Process proc, int cols, int rows) { // Not supported } - - public ServerExecCommand(List command, Map env, String directory, boolean redirect, boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) { + + public ServerExecCommand(List command, Map env, String directory, boolean redirect, + boolean appendEnv, StreamChannel cmdChan, StreamChannel ioChan, StreamChannel errChan) { super(command, env, directory, redirect, appendEnv, cmdChan, ioChan, errChan); } } diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerFetchInfoCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerFetchInfoCommand.java index d03b01626a1..5e42bfc45ff 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerFetchInfoCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerFetchInfoCommand.java @@ -21,10 +21,10 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public class ServerFetchInfoCommand extends AbstractServerCommand { private IFileInfo info; - + private final URI uri; private final OutputStream out; - + private class CommandRunner implements Runnable { @Override public void run() { @@ -39,7 +39,7 @@ public class ServerFetchInfoCommand extends AbstractServerCommand { } } } - + public ServerFetchInfoCommand(StreamChannel chan, String path) { this.out = chan.getOutputStream(); this.uri = URI.create("file:" + path); //$NON-NLS-1$ diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetCwdCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetCwdCommand.java index 9bc2a5f4d2d..43b787b6d35 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetCwdCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetCwdCommand.java @@ -17,7 +17,7 @@ public class ServerGetCwdCommand extends AbstractServerCommand { private String cwd; private final DataOutputStream result; - + private class CommandRunner implements Runnable { @Override public void run() { @@ -29,7 +29,7 @@ public class ServerGetCwdCommand extends AbstractServerCommand { } } } - + public ServerGetCwdCommand(StreamChannel chan) { this.result = new DataOutputStream(chan.getOutputStream()); } diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetEnvCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetEnvCommand.java index 624911024e7..980de6591f3 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetEnvCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetEnvCommand.java @@ -17,12 +17,12 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public class ServerGetEnvCommand extends AbstractServerCommand { private final DataOutputStream result; - + private class CommandRunner implements Runnable { @Override public void run() { try { - Map env = System.getenv(); + Map env = System.getenv(); result.writeInt(env.size()); for (Map.Entry entry : env.entrySet()) { result.writeUTF(entry.getKey()); @@ -34,7 +34,7 @@ public class ServerGetEnvCommand extends AbstractServerCommand { } } } - + public ServerGetEnvCommand(StreamChannel chan) { this.result = new DataOutputStream(chan.getOutputStream()); } diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetInputStreamCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetInputStreamCommand.java index 6fb283553c0..aa1891a1cee 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetInputStreamCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetInputStreamCommand.java @@ -27,11 +27,11 @@ public class ServerGetInputStreamCommand extends AbstractServerCommand { private final OutputStream out; private final URI uri; private final int options; - + private class Forwarder implements Runnable { private final InputStream in; private final OutputStream out; - + public Forwarder(InputStream in, OutputStream out) { this.in = in; this.out = out; @@ -72,13 +72,14 @@ 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()); } } - + private void startForwarder(InputStream in, OutputStream out) { Forwarder forwarder = new Forwarder(in, out); new Thread(forwarder).start(); diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetOutputStreamCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetOutputStreamCommand.java index ab2517e58ee..0557d49fcc4 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetOutputStreamCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetOutputStreamCommand.java @@ -28,11 +28,11 @@ public class ServerGetOutputStreamCommand extends AbstractServerCommand { private final InputStream in; private final URI uri; private final int options; - + private class Forwarder implements Runnable { private final InputStream in; private final OutputStream out; - + public Forwarder(InputStream in, OutputStream out) { this.in = in; this.out = out; @@ -73,13 +73,14 @@ 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()); } } - + private void startForwarder(InputStream in, OutputStream out) { Forwarder forwarder = new Forwarder(in, out); new Thread(forwarder).start(); diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetPropertiesCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetPropertiesCommand.java index dab727e0123..9feab7b6428 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetPropertiesCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerGetPropertiesCommand.java @@ -19,18 +19,23 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public class ServerGetPropertiesCommand extends AbstractServerCommand { private final DataOutputStream result; - + private class CommandRunner implements Runnable { @Override public void run() { try { - Map props = new HashMap(); - 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)); + Map props = new HashMap(); + 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$ @@ -45,7 +50,7 @@ public class ServerGetPropertiesCommand extends AbstractServerCommand { } } } - + public ServerGetPropertiesCommand(StreamChannel chan) { this.result = new DataOutputStream(chan.getOutputStream()); } diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerMkdirCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerMkdirCommand.java index cb3ddb43e6a..612473619a5 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerMkdirCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerMkdirCommand.java @@ -17,7 +17,7 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException; public class ServerMkdirCommand extends AbstractServerCommand { private final int options; private final URI uri; - + public ServerMkdirCommand(int options, String path) { this.options = options; this.uri = URI.create("file:" + path); //$NON-NLS-1$ diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerPutInfoCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerPutInfoCommand.java index 61d2abfde37..d4d3e23b813 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerPutInfoCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerPutInfoCommand.java @@ -19,7 +19,7 @@ public class ServerPutInfoCommand extends AbstractServerCommand { private final IFileInfo info; private final int options; private final URI uri; - + public ServerPutInfoCommand(IFileInfo info, int options, String path) { this.info = info; this.options = options; @@ -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()); } diff --git a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerShellCommand.java b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerShellCommand.java index 74545c63f7f..b14aea0a0da 100644 --- a/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerShellCommand.java +++ b/remote/org.eclipse.remote.proxy.server.core/src/org/eclipse/remote/internal/proxy/server/core/commands/ServerShellCommand.java @@ -31,7 +31,7 @@ public class ServerShellCommand extends AbstractServerExecCommand { this.proc = proc; this.pty = pty; } - + @Override public OutputStream getOutputStream() { if (pty != null) { @@ -70,54 +70,54 @@ public class ServerShellCommand extends AbstractServerExecCommand { public void destroy() { proc.destroy(); } - + public void setTerminalSize(int cols, int rows) { if (pty != null) { pty.setTerminalSize(cols, rows); } } } - + public ServerShellCommand(StreamChannel cmdChan, StreamChannel ioChan) { super(null, null, null, true, false, cmdChan, ioChan, null); } public Process doRun() throws IOException { String shell = findLoginShell(); - + if (PTY.isSupported(Mode.TERMINAL)) { PTY pty = new PTY(Mode.TERMINAL); - Process p = ProcessFactory.getFactory().exec(new String[] {shell, "-l"}, null, null, pty); //$NON-NLS-1$ + Process p = ProcessFactory.getFactory().exec(new String[] { shell, "-l" }, null, null, pty); //$NON-NLS-1$ return new ShellProcess(p, pty); } - - return ProcessFactory.getFactory().exec(new String[] {shell, "-l"}, null, null); //$NON-NLS-1$ + + return ProcessFactory.getFactory().exec(new String[] { shell, "-l" }, null, null); //$NON-NLS-1$ } - + protected void doKill(Process proc) { if (proc.isAlive()) { proc.destroyForcibly(); } } - + protected void doSetTerminalSize(Process proc, int cols, int rows) { if (proc.isAlive() && proc instanceof ShellProcess) { - ShellProcess shell = (ShellProcess)proc; + ShellProcess shell = (ShellProcess) proc; shell.setTerminalSize(cols, rows); } } /** * Find the login shell. - * + * * On Linux, use `getent passwd $USER` * On Mac OSX, use `dscl . -read /Users/$USER UserShell` - * + * * @return */ private String findLoginShell() throws IOException { String res; - + String osName = System.getProperty("os.name"); //$NON-NLS-1$ String userName = System.getProperty("user.name"); //$NON-NLS-1$ if (osName == null || userName == null) { @@ -147,7 +147,7 @@ public class ServerShellCommand extends AbstractServerExecCommand { } throw new IOException("Unable to find login shell for os=" + osName + " user=" + userName); //$NON-NLS-1$ //$NON-NLS-2$ } - + private String executeCommand(String command) throws IOException { String line; StringBuffer output = new StringBuffer(); diff --git a/remote/org.eclipse.remote.proxy.server.macosx.x86_64/build.properties b/remote/org.eclipse.remote.proxy.server.macosx.x86_64/build.properties index c437c59c8ec..008b5fb1623 100644 --- a/remote/org.eclipse.remote.proxy.server.macosx.x86_64/build.properties +++ b/remote/org.eclipse.remote.proxy.server.macosx.x86_64/build.properties @@ -2,4 +2,3 @@ bin.includes = META-INF/,\ proxy.server.tar.gz,\ plugin.properties,\ about.html - \ No newline at end of file diff --git a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/Activator.java b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/Activator.java index f9e96094b4c..7152957bb36 100644 --- a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/Activator.java +++ b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/Activator.java @@ -14,7 +14,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + /** * The constructor */ @@ -42,7 +42,7 @@ public class Activator extends AbstractUIPlugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ConnectionTests.java b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ConnectionTests.java index 66c9a459659..b1100eb7af4 100644 --- a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ConnectionTests.java +++ b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ConnectionTests.java @@ -28,50 +28,50 @@ import junit.framework.TestCase; public class ConnectionTests extends TestCase { private IRemoteConnectionType connType; - + class Context { private String line; private State state; private BufferedReader reader; private BufferedWriter writer; - + public Context(BufferedReader reader, BufferedWriter writer) { this.reader = reader; this.writer = writer; setState(States.INIT); } - - String getLine() { - return line; - } - - void setLine(String line) { - this.line = line; - } - - State getState() { - return state; - } - - void setState(State state) { - this.state = state; - } + + String getLine() { + return line; + } + + void setLine(String line) { + this.line = line; + } + + State getState() { + return state; + } + + void setState(State state) { + this.state = state; + } } - + interface State { - /** - * @return true to keep processing, false to read more data. - */ - boolean process(Context context) throws IOException; + /** + * @return true to keep processing, false to read more data. + */ + boolean process(Context context) throws IOException; } - + enum States implements State { INIT { @Override public boolean process(Context context) throws IOException { - System.out.println("state="+INIT); + System.out.println("state=" + INIT); String line = context.reader.readLine(); - System.out.println("got "+ line); + System.out.println("got " + line); if (line.equals("running")) { context.setState(States.CHECK); return true; @@ -82,7 +82,7 @@ public class ConnectionTests extends TestCase { CHECK { @Override public boolean process(Context context) throws IOException { - System.out.println("state="+CHECK); + System.out.println("state=" + CHECK); context.writer.write("check\n"); context.writer.flush(); String line = context.reader.readLine(); @@ -95,14 +95,14 @@ public class ConnectionTests extends TestCase { context.setState(States.DOWNLOAD); return true; } - System.out.println("fail:"+parts[1]); + System.out.println("fail:" + parts[1]); return false; } }, DOWNLOAD { @Override public boolean process(Context context) throws IOException { - System.out.println("state="+DOWNLOAD); + System.out.println("state=" + DOWNLOAD); File file = new File("proxy.server-linux.gtk.x86_64.tar.gz"); long count = file.length() / 510; System.out.println("download " + count); @@ -116,13 +116,13 @@ public class ConnectionTests extends TestCase { context.setState(States.START); return true; case "fail": - System.out.println("fail:"+parts[1]); + System.out.println("fail:" + parts[1]); return false; } } return false; } - + private boolean downloadFile(File file, BufferedWriter writer) { try { Base64.Encoder encoder = Base64.getEncoder(); @@ -147,14 +147,14 @@ public class ConnectionTests extends TestCase { START { @Override public boolean process(Context context) throws IOException { - System.out.println("state="+START); + System.out.println("state=" + START); context.writer.write("start\n"); context.writer.flush(); return false; } } } - + public void testProxyConnection() { try { IJSchService jService = Activator.getService(IJSchService.class); @@ -162,7 +162,7 @@ public class ConnectionTests extends TestCase { session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$ //$NON-NLS-2$ new UserInfoPrompter(session); jService.connect(session, 0, new NullProgressMonitor()); - ChannelExec server = (ChannelExec)session.openChannel("exec"); + ChannelExec server = (ChannelExec) session.openChannel("exec"); server.setCommand("/bin/sh"); server.connect(); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(server.getOutputStream())); @@ -179,54 +179,54 @@ public class ConnectionTests extends TestCase { while (context.getState().process(context)) { // do state machine } - } catch (JSchException | IOException e) { + } catch (JSchException | IOException e) { fail(e.getMessage()); } -// try { -// final Process proc = Runtime.getRuntime().exec("java" -// + " -cp /Users/gw6/Work/git/org.eclipse.remote/releng/org.eclipse.remote.proxy.server.product/target/products/proxy.server/macosx/cocoa/x86_64/Proxy.app/Contents/Eclipse/plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar" -// + " org.eclipse.equinox.launcher.Main" -// + " -application org.eclipse.remote.proxy.server.core.application" -// + " -noExit"); -// assertTrue(proc.isAlive()); -// -// new Thread("stderr") { -// private byte[] buf = new byte[1024]; -// @Override -// public void run() { -// int n; -// BufferedInputStream err = new BufferedInputStream(proc.getErrorStream()); -// try { -// while ((n = err.read(buf)) >= 0) { -// if (n > 0) { -// System.err.println("server: " + new String(buf, 0, n)); -// } -// } -// } catch (IOException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// -// }.start(); -// -// IRemoteConnection conn = connType.newConnection("test"); -// assertNotNull(conn); -// IRemoteProxyService proxy = conn.getService(IRemoteProxyService.class); -// assertNotNull(proxy); -// proxy.setStreams(proc.getInputStream(), proc.getOutputStream()); -// conn.open(new NullProgressMonitor()); -// conn.close(); -// -// proc.destroy(); -// proc.waitFor(); -// assertEquals(false, proc.isAlive()); -// } catch (IOException | RemoteConnectionException | InterruptedException e) { -// fail(e.getMessage()); -// } + // try { + // final Process proc = Runtime.getRuntime().exec("java" + // + " -cp /Users/gw6/Work/git/org.eclipse.remote/releng/org.eclipse.remote.proxy.server.product/target/products/proxy.server/macosx/cocoa/x86_64/Proxy.app/Contents/Eclipse/plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar" + // + " org.eclipse.equinox.launcher.Main" + // + " -application org.eclipse.remote.proxy.server.core.application" + // + " -noExit"); + // assertTrue(proc.isAlive()); + // + // new Thread("stderr") { + // private byte[] buf = new byte[1024]; + // @Override + // public void run() { + // int n; + // BufferedInputStream err = new BufferedInputStream(proc.getErrorStream()); + // try { + // while ((n = err.read(buf)) >= 0) { + // if (n > 0) { + // System.err.println("server: " + new String(buf, 0, n)); + // } + // } + // } catch (IOException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } + // } + // + // }.start(); + // + // IRemoteConnection conn = connType.newConnection("test"); + // assertNotNull(conn); + // IRemoteProxyService proxy = conn.getService(IRemoteProxyService.class); + // assertNotNull(proxy); + // proxy.setStreams(proc.getInputStream(), proc.getOutputStream()); + // conn.open(new NullProgressMonitor()); + // conn.close(); + // + // proc.destroy(); + // proc.waitFor(); + // assertEquals(false, proc.isAlive()); + // } catch (IOException | RemoteConnectionException | InterruptedException e) { + // fail(e.getMessage()); + // } } - + private String executeSshCommand(ChannelShell shell, String command) throws RemoteConnectionException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); @@ -247,11 +247,11 @@ public class ConnectionTests extends TestCase { @Override protected void setUp() throws Exception { -// IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class); -// connType = manager.getConnectionType("org.eclipse.remote.Proxy"); //$NON-NLS-1$ -// assertNotNull(connType); + // IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class); + // connType = manager.getConnectionType("org.eclipse.remote.Proxy"); //$NON-NLS-1$ + // assertNotNull(connType); } - + @Override protected void tearDown() throws Exception { } diff --git a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/FileStoreTests.java b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/FileStoreTests.java index 28ba3374944..875b83d1007 100644 --- a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/FileStoreTests.java +++ b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/FileStoreTests.java @@ -40,7 +40,7 @@ public class FileStoreTests extends TestCase { private IFileStore localParent; private IFileStore remoteDir; private IFileStore localDir; - + private static IRemoteFileService fileService; private static IRemoteConnection connection; @@ -78,7 +78,7 @@ public class FileStoreTests extends TestCase { BufferedReader buf = new BufferedReader(new InputStreamReader(stream)); String line = buf.readLine(); assertEquals(line, TEST_CONTENTS.split("\n")[0]); - + buf.close(); } catch (Exception e) { fail(e.getMessage()); @@ -201,7 +201,7 @@ public class FileStoreTests extends TestCase { fi = fs.fetchInfo(); assertEquals(expected, fi.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)); } - + public void xtestLargeFile() { IFileStore local = EFS.getLocalFileSystem().getStore(new Path("/usr/bin/php")); IFileStore remote = remoteDir.getChild("php.xxx"); @@ -223,7 +223,7 @@ public class FileStoreTests extends TestCase { fail(e.getMessage()); } } - + public void testCopyLargeFile() { IFileStore local = EFS.getLocalFileSystem().getStore(new Path("/usr/bin/php")); IFileStore remote = remoteDir.getChild("php.xxx"); @@ -246,7 +246,7 @@ public class FileStoreTests extends TestCase { IRemoteConnectionWorkingCopy wc = connType.newConnection(CONNECTION_NAME); IRemoteConnectionHostService host = wc.getService(IRemoteConnectionHostService.class); host.setHostname("titan-ext1.ccs.ornl.gov"); -// host.setHostname("localhost"); + // host.setHostname("localhost"); host.setUsername("gw6"); connection = wc.save(); assertNotNull(connection); diff --git a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexServerTests.java b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexServerTests.java index 6c3d2c9c1cb..a8d1fb1d3e3 100644 --- a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexServerTests.java +++ b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexServerTests.java @@ -15,23 +15,23 @@ import junit.framework.TestCase; public class MultiplexServerTests extends TestCase { private static final int NUM_CHANS = 5; - + private class ChanReader implements Runnable { private byte[] buf = new byte[8192]; private StreamChannel chan; private StringBuffer[] recvBufs; private String name; - + public ChanReader(StreamChannel chan, StringBuffer[] recvBufs, String name) { this.chan = chan; this.recvBufs = recvBufs; this.name = name; } - + public String getName() { return name; } - + @Override public void run() { try { @@ -53,33 +53,33 @@ public class MultiplexServerTests extends TestCase { } } } - + private class ChanWriter implements Runnable { private StreamChannel chan; private StringBuffer[] sentBufs; private Random r = new Random(); private String name; - + public ChanWriter(StreamChannel chan, StringBuffer[] sentBufs, String name) { this.chan = chan; this.sentBufs = sentBufs; this.name = name; } - + public String getName() { return name; } - + @Override public void run() { - try{ + try { synchronized (MultiplexServerTests.this) { System.out.println(getName() + " started"); } for (int i = 0; i < 100; i++) { String s = String.format("%05d\n", i); chan.getOutputStream().write(s.getBytes()); - // chan.getOutputStream().flush(); + // chan.getOutputStream().flush(); sentBufs[chan.getId()].append(s); try { Thread.sleep(r.nextInt(100)); @@ -101,10 +101,10 @@ public class MultiplexServerTests extends TestCase { try { final StringBuffer[] clntSentBufs = new StringBuffer[NUM_CHANS]; final StringBuffer[] clntRecvBufs = new StringBuffer[NUM_CHANS]; - + final Thread[] clntReaders = new Thread[NUM_CHANS]; final Thread[] clntWriters = new Thread[NUM_CHANS]; - + for (int i = 0; i < NUM_CHANS; i++) { clntSentBufs[i] = new StringBuffer(); clntRecvBufs[i] = new StringBuffer(); @@ -112,9 +112,10 @@ public class MultiplexServerTests extends TestCase { final Process proc = Runtime.getRuntime().exec("java -jar /Users/gw6/Desktop/Server.jar"); assertTrue(proc.isAlive()); - + new Thread("stderr") { private byte[] buf = new byte[1024]; + @Override public void run() { int n; @@ -128,19 +129,20 @@ public class MultiplexServerTests extends TestCase { } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + }.start(); - + StreamChannelManager mpxClnt = startMpxClient(proc.getInputStream(), proc.getOutputStream()); - - List channels = runChannelTest(mpxClnt, clntReaders, clntWriters, clntSentBufs, clntRecvBufs); - + + List channels = runChannelTest(mpxClnt, clntReaders, clntWriters, clntSentBufs, + clntRecvBufs); + for (int i = 0; i < NUM_CHANS; i++) { clntWriters[i].join(); } - + for (StreamChannel channel : channels) { channel.close(); } @@ -150,7 +152,7 @@ public class MultiplexServerTests extends TestCase { clntReaders[i].join(); } } - + proc.destroy(); proc.waitFor(); assertEquals(0, proc.exitValue()); @@ -158,16 +160,17 @@ public class MultiplexServerTests extends TestCase { fail(e.getMessage()); } } - - private List runChannelTest(StreamChannelManager mpx, Thread[] readers, Thread[] writers, final StringBuffer[] sentBufs, final StringBuffer[] recvBufs) throws IOException { + + private List runChannelTest(StreamChannelManager mpx, Thread[] readers, Thread[] writers, + final StringBuffer[] sentBufs, final StringBuffer[] recvBufs) throws IOException { List channels = new ArrayList(); - for (int i = 0 ; i < NUM_CHANS; i++) { + for (int i = 0; i < NUM_CHANS; i++) { StreamChannel chan = mpx.openChannel(); // needs to be in same thread as reader -// ChanReader reader = new ChanReader(chan, recvBufs, "clnt reader thread " + chan.getId()); -// readers[chan.getId()] = new Thread(reader, reader.getName()); + // ChanReader reader = new ChanReader(chan, recvBufs, "clnt reader thread " + chan.getId()); + // readers[chan.getId()] = new Thread(reader, reader.getName()); ChanWriter writer = new ChanWriter(chan, sentBufs, "clnt writer thread " + chan.getId()); writers[chan.getId()] = new Thread(writer, writer.getName()); -// readers[chan.getId()].start(); + // readers[chan.getId()].start(); writers[chan.getId()].start(); channels.add(chan); } @@ -179,11 +182,11 @@ public class MultiplexServerTests extends TestCase { new Thread(mpx, "client multiplexer").start(); return mpx; } - + @Override protected void setUp() throws Exception { } - + @Override protected void tearDown() throws Exception { } diff --git a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexTests.java b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexTests.java index 29703f962e6..121f8917a6d 100644 --- a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexTests.java +++ b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/MultiplexTests.java @@ -22,22 +22,22 @@ public class MultiplexTests extends TestCase { private static final int NUM_CHANS_PER_THREAD = 5; private static final int NUM_THREADS = 5; private static final int FINISH = -1; - + private class ChanReader implements Runnable { private DataInputStream in; private List recvBufs; private String name; - + public ChanReader(StreamChannel chan, List recvBufs, String name) { this.in = new DataInputStream(chan.getInputStream()); this.recvBufs = recvBufs; this.name = name; } - + public String getName() { return name; } - + @Override public void run() { try { @@ -63,26 +63,26 @@ public class MultiplexTests extends TestCase { } } } - + private class ChanWriter implements Runnable { private DataOutputStream out; private List sentBufs; private Random r = new Random(); private String name; - + public ChanWriter(StreamChannel chan, List sentBufs, String name) { this.out = new DataOutputStream(chan.getOutputStream()); this.sentBufs = sentBufs; this.name = name; } - + public String getName() { return name; } - + @Override public void run() { - try{ + try { synchronized (MultiplexTests.this) { System.out.println(getName() + " started"); } @@ -107,25 +107,25 @@ public class MultiplexTests extends TestCase { } } } - + private class ChanReaderWriter implements Runnable { private DataInputStream in; private DataOutputStream out; private String name; - + public ChanReaderWriter(StreamChannel chan, String name) { this.in = new DataInputStream(chan.getInputStream()); this.out = new DataOutputStream(chan.getOutputStream()); this.name = name; } - + public String getName() { return name; } - + @Override public void run() { - try{ + try { synchronized (MultiplexTests.this) { System.out.println(getName() + " started"); } @@ -147,22 +147,21 @@ public class MultiplexTests extends TestCase { } } - public void testChannels() { try { final PipedInputStream inClnt = new PipedInputStream(); final PipedInputStream inSvr = new PipedInputStream(); final PipedOutputStream outClnt = new PipedOutputStream(inSvr); final PipedOutputStream outSvr = new PipedOutputStream(inClnt); - + final List> clntSentBufs = new ArrayList>(); final List> clntRecvBufs = new ArrayList>(); - + final Thread[][] clntReaders = new Thread[NUM_THREADS][NUM_CHANS_PER_THREAD]; final Thread[][] clntWriters = new Thread[NUM_THREADS][NUM_CHANS_PER_THREAD]; final Thread[] svrRW = new Thread[NUM_THREADS * NUM_CHANS_PER_THREAD]; final Thread[] testers = new Thread[NUM_THREADS]; - + for (int i = 0; i < NUM_CHANS_PER_THREAD * NUM_THREADS; i++) { clntSentBufs.add(new ArrayList()); clntRecvBufs.add(new ArrayList()); @@ -170,16 +169,17 @@ public class MultiplexTests extends TestCase { // Must start server first or it will miss the new channel message StreamChannelManager mpxSvr = startMpxServer(inSvr, outSvr, svrRW); - + StreamChannelManager mpxClnt = startMpxClient(inClnt, outClnt); - - List channels = runChannelTest(mpxClnt, testers, clntReaders, clntWriters, clntSentBufs, clntRecvBufs); + + List channels = runChannelTest(mpxClnt, testers, clntReaders, clntWriters, clntSentBufs, + clntRecvBufs); // Make sure all the testers have finished for (int i = 0; i < NUM_THREADS; i++) { testers[i].join(); } - + // Wait for the readers and writers to complete for (int i = 0; i < NUM_THREADS; i++) { for (int j = 0; j < NUM_CHANS_PER_THREAD; j++) { @@ -187,7 +187,7 @@ public class MultiplexTests extends TestCase { clntReaders[i][j].join(); } } - + for (StreamChannel channel : channels) { channel.close(); } @@ -203,20 +203,24 @@ public class MultiplexTests extends TestCase { fail(e.getMessage()); } } - - private List runChannelTest(final StreamChannelManager mpx, final Thread[] testers, final Thread[][] readers, final Thread[][] writers, final List> sentBufs, final List> recvBufs) throws IOException { + + private List runChannelTest(final StreamChannelManager mpx, final Thread[] testers, + final Thread[][] readers, final Thread[][] writers, final List> sentBufs, + final List> recvBufs) throws IOException { final List channels = new ArrayList(); - for (int i = 0 ; i < NUM_THREADS; i++) { + for (int i = 0; i < NUM_THREADS; i++) { final int thread = i; testers[i] = new Thread("client test thread " + thread) { @Override public void run() { try { - for (int j = 0 ; j < NUM_CHANS_PER_THREAD; j++) { + 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(); @@ -237,17 +241,18 @@ public class MultiplexTests extends TestCase { new Thread(mpx, "client multiplexer").start(); 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() { private int numThreadChans; - + @Override public void newChannel(final StreamChannel chan) { synchronized (MultiplexTests.this) { - System.out.println("newChannel "+chan.getId()); + System.out.println("newChannel " + chan.getId()); } ChanReaderWriter rw = new ChanReaderWriter(chan, "svr rw thread " + numThreadChans); @@ -257,21 +262,21 @@ public class MultiplexTests extends TestCase { @Override public void closeChannel(StreamChannel chan) { -// readers[idx].interrupt(); -// writers[idx].interrupt(); + // readers[idx].interrupt(); + // writers[idx].interrupt(); synchronized (MultiplexTests.this) { - System.out.println("closeChannel "+ chan.getId()); + System.out.println("closeChannel " + chan.getId()); } } }); new Thread(mpx, "server multiplexer").start(); return mpx; } - + @Override protected void setUp() throws Exception { } - + @Override protected void tearDown() throws Exception { } diff --git a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ProcessTests.java b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ProcessTests.java index 0cbaa68196c..6cdcc46cd1a 100644 --- a/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ProcessTests.java +++ b/remote/org.eclipse.remote.proxy.tests/src/org/eclipse/remote/proxy/tests/ProcessTests.java @@ -28,7 +28,7 @@ public class ProcessTests extends TestCase { private static IRemoteConnection connection; private static IRemoteProcessService processService; - + private boolean threadFailed = false; public void testStreamHalfClose() { @@ -52,9 +52,9 @@ public class ProcessTests extends TestCase { } catch (IOException e) { fail(e.getMessage()); } - + } - + public void testConcurrentProcess() { Thread[] threads = new Thread[NUM_THREADS]; @@ -66,14 +66,14 @@ public class ProcessTests extends TestCase { final Set results = Collections.synchronizedSet(new HashSet()); IRemoteProcessBuilder builder = processService.getProcessBuilder("perl", "-v"); //$NON-NLS-1$ assertNotNull(builder); -// builder.redirectErrorStream(true); + // builder.redirectErrorStream(true); for (int i = 0; i < 1; i++) { try { IRemoteProcess proc = builder.start(); BufferedReader stdout = new BufferedReader(new InputStreamReader(proc.getInputStream())); String line; while ((line = stdout.readLine()) != null) { - System.out.println("read "+line); + System.out.println("read " + line); results.add(line); results.add("\n"); } @@ -143,7 +143,7 @@ public class ProcessTests extends TestCase { BufferedReader stdout = new BufferedReader(new InputStreamReader(proc.getInputStream())); String line = stdout.readLine(); int count = Integer.parseInt(line); - for (int i = 0 ; i < count; i++) { + for (int i = 0; i < count; i++) { line = stdout.readLine(); if (line == null) { break; @@ -206,7 +206,7 @@ public class ProcessTests extends TestCase { } public void testExitValue() { - IRemoteProcessBuilder builder = processService.getProcessBuilder(new String[]{"sleep","50"}); //$NON-NLS-1$ + IRemoteProcessBuilder builder = processService.getProcessBuilder(new String[] { "sleep", "50" }); //$NON-NLS-1$ assertNotNull(builder); IRemoteProcess rp = null; try { @@ -220,7 +220,7 @@ public class ProcessTests extends TestCase { try { p.exitValue(); fail("Process has not exited. Should throws an IllegalThreadStateException exception"); - } catch(IllegalThreadStateException e) { + } catch (IllegalThreadStateException e) { // Ok } try { @@ -231,7 +231,7 @@ public class ProcessTests extends TestCase { } assertFalse(p.isAlive()); } - + @Override protected void setUp() throws Exception { if (connection == null) { @@ -241,7 +241,7 @@ public class ProcessTests extends TestCase { IRemoteConnectionWorkingCopy wc = connType.newConnection(CONNECTION_NAME); IRemoteConnectionHostService host = wc.getService(IRemoteConnectionHostService.class); host.setHostname("localhost"); -// host.setHostname("titan-ext1.ccs.ornl.gov"); + // host.setHostname("titan-ext1.ccs.ornl.gov"); host.setUsername("gw6"); connection = wc.save(); assertNotNull(connection); @@ -249,7 +249,7 @@ public class ProcessTests extends TestCase { assertTrue(connection.isOpen()); processService = connection.getService(IRemoteProcessService.class); assertNotNull(processService); - } + } } @Override diff --git a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/Activator.java b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/Activator.java index 0a54e71ae29..78b23735369 100644 --- a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/Activator.java +++ b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/Activator.java @@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { @@ -32,7 +32,7 @@ public class Activator extends AbstractUIPlugin { /** * Get unique identifier - * + * * @return * @since 5.0 */ @@ -45,7 +45,7 @@ public class Activator extends AbstractUIPlugin { /** * Logs the specified status with this plug-in's log. - * + * * @param status * status to log */ @@ -55,7 +55,7 @@ public class Activator extends AbstractUIPlugin { /** * Logs an internal error with the specified message. - * + * * @param message * the error message to log */ @@ -65,7 +65,7 @@ public class Activator extends AbstractUIPlugin { /** * Logs an internal error with the specified throwable - * + * * @param e * the exception to be logged */ @@ -83,7 +83,7 @@ public class Activator extends AbstractUIPlugin { /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyFileSystemContributor.java b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyFileSystemContributor.java index aa083247150..85768358df7 100644 --- a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyFileSystemContributor.java +++ b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyFileSystemContributor.java @@ -1,7 +1,7 @@ /******************************************************************************** * Copyright (c) 2016 Oak Ridge National Laboratory 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 + * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html ********************************************************************************/ diff --git a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java index 36e43157b2f..917ef86ab48 100644 --- a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java +++ b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java @@ -21,7 +21,7 @@ import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; public class ProxyUserAuthenticator implements IUserAuthenticatorService { - + private final IRemoteConnection remoteConnection; private UserInfoPrompter prompter; @@ -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 } @@ -41,7 +42,7 @@ public class ProxyUserAuthenticator implements IUserAuthenticatorService { public IRemoteConnection getRemoteConnection() { return remoteConnection; } - + @Override public PasswordAuthentication prompt(String username, String message) { if (prompter.promptPassword(message)) { @@ -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]]; @@ -99,7 +100,7 @@ public class ProxyUserAuthenticator implements IUserAuthenticatorService { } return display; } - + public static class Factory implements IRemoteConnection.Service.Factory { @Override @SuppressWarnings("unchecked") diff --git a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/messages/messages.properties b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/messages/messages.properties index 84e9f80a41d..743a4e95b3d 100755 --- a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/messages/messages.properties +++ b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/messages/messages.properties @@ -4,7 +4,7 @@ # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html -# +# # Contributors: # IBM Corporation - initial implementation ############################################################################### diff --git a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java index 3bdbff874b5..a3b719d7ea5 100755 --- a/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java +++ b/remote/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java @@ -150,7 +150,7 @@ public class ProxyConnectionPage extends WizardPage { fServerCommandText.setText(ProxyConnection.DEFAULT_SERVER_COMMAND); fServerCommandText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fDefaultServerButton.setSelection(ProxyConnection.DEFAULT_USE_DEFAULT_SERVER); - + expComp.setClient(advancedComp); } @@ -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()); } } diff --git a/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortCommandShell.java b/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortCommandShell.java index 887507ad770..744bf6762a0 100644 --- a/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortCommandShell.java +++ b/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortCommandShell.java @@ -30,8 +30,7 @@ public class SerialPortCommandShell implements IRemoteProcess { this.serialPort = serialPort; serialPort.open(); } - - + @Override public synchronized void destroy() { if (serialPort.isOpen()) { diff --git a/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortConnection.java b/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortConnection.java index e5df667db54..2b4fa6503da 100644 --- a/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortConnection.java +++ b/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/core/SerialPortConnection.java @@ -30,7 +30,7 @@ public class SerialPortConnection implements ISerialPortService, IRemoteCommandS private final IRemoteConnection remoteConnection; private SerialPort serialPort; - + private SerialPortConnection(IRemoteConnection remoteConnection) { this.remoteConnection = remoteConnection; this.remoteConnection.addConnectionChangeListener(new IRemoteConnectionChangeListener() { @@ -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); } diff --git a/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/internal/core/Activator.java b/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/internal/core/Activator.java index 2a0dff7fa22..e9fcfe30e04 100644 --- a/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/internal/core/Activator.java +++ b/remote/org.eclipse.remote.serial.core/src/org/eclipse/remote/serial/internal/core/Activator.java @@ -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)); } } diff --git a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/Activator.java b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/Activator.java index f22863d95bd..6862e825b8b 100644 --- a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/Activator.java +++ b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/Activator.java @@ -27,10 +27,10 @@ public class Activator extends AbstractUIPlugin { // Image keys public static final String IMG_CONNECTION_TYPE = PLUGIN_ID + ".connectionType"; //$NON-NLS-1$ - + // The shared instance private static Activator plugin; - + public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -54,7 +54,7 @@ public class Activator extends AbstractUIPlugin { public static void log(IStatus status) { plugin.getLog().log(status); } - + public static void log(Exception e) { if (e instanceof CoreException) { log(((CoreException) e).getStatus()); diff --git a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java index ef938783a3e..cb7e1b35359 100644 --- a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java +++ b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java @@ -28,11 +28,11 @@ import org.eclipse.swt.widgets.Shell; public class SerialPortConnectionsUI extends AbstractRemoteUIConnectionService { private final IRemoteConnectionType connectionType; - + private SerialPortConnectionsUI(IRemoteConnectionType connectionType) { this.connectionType = connectionType; } - + public static class Factory implements IRemoteConnectionType.Service.Factory { @SuppressWarnings("unchecked") @Override diff --git a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/NewSerialPortConnectionWizardPage.java b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/NewSerialPortConnectionWizardPage.java index 4e69cffdf42..8ee3fdc0cd4 100644 --- a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/NewSerialPortConnectionWizardPage.java +++ b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/NewSerialPortConnectionWizardPage.java @@ -17,7 +17,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; public class NewSerialPortConnectionWizardPage extends WizardPage { - + protected SerialPortConnectionBlock block; public NewSerialPortConnectionWizardPage() { @@ -31,14 +31,14 @@ public class NewSerialPortConnectionWizardPage extends WizardPage { public void update() { setPageComplete(block.isComplete()); } - + }); } @Override public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); - comp.setLayout(new GridLayout(2, false)); + comp.setLayout(new GridLayout(2, false)); block.createBlock(comp, null); setControl(comp); } diff --git a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionBlock.java b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionBlock.java index c5a0de7d773..2f05c3a9465 100644 --- a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionBlock.java +++ b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionBlock.java @@ -35,7 +35,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; public class SerialPortConnectionBlock { - + private String name; private String portName; private int baudRateIndex; @@ -51,26 +51,25 @@ public class SerialPortConnectionBlock { private Combo byteSizeCombo; private Combo parityCombo; private Combo stopBitsCombo; - + private boolean isComplete; private List listeners = new ArrayList<>(); - /** * Creates the UI elements for the SerialPortConnectionBlock - * + * * @param comp - parent composite * @param wc - an IRemoteConnectionWorkingCopy to populate the default values from. Can be null. */ public void createBlock(Composite comp, IRemoteConnectionWorkingCopy wc) { - + String name = ""; String connectionPortName = ""; int baudRateStringIndex = BaudRate.getStringIndex(BaudRate.getDefault()); int byteSizeStringIndex = ByteSize.getStringIndex(ByteSize.getDefault()); int parityStringIndex = Parity.getStringIndex(Parity.getDefault()); int stopBitsStringIndex = StopBits.getStringIndex(StopBits.getDefault()); - + if (wc != null) { name = wc.getName(); connectionPortName = wc.getAttribute(ISerialPortService.PORT_NAME_ATTR); @@ -79,7 +78,7 @@ public class SerialPortConnectionBlock { parityStringIndex = Integer.parseInt(wc.getAttribute(ISerialPortService.PARITY_ATTR)); stopBitsStringIndex = Integer.parseInt(wc.getAttribute(ISerialPortService.STOP_BITS_ATTR)); } - + Label nameLabel = new Label(comp, SWT.NONE); nameLabel.setText(Messages.NewSerialPortConnectionWizardPage_NameLabel); @@ -188,7 +187,6 @@ public class SerialPortConnectionBlock { } }); - updateStatus(); } @@ -204,8 +202,8 @@ public class SerialPortConnectionBlock { stopBitsIndex = stopBitsCombo.getSelectionIndex(); isComplete = (!name.isEmpty() && portName != null); - - for(SerialBlockUpdateListener listener : listeners) { + + for (SerialBlockUpdateListener listener : listeners) { listener.update(); } } @@ -233,20 +231,20 @@ public class SerialPortConnectionBlock { public int getStopBitsIndex() { return stopBitsIndex; } - + public boolean isComplete() { return isComplete; } - + public void addUpdateListener(SerialBlockUpdateListener listener) { if (listener != null && !listeners.contains(listener)) listeners.add(listener); } - + public void removeUpdateListener(SerialBlockUpdateListener listener) { listeners.remove(listener); } - + public abstract class SerialBlockUpdateListener { public abstract void update(); } diff --git a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionPropertyPage.java b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionPropertyPage.java index 262ae591068..3c84e355fcc 100644 --- a/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionPropertyPage.java +++ b/remote/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/ui/SerialPortConnectionPropertyPage.java @@ -22,46 +22,44 @@ 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; protected IRemoteConnectionWorkingCopy workingCopy; - + public SerialPortConnectionPropertyPage() { super(); - block = new SerialPortConnectionBlock(); + block = new SerialPortConnectionBlock(); } @Override protected Control createContents(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout(2, false)); - + block.addUpdateListener(block.new SerialBlockUpdateListener() { @Override public void update() { setValid(block.isComplete()); } - - }); - + + }); + IRemoteConnection remoteConnection = getElement().getAdapter(IRemoteConnection.class); if (remoteConnection != null) workingCopy = remoteConnection.getWorkingCopy(); else workingCopy = null; - - + block.createBlock(comp, workingCopy); return comp; } - + @Override public boolean performOk() { if (workingCopy != null) { - + workingCopy.setName(block.getConnectionName()); workingCopy.setAttribute(ISerialPortService.PORT_NAME_ATTR, block.getPortName()); workingCopy.setAttribute(ISerialPortService.BAUD_RATE_ATTR, Integer.toString(block.getBaudRateIndex())); @@ -74,10 +72,10 @@ public class SerialPortConnectionPropertyPage extends PropertyPage implements IW Activator.log(e); return false; } - + } - + return true; } - + } diff --git a/remote/org.eclipse.remote.telnet.core.tests/src/org/eclipse/remote/telnet/core/tests/TelnetConnectionTests.java b/remote/org.eclipse.remote.telnet.core.tests/src/org/eclipse/remote/telnet/core/tests/TelnetConnectionTests.java index 086c34fdc34..02324a99b64 100644 --- a/remote/org.eclipse.remote.telnet.core.tests/src/org/eclipse/remote/telnet/core/tests/TelnetConnectionTests.java +++ b/remote/org.eclipse.remote.telnet.core.tests/src/org/eclipse/remote/telnet/core/tests/TelnetConnectionTests.java @@ -53,15 +53,15 @@ public class TelnetConnectionTests { @BeforeClass public static void setup() { String host = System.getenv("TEST_HOSTNAME"); - if(host != null) { + if (host != null) { hostname = host; } String user = System.getenv("TEST_USERNAME"); - if(user != null) { + if (user != null) { username = user; } String passwd = System.getenv("TEST_PASSWORD"); - if(user != null) { + if (user != null) { password = passwd; } IRemoteServicesManager services = Activator.getService(IRemoteServicesManager.class); @@ -120,7 +120,7 @@ public class TelnetConnectionTests { assertNotNull("Command shel output stream", os); InputStream is = commandShell.getInputStream(); assertNotNull("Command shel input stream"); - if(!username.isEmpty() && !password.isEmpty()) { + if (!username.isEmpty() && !password.isEmpty()) { try { // Assume that a login prompt appears readPrompt(is); @@ -157,7 +157,7 @@ public class TelnetConnectionTests { int v; try { v = is.read(); - while((v != -1) && (v != ':')) { + while ((v != -1) && (v != ':')) { v = is.read(); } } catch (IOException e) { diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCodes.java b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCodes.java index 3572e911bef..3a1d16da464 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCodes.java +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCodes.java @@ -6,10 +6,10 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Fran Litterio (Wind River) - initial API and implementation - * Helmut Haigermoser (Wind River) - repackaged - * Ted Williams (Wind River) - repackaged into org.eclipse namespace - * Michael Scharf (Wind River) - split into core, view and connector plugins + * Fran Litterio (Wind River) - initial API and implementation + * Helmut Haigermoser (Wind River) - repackaged + * Ted Williams (Wind River) - repackaged into org.eclipse namespace + * Michael Scharf (Wind River) - split into core, view and connector plugins * Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Greg Watson (IBM) - Adapted for org.eclipse.remote *******************************************************************************/ @@ -21,75 +21,73 @@ 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 -{ - /** Command code: Subnegotiation End. */ - static final byte TELNET_SE = (byte)240; +interface TelnetCodes { + /** Command code: Subnegotiation End. */ + static final byte TELNET_SE = (byte) 240; - /** Command code: No-op. */ - static final byte TELNET_NOP = (byte)241; + /** Command code: No-op. */ + static final byte TELNET_NOP = (byte) 241; - /** Command code: Data Mark. */ - static final byte TELNET_DM = (byte)242; + /** Command code: Data Mark. */ + static final byte TELNET_DM = (byte) 242; - /** Command code: Break. */ - static final byte TELNET_BREAK = (byte)243; + /** Command code: Break. */ + static final byte TELNET_BREAK = (byte) 243; - /** Command code: Interrupt Process. */ - static final byte TELNET_IP = (byte)244; + /** Command code: Interrupt Process. */ + static final byte TELNET_IP = (byte) 244; - /** Command code: Abort Output. */ - static final byte TELNET_AO = (byte)245; + /** Command code: Abort Output. */ + static final byte TELNET_AO = (byte) 245; - /** Command code: Are You There. */ - static final byte TELNET_AYT = (byte)246; + /** Command code: Are You There. */ + static final byte TELNET_AYT = (byte) 246; - /** Command code: Erase Character. */ - static final byte TELNET_EC = (byte)247; + /** Command code: Erase Character. */ + static final byte TELNET_EC = (byte) 247; - /** Command code: Erase Line. */ - static final byte TELNET_EL = (byte)248; + /** Command code: Erase Line. */ + static final byte TELNET_EL = (byte) 248; - /** Command code: Go Ahead. */ - static final byte TELNET_GA = (byte)249; + /** Command code: Go Ahead. */ + static final byte TELNET_GA = (byte) 249; - /** Command code: Subnegotiation Begin. */ - static final byte TELNET_SB = (byte)250; + /** Command code: Subnegotiation Begin. */ + static final byte TELNET_SB = (byte) 250; - /** Command code: Will. */ - static final byte TELNET_WILL = (byte)251; + /** Command code: Will. */ + static final byte TELNET_WILL = (byte) 251; - /** Command code: Won't. */ - static final byte TELNET_WONT = (byte)252; + /** Command code: Won't. */ + static final byte TELNET_WONT = (byte) 252; - /** Command code: Do. */ - static final byte TELNET_DO = (byte)253; + /** Command code: Do. */ + static final byte TELNET_DO = (byte) 253; - /** Command code: Don't. */ - static final byte TELNET_DONT = (byte)254; + /** Command code: Don't. */ + static final byte TELNET_DONT = (byte) 254; - /** Command code: Interpret As Command. */ - static final byte TELNET_IAC = (byte)255; + /** Command code: Interpret As Command. */ + static final byte TELNET_IAC = (byte) 255; - /** Command code: IS. */ - static final byte TELNET_IS = 0; + /** Command code: IS. */ + static final byte TELNET_IS = 0; - /** Command code: SEND. */ - static final byte TELNET_SEND = 1; + /** Command code: SEND. */ + static final byte TELNET_SEND = 1; + /** Option code: Transmit Binary option. */ + static final byte TELNET_OPTION_TRANSMIT_BINARY = 0; - /** Option code: Transmit Binary option. */ - static final byte TELNET_OPTION_TRANSMIT_BINARY = 0; + /** Option code: Echo option. */ + static final byte TELNET_OPTION_ECHO = 1; - /** Option code: Echo option. */ - static final byte TELNET_OPTION_ECHO = 1; + /** Option code: Suppress Go Ahead option. */ + static final byte TELNET_OPTION_SUPPRESS_GA = 3; - /** Option code: Suppress Go Ahead option. */ - static final byte TELNET_OPTION_SUPPRESS_GA = 3; + /** Option code: Terminal Type */ + static final byte TELNET_OPTION_TERMINAL_TYPE = 24; - /** Option code: Terminal Type */ - static final byte TELNET_OPTION_TERMINAL_TYPE = 24; - - /** Option code: Negotitate About Window Size (NAWS) */ - static final byte TELNET_OPTION_NAWS = 31; + /** Option code: Negotitate About Window Size (NAWS) */ + static final byte TELNET_OPTION_NAWS = 31; } diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCommandShell.java b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCommandShell.java index 840d828666c..e86b24e6141 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCommandShell.java +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetCommandShell.java @@ -35,7 +35,7 @@ public class TelnetCommandShell implements IRemoteProcess { public TelnetCommandShell(IRemoteConnection remoteConnection, TelnetConnection telnetConnection) { this.telnetConnection = telnetConnection; - assert(remoteConnection.getService(IRemoteConnectionHostService.class) != null); + assert (remoteConnection.getService(IRemoteConnectionHostService.class) != null); } @Override diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetConnection.java b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetConnection.java index bf2a81fa289..2888a9162cb 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetConnection.java +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetConnection.java @@ -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 getService(IRemoteConnection remoteConnection, Class 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); } diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetOption.java b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetOption.java index e37b5537971..edb54bbf3e5 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetOption.java +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetOption.java @@ -102,7 +102,7 @@ class TelnetOption implements TelnetCodes { "SEND URL", // 48 //$NON-NLS-1$ "FORWARD X", // 49 //$NON-NLS-1$ "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 50 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ - // ... + // ... "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ @@ -111,12 +111,12 @@ class TelnetOption implements TelnetCodes { "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "?", "?", "?", "?", "?", "?", "?", // ... //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ - // 137 + // 137 "TELOPT PRAGMA LOGON", // 138 //$NON-NLS-1$ "TELOPT SSPI LOGON", // 139 //$NON-NLS-1$ "TELOPT PRAGMA HEARTBEAT", // 140 //$NON-NLS-1$ "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 141 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ - // ... + // ... "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ @@ -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); diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetProtocol.java b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetProtocol.java index f334d4fcac2..d32987848f1 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetProtocol.java +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/core/TelnetProtocol.java @@ -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); } @@ -359,21 +360,21 @@ public class TelnetProtocol extends Thread implements TelnetCodes { // Tell the command shell that we have terminated shell.terminated(); try { - if(inputChannel != null) { + if (inputChannel != null) { inputChannel.close(); } } catch (IOException ioe) { /* ignore */ } try { - if(serverOutputStream != null) { + if (serverOutputStream != null) { serverOutputStream.close(); } } catch (IOException ioe) { /* ignore */ } try { - if(clientOutputStream != null) { + if (clientOutputStream != null) { clientOutputStream.close(); } } catch (IOException ioe) { @@ -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$ } diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Activator.java b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Activator.java index 1d1167e60ba..cefbf57ab25 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Activator.java +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Activator.java @@ -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)); } } diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Logger.java b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Logger.java index 05c5e46afa9..323c5c2a1f8 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Logger.java +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/Logger.java @@ -38,7 +38,7 @@ import org.osgi.framework.BundleContext; * * * @author Fran Litterio - * + * */ public final class Logger implements DebugOptionsListener { public static final String TRACE_DEBUG_LOG = "org.eclipse.remote.telnet.core/debug/log"; //$NON-NLS-1$ @@ -65,7 +65,7 @@ public final class Logger implements DebugOptionsListener { /** * Encodes a String such that non-printable control characters are * converted into user-readable escape sequences for logging. - * + * * @param message * String to encode * @return encoded String @@ -140,7 +140,7 @@ public final class Logger implements DebugOptionsListener { /** * Checks if logging is enabled. - * + * * @return true if logging is enabled. */ public static final boolean isLogEnabled() { @@ -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(); } diff --git a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/messages/messages.properties b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/messages/messages.properties index fcab7809e16..7c0590c3e33 100644 --- a/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/messages/messages.properties +++ b/remote/org.eclipse.remote.telnet.core/src/org/eclipse/remote/telnet/internal/core/messages/messages.properties @@ -8,5 +8,5 @@ # Contributors: # IBM Corporation - initial contribution ################################################################################ -TelnetCommandShell_0=Unknown host: +TelnetCommandShell_0=Unknown host: TelnetProtocol_0=Connection closed by foreign host. diff --git a/remote/org.eclipse.remote.ui.tests/src/org/eclipse/remote/ui/tests/RemoteResourceBrowserTest.java b/remote/org.eclipse.remote.ui.tests/src/org/eclipse/remote/ui/tests/RemoteResourceBrowserTest.java index 1a73add52d4..a7798425dc1 100644 --- a/remote/org.eclipse.remote.ui.tests/src/org/eclipse/remote/ui/tests/RemoteResourceBrowserTest.java +++ b/remote/org.eclipse.remote.ui.tests/src/org/eclipse/remote/ui/tests/RemoteResourceBrowserTest.java @@ -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. diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/DeferredFileStore.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/DeferredFileStore.java index 08e77da84bd..8a13369719a 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/DeferredFileStore.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/DeferredFileStore.java @@ -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) { @@ -113,7 +114,7 @@ public class DeferredFileStore implements IDeferredWorkbenchAdapter, IAdaptable * Return the IWorkbenchAdapter for element or the element if it is * an instance of IWorkbenchAdapter. If it does not exist return * null. - * + * * @param element * @return IWorkbenchAdapter or null */ @@ -123,16 +124,16 @@ public class DeferredFileStore implements IDeferredWorkbenchAdapter, IAdaptable /** * If it is possible to adapt the given object to the given type, this returns the adapter. Performs the following checks: - * + * *
      *
    1. Returns sourceObject if it is an instance of the adapter type.
    2. *
    3. If sourceObject implements IAdaptable, it is queried for adapters.
    4. *
    5. If sourceObject is not an instance of PlatformObject (which would have already done so), the adapter manager is queried * for adapters
    6. *
    - * + * * Otherwise returns null. - * + * * @param sourceObject * object to adapt, or null * @param adapterType @@ -187,7 +188,7 @@ public class DeferredFileStore implements IDeferredWorkbenchAdapter, IAdaptable /** * Get the filestore backing this object - * + * * @return */ public IFileStore getFileStore() { diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/PendingUpdateAdapter.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/PendingUpdateAdapter.java index 99a3a8b6e91..b458b7bcd41 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/PendingUpdateAdapter.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/PendingUpdateAdapter.java @@ -25,7 +25,7 @@ public class PendingUpdateAdapter implements IWorkbenchAdapter, IAdaptable { /** * Return whether or not this has been removed from the tree. - * + * * @return boolean */ public boolean isRemoved() { @@ -34,7 +34,7 @@ public class PendingUpdateAdapter implements IWorkbenchAdapter, IAdaptable { /** * Set whether or not this has been removed from the tree. - * + * * @param removedValue * boolean */ diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteContentProvider.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteContentProvider.java index 12a17e3693d..76dfe49c53f 100755 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteContentProvider.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteContentProvider.java @@ -45,7 +45,7 @@ public class RemoteContentProvider extends WorkbenchContentProvider { /** * Sets the workingSet. - * + * * @param workingSet * The workingSet to set */ @@ -55,7 +55,7 @@ public class RemoteContentProvider extends WorkbenchContentProvider { /** * Returns the workingSet. - * + * * @return IWorkingSet */ public IWorkingSet getWorkingSet() { diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeContentManager.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeContentManager.java index 4d972944bae..43bd9f8411a 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeContentManager.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeContentManager.java @@ -32,7 +32,7 @@ import org.eclipse.ui.progress.WorkbenchJob; * A remote content manager that merges content into a tree rather then replacing its children with a * "pending" node, and then the real children when they are available. This avoids collapsing the viewer when * a refresh is performed. This implementation is currently tied to the RemoteTreeViewer. - * + * * @since 3.1 */ public class RemoteTreeContentManager { @@ -124,7 +124,7 @@ public class RemoteTreeContentManager { /** * Contructs a new content manager. - * + * * @param provider * content provider * @param viewer @@ -144,7 +144,7 @@ public class RemoteTreeContentManager { /** * Create the element collector for the receiver. - * + * * @param parent * The parent object being filled in, * @param placeholder @@ -158,7 +158,7 @@ public class RemoteTreeContentManager { /** * Returns the child elements of the given element, or in the case of a deferred element, returns a * placeholder. If a deferred element is used, a job is created to fetch the children in the background. - * + * * @param parent * The parent object. * @return Object[] or null if parent is not an instance of IDeferredWorkbenchAdapter. @@ -182,7 +182,7 @@ public class RemoteTreeContentManager { /** * Create a UIJob to replace the children of the parent in the tree viewer. - * + * * @param parent * the parent for which children are to be replaced * @param children @@ -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; } @@ -214,7 +215,7 @@ public class RemoteTreeContentManager { /** * Create a UIJob to prune the children of the parent in the tree viewer, starting at the given offset. - * + * * @param parent * the parent for which children should be pruned * @param offset @@ -241,7 +242,7 @@ public class RemoteTreeContentManager { /** * Run a job to clear the placeholder. This is used when the update for the tree is complete so that the * user is aware that no more updates are pending. - * + * * @param placeholder */ protected void runClearPlaceholderJob(final PendingUpdateAdapter placeholder) { @@ -274,7 +275,7 @@ public class RemoteTreeContentManager { /** * Return the IDeferredWorkbenchAdapter for element or the element if it is an instance of * IDeferredWorkbenchAdapter. If it does not exist return null. - * + * * @param element * @return IDeferredWorkbenchAdapter or null */ @@ -313,7 +314,7 @@ public class RemoteTreeContentManager { * Provides an optimized lookup for determining if an element has children. This is required because * elements that are populated lazilly can't answer getChildren just to determine the * potential for children. Throw an AssertionFailedException if element is null. - * + * * @param element * The Object being tested. This should not be null. * @return boolean true if there are potentially children. diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeViewer.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeViewer.java index f21f71609cb..99b18ed14fa 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeViewer.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteTreeViewer.java @@ -43,7 +43,7 @@ public class RemoteTreeViewer extends TreeViewer { /** * Constructs a job to expand the given element. - * + * */ public ExpansionJob() { super("Expansion"); //$NON-NLS-1$ @@ -167,7 +167,7 @@ public class RemoteTreeViewer extends TreeViewer { /** * Constructs a remote tree viewer parented by the given composite. - * + * * @param parent * parent composite */ @@ -181,7 +181,7 @@ public class RemoteTreeViewer extends TreeViewer { /** * Constructs a remote tree viewer parented by the given composite * with the given style. - * + * * @param parent * parent composite * @param style @@ -196,7 +196,7 @@ public class RemoteTreeViewer extends TreeViewer { /** * Constructs a remote tree viewer with the given tree. - * + * * @param tree * tree widget */ @@ -228,7 +228,7 @@ public class RemoteTreeViewer extends TreeViewer { /** * The given element is being removed from the tree. Cancel * any deferred updates for the element. - * + * * @param element */ protected void validateDeferredUpdates(Object element) { diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIImages.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIImages.java index ccf28383f6d..8f79f9a6ea0 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIImages.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIImages.java @@ -42,20 +42,23 @@ public class RemoteUIImages { public static final String IMG_ELCL_NEW_FOLDER = NAME_PREFIX + T_ELCL + ".new_folder.gif"; //$NON-NLS-1$ public static final String IMG_DLCL_NEW_FOLDER = NAME_PREFIX + T_DLCL + ".new_folder.gif"; //$NON-NLS-1$ public static final String IMG_DEFAULT_TYPE = NAME_PREFIX + "defaultType"; //$NON-NLS-1$ - + /* * Set of predefined Image Descriptors. */ 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. - * + * * @param key * the image's key * @return the image managed under the given key @@ -66,7 +69,7 @@ public class RemoteUIImages { /** * Returns the image descriptor for the given key in this registry. Might be called in a non-UI thread. - * + * * @param key * the image's key * @return the image descriptor for the given key @@ -78,7 +81,7 @@ public class RemoteUIImages { /** * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions * are retrieved from the *lcl16 folders. - * + * * @param action * the action * @param iconName diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIPlugin.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIPlugin.java index 11d4fe00148..f41e885e268 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIPlugin.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/RemoteUIPlugin.java @@ -19,7 +19,7 @@ public class RemoteUIPlugin extends AbstractUIPlugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static RemoteUIPlugin getDefault() { @@ -28,7 +28,7 @@ public class RemoteUIPlugin extends AbstractUIPlugin { /** * Get unique identifier for this plugin - * + * * @since 7.0 */ public static String getUniqueIdentifier() { @@ -40,7 +40,7 @@ public class RemoteUIPlugin extends AbstractUIPlugin { /** * Generate a log message given an IStatus object - * + * * @param status * IStatus object * @since 5.0 @@ -51,7 +51,7 @@ public class RemoteUIPlugin extends AbstractUIPlugin { /** * Generate a log message - * + * * @param msg * message to log * @since 5.0 @@ -62,18 +62,19 @@ public class RemoteUIPlugin extends AbstractUIPlugin { /** * Generate a log message for an exception - * + * * @param e * exception used to generate message * @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)); } /** * Return the OSGi service with the given service interface. - * + * * @param service service interface * @return the specified service or null if it's not registered */ diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/ServicePropertyTester.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/ServicePropertyTester.java index cf09012ef42..5e230c62888 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/ServicePropertyTester.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/ServicePropertyTester.java @@ -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) service); + return connection.getConnectionType() + .hasService((Class) 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 { diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/ConnectionsPreferencePage.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/ConnectionsPreferencePage.java index c1963b20fb5..3bbf24fee00 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/ConnectionsPreferencePage.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/ConnectionsPreferencePage.java @@ -67,7 +67,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage; /** * This class implements a preference page which can be used to view a list of * JSch connections, create new connections or to delete existing connections. - * + * */ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { @@ -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: @@ -157,7 +158,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe /** * Handle widget selection events for this page - * + * */ private class EventHandler extends SelectionAdapter { @Override @@ -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; @@ -256,7 +257,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe /** * Create the contents for this page - * + * * @param parent * - The parent widget for the client area */ @@ -267,7 +268,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe /** * Create the widgets for this page - * + * * @param parent * The parent widget for the client area * @return @@ -456,7 +457,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe /** * Delete service configurations when Ok button is pressed - * + * * @return Status from superclass indicating if Ok processing is to continue */ @Override @@ -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; } @@ -609,7 +612,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe /** * Get the original connection if the working copy is not dirty - * + * * @param conn * @return */ diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/PreferencesAdapter.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/PreferencesAdapter.java index 15f448d8503..c330f754683 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/PreferencesAdapter.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/PreferencesAdapter.java @@ -21,7 +21,7 @@ import org.eclipse.remote.internal.core.preferences.Preferences; /** * Adapts {@link org.eclipse.core.runtime.IEclipsePreferences} to {@link org.eclipse.jface.preference.IPreferenceStore} - * + * * @since 3.0 */ public class PreferencesAdapter implements IPreferenceStore { @@ -56,7 +56,7 @@ public class PreferencesAdapter implements IPreferenceStore { /** * Initialize with the given Preferences. - * + * * @param preferences * The preferences to wrap. * @since 4.0 diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/RemoteDevelopmentPreferencePage.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/RemoteDevelopmentPreferencePage.java index 46a5eee1766..a2dd47dad59 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/RemoteDevelopmentPreferencePage.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/preferences/RemoteDevelopmentPreferencePage.java @@ -26,7 +26,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage; /** * @since 4.1 - * + * */ public class RemoteDevelopmentPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { @@ -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())); } } diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/services/local/LocalUIConnectionService.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/services/local/LocalUIConnectionService.java index 2a8de067f08..3400de6996a 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/services/local/LocalUIConnectionService.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/services/local/LocalUIConnectionService.java @@ -20,11 +20,11 @@ import org.eclipse.swt.widgets.Shell; public class LocalUIConnectionService extends AbstractRemoteUIConnectionService { private IRemoteConnectionType connectionType; - + public LocalUIConnectionService(IRemoteConnectionType connectionType) { this.connectionType = connectionType; } - + @Override public IRemoteUIConnectionWizard getConnectionWizard(Shell shell) { // we don't do this diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/AbstractRemoteUIConnectionService.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/AbstractRemoteUIConnectionService.java index aaac6148a9e..ea90c18ef38 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/AbstractRemoteUIConnectionService.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/AbstractRemoteUIConnectionService.java @@ -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())); } } } diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionService.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionService.java index 11c794dee7d..8699f256f71 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionService.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionService.java @@ -31,7 +31,7 @@ public interface IRemoteUIConnectionService extends IRemoteConnectionType.Servic /** * Create a wizard for adding or editing connections. The implementation can choose to do this in any way, but typically will * use a dialog or wizard. - * + * * @param shell * shell used to display dialogs * @return connection wizard @@ -42,7 +42,7 @@ public interface IRemoteUIConnectionService extends IRemoteConnectionType.Servic * Attempt to open a connection using a progress monitor. Can be called on either open or closed connections, and will * initialize the remote services if necessary. Users should check connection.isOpen() on return to determine if the connection * was actually opened. - * + * * @param shell * shell used to display dialogs * @param context @@ -55,7 +55,7 @@ public interface IRemoteUIConnectionService extends IRemoteConnectionType.Servic /** * Return the label provider that provides the text and base image for the connection type * and connections of that type. - * + * * @return label provider */ public ILabelProvider getLabelProvider(); diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionWizard.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionWizard.java index 770b04ccbec..2168cfd6fd6 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionWizard.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIConnectionWizard.java @@ -23,14 +23,14 @@ public interface IRemoteUIConnectionWizard extends IWizard { * Open configuration wizard allowing the user to enter information about a connection. If the user confirms the information is * correct (e.g. selects OK in a dialog) then a working copy of the connection is returned. If the user discards the * information, then null is returned. - * + * * @return connection working copy or null if the wizard is canceled */ IRemoteConnectionWorkingCopy open(); /** * Get the connection being edited. - * + * * @return connection being edited * @since 2.0 */ @@ -39,7 +39,7 @@ public interface IRemoteUIConnectionWizard extends IWizard { /** * Set a connection containing the information to be edited by the wizard. Setting this value overrides the * {@link #setConnectionName(String)} method. - * + * * @param connection * connection used to initialize the wizard */ @@ -47,7 +47,7 @@ public interface IRemoteUIConnectionWizard extends IWizard { /** * Set the initial name of the connection. - * + * * @param name * initial connection name */ @@ -56,7 +56,7 @@ public interface IRemoteUIConnectionWizard extends IWizard { /** * Supply a set of connection names that are invalid. The dialog should display an error if the user trys to select a name from * the set. - * + * * @param names * set of invalid connections names */ diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIFileService.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIFileService.java index dd62d033613..fd26afe0896 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIFileService.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/IRemoteUIFileService.java @@ -19,16 +19,16 @@ import org.eclipse.swt.widgets.Shell; /** * Interface for providing file management operations in the UI. Clients can call these methods to open generic dialogs for * operations on remote resources. - * + * * @since 2.0 */ public interface IRemoteUIFileService extends IRemoteConnectionType.Service { /** * Browse for a remote directory. The return value is the path of the * directory on the remote system. - * + * * Equivalent to {@link org.eclipse.swt.widgets.DirectoryDialog}. - * + * * @param shell * workbench shell * @param message @@ -46,9 +46,9 @@ public interface IRemoteUIFileService extends IRemoteConnectionType.Service { /** * Browse for a remote file. The return value is the path of the file on * the remote system. - * + * * Equivalent to {@link org.eclipse.swt.widgets.FileDialog}. - * + * * @param shell * workbench shell * @param message @@ -67,9 +67,9 @@ public interface IRemoteUIFileService extends IRemoteConnectionType.Service { /** * Browse for a set of remote files. The return value is a list of paths * of the files on the remote system. - * + * * Equivalent to {@link org.eclipse.swt.widgets.FileDialog}. - * + * * @param shell * workbench shell * @param message @@ -86,7 +86,7 @@ public interface IRemoteUIFileService extends IRemoteConnectionType.Service { /** * Get the last connection that was selected in the browser. - * + * * @return selected connection */ public IRemoteConnection getConnection(); @@ -94,7 +94,7 @@ public interface IRemoteUIFileService extends IRemoteConnectionType.Service { /** * Set the connection to use for file browsing. The connection must support the IRemoteFileService service or it will be * ignored. - * + * * @param connection * connection to use for file browsing */ @@ -102,7 +102,7 @@ public interface IRemoteUIFileService extends IRemoteConnectionType.Service { /** * Show a list of available connections if possible. - * + * * @param enable * enable connection list */ diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/RemoteConnectionsLabelProvider.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/RemoteConnectionsLabelProvider.java index c86cf66100d..f5de06ff54b 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/RemoteConnectionsLabelProvider.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/RemoteConnectionsLabelProvider.java @@ -26,7 +26,7 @@ import org.eclipse.ui.PlatformUI; * A label provider to show the test and base image for remote connections. * It calls out to the connection type services to get the text and images for * the types of the connections. - * + * * @since 2.0 */ public class RemoteConnectionsLabelProvider extends LabelProvider { @@ -49,7 +49,7 @@ public class RemoteConnectionsLabelProvider extends LabelProvider { @Override public Image getImage(Object element) { if (element instanceof IRemoteConnection) { - IRemoteConnection connection = (IRemoteConnection) element; + IRemoteConnection connection = (IRemoteConnection) element; IRemoteConnectionType type = connection.getConnectionType(); IRemoteUIConnectionService uiService = type.getService(IRemoteUIConnectionService.class); if (uiService != null) { @@ -60,14 +60,15 @@ 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() { Rectangle bounds = baseImage.getBounds(); return new Point(bounds.width, bounds.height); } - + @Override protected void drawCompositeImage(int width, int height) { drawImage(baseImage.getImageData(), 0, 0); diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/dialogs/RemoteResourceBrowser.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/dialogs/RemoteResourceBrowser.java index ec0e1423be4..a461b7433ad 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/dialogs/RemoteResourceBrowser.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/dialogs/RemoteResourceBrowser.java @@ -39,16 +39,16 @@ import org.eclipse.swt.widgets.Shell; /** * Generic file/directory browser for remote resources. - * + * * A directory browser (DIRECTORY_BROWSER) only allows selection of directories. * A file browser (FILE_BROWSER) allows selection of files and directories, but the ok button is only enabled when a file is * selected. * A resource browser (FILE_BROWSER|DIRECTORY_BROWSER) allows selection of files and directories. This is the default. - * + * * To select multiple resources, set the style to SWT.MULTI. - * + * * @author greg - * + * */ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { public static final String EMPTY_STRING = ""; //$NON-NLS-1$ @@ -183,7 +183,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Get the connection that was selected - * + * * @return selected connection */ public IRemoteConnection getConnection() { @@ -195,7 +195,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Get the resources that was selected. - * + * * @return selected resource or null if no resource is selected */ public IFileStore getResource() { @@ -207,7 +207,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Get the resources that were selected. - * + * * @return selected resources */ public List getResources() { @@ -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 { @@ -233,7 +233,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Set the connection for the browser. The connection must support the IRemoteFileService service or this method will have no * effect. - * + * * @param connection * connection that supports the IRemoteFileService service */ @@ -247,7 +247,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { * Set the initial path to start browsing. This will be set in the browser * text field, and in a future version should expand the browser to this * location if it exists. - * + * * @param path initial path */ public void setInitialPath(String path) { @@ -256,7 +256,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Set the fDialogTitle of the dialog. - * + * * @param title title to display */ public void setTitle(String title) { @@ -281,7 +281,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Show available connections on browser if possible (default disabled). - * + * * @param enable enable connection display if true */ public void showConnections(boolean enable) { @@ -290,7 +290,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Enable a checkbox to show hidden files (default enabled) - * + * * @param showHidden show hidden files if true */ public void showHiddenCheckbox(boolean showHidden) { @@ -299,7 +299,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Enable selection of local files - * + * * @param showLocalSelection show local files if true */ public void showLocalSelection(boolean showLocalSelection) { @@ -308,7 +308,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext { /** * Enable a button to create new folders (default enabled) - * + * * @param showNewFolderButton show new folder button if true */ public void showNewFolderButton(boolean showNewFolderButton) { diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java index 8578a4d84f0..a00cba92b0b 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java @@ -41,16 +41,16 @@ import org.eclipse.swt.widgets.Label; /** * Widget to allow the user to select a service provider and connection. Provides a "New" button to create a new connection. - * + * * If title is supplied then the widget will be placed in a group. - * + * * @since 5.0 - * + * */ public class RemoteConnectionWidget extends Composite { /** * Listener for widget selected events. Allows the events to be enabled/disabled. - * + * */ protected class WidgetListener implements SelectionListener { /** State of the listener (enabled/disabled). */ @@ -83,7 +83,7 @@ public class RemoteConnectionWidget extends Composite { /** * Set listener enabled state - * + * * @param enabled */ public synchronized void setEnabled(boolean enabled) { @@ -121,7 +121,7 @@ public class RemoteConnectionWidget extends Composite { /** * Force the use of the connection type combo, regardless of the PREF_CONNECTION_TYPE preference setting. - * + * * @since 2.0 */ public static int FLAG_FORCE_CONNECTION_TYPE_SELECTION = 1 << 0; @@ -149,7 +149,7 @@ public class RemoteConnectionWidget extends Composite { /** * Constructor - * + * * @param parent * parent composite * @param style @@ -165,7 +165,7 @@ public class RemoteConnectionWidget extends Composite { /** * Constructor - * + * * @param parent * parent composite * @param style @@ -184,7 +184,7 @@ public class RemoteConnectionWidget extends Composite { /** * Constructor - * + * * @param parent * parent composite * @param style @@ -204,7 +204,7 @@ public class RemoteConnectionWidget extends Composite { /** * Constructor - * + * * @param parent * parent composite * @param style @@ -325,7 +325,7 @@ public class RemoteConnectionWidget extends Composite { *

    * widgetSelected is called when the user changes the service provider or connection. *

    - * + * * @param listener * the listener which should be notified */ @@ -337,7 +337,7 @@ public class RemoteConnectionWidget extends Composite { * Limit the connection types that will be used when displaying valid connections. Only connection types that support * connections with supplied services will be displayed in the connection type combo, and only connections from these connection * types will be displayed in the connection combo. - * + * * @param services * list of services {@link IRemoteConnection.Service} * @since 2.0 @@ -353,7 +353,7 @@ public class RemoteConnectionWidget extends Composite { /** * Get the new button from the widget - * + * * @return button * @since 7.0 */ @@ -363,7 +363,7 @@ public class RemoteConnectionWidget extends Composite { /** * Get the connection that is currently selected in the widget, or null if there is no selected connection. - * + * * @return selected connection */ public IRemoteConnection getConnection() { @@ -426,7 +426,7 @@ public class RemoteConnectionWidget extends Composite { /** * Handle creation of a new connection by pressing the 'New...' button. Calls handleRemoteServicesSelected() to update the * connection combo with the new connection. - * + * * TODO should probably select the new connection */ protected void handleNewRemoteConnectionSelected() { @@ -450,9 +450,9 @@ public class RemoteConnectionWidget extends Composite { /** * Handle selection of a new connection type from the connection type combo. Handles the special case where the * connection type combo is null and a local connection is supplied. In this case, the selected connection type is not changed. - * + * * The assumption is that this will trigger a call to the selection handler for the connection combo. - * + * * @param conn * connection to select as current. If conn is null, select the first item in the list. * @since 2.0 @@ -536,7 +536,7 @@ public class RemoteConnectionWidget extends Composite { /** * Initialize the contents of the connection type combo. Keeps an array of connection types that matches the combo elements. - * + * * @since 2.0 */ protected void initializeConnectionTypeCombo() { @@ -573,7 +573,7 @@ public class RemoteConnectionWidget extends Composite { /** * Remove a listener that will be notified when one of the widget's controls are selected - * + * * @param listener * listener to remove */ @@ -583,7 +583,7 @@ public class RemoteConnectionWidget extends Composite { /** * Set the connection that should be selected in the widget. - * + * * @param connection * connection to select * @throws CoreException @@ -604,7 +604,7 @@ public class RemoteConnectionWidget extends Composite { /** * Set the connection that should be selected in the widget. - * + * * @param id * connection type id * @param name diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteDirectoryWidget.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteDirectoryWidget.java index c669ee97520..825f8dbc69c 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteDirectoryWidget.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteDirectoryWidget.java @@ -37,11 +37,11 @@ import org.eclipse.swt.widgets.Text; * Widget to allow the user to select a remote directory. Provides a "Browse" * button that uses the currently specified connection and a "Restore Default" * button to revert to the initial setting. - * + * * If title is supplied then the widget will be placed in a group. - * + * * The browse message can be modified using {@link #setBrowseMessage(String)} - * + * */ public class RemoteDirectoryWidget extends Composite { private final Text text; @@ -131,7 +131,7 @@ public class RemoteDirectoryWidget extends Composite { /** * Add a listener that will be notified when the directory path is modified. - * + * * @param listener * listener to add */ @@ -142,7 +142,7 @@ public class RemoteDirectoryWidget extends Composite { /** * Get the directory location path. This path will be relative to the remote * machine. - * + * * @return directory location path */ public String getLocationPath() { @@ -152,7 +152,7 @@ public class RemoteDirectoryWidget extends Composite { /** * Remove a listener that will be notified when the directory path is * modified. - * + * * @param listener * listener to remove */ @@ -163,7 +163,7 @@ public class RemoteDirectoryWidget extends Composite { /** * Set the message that will be displayed in the remote directory browser * dialog. - * + * * @param message * message to be displayed */ @@ -173,10 +173,10 @@ public class RemoteDirectoryWidget extends Composite { /** * Set the remote connection to use for browsing for the remote directory. - * + * * The connection type must provide the IRemoteUIConnectionService and IRemoteUIFileService services and the connection must * support the IRemoteFileService service. If any of these conditions are not met, this method will do nothing. - * + * * @param conn * remote connection * @since 4.0 @@ -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(); @@ -197,7 +198,7 @@ public class RemoteDirectoryWidget extends Composite { /** * Set the initial remote location that will be displayed in the widget. - * + * * @param path */ public void setLocationPath(String path) { @@ -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); } } diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteFileWidget.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteFileWidget.java index 2f15ed87b4a..06522e688e9 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteFileWidget.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteFileWidget.java @@ -37,14 +37,14 @@ import org.eclipse.swt.widgets.Text; * Widget to allow the user to select a remote file. Provides a "Browse" * button that uses the currently specified connection and a "Restore Default" * button to revert to the initial setting. - * + * * If GROUP_FLAG is set, then the widget will be placed in a group. * If RESTORE_BUTTON_FLAG is set, then a "Restore Default" button will be added - * + * * If defaultPath is not null, then the initial path will be set to its value. - * + * * The browse message can be modified using {@link #setBrowseMessage(String)} - * + * */ public class RemoteFileWidget extends Composite { public static int GROUP_FLAG = 0x01; @@ -129,7 +129,7 @@ public class RemoteFileWidget extends Composite { /** * Add a listener that will be notified when the file path is modified. - * + * * @param listener * listener to add */ @@ -157,7 +157,7 @@ public class RemoteFileWidget extends Composite { /** * Get the file location path. This path will be relative to the remote * machine. - * + * * @return file location path */ public String getLocationPath() { @@ -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; } @@ -194,7 +195,7 @@ public class RemoteFileWidget extends Composite { /** * Remove a listener that will be notified when the file path is * modified. - * + * * @param listener * listener to remove */ @@ -218,7 +219,7 @@ public class RemoteFileWidget extends Composite { /** * Set the message that will be displayed in the remote file browser * dialog. - * + * * @param message * message to be displayed */ @@ -228,10 +229,10 @@ public class RemoteFileWidget extends Composite { /** * Set the remote connection to use for browsing for the remote file. - * + * * The connection type must provide the IRemoteUIConnectionService and IRemoteUIFileService services and the connection must * support the IRemoteFileService service. If any of these conditions are not met, this method will do nothing. - * + * * @param conn * remote connection * @since 4.0 @@ -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(); @@ -262,7 +264,7 @@ public class RemoteFileWidget extends Composite { /** * Set the label to be displayed - * + * * @param label */ public void setLabel(String label) { @@ -273,7 +275,7 @@ public class RemoteFileWidget extends Composite { /** * Set the initial remote location that will be displayed in the widget. - * + * * @param path */ public void setLocationPath(String path) { @@ -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); } } diff --git a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java index f047cbb7c03..a5d0c184066 100644 --- a/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java +++ b/remote/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java @@ -77,20 +77,20 @@ import org.eclipse.ui.progress.UIJob; /** * Generic file/directory browser for remote resources. - * + * * @author greg - * + * */ public class RemoteResourceBrowserWidget extends Composite { /** * Delayed input dialog uses {@link ValidateJob} to create an InputDialog that only validates it's text field after an * appropriate timeout has occurred. This is to prevent excessive network traffic when checking the existence of a remote * directory on a target system. - * + * * Due to the timing of the validation, it is possible to close the dialog prior to the validation completing. However since the * validation is only used to check for the existence of a remote file/directory, the worst that can happen is that the user * will not be notified that the directory already exists. - * + * */ private class DelayedInputDialog extends InputDialog { public DelayedInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, @@ -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)); } } @@ -404,8 +404,8 @@ public class RemoteResourceBrowserWidget extends Composite { /* * Only add filter if we are a directory browser. File and resource browsers show everything. */ - int mask = FILE_BROWSER|DIRECTORY_BROWSER; - if ((fOptionFlags & mask) != mask // Avoid filter on resource browsers. + int mask = FILE_BROWSER | DIRECTORY_BROWSER; + if ((fOptionFlags & mask) != mask // Avoid filter on resource browsers. && (fOptionFlags & DIRECTORY_BROWSER) != 0) { fTreeViewer.addFilter(new ViewerFilter() { @Override @@ -440,7 +440,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Add a listener that will be notified when the selection is changed. - * + * * @param listener * listener to add */ @@ -450,7 +450,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Change the viewers input. Called when a new connection is selected. - * + * * @param conn * new connection * @return true if input successfully changed @@ -493,7 +493,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * When a new connection is selected, make sure it is open before using it. - * + * * @throws CoreException */ private void connectionSelected() throws CoreException { @@ -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,21 +545,22 @@ 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() { - @Override - public String isValid(String newText) { - if (!newText.equals("")) { //$NON-NLS-1$ - IFileStore newPath = path.getChild(newText); - if (newPath.fetchInfo().exists()) { - return Messages.RemoteResourceBrowserWidget_3; + 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$ + IFileStore newPath = path.getChild(newText); + if (newPath.fetchInfo().exists()) { + return Messages.RemoteResourceBrowserWidget_3; + } + } else { + return Messages.RemoteResourceBrowserWidget_4; + } + return null; } - } else { - return Messages.RemoteResourceBrowserWidget_4; - } - return null; - } - }); + }); fValidateJob.setDialog(dialog); if (dialog.open() == Dialog.OK) { userPath[0] = dialog.getValue(); @@ -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()); } }); } @@ -597,7 +600,7 @@ public class RemoteResourceBrowserWidget extends Composite { * Determine the initial path for the browser. If the initial path is not * supplied or does not exist on the remote machine, then the initial path * will be the cwd. - * + * * @param cwd * @param initialPath * @return initial path @@ -617,7 +620,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Get the connection that was selected - * + * * @return selected connection */ public IRemoteConnection getConnection() { @@ -626,7 +629,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Get a resource that corresponds to the text field - * + * * @return resource corresponding to the text field * @since 1.1 */ @@ -641,7 +644,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Get the resources that were selected. - * + * * @return selected resources */ public List getResources() { @@ -663,7 +666,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Remove a listener that will be notified when the selection is changed - * + * * @param listener * listener to remove */ @@ -674,7 +677,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Set the connection for the browser. The connection must support the IRemoteFileService service or this method will have no * effect. - * + * * @param connection * connection that supports the IRemoteFileService service */ @@ -692,9 +695,9 @@ public class RemoteResourceBrowserWidget extends Composite { * Set the initial path to start browsing. This will be set in the browser * text field, and in a future version should expand the browser to this * location if it exists. - * + * * NOTE: This must be called *before* {@link #setConnection(IRemoteConnection)} to have any effect. - * + * * @param path */ public void setInitialPath(String path) { @@ -705,7 +708,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Set the root directory for the browser. This will also update the text * field with the path. If the path is null, the browser will be set to the initial state. - * + * * @param path * path of root directory or null */ @@ -730,7 +733,7 @@ public class RemoteResourceBrowserWidget extends Composite { /** * Set the fDialogTitle of the dialog. - * + * * @param title */ public void setTitle(String title) {