[Esbox-commits] r1627 - branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh

fabricioepa at garage.maemo.org fabricioepa at garage.maemo.org
Thu May 21 16:06:32 EEST 2009


Author: fabricioepa
Date: 2009-05-21 16:06:31 +0300 (Thu, 21 May 2009)
New Revision: 1627

Modified:
   branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferencePage.java
Log:
Fix #3827

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferencePage.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferencePage.java	2009-05-21 03:29:40 UTC (rev 1626)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferencePage.java	2009-05-21 13:06:31 UTC (rev 1627)
@@ -14,11 +14,23 @@
 import org.eclipse.jface.preference.BooleanFieldEditor;
 import org.eclipse.jface.preference.FieldEditorPreferencePage;
 import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 import org.maemo.esbox.internal.scratchbox.core.IHelpID;
 import org.maemo.mica.common.core.GeneralUtils;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
+import org.maemo.mica.protocol.ssh.ui.ExchangeKeysDialog;
+import org.maemo.esbox.internal.scratchbox.core.Activator;
 
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
 /**
  * @author Fabrício S Epaminondas (UFCG)
  *
@@ -33,6 +45,41 @@
 		setDescription("SBRSH preference configuration.");
 	}
 	
+	
+	@Override
+	protected Control createContents(Composite parent) {
+		Composite composite=  (Composite) super.createContents(parent);
+
+		Button fExchangeKeys =  new Button(composite, SWT.PUSH);
+		fExchangeKeys.setText("Exchange Keys");
+		fExchangeKeys.setToolTipText("Export host identity to client and" +
+				" authorize paswordless ssh connection from client to host.");
+		fExchangeKeys.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				Shell shell = WorkbenchUtils.getActiveShell();
+				final ExchangeKeysDialog dialog;
+				try {
+					dialog = new ExchangeKeysDialog(shell, "Exchanging Keys");
+					// default values
+					dialog.getExchanger().setGenerateKeys(true);
+					DialogUtils.getShell().getDisplay().syncExec(
+							new Runnable() {
+								public void run() {
+									dialog.open();
+								}
+							});
+				} catch (Exception ex) {
+					Activator.getErrorLogger().logAndShowError(
+							"Could not connect to device", ex);
+				}
+			}
+		});
+		
+
+		
+		return composite;
+	}
 	public void createFieldEditors() {
 		
 		GeneralUtils.setHelpID(getControl(), IHelpID.HID_GLOBAL_PREF_ESBOX_SBRSH);



More information about the Esbox-commits mailing list