tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / remote / RemoteSystemProxy.java
index b9f07836a2d14fbfc2f9da18f0c9cc910a08698d..873ce131552f8234aff40be897a2ab707b7cba6a 100644 (file)
@@ -1,20 +1,19 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
- * 
+ * Copyright (c) 2012, 2013 Ericsson
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  *   Bernd Hufmann - Initial API and implementation
  **********************************************************************/
 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote;
 
 import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.CommandShell;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell;
 import org.eclipse.rse.core.model.IHost;
 import org.eclipse.rse.core.model.IRSECallback;
 import org.eclipse.rse.core.subsystems.ICommunicationsListener;
@@ -26,21 +25,30 @@ import org.eclipse.rse.services.terminals.ITerminalService;
 import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
 
 /**
- * <b><u>RemoteSystemProxy</u></b>
  * <p>
  * RemoteSystemProxy implementation.
  * </p>
+ *
+ * @author Bernd Hufmann
  */
 public class RemoteSystemProxy implements IRemoteSystemProxy {
-    
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
-    private IHost fHost;
+
+    private final IHost fHost;
 
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     *
+     * @param host
+     *            The host of this proxy
+     */
     public RemoteSystemProxy(IHost host) {
         fHost = host;
     }
@@ -48,9 +56,7 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#getShellService(org.eclipse.rse.core.model.IHost)
-     */
+
     @Override
     public IShellService getShellService() {
         ISubSystem ss = getShellServiceSubSystem();
@@ -60,9 +66,6 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#getTerminalService()
-     */
     @Override
     public ITerminalService getTerminalService() {
         ISubSystem ss = getTerminalServiceSubSystem();
@@ -72,9 +75,6 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#getShellServiceSubSystem()
-     */
     @Override
     public ISubSystem getShellServiceSubSystem() {
         if (fHost == null) {
@@ -87,16 +87,13 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
             if (svc!=null) {
                 ssvc = (IShellService)svc.getAdapter(IShellService.class);
                 if (ssvc != null) {
-                    return subSystems[i];   
-                }   
+                    return subSystems[i];
+                }
             }
         }
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#getTerminalServiceSubSystem()
-     */
     @Override
     public ISubSystem getTerminalServiceSubSystem() {
         if (fHost == null) {
@@ -109,17 +106,13 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
             if (svc!=null) {
                 ssvc = (ITerminalService)svc.getAdapter(ITerminalService.class);
                 if (ssvc != null) {
-                    return subSystems[i];   
-                }   
+                    return subSystems[i];
+                }
             }
         }
         return null;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy#getFileServiceSubSystem()
-     */
     @Override
     public IFileServiceSubSystem getFileServiceSubSystem() {
         if (fHost == null) {
@@ -133,10 +126,22 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
         }
         return null;
     }
-    
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#connect(org.eclipse.rse.core.model.IRSECallback)
-     */
+
+    @Override
+    public int getPort() {
+        if (getShellServiceSubSystem() != null) {
+            return getShellServiceSubSystem().getConnectorService().getPort();
+        }
+        return IRemoteSystemProxy.INVALID_PORT_NUMBER;
+    }
+
+    @Override
+    public void setPort(int port) {
+        if ((getShellServiceSubSystem() != null) && (port > 0)) {
+            getShellServiceSubSystem().getConnectorService().setPort(port);
+        }
+    }
+
     @Override
     public void connect(IRSECallback callback) throws ExecutionException {
         ISubSystem shellSubSystem = getShellServiceSubSystem();
@@ -144,7 +149,10 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
             if (!shellSubSystem.isConnected()) {
                 try {
                     shellSubSystem.connect(false, callback);
-                } catch (Exception e) {
+                } catch (OperationCanceledException e) {
+                    callback.done(Status.CANCEL_STATUS, null);
+                }
+                catch (Exception e) {
                     throw new ExecutionException(e.toString(), e);
                 }
             } else {
@@ -153,9 +161,6 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#disconnect()
-     */
     @Override
     public void disconnect() throws ExecutionException {
             ISubSystem shellSubSystem = getShellServiceSubSystem();
@@ -168,19 +173,13 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
             }
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#createCommandShell()
-     */
     @Override
     public ICommandShell createCommandShell() throws ExecutionException {
         ICommandShell shell = new CommandShell(this);
         shell.connect();
         return shell;
     }
-    
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#addCommunicationListener(org.eclipse.rse.core.subsystems.ICommunicationsListener)
-     */
+
     @Override
     public void addCommunicationListener(ICommunicationsListener listener) {
         IConnectorService[] css = fHost.getConnectorServices();
@@ -189,9 +188,6 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#removeCommunicationListener(org.eclipse.rse.core.subsystems.ICommunicationsListener)
-     */
     @Override
     public void removeCommunicationListener(ICommunicationsListener listener) {
         IConnectorService[] css = fHost.getConnectorServices();
This page took 0.026332 seconds and 5 git commands to generate.