org.eclipse.jsch.ui_1.1.400.v20120522-1148

16:45:38.553 INFO  jd.cli.Main - Decompiling org.eclipse.jsch.ui_1.1.400.v20120522-1148.jar
package org.eclipse.jsch.internal.ui;

public abstract interface IHelpContextIds
{
  public static final String USER_VALIDATION_DIALOG = "org.eclipse.team.cvs.ui.user_validation_dialog_contex";
  public static final String KEYBOARD_INTERACTIVE_DIALOG = "org.eclipse.team.cvs.ui.keyboard_interactive_dialog_context";
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.IHelpContextIds
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui;

public abstract interface IUIConstants
{
  public static final String PREFIX = "org.eclipse.jsch.ui.";
  public static final String ICON_PATH = "$nl$/icons/full/";
  public static final String PREF_FIRST_STARTUP = "pref_first_startup";
  public static final String IMG_KEY_LOCK = "wizban/keylock.gif";
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.IUIConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui;

import java.net.URL;
import java.util.Hashtable;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jsch.core.IJSchService;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;

public class JSchUIPlugin
  extends AbstractUIPlugin
{
  public static final String ID = "org.eclipse.jsch.ui";
  public static final String DECORATOR_ID = "org.eclipse.jsch.ui.decorator";
  private static Hashtable imageDescriptors = new Hashtable(20);
  private static JSchUIPlugin plugin;
  private ServiceTracker tracker;
  
  public JSchUIPlugin()
  {
    plugin = this;
  }
  
  public static JSchUIPlugin getPlugin()
  {
    return plugin;
  }
  
  public static ImageDescriptor getImageDescriptor(String id)
  {
    return (ImageDescriptor)imageDescriptors.get(id);
  }
  
  protected void createImageDescriptor(String id)
  {
    URL url = FileLocator.find(getPlugin().getBundle(), new Path(
      "$nl$/icons/full/" + id), null);
    ImageDescriptor desc = ImageDescriptor.createFromURL(url);
    imageDescriptors.put(id, desc);
  }
  
  public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename)
  {
    URL fullPathString = FileLocator.find(Platform.getBundle(extension.getNamespaceIdentifier()), new Path(subdirectoryAndFilename), null);
    return ImageDescriptor.createFromURL(fullPathString);
  }
  
  private void initializeImages()
  {
    createImageDescriptor("wizban/keylock.gif");
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    
    initializeImages();
    
    IPreferenceStore store = getPreferenceStore();
    if (store.getBoolean("pref_first_startup")) {
      store.setValue("pref_first_startup", false);
    }
    tracker = new ServiceTracker(getBundle().getBundleContext(), IJSchService.class.getName(), null);
    tracker.open();
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
    tracker.close();
  }
  
  public IJSchService getJSchService()
  {
    return (IJSchService)tracker.getService();
  }
  
  public URL getImageUrl(String relative)
  {
    return FileLocator.find(Platform.getBundle("org.eclipse.jsch.ui"), new Path("$nl$/icons/full/" + relative), null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.JSchUIPlugin
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class KeyboardInteractiveDialog$1
  extends SelectionAdapter
{
  final KeyboardInteractiveDialog this$0;
  
  KeyboardInteractiveDialog$1(KeyboardInteractiveDialog paramKeyboardInteractiveDialog)
  {
    this$0 = paramKeyboardInteractiveDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.allowCaching = this$0.allowCachingButton.getSelection();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.KeyboardInteractiveDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class KeyboardInteractiveDialog
  extends TrayDialog
{
  private Text[] texts;
  protected Image keyLockImage;
  protected Button allowCachingButton;
  protected Text usernameField;
  protected String userName;
  protected String domain;
  protected String destination;
  protected String name;
  protected String instruction;
  protected String lang;
  protected String[] prompt;
  protected boolean[] echo;
  private String message;
  private String[] result;
  protected boolean allowCaching = false;
  private boolean isPasswordAuth = false;
  
  public KeyboardInteractiveDialog(Shell parentShell, String location, String destination, String name, String userName, String instruction, String[] prompt, boolean[] echo)
  {
    super(parentShell);
    domain = location;
    this.destination = destination;
    this.name = name;
    this.userName = userName;
    this.instruction = instruction;
    this.prompt = prompt;
    this.echo = echo;
    if ((name != null) && (name.length() > 0)) {
      message = NLS.bind(Messages.KeyboardInteractiveDialog_0, new String[] { destination, name });
    } else {
      message = NLS.bind(Messages.KeyboardInteractiveDialog_1, destination);
    }
    if (isPasswordAuth(prompt)) {
      isPasswordAuth = true;
    }
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    if (isPasswordAuth) {
      newShell.setText(Messages.KeyboardInteractiveDialog_2);
    } else {
      newShell.setText(message);
    }
    PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, 
      "org.eclipse.team.cvs.ui.keyboard_interactive_dialog_context");
  }
  
  public void create()
  {
    super.create();
    if ((isPasswordAuth) && (usernameField != null) && (userName != null))
    {
      usernameField.setText(userName);
      usernameField.setEditable(false);
    }
    if (texts.length > 0) {
      texts[0].setFocus();
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite top = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    
    top.setLayout(layout);
    top.setLayoutData(new GridData(768));
    
    Composite imageComposite = new Composite(top, 0);
    layout = new GridLayout();
    imageComposite.setLayout(layout);
    imageComposite.setLayoutData(new GridData(1040));
    
    Composite main = new Composite(top, 0);
    layout = new GridLayout();
    numColumns = 3;
    main.setLayout(layout);
    main.setLayoutData(new GridData(768));
    
    Label imageLabel = new Label(imageComposite, 0);
    keyLockImage = ImageDescriptor.createFromURL(JSchUIPlugin.getPlugin().getImageUrl("wizban/keylock.gif")).createImage();
    imageLabel.setImage(keyLockImage);
    GridData data = new GridData(768);
    
    imageLabel.setLayoutData(data);
    if (message != null)
    {
      Label messageLabel = new Label(main, 64);
      messageLabel.setText(message);
      data = new GridData(768);
      
      horizontalSpan = 3;
      widthHint = 300;
      messageLabel.setLayoutData(data);
    }
    if (domain != null)
    {
      Label d = new Label(main, 64);
      d.setText(Messages.KeyboardInteractiveDialog_3);
      data = new GridData();
      d.setLayoutData(data);
      Label label = new Label(main, 64);
      
      label.setText(domain);
      
      data = new GridData(768);
      
      horizontalSpan = 2;
      widthHint = 300;
      label.setLayoutData(data);
    }
    if ((instruction != null) && (instruction.length() > 0))
    {
      Label label = new Label(main, 64);
      label.setText(instruction);
      data = new GridData(768);
      
      horizontalSpan = 3;
      widthHint = 300;
      label.setLayoutData(data);
    }
    if (isPasswordAuth) {
      createUsernameFields(main);
    }
    createPasswordFields(main);
    if ((isPasswordAuth & domain != null))
    {
      allowCachingButton = new Button(main, 32);
      allowCachingButton.setText(Messages.KeyboardInteractiveDialog_4);
      data = new GridData(768);
      
      horizontalSpan = 3;
      allowCachingButton.setLayoutData(data);
      allowCachingButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          allowCaching = allowCachingButton.getSelection();
        }
      });
    }
    Dialog.applyDialogFont(parent);
    return main;
  }
  
  protected void createUsernameFields(Composite parent)
  {
    new Label(parent, 0).setText(Messages.KeyboardInteractiveDialog_6);
    
    usernameField = new Text(parent, 2048);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    widthHint = convertHorizontalDLUsToPixels(200);
    usernameField.setLayoutData(data);
  }
  
  protected void createPasswordFields(Composite parent)
  {
    texts = new Text[prompt.length];
    for (int i = 0; i < prompt.length; i++)
    {
      new Label(parent, 0).setText(prompt[i]);
      int flag = 2048;
      if (echo[i] == 0) {
        flag |= 0x400000;
      }
      texts[i] = new Text(parent, flag);
      GridData data = new GridData(768);
      horizontalSpan = 2;
      widthHint = convertHorizontalDLUsToPixels(200);
      texts[i].setLayoutData(data);
      if (echo[i] == 0) {
        texts[i].setEchoChar('*');
      }
    }
  }
  
  public String[] getResult()
  {
    return result;
  }
  
  public boolean getAllowCaching()
  {
    return allowCaching;
  }
  
  protected void okPressed()
  {
    result = new String[prompt.length];
    for (int i = 0; i < texts.length; i++) {
      result[i] = texts[i].getText();
    }
    super.okPressed();
  }
  
  protected void cancelPressed()
  {
    result = null;
    super.cancelPressed();
  }
  
  public boolean close()
  {
    if (keyLockImage != null) {
      keyLockImage.dispose();
    }
    return super.close();
  }
  
  static boolean isPasswordAuth(String[] prompt)
  {
    return (prompt != null) && (prompt.length == 1) && (prompt[0].trim().equalsIgnoreCase("password:"));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.KeyboardInteractiveDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.jsch.internal.ui.messages";
  public static String CVSSSH2ServerConnection_open;
  public static String CVSSSH2PreferencePage_18;
  public static String CVSSSH2PreferencePage_19;
  public static String CVSSSH2PreferencePage_2;
  public static String CVSSSH2PreferencePage_20;
  public static String CVSSSH2PreferencePage_21;
  public static String CVSSSH2PreferencePage_23;
  public static String CVSSSH2PreferencePage_24;
  public static String CVSSSH2PreferencePage_25;
  public static String CVSSSH2PreferencePage_26;
  public static String CVSSSH2PreferencePage_27;
  public static String CVSSSH2PreferencePage_3;
  public static String CVSSSH2PreferencePage_30;
  public static String CVSSSH2PreferencePage_31;
  public static String CVSSSH2PreferencePage_32;
  public static String CVSSSH2PreferencePage_33;
  public static String CVSSSH2PreferencePage_34;
  public static String CVSSSH2PreferencePage_35;
  public static String CVSSSH2PreferencePage_36;
  public static String CVSSSH2PreferencePage_39;
  public static String CVSSSH2PreferencePage_4;
  public static String CVSSSH2PreferencePage_41;
  public static String CVSSSH2PreferencePage_42;
  public static String CVSSSH2PreferencePage_43;
  public static String CVSSSH2PreferencePage_44;
  public static String CVSSSH2PreferencePage_45;
  public static String CVSSSH2PreferencePage_47;
  public static String CVSSSH2PreferencePage_48;
  public static String CVSSSH2PreferencePage_49;
  public static String CVSSSH2PreferencePage_5;
  public static String CVSSSH2PreferencePage_50;
  public static String CVSSSH2PreferencePage_53;
  public static String CVSSSH2PreferencePage_55;
  public static String CVSSSH2PreferencePage_57;
  public static String CVSSSH2PreferencePage_59;
  public static String CVSSSH2PreferencePage_99;
  public static String CVSSSH2PreferencePage_100;
  public static String CVSSSH2PreferencePage_104;
  public static String CVSSSH2PreferencePage_105;
  public static String CVSSSH2PreferencePage_106;
  public static String CVSSSH2PreferencePage_107;
  public static String CVSSSH2PreferencePage_108;
  public static String CVSSSH2PreferencePage_109;
  public static String CVSSSH2PreferencePage_110;
  public static String CVSSSH2PreferencePage_111;
  public static String CVSSSH2ServerConnection_3;
  public static String CVSSSH2ServerConnection_0;
  public static String CVSSSH2ServerConnection_1;
  public static String CVSSSH2PreferencePage_information;
  public static String CVSSSH2PreferencePage_error;
  public static String CVSSSH2PreferencePage_confirmation;
  public static String CVSSSH2PreferencePage_question;
  public static String CVSSSH2PreferencePage_125;
  public static String CVSSSH2PreferencePage_126;
  public static String CVSSSH2PreferencePage_127;
  public static String CVSSSH2PreferencePage_128;
  public static String CVSSSH2PreferencePage_129;
  public static String CVSSSH2PreferencePage_130;
  public static String CVSSSH2PreferencePage_131;
  public static String CVSSSH2PreferencePage_132;
  public static String CVSSSH2PreferencePage_133;
  public static String CVSSSH2PreferencePage_134;
  public static String CVSSSH2PreferencePage_135;
  public static String CVSSSH2PreferencePage_136;
  public static String CVSSSH2PreferencePage_137;
  public static String CVSSSH2PreferencePage_138;
  public static String CVSSSH2PreferencePage_139;
  public static String KeyboardInteractiveDialog_0;
  public static String KeyboardInteractiveDialog_1;
  public static String KeyboardInteractiveDialog_2;
  public static String KeyboardInteractiveDialog_3;
  public static String KeyboardInteractiveDialog_4;
  public static String KeyboardInteractiveDialog_6;
  public static String KeyboradInteractiveDialog_message;
  public static String KeyboardInteractiveDialog_labelRepository;
  public static String PreferencePage_0;
  public static String PreferencePage_1;
  public static String UserInfoPrompter_0;
  public static String UserInfoPrompter_1;
  public static String UserValidationDialog_0;
  public static String UserValidationDialog_1;
  public static String UserValidationDialog_2;
  public static String UserValidationDialog_4;
  public static String UserValidationDialog_5;
  public static String UserValidationDialog_6;
  public static String UserValidationDialog_required;
  public static String UserValidationDialog_labelUser;
  public static String UserValidationDialog_labelPassword;
  public static String UserValidationDialog_password;
  public static String UserValidationDialog_user;
  public static String WorkbenchUserAuthenticator_cancelled;
  public static String WorkbenchUserAuthenticator_1;
  public static String WorkbenchUserAuthenticator_2;
  public static String WorkbenchUserAuthenticator_The_operation_was_canceled_by_the_user_1;
  
  static
  {
    NLS.initializeMessages("org.eclipse.jsch.internal.ui.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.Messages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class UserValidationDialog$1
  extends SelectionAdapter
{
  final UserValidationDialog this$0;
  
  UserValidationDialog$1(UserValidationDialog paramUserValidationDialog)
  {
    this$0 = paramUserValidationDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.allowCaching = this$0.allowCachingButton.getSelection();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.UserValidationDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class UserValidationDialog
  extends TrayDialog
{
  protected Text usernameField;
  protected Text passwordField;
  protected Button allowCachingButton;
  protected String domain;
  protected String defaultUsername;
  protected String password = null;
  protected boolean allowCaching = false;
  protected Image keyLockImage;
  protected boolean isUsernameMutable = true;
  protected String username = null;
  protected String message = null;
  
  public UserValidationDialog(Shell parentShell, String location, String defaultName, String message)
  {
    super(parentShell);
    setShellStyle(getShellStyle() | 0x10);
    defaultUsername = defaultName;
    domain = location;
    this.message = message;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    newShell.setText(Messages.UserValidationDialog_0);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, "org.eclipse.team.cvs.ui.user_validation_dialog_contex");
  }
  
  public void create()
  {
    super.create();
    
    usernameField.setText(defaultUsername);
    if (isUsernameMutable)
    {
      usernameField.selectAll();
      usernameField.setFocus();
    }
    else
    {
      usernameField.setEditable(false);
      passwordField.setFocus();
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite top = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    
    top.setLayout(layout);
    top.setLayoutData(new GridData(768));
    
    Composite imageComposite = new Composite(top, 0);
    layout = new GridLayout();
    imageComposite.setLayout(layout);
    imageComposite.setLayoutData(new GridData(1040));
    
    Composite main = new Composite(top, 0);
    layout = new GridLayout();
    numColumns = 3;
    main.setLayout(layout);
    main.setLayoutData(new GridData(768));
    
    Label imageLabel = new Label(imageComposite, 0);
    keyLockImage = ImageDescriptor.createFromURL(JSchUIPlugin.getPlugin().getImageUrl("wizban/keylock.gif")).createImage();
    imageLabel.setImage(keyLockImage);
    GridData data = new GridData(768);
    imageLabel.setLayoutData(data);
    if (message != null)
    {
      Label messageLabel = new Label(main, 64);
      messageLabel.setText(message);
      data = new GridData(768);
      horizontalSpan = 3;
      widthHint = 300;
      messageLabel.setLayoutData(data);
    }
    if (domain != null)
    {
      Label d = new Label(main, 64);
      d.setText(Messages.UserValidationDialog_1);
      data = new GridData();
      d.setLayoutData(data);
      Label label = new Label(main, 64);
      label.setText(domain);
      data = new GridData(768);
      horizontalSpan = 2;
      widthHint = 300;
      label.setLayoutData(data);
    }
    createUsernameFields(main);
    createPasswordFields(main);
    if (domain != null)
    {
      allowCachingButton = new Button(main, 32);
      allowCachingButton.setText(Messages.UserValidationDialog_2);
      data = new GridData(768);
      horizontalSpan = 3;
      allowCachingButton.setLayoutData(data);
      allowCachingButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          allowCaching = allowCachingButton.getSelection();
        }
      });
    }
    Dialog.applyDialogFont(parent);
    
    return main;
  }
  
  protected void createPasswordFields(Composite parent)
  {
    new Label(parent, 0).setText(Messages.UserValidationDialog_4);
    
    passwordField = new Text(parent, 4196352);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    widthHint = convertHorizontalDLUsToPixels(200);
    passwordField.setLayoutData(data);
  }
  
  protected void createUsernameFields(Composite parent)
  {
    new Label(parent, 0).setText(Messages.UserValidationDialog_5);
    
    usernameField = new Text(parent, 2048);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    widthHint = convertHorizontalDLUsToPixels(200);
    usernameField.setLayoutData(data);
  }
  
  public String getPassword()
  {
    return password;
  }
  
  public String getUsername()
  {
    return username;
  }
  
  public boolean getAllowCaching()
  {
    return allowCaching;
  }
  
  protected void okPressed()
  {
    password = passwordField.getText();
    username = usernameField.getText();
    
    super.okPressed();
  }
  
  protected void cancelPressed()
  {
    password = null;
    username = null;
    super.cancelPressed();
  }
  
  public void setUsernameMutable(boolean value)
  {
    isUsernameMutable = value;
  }
  
  public boolean close()
  {
    if (keyLockImage != null) {
      keyLockImage.dispose();
    }
    return super.close();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.UserValidationDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui.authenticator;

public abstract interface IHelpContextIds
{
  public static final String PREFIX = "org.eclipse.jsch.ui.";
  public static final String KEYBOARD_INTERACTIVE_DIALOG = "org.eclipse.jsch.ui.keyboard_interactive_dialog_context";
  public static final String USER_VALIDATION_DIALOG = "org.eclipse.jsch.ui.user_validation_dialog_context";
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.authenticator.IHelpContextIds
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui.authenticator;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class KeyboardInteractiveDialog$1
  extends SelectionAdapter
{
  final KeyboardInteractiveDialog this$0;
  
  KeyboardInteractiveDialog$1(KeyboardInteractiveDialog paramKeyboardInteractiveDialog)
  {
    this$0 = paramKeyboardInteractiveDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.allowCaching = this$0.allowCachingButton.getSelection();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.authenticator.KeyboardInteractiveDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui.authenticator;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jsch.internal.ui.JSchUIPlugin;
import org.eclipse.jsch.internal.ui.Messages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class KeyboardInteractiveDialog
  extends TrayDialog
{
  protected boolean isUsernameMutable = false;
  private Text[] texts;
  protected Image keyLockImage;
  protected Button allowCachingButton;
  protected Text usernameField;
  protected String defaultUsername;
  protected String comment;
  protected String destination;
  protected String name;
  protected String instruction;
  protected String lang;
  protected String[] prompt;
  protected boolean[] echo;
  private String message;
  private String[] result;
  protected boolean allowCaching = false;
  private boolean isPasswordAuth = false;
  
  public KeyboardInteractiveDialog(Shell parentShell, String comment, String destination, String name, String userName, String instruction, String[] prompt, boolean[] echo)
  {
    super(parentShell);
    setShellStyle(getShellStyle() | 0x10);
    this.comment = comment;
    this.destination = destination;
    this.name = name;
    defaultUsername = userName;
    this.instruction = instruction;
    this.prompt = prompt;
    this.echo = echo;
    message = NLS.bind(Messages.KeyboradInteractiveDialog_message, 
      new String[] {destination + (
      (name != null) && (name.length() > 0) ? ": " + name : "") });
    if ((prompt != null) && (prompt.length == 1) && (prompt[0].trim().equalsIgnoreCase("password:"))) {
      isPasswordAuth = true;
    }
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    if (isPasswordAuth) {
      newShell.setText(Messages.UserValidationDialog_required);
    } else {
      newShell.setText(message);
    }
    PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, 
      "org.eclipse.jsch.ui.keyboard_interactive_dialog_context");
  }
  
  public void create()
  {
    super.create();
    if ((isPasswordAuth) && (usernameField != null))
    {
      usernameField.setText(defaultUsername);
      usernameField.setEditable(false);
    }
    if (texts.length > 0) {
      texts[0].setFocus();
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite top = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    
    top.setLayout(layout);
    top.setLayoutData(new GridData(768));
    
    Composite imageComposite = new Composite(top, 0);
    layout = new GridLayout();
    imageComposite.setLayout(layout);
    imageComposite.setLayoutData(new GridData(1040));
    
    Composite main = new Composite(top, 0);
    layout = new GridLayout();
    numColumns = 3;
    main.setLayout(layout);
    main.setLayoutData(new GridData(768));
    
    Label imageLabel = new Label(imageComposite, 0);
    keyLockImage = JSchUIPlugin.getImageDescriptor("wizban/keylock.gif")
      .createImage();
    imageLabel.setImage(keyLockImage);
    GridData data = new GridData(768);
    
    imageLabel.setLayoutData(data);
    if (message != null)
    {
      Label messageLabel = new Label(main, 64);
      messageLabel.setText(message);
      data = new GridData(768);
      horizontalSpan = 3;
      widthHint = 400;
      messageLabel.setLayoutData(data);
    }
    if (comment != null)
    {
      Label label = new Label(main, 64);
      if (isUsernameMutable) {
        label.setText(NLS.bind(Messages.UserValidationDialog_labelUser, 
          new String[] { comment }));
      } else {
        label.setText(NLS.bind(Messages.UserValidationDialog_labelPassword, 
          new Object[] { defaultUsername, comment }));
      }
      data = new GridData(768);
      horizontalSpan = 3;
      widthHint = 400;
      label.setLayoutData(data);
    }
    if ((instruction != null) && (instruction.length() > 0))
    {
      Label label = new Label(main, 64);
      label.setText(instruction);
      data = new GridData(768);
      horizontalSpan = 3;
      widthHint = 400;
      label.setLayoutData(data);
    }
    if (isPasswordAuth) {
      createUsernameFields(main);
    }
    createPasswordFields(main);
    if (isPasswordAuth)
    {
      allowCachingButton = new Button(main, 32);
      allowCachingButton.setText(Messages.UserValidationDialog_6);
      data = new GridData(768);
      horizontalSpan = 3;
      allowCachingButton.setLayoutData(data);
      allowCachingButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          allowCaching = allowCachingButton.getSelection();
        }
      });
    }
    Dialog.applyDialogFont(parent);
    
    return main;
  }
  
  protected void createUsernameFields(Composite parent)
  {
    new Label(parent, 0).setText(Messages.UserValidationDialog_user);
    
    usernameField = new Text(parent, 2048);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    widthHint = convertHorizontalDLUsToPixels(200);
    usernameField.setLayoutData(data);
  }
  
  protected void createPasswordFields(Composite parent)
  {
    texts = new Text[prompt.length];
    for (int i = 0; i < prompt.length; i++)
    {
      new Label(parent, 0).setText(prompt[i]);
      int flag = 2048;
      if (echo[i] == 0) {
        flag |= 0x400000;
      }
      texts[i] = new Text(parent, flag);
      GridData data = new GridData(768);
      horizontalSpan = 2;
      widthHint = convertHorizontalDLUsToPixels(200);
      texts[i].setLayoutData(data);
      if (echo[i] == 0) {
        texts[i].setEchoChar('*');
      }
    }
  }
  
  public String[] getResult()
  {
    return result;
  }
  
  public boolean getAllowCaching()
  {
    return allowCaching;
  }
  
  protected void okPressed()
  {
    result = new String[prompt.length];
    for (int i = 0; i < texts.length; i++) {
      result[i] = texts[i].getText();
    }
    super.okPressed();
  }
  
  public void setUsernameMutable(boolean value)
  {
    isUsernameMutable = value;
  }
  
  protected void cancelPressed()
  {
    result = null;
    super.cancelPressed();
  }
  
  public boolean close()
  {
    if (keyLockImage != null) {
      keyLockImage.dispose();
    }
    return super.close();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.authenticator.KeyboardInteractiveDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui.authenticator;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class UserValidationDialog$1
  extends SelectionAdapter
{
  final UserValidationDialog this$0;
  
  UserValidationDialog$1(UserValidationDialog paramUserValidationDialog)
  {
    this$0 = paramUserValidationDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.allowCaching = this$0.allowCachingButton.getSelection();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.authenticator.UserValidationDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui.authenticator;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jsch.internal.ui.JSchUIPlugin;
import org.eclipse.jsch.internal.ui.Messages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class UserValidationDialog
  extends TrayDialog
{
  protected Text usernameField;
  protected Text passwordField;
  protected Button allowCachingButton;
  protected String comment;
  protected String defaultUsername;
  protected String password = null;
  protected boolean allowCaching = false;
  protected boolean isAllowCaching = false;
  protected Image keyLockImage;
  protected boolean isUsernameMutable = true;
  protected String username = null;
  protected String message = null;
  
  public UserValidationDialog(Shell parentShell, String comment, String defaultName, String message, boolean isAllowCaching)
  {
    super(parentShell);
    setShellStyle(getShellStyle() | 0x10);
    defaultUsername = defaultName;
    this.comment = comment;
    this.message = message;
    this.isAllowCaching = isAllowCaching;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    newShell.setText(Messages.UserValidationDialog_required);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, 
      "org.eclipse.jsch.ui.user_validation_dialog_context");
  }
  
  public void create()
  {
    super.create();
    
    usernameField.setText(defaultUsername);
    if (isUsernameMutable)
    {
      usernameField.selectAll();
      usernameField.setFocus();
    }
    else
    {
      usernameField.setEditable(false);
      passwordField.setFocus();
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite top = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    
    top.setLayout(layout);
    top.setLayoutData(new GridData(768));
    
    Composite imageComposite = new Composite(top, 0);
    layout = new GridLayout();
    imageComposite.setLayout(layout);
    imageComposite.setLayoutData(new GridData(1040));
    
    Composite main = new Composite(top, 0);
    layout = new GridLayout();
    numColumns = 3;
    main.setLayout(layout);
    main.setLayoutData(new GridData(768));
    
    Label imageLabel = new Label(imageComposite, 0);
    keyLockImage = JSchUIPlugin.getImageDescriptor("wizban/keylock.gif")
      .createImage();
    imageLabel.setImage(keyLockImage);
    GridData data = new GridData(768);
    
    imageLabel.setLayoutData(data);
    if (message != null)
    {
      Label messageLabel = new Label(main, 64);
      messageLabel.setText(message);
      data = new GridData(768);
      horizontalSpan = 3;
      widthHint = 400;
      messageLabel.setLayoutData(data);
    }
    if (comment != null)
    {
      Label label = new Label(main, 64);
      if (isUsernameMutable) {
        label.setText(NLS.bind(Messages.UserValidationDialog_labelUser, 
          new String[] { comment }));
      } else {
        label.setText(NLS.bind(Messages.UserValidationDialog_labelPassword, 
          new Object[] { defaultUsername, comment }));
      }
      data = new GridData(768);
      horizontalSpan = 3;
      widthHint = 400;
      label.setLayoutData(data);
    }
    createUsernameFields(main);
    createPasswordFields(main);
    if (isAllowCaching)
    {
      allowCachingButton = new Button(main, 32);
      allowCachingButton.setText(Messages.UserValidationDialog_6);
      data = new GridData(768);
      horizontalSpan = 3;
      allowCachingButton.setLayoutData(data);
      allowCachingButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          allowCaching = allowCachingButton.getSelection();
        }
      });
    }
    Dialog.applyDialogFont(parent);
    
    return main;
  }
  
  protected void createPasswordFields(Composite parent)
  {
    new Label(parent, 0).setText(Messages.UserValidationDialog_password);
    
    passwordField = new Text(parent, 4196352);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    widthHint = convertHorizontalDLUsToPixels(200);
    passwordField.setLayoutData(data);
  }
  
  protected void createUsernameFields(Composite parent)
  {
    new Label(parent, 0).setText(Messages.UserValidationDialog_user);
    
    usernameField = new Text(parent, 2048);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    widthHint = convertHorizontalDLUsToPixels(200);
    usernameField.setLayoutData(data);
  }
  
  public String getPassword()
  {
    return password;
  }
  
  public String getUsername()
  {
    return username;
  }
  
  public boolean getAllowCaching()
  {
    return allowCaching;
  }
  
  protected void okPressed()
  {
    password = passwordField.getText();
    username = usernameField.getText();
    
    super.okPressed();
  }
  
  public void setUsernameMutable(boolean value)
  {
    isUsernameMutable = value;
  }
  
  public boolean close()
  {
    if (keyLockImage != null) {
      keyLockImage.dispose();
    }
    return super.close();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.authenticator.UserValidationDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui.authenticator;

import org.eclipse.jsch.core.IJSchLocation;
import org.eclipse.jsch.internal.core.IUserInfo;

class WorkbenchUserAuthenticator$1
  implements Runnable
{
  final WorkbenchUserAuthenticator this$0;
  private final boolean[] val$allowCaching;
  private final IJSchLocation val$location;
  private final IUserInfo val$userinfo;
  private final String val$message;
  private final String[] val$result;
  
  WorkbenchUserAuthenticator$1(WorkbenchUserAuthenticator paramWorkbenchUserAuthenticator, boolean[] paramArrayOfBoolean, IJSchLocation paramIJSchLocation, IUserInfo paramIUserInfo, String paramString, String[] paramArrayOfString)
  {
    this$0 = paramWorkbenchUserAuthenticator;val$allowCaching = paramArrayOfBoolean;val$location = paramIJSchLocation;val$userinfo = paramIUserInfo;val$message = paramString;val$result = paramArrayOfString;
  }
  
  public void run()
  {
    val$allowCaching[0] = this$0.promptForPassword(val$location, val$userinfo.getUsername(), 
      val$message, val$userinfo.isUsernameMutable(), val$result);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.ui.authenticator.WorkbenchUserAuthenticator.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.ui.authenticator;

import org.eclipse.jsch.core.IJSchLocation;

class WorkbenchUserAuthenticator$2
  implements Runnable
{
  final WorkbenchUserAuthenticator this$0;
  private final String[][] val$result;
  private final IJSchLocation val$location;
  private final String val$destination;
  private final String val$name;
  private final String val$instruction;
  private final String[] val$prompt;
  private final boolean[] val$echo;
  private final boolean[] val$allowCaching;
  
  WorkbenchUserAuthenticator$2(WorkbenchUserAuthenticator paramWorkbenchUserAuthenticator, String[][] paramArrayOfString, IJSchLocation paramIJSchLocation, String paramStri
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd