[yocto] [PATCH 1/3] Move remote system type checkings from GUI Dialogs and to RSEHelper

Ioana Grigoropol ioanax.grigoropol at intel.com
Wed May 8 05:55:02 PDT 2013


- BaseSettingDialog contains code that checks whether the system type associated with a certain IHost is not null, enable and remote
- these checkings should be done in the RSEHelper for two reasons:
	- limit the dependecies to the RSE Api
	- isolate remote functionaties from GUI
- created method isHostViable in RSEHelper that performs all the checks need by BaseSettingDialog
- replace system type checkings in BaseSettingDialog with calls to isHostViable(IHost)

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol at intel.com>
---
 .../src/org/yocto/sdk/remotetools/RSEHelper.java   |    8 ++++++++
 .../sdk/remotetools/actions/BaseSettingDialog.java |    9 ++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java
index de42801..bf48464 100644
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java
@@ -43,6 +43,7 @@ import org.eclipse.rse.services.shells.IHostShell;
 import org.eclipse.rse.services.shells.IShellService;
 import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
 import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
+import org.eclipse.rse.core.IRSESystemType;
 
 public class RSEHelper {
 	
@@ -395,4 +396,11 @@ public class RSEHelper {
 		}
 		throw new CoreException(status);
 	}
+
+	public static boolean isHostViable(IHost host) {
+		IRSESystemType sysType = host.getSystemType();
+		if (sysType != null && sysType.isEnabled() && !sysType.isLocal())
+			return true;
+		return false;
+	}
 }
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java
index c88d0e5..5c76bf9 100644
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java
@@ -142,12 +142,9 @@ public class BaseSettingDialog extends Dialog {
 			button.setEnabled(false);
 		IHost currentConnectionSelected = getCurrentConnection();
 		if (currentConnectionSelected != null) {
-			IRSESystemType sysType = currentConnectionSelected.getSystemType();
-			if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) {
-				if(button!=null) {
+			if (RSEHelper.isHostViable(currentConnectionSelected) && button != null){
 					button.setEnabled(true);
 					ret=true;
-				}
 			}
 		}
 		return ret;
@@ -156,10 +153,8 @@ public class BaseSettingDialog extends Dialog {
 	protected void updateCurConn() {
 		IHost currentConnectionSelected = getCurrentConnection();
 		if (currentConnectionSelected != null) {
-			IRSESystemType sysType = currentConnectionSelected.getSystemType();
-			if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) {
+			if (RSEHelper.isHostViable(currentConnectionSelected))
 				curConn=currentConnectionSelected.getAliasName();
-			}
 		}
 		updateOkButton();
 	}
-- 
1.7.9.5




More information about the yocto mailing list