{"thread":{"id":"12017","subject":"[EGIT PATCH 2/2] Initial wizard step for Robin's fetch functionality.","startedAt":"2008-02-10T23:32:26Z","lastAt":"2008-02-11T06:02:01Z","messageCount":2,"participants":["Roger C. Soares","Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"68295","messageId":"1202686346-2885-1-git-send-email-rogersoares@intelinet.com.br","threadId":"12017","inReplyTo":null,"subject":"[EGIT PATCH 2/2] Initial wizard step for Robin's fetch functionality.","fromName":"Roger C. Soares","fromEmail":"rogersoares@intelinet.com.br","sentAt":"2008-02-10T23:32:26Z","receivedAt":"2008-02-10T23:32:26Z","isPatch":true,"sender":{"key":"rogersoares@intelinet.com.br","avatar":null},"body":"not to be commited.\n---\nHi Robin,\n\nThis is what I understood from your dialog. You can use this in part and/or\nintegrate with your patch the way you think is best. Hope it helps.\n\n[]s,\nRoger.\n\n .../egit/ui/internal/wizards/GitCloneWizard.java   |  252 ++++++++++++++++++--\n 1 files changed, 230 insertions(+), 22 deletions(-)\n\ndiff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/wizards/GitCloneWizard.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/wizards/GitCloneWizard.java\nindex e8ba87e..d2763b3 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/wizards/GitCloneWizard.java\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/wizards/GitCloneWizard.java\n@@ -20,10 +20,17 @@ import org.eclipse.jface.viewers.IStructuredSelection;\n import org.eclipse.jface.wizard.Wizard;\n import org.eclipse.jface.wizard.WizardPage;\n import org.eclipse.swt.SWT;\n-import org.eclipse.swt.layout.FillLayout;\n+import org.eclipse.swt.events.KeyAdapter;\n+import org.eclipse.swt.events.KeyEvent;\n+import org.eclipse.swt.events.SelectionAdapter;\n+import org.eclipse.swt.events.SelectionEvent;\n+import org.eclipse.swt.layout.GridData;\n+import org.eclipse.swt.layout.GridLayout;\n+import org.eclipse.swt.widgets.Combo;\n import org.eclipse.swt.widgets.Composite;\n import org.eclipse.swt.widgets.Control;\n import org.eclipse.swt.widgets.Label;\n+import org.eclipse.swt.widgets.Text;\n import org.eclipse.ui.IImportWizard;\n import org.eclipse.ui.IWorkbench;\n import org.spearce.egit.ui.UIIcons;\n@@ -32,7 +39,7 @@ import org.spearce.egit.ui.UIIcons;\n  * Import Git Repository Wizard. A front end to a git clone operation.\n  */\n public class GitCloneWizard extends Wizard implements IImportWizard {\n-\tprivate WarningPage warning;\n+\tprivate CloneInputPage cloneInput;\n \n \tpublic void init(IWorkbench arg0, IStructuredSelection arg1) {\n \t\t// Empty\n@@ -40,44 +47,245 @@ public class GitCloneWizard extends Wizard implements IImportWizard {\n \n \t@Override\n \tpublic void addPages() {\n-\t\twarning = new WarningPage();\n-\t\taddPage(warning);\n+\t\tcloneInput = new CloneInputPage();\n+\t\taddPage(cloneInput);\n \t}\n \n \t@Override\n \tpublic boolean performFinish() {\n+\t\tSystem.out.println(\"fetch uri: \" + cloneInput.getUri());\n \t\treturn true;\n \t}\n }\n \n-class WarningPage extends WizardPage {\n-\tprivate Composite container;\n+class CloneInputPage extends WizardPage {\n+\t/** No authentication requested */\n+\tpublic static final int AUTH_NONE = 0;\n+\n+\t/** User and password authentication requested */\n+\tpublic static final int AUTH_USER_PASS = 1;\n+\n+\t/** SSH public key authentication requested */\n+\tpublic static final int AUTH_SSH_PUBLIC_KEY = 2;\n+\n+\tprivate Composite localComposite;\n+\n+\tprivate String[] authItems = new String[] { \"None\", \"User/Password\",\n+\t\t\t\"SSH public key\" };\n+\n+\tprivate Combo authCombo;\n+\n+\tprivate Text uriText;\n+\n+\tprivate Text userText;\n+\n+\tprivate Text passText;\n+\n+\tprivate Text keyText;\n \n \t/**\n-\t * Warning message for new users alerting on how to use egit.\n+\t * Wizard page that allows the user entering the location of a repository to\n+\t * be cloned.\n \t */\n-\tpublic WarningPage() {\n-\t\tsuper(\"Warning Page\", \"Warning\", UIIcons.WIZBAN_IMPORT_REPO);\n-\t\tsetDescription(\"Git Import is not ready yet.\");\n+\tpublic CloneInputPage() {\n+\t\tsuper(\"Clone Input Page\", \"Import Git Repository\",\n+\t\t\t\tUIIcons.WIZBAN_IMPORT_REPO);\n+\t\tsetDescription(\"Enter the location of the repository to be cloned.\");\n \t}\n \n \tpublic void createControl(Composite parent) {\n-\t\tcontainer = new Composite(parent, SWT.NULL);\n-\t\tFillLayout layout = new FillLayout();\n-\t\tcontainer.setLayout(layout);\n-\t\tLabel label1 = new Label(container, SWT.NULL);\n-\t\tlabel1.setText(\"\\nUse Git (THE Git) to create or clone your repo.\"\n-\t\t\t\t+ \"\\nSelect the project in the navigator and\"\n-\t\t\t\t+ \"\\ngo to the context menu's Team item and\"\n-\t\t\t\t+ \"\\nbelow it you will find \\\"Share Project\\\".\"\n-\t\t\t\t+ \"\\nSelect it and the rest is self explanatory.\");\n-\n-\t\tsetControl(container);\n+\t\tlocalComposite = new Composite(parent, SWT.NULL);\n+\t\tGridLayout layout = new GridLayout();\n+\t\tlayout.numColumns = 2;\n+\t\tlocalComposite.setLayout(layout);\n+\n+\t\tLabel uriLabel = new Label(localComposite, SWT.NULL);\n+\t\turiLabel.setText(\"Location:\");\n+\n+\t\turiText = new Text(localComposite, SWT.BORDER);\n+\t\turiText.setText(\"\");\n+\t\tGridData uriTextData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);\n+\t\turiText.setLayoutData(uriTextData);\n+\n+\t\tLabel authLabel = new Label(localComposite, SWT.NULL);\n+\t\tauthLabel.setText(\"Authentication:\");\n+\n+\t\tauthCombo = new Combo(localComposite, SWT.DROP_DOWN | SWT.READ_ONLY);\n+\t\tauthCombo.setItems(authItems);\n+\t\tauthCombo.select(0);\n+\n+\t\tfinal Label userLabel = new Label(localComposite, SWT.NULL);\n+\t\tuserLabel.setText(\"User:\");\n+\t\tfinal GridData userLabelData = new GridData();\n+\t\tuserLabelData.exclude = true;\n+\t\tuserLabel.setLayoutData(userLabelData);\n+\n+\t\tuserText = new Text(localComposite, SWT.BORDER);\n+\t\tuserText.setText(\"\");\n+\t\tfinal GridData userTextData = new GridData(SWT.FILL, SWT.DEFAULT, true,\n+\t\t\t\tfalse);\n+\t\tuserTextData.exclude = true;\n+\t\tuserText.setLayoutData(userTextData);\n+\n+\t\tfinal Label passLabel = new Label(localComposite, SWT.NULL);\n+\t\tpassLabel.setText(\"Password:\");\n+\t\tfinal GridData passLabelData = new GridData();\n+\t\tpassLabelData.exclude = true;\n+\t\tpassLabel.setLayoutData(passLabelData);\n+\n+\t\tpassText = new Text(localComposite, SWT.BORDER | SWT.PASSWORD);\n+\t\tpassText.setText(\"\");\n+\t\tfinal GridData passTextData = new GridData(SWT.FILL, SWT.DEFAULT, true,\n+\t\t\t\tfalse);\n+\t\tpassTextData.exclude = true;\n+\t\tpassText.setLayoutData(passTextData);\n+\n+\t\tfinal Label keyLabel = new Label(localComposite, SWT.NULL);\n+\t\tkeyLabel.setText(\"SSH public key:\");\n+\t\tfinal GridData keyLabelData = new GridData();\n+\t\tkeyLabelData.exclude = true;\n+\t\tkeyLabel.setLayoutData(keyLabelData);\n+\n+\t\tkeyText = new Text(localComposite, SWT.BORDER | SWT.WRAP);\n+\t\tkeyText.setText(\"\");\n+\t\tfinal GridData keyTextData = new GridData(SWT.FILL, SWT.DEFAULT, true,\n+\t\t\t\tfalse);\n+\t\tkeyTextData.exclude = true;\n+\t\tkeyTextData.heightHint = 100;\n+\t\tkeyText.setLayoutData(keyTextData);\n+\n+\t\tKeyAdapter completeListener = new KeyAdapter() {\n+\t\t\tpublic void keyReleased(KeyEvent e) {\n+\t\t\t\tenableDisableFinish();\n+\t\t\t}\n+\t\t};\n+\n+\t\turiText.addKeyListener(completeListener);\n+\t\tuserText.addKeyListener(completeListener);\n+\t\tpassText.addKeyListener(completeListener);\n+\t\tkeyText.addKeyListener(completeListener);\n+\n+\t\tauthCombo.addSelectionListener(new SelectionAdapter() {\n+\t\t\t@Override\n+\t\t\tpublic void widgetSelected(SelectionEvent e) {\n+\t\t\t\tint authRequested = getAuthRequested();\n+\t\t\t\thideAll();\n+\t\t\t\tif (authRequested == AUTH_USER_PASS) {\n+\t\t\t\t\tuserLabelData.exclude = false;\n+\t\t\t\t\tuserLabel.setVisible(true);\n+\t\t\t\t\tuserTextData.exclude = false;\n+\t\t\t\t\tuserText.setVisible(true);\n+\n+\t\t\t\t\tpassLabelData.exclude = false;\n+\t\t\t\t\tpassLabel.setVisible(true);\n+\t\t\t\t\tpassTextData.exclude = false;\n+\t\t\t\t\tpassText.setVisible(true);\n+\t\t\t\t} else if (authRequested == AUTH_SSH_PUBLIC_KEY) {\n+\t\t\t\t\tkeyLabelData.exclude = false;\n+\t\t\t\t\tkeyLabel.setVisible(true);\n+\t\t\t\t\tkeyTextData.exclude = false;\n+\t\t\t\t\tkeyText.setVisible(true);\n+\t\t\t\t}\n+\t\t\t\tlocalComposite.layout(false);\n+\t\t\t\tenableDisableFinish();\n+\t\t\t}\n+\n+\t\t\tprivate void hideAll() {\n+\t\t\t\tuserLabelData.exclude = true;\n+\t\t\t\tuserLabel.setVisible(false);\n+\t\t\t\tuserTextData.exclude = true;\n+\t\t\t\tuserText.setVisible(false);\n+\n+\t\t\t\tpassLabelData.exclude = true;\n+\t\t\t\tpassLabel.setVisible(false);\n+\t\t\t\tpassTextData.exclude = true;\n+\t\t\t\tpassText.setVisible(false);\n+\n+\t\t\t\tkeyLabelData.exclude = true;\n+\t\t\t\tkeyLabel.setVisible(false);\n+\t\t\t\tkeyTextData.exclude = true;\n+\t\t\t\tkeyText.setVisible(false);\n+\t\t\t}\n+\t\t});\n+\n+\t\tsetControl(localComposite);\n \t\tsetPageComplete(false);\n \t}\n \n+\tprivate void enableDisableFinish() {\n+\t\tboolean isComplete = false;\n+\t\tif (uriText.getText().length() > 0) {\n+\t\t\tisComplete = true;\n+\t\t}\n+\t\tint authRequested = getAuthRequested();\n+\t\tif (authRequested == AUTH_USER_PASS) {\n+\t\t\tif (userText.getText().length() == 0\n+\t\t\t\t\t|| passText.getText().length() == 0) {\n+\t\t\t\tisComplete = false;\n+\t\t\t}\n+\t\t} else if (authRequested == AUTH_SSH_PUBLIC_KEY) {\n+\t\t\tif (keyText.getText().length() == 0) {\n+\t\t\t\tisComplete = false;\n+\t\t\t}\n+\t\t}\n+\t\tsetPageComplete(isComplete);\n+\t}\n+\n \t@Override\n \tpublic Control getControl() {\n-\t\treturn container;\n+\t\treturn localComposite;\n+\t}\n+\n+\t/**\n+\t * Returns authentication method entered in the Wizard page.\n+\t * \n+\t * @return String the authentication method chosen: <code>AUTH_NONE</code>,\n+\t *         <code>AUTH_USER_PASS</code> or <code>AUTH_SSH_PUBLIC_KEY</code>.\n+\t */\n+\tpublic int getAuthRequested() {\n+\t\tString text = authCombo.getText();\n+\t\tif (authItems[1].equals(text)) {\n+\t\t\treturn AUTH_USER_PASS;\n+\t\t} else if (authItems[2].equals(text)) {\n+\t\t\treturn AUTH_SSH_PUBLIC_KEY;\n+\t\t}\n+\n+\t\treturn AUTH_NONE;\n+\t}\n+\n+\t/**\n+\t * Returns the URI entered in the Wizard page.\n+\t * \n+\t * @return String the URI entered in the Wizard page.\n+\t */\n+\tpublic String getUri() {\n+\t\treturn uriText.getText();\n+\t}\n+\n+\t/**\n+\t * Returns the user entered in the Wizard page.\n+\t * \n+\t * @return String the user entered in the Wizard page.\n+\t */\n+\tpublic String getUser() {\n+\t\treturn userText.getText();\n+\t}\n+\n+\t/**\n+\t * Returns the password entered in the Wizard page.\n+\t * \n+\t * @return String the password entered in the Wizard page.\n+\t */\n+\tpublic String getPassword() {\n+\t\treturn passText.getText();\n+\t}\n+\n+\t/**\n+\t * Returns the SSH public key entered in the Wizard page.\n+\t * \n+\t * @return String the SSH public key entered in the Wizard page.\n+\t */\n+\tpublic String getSshPublicKey() {\n+\t\treturn keyText.getText();\n \t}\n }\n-- \n1.5.3.8\n"},{"id":"68325","messageId":"200802110702.02736.robin.rosenberg@dewire.com","threadId":"12017","inReplyTo":"1202686346-2885-1-git-send-email-rogersoares@intelinet.com.br","subject":"Re: [EGIT PATCH 2/2] Initial wizard step for Robin's fetch functionality.","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2008-02-11T06:02:01Z","receivedAt":"2008-02-11T06:02:01Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"måndagen den 11 februari 2008 skrev Roger C. Soares:\n> not to be commited.\n> ---\n> Hi Robin,\n> \n> This is what I understood from your dialog. You can use this in part and/or\n> integrate with your patch the way you think is best. Hope it helps.\n\nThis looks about right, to start with at least. Thanks.\n\n-- robin\n"}]}