package rhogenwizard.rhohub;

import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jgit.errors.UnsupportedCredentialItem;
import org.eclipse.jgit.transport.CredentialItem;
import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;

public class GitCredentialsProvider extends CredentialsProvider
{
    @Override
    public boolean get(URIish arg0, final CredentialItem... arg1) throws UnsupportedCredentialItem
    {
    	Display.getDefault().syncExec(new Runnable() 
    	{
    		public void run() 
    		{
    			try 
    			{
			        InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), 
			            "Git password", "Please enter you git password.", "", null) 
			        {
			            @Override
			            protected int getInputTextStyle() 
			            {
			                return SWT.SINGLE | SWT.BORDER ;
			            }
			        };
			        dlg.open();
			        
			        CredentialItem.StringType pwdCred = (CredentialItem.StringType )arg1[0];
			        pwdCred.setValue(dlg.getValue());
    			} 
    			catch (Exception ex) 
    			{
    				ex.printStackTrace();
    			}
    		}
    	});
    			
        return true;
    }

    @Override
    public boolean isInteractive()
    {
        return false;
    }

    @Override
    public boolean supports(CredentialItem... arg0)
    {
        return false;
    }
}

@@ -343,16 +343,50 @@
 splay;%0A%0A
+import rhogenwizard.DialogUtils;%0A%0A
 public c
@@ -558,24 +558,325 @@
 lItem%0A    %7B%0A
+    %09if (arg1%5B0%5D instanceof CredentialItem.YesNoType)%0A    %09%7B%0A    %09%09CredentialItem.YesNoType yesnoCred = (CredentialItem.YesNoType)arg1%5B0%5D;%0A    %09%09%0A    %09%09yesnoCred.setValue(DialogUtils.quetsion(%22Git%22, arg1%5B0%5D.getPromptText()));%0A    %09%7D%0A    %09else if (arg1%5B0%5D instanceof CredentialItem.StringType)%0A    %09%7B%0A%09
     %09Display
@@ -914,23 +914,25 @@
 able() %0A
+%09
     %09%7B%0A
+%09
     %09%09pu
@@ -952,16 +952,17 @@
 () %0A
+%09
     %09%09%7B%0A
     
@@ -953,24 +953,25 @@
 ) %0A%09    %09%09%7B%0A
+%09
     %09%09%09try %0A
@@ -970,16 +970,17 @@
 %09%09%09try %0A
+%09
     %09%09%09%7B
@@ -980,16 +980,17 @@
    %09%09%09%7B%0A
+%09
 %09%09%09     
@@ -1066,16 +1066,17 @@
 ell(), %0A
+%09
 %09%09%09     
@@ -1142,24 +1142,25 @@
 , null) %0A%09%09%09
+%09
         %7B%0A%09%09
@@ -1149,32 +1149,33 @@
  %0A%09%09%09%09        %7B%0A
+%09
 %09%09%09            @
@@ -1183,16 +1183,17 @@
 verride%0A
+%09
 %09%09%09     
@@ -1233,24 +1233,25 @@
 Style() %0A%09%09%09
+%09
             
@@ -1252,16 +1252,17 @@
       %7B%0A
+%09
 %09%09%09     
@@ -1303,21 +1303,36 @@
 .BORDER 
+%7C SWT.PASSWORD
 ;%0A%09%09%09
+%09
         
@@ -1336,24 +1336,25 @@
        %7D%0A%09%09%09
+%09
         %7D;%0A%09
@@ -1352,16 +1352,17 @@
      %7D;%0A
+%09
 %09%09%09     
@@ -1375,24 +1375,25 @@
 .open();%0A%09%09%09
+%09
         %0A%09%09%09
@@ -1389,16 +1389,17 @@
        %0A
+%09
 %09%09%09     
@@ -1463,17 +1463,16 @@
 ringType
- 
 )arg1%5B0%5D
@@ -1476,16 +1476,17 @@
 %5B0%5D;%0A%09%09%09
+%09
         
@@ -1515,24 +1515,25 @@
 etValue());%0A
+%09
     %09%09%09%7D %0A  
@@ -1530,16 +1530,17 @@
   %09%09%09%7D %0A
+%09
     %09%09%09c
@@ -1560,16 +1560,17 @@
 on ex) %0A
+%09
     %09%09%09%7B
@@ -1570,16 +1570,17 @@
    %09%09%09%7B%0A
+%09
     %09%09%09%09
@@ -1601,16 +1601,17 @@
 race();%0A
+%09
     %09%09%09%7D
@@ -1615,16 +1615,17 @@
 %09%09%7D%0A
+%09
     %09%09%7D%0A
     
@@ -1620,16 +1620,17 @@
     %09%09%7D%0A
+%09
     %09%7D);
@@ -1635,17 +1635,22 @@
 );%0A    %09
-%09
+%7D%0A    
 %09%0A      

fix shows git request