org.eclipse.mylyn.commons.repositories.ui_0.9.1.v20120425-0100

16:46:29.560 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.commons.repositories.ui_0.9.1.v20120425-0100.jar
package org.eclipse.mylyn.commons.repositories.ui;

import org.eclipse.core.runtime.Assert;
import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationType;
import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;

class RepositoryLocationPart$UserCredentialsListener
  implements ModifyListener, SelectionListener
{
  private final AuthenticationType<UserCredentials> authenticationType;
  private final Text domainText;
  private final Button enabledButton;
  private boolean enablementReversed;
  private final Text passwordText;
  private final Button savePasswordButton;
  private boolean updating;
  private final Text userText;
  
  public RepositoryLocationPart$UserCredentialsListener(AuthenticationType<UserCredentials> arg1, Button authenticationType, Text enabledButton, Text userText, Text passwordText, Button domainText)
  {
    Assert.isNotNull(authenticationType);
    Assert.isNotNull(enabledButton);
    Assert.isNotNull(userText);
    Assert.isNotNull(passwordText);
    this.authenticationType = authenticationType;
    this.enabledButton = enabledButton;
    this.userText = userText;
    this.passwordText = passwordText;
    this.domainText = domainText;
    this.savePasswordButton = savePasswordButton;
    init();
  }
  
  public boolean isEnablementReversed()
  {
    return enablementReversed;
  }
  
  public void modifyText(ModifyEvent event)
  {
    apply();
  }
  
  public void setEnabled(boolean enabled)
  {
    if (!enabled)
    {
      enabledButton.setEnabled(false);
      setInputFieldsEnabled(false);
    }
    else
    {
      enabledButton.setEnabled(true);
      updateWidgetEnablement();
    }
  }
  
  public void setEnablementReversed(boolean enablementReversed)
  {
    this.enablementReversed = enablementReversed;
  }
  
  public void widgetDefaultSelected(SelectionEvent event)
  {
    apply();
  }
  
  public void widgetSelected(SelectionEvent event)
  {
    apply();
    if (widget == enabledButton) {
      updateWidgetEnablement();
    }
  }
  
  private void apply()
  {
    if (updating) {
      return;
    }
    if (getEnabledButtonSelection())
    {
      String domain = domainText != null ? domainText.getText() : null;
      UserCredentials credentials = new UserCredentials(userText.getText(), passwordText.getText(), domain, 
        savePasswordButton.getSelection());
      this$0.getWorkingCopy().setCredentials(authenticationType, credentials);
    }
    else
    {
      this$0.getWorkingCopy().setCredentials(authenticationType, null);
    }
  }
  
  /* Error */
  private void restore()
  {
    // Byte code:
    //   0: aload_0
    //   1: iconst_1
    //   2: putfield 132	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updating	Z
    //   5: aload_0
    //   6: getfield 134	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:this$0	Lorg/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart;
    //   9: invokevirtual 150	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart:getWorkingCopy	()Lorg/eclipse/mylyn/commons/repositories/core/RepositoryLocation;
    //   12: aload_0
    //   13: getfield 133	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:authenticationType	Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationType;
    //   16: invokevirtual 143	org/eclipse/mylyn/commons/repositories/core/RepositoryLocation:getCredentials	(Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationType;)Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationCredentials;
    //   19: checkcast 64	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials
    //   22: astore_1
    //   23: aload_1
    //   24: ifnull +88 -> 112
    //   27: aload_0
    //   28: getfield 135	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:enabledButton	Lorg/eclipse/swt/widgets/Button;
    //   31: aload_0
    //   32: invokevirtual 156	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:isEnablementReversed	()Z
    //   35: ifeq +7 -> 42
    //   38: iconst_0
    //   39: goto +4 -> 43
    //   42: iconst_1
    //   43: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
    //   46: aload_0
    //   47: getfield 139	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:userText	Lorg/eclipse/swt/widgets/Text;
    //   50: aload_1
    //   51: invokevirtual 148	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getUserName	()Ljava/lang/String;
    //   54: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
    //   57: aload_0
    //   58: getfield 138	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:passwordText	Lorg/eclipse/swt/widgets/Text;
    //   61: aload_1
    //   62: invokevirtual 147	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getPassword	()Ljava/lang/String;
    //   65: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
    //   68: aload_0
    //   69: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
    //   72: ifnull +26 -> 98
    //   75: aload_0
    //   76: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
    //   79: aload_1
    //   80: invokevirtual 146	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getDomain	()Ljava/lang/String;
    //   83: ifnull +10 -> 93
    //   86: aload_1
    //   87: invokevirtual 146	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getDomain	()Ljava/lang/String;
    //   90: goto +5 -> 95
    //   93: ldc 1
    //   95: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
    //   98: aload_0
    //   99: getfield 136	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:savePasswordButton	Lorg/eclipse/swt/widgets/Button;
    //   102: aload_1
    //   103: invokevirtual 145	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getSavePassword	()Z
    //   106: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
    //   109: goto +67 -> 176
    //   112: aload_0
    //   113: getfield 135	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:enabledButton	Lorg/eclipse/swt/widgets/Button;
    //   116: aload_0
    //   117: invokevirtual 156	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:isEnablementReversed	()Z
    //   120: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
    //   123: aload_0
    //   124: getfield 139	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:userText	Lorg/eclipse/swt/widgets/Text;
    //   127: ldc 1
    //   129: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
    //   132: aload_0
    //   133: getfield 138	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:passwordText	Lorg/eclipse/swt/widgets/Text;
    //   136: ldc 1
    //   138: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
    //   141: aload_0
    //   142: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
    //   145: ifnull +12 -> 157
    //   148: aload_0
    //   149: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
    //   152: ldc 1
    //   154: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
    //   157: aload_0
    //   158: getfield 136	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:savePasswordButton	Lorg/eclipse/swt/widgets/Button;
    //   161: iconst_1
    //   162: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
    //   165: goto +11 -> 176
    //   168: astore_2
    //   169: aload_0
    //   170: iconst_0
    //   171: putfield 132	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updating	Z
    //   174: aload_2
    //   175: athrow
    //   176: aload_0
    //   177: iconst_0
    //   178: putfield 132	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updating	Z
    //   181: aload_0
    //   182: invokespecial 154	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updateWidgetEnablement	()V
    //   185: return
    // Line number table:
    //   Java source line #318	-> byte code offset #0
    //   Java source line #319	-> byte code offset #5
    //   Java source line #320	-> byte code offset #23
    //   Java source line #321	-> byte code offset #27
    //   Java source line #322	-> byte code offset #46
    //   Java source line #323	-> byte code offset #57
    //   Java source line #324	-> byte code offset #68
    //   Java source line #325	-> byte code offset #75
    //   Java source line #327	-> byte code offset #98
    //   Java source line #329	-> byte code offset #112
    //   Java source line #330	-> byte code offset #123
    //   Java source line #331	-> byte code offset #132
    //   Java source line #332	-> byte code offset #141
    //   Java source line #333	-> byte code offset #148
    //   Java source line #335	-> byte code offset #157
    //   Java source line #337	-> byte code offset #168
    //   Java source line #338	-> byte code offset #169
    //   Java source line #339	-> byte code offset #174
    //   Java source line #338	-> byte code offset #176
    //   Java source line #340	-> byte code offset #181
    //   Java source line #341	-> byte code offset #185
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	186	0	this	UserCredentialsListener
    //   22	81	1	credentials	UserCredentials
    //   168	7	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	168	168	finally
  }
  
  private void setInputFieldsEnabled(boolean enabled)
  {
    userText.setEnabled(enabled);
    passwordText.setEnabled(enabled);
    if (domainText != null) {
      domainText.setEnabled(enabled);
    }
    savePasswordButton.setEnabled(enabled);
  }
  
  private void updateWidgetEnablement()
  {
    setInputFieldsEnabled(getEnabledButtonSelection());
  }
  
  protected boolean getEnabledButtonSelection()
  {
    return enabledButton.getSelection() ^ isEnablementReversed();
  }
  
  protected void init()
  {
    enabledButton.addSelectionListener(this);
    userText.addModifyListener(this);
    passwordText.addModifyListener(this);
    if (domainText != null) {
      domainText.addModifyListener(this);
    }
    savePasswordButton.addSelectionListener(this);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.repositories.ui.RepositoryLocationPart.UserCredentialsListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.repositories.ui;

import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.databinding.dialog.DialogPageSupport;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.databinding.wizard.WizardPageSupport;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
import org.eclipse.mylyn.commons.repositories.core.RepositoryValidator;
import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationType;
import org.eclipse.mylyn.commons.repositories.core.auth.CertificateCredentials;
import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
import org.eclipse.mylyn.commons.workbench.forms.SectionComposite;
import org.eclipse.mylyn.internal.commons.repositories.ui.RepositoryLocationValueProperty;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.statushandlers.StatusManager;

public class RepositoryLocationPart
{
  protected static final String PREFS_PAGE_ID_NET_PROXY = "org.eclipse.ui.net.NetPreferences";
  private DataBindingContext bindingContext;
  private boolean needsAdditionalSections;
  private boolean needsAnonymousLogin;
  private boolean needsCertificateAuth;
  private boolean needsHttpAuth;
  private boolean needsProxy;
  private boolean needsValidation;
  private IAdaptable serviceLocator;
  private final RepositoryLocation workingCopy;
  
  public class UrlValidator
    implements IValidator
  {
    public UrlValidator() {}
    
    public IStatus validate(Object value)
    {
      if (!isValidUrl(value.toString())) {
        return new Status(4, "org.eclipse.mylyn.commons.repositories.ui", 
          Messages.RepositoryLocationPart_Enter_a_valid_server_url);
      }
      return Status.OK_STATUS;
    }
  }
  
  private class CertificateCredentialsListener
    implements ModifyListener, SelectionListener
  {
    private final AuthenticationType<CertificateCredentials> authenticationType;
    private final Button enabledButton;
    private final Text keyStoreFileNameText;
    private final Text passwordText;
    private final Button savePasswordButton;
    private boolean updating;
    
    public CertificateCredentialsListener(Button authenticationType, Text enabledButton, Text keyStoreFileNameText, Button passwordText)
    {
      Assert.isNotNull(authenticationType);
      Assert.isNotNull(enabledButton);
      Assert.isNotNull(keyStoreFileNameText);
      Assert.isNotNull(passwordText);
      this.authenticationType = authenticationType;
      this.enabledButton = enabledButton;
      this.keyStoreFileNameText = keyStoreFileNameText;
      this.passwordText = passwordText;
      this.savePasswordButton = savePasswordButton;
      init();
    }
    
    public void modifyText(ModifyEvent event)
    {
      apply();
    }
    
    public void setEnabled(boolean enabled)
    {
      if (!enabled)
      {
        enabledButton.setEnabled(false);
        setInputFieldsEnabled(false);
      }
      else
      {
        enabledButton.setEnabled(true);
        updateWidgetEnablement();
      }
    }
    
    public void widgetDefaultSelected(SelectionEvent event)
    {
      apply();
    }
    
    public void widgetSelected(SelectionEvent event)
    {
      apply();
      if (widget == enabledButton) {
        updateWidgetEnablement();
      }
    }
    
    private void apply()
    {
      if (updating) {
        return;
      }
      if (getEnabledButtonSelection())
      {
        CertificateCredentials credentials = new CertificateCredentials(keyStoreFileNameText.getText(), 
          passwordText.getText(), null, savePasswordButton.getSelection());
        getWorkingCopy().setCredentials(authenticationType, credentials);
      }
      else
      {
        getWorkingCopy().setCredentials(authenticationType, null);
      }
    }
    
    /* Error */
    private void restore()
    {
      // Byte code:
      //   0: aload_0
      //   1: iconst_1
      //   2: putfield 120	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:updating	Z
      //   5: aload_0
      //   6: getfield 122	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:this$0	Lorg/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart;
      //   9: invokevirtual 136	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart:getWorkingCopy	()Lorg/eclipse/mylyn/commons/repositories/core/RepositoryLocation;
      //   12: aload_0
      //   13: getfield 121	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:authenticationType	Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationType;
      //   16: invokevirtual 130	org/eclipse/mylyn/commons/repositories/core/RepositoryLocation:getCredentials	(Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationType;)Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationCredentials;
      //   19: checkcast 58	org/eclipse/mylyn/commons/repositories/core/auth/CertificateCredentials
      //   22: astore_1
      //   23: aload_1
      //   24: ifnull +47 -> 71
      //   27: aload_0
      //   28: getfield 123	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:enabledButton	Lorg/eclipse/swt/widgets/Button;
      //   31: iconst_1
      //   32: invokevirtual 145	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   35: aload_0
      //   36: getfield 125	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:keyStoreFileNameText	Lorg/eclipse/swt/widgets/Text;
      //   39: aload_1
      //   40: invokevirtual 133	org/eclipse/mylyn/commons/repositories/core/auth/CertificateCredentials:getKeyStoreFileName	()Ljava/lang/String;
      //   43: invokevirtual 149	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   46: aload_0
      //   47: getfield 126	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:passwordText	Lorg/eclipse/swt/widgets/Text;
      //   50: aload_1
      //   51: invokevirtual 134	org/eclipse/mylyn/commons/repositories/core/auth/CertificateCredentials:getPassword	()Ljava/lang/String;
      //   54: invokevirtual 149	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   57: aload_0
      //   58: getfield 124	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:savePasswordButton	Lorg/eclipse/swt/widgets/Button;
      //   61: aload_1
      //   62: invokevirtual 132	org/eclipse/mylyn/commons/repositories/core/auth/CertificateCredentials:getSavePassword	()Z
      //   65: invokevirtual 145	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   68: goto +48 -> 116
      //   71: aload_0
      //   72: getfield 123	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:enabledButton	Lorg/eclipse/swt/widgets/Button;
      //   75: iconst_0
      //   76: invokevirtual 145	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   79: aload_0
      //   80: getfield 125	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:keyStoreFileNameText	Lorg/eclipse/swt/widgets/Text;
      //   83: ldc 1
      //   85: invokevirtual 149	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   88: aload_0
      //   89: getfield 126	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:passwordText	Lorg/eclipse/swt/widgets/Text;
      //   92: ldc 1
      //   94: invokevirtual 149	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   97: aload_0
      //   98: getfield 124	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:savePasswordButton	Lorg/eclipse/swt/widgets/Button;
      //   101: iconst_1
      //   102: invokevirtual 145	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   105: goto +11 -> 116
      //   108: astore_2
      //   109: aload_0
      //   110: iconst_0
      //   111: putfield 120	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:updating	Z
      //   114: aload_2
      //   115: athrow
      //   116: aload_0
      //   117: iconst_0
      //   118: putfield 120	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:updating	Z
      //   121: aload_0
      //   122: invokespecial 140	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$CertificateCredentialsListener:updateWidgetEnablement	()V
      //   125: return
      // Line number table:
      //   Java source line #157	-> byte code offset #0
      //   Java source line #158	-> byte code offset #5
      //   Java source line #159	-> byte code offset #23
      //   Java source line #160	-> byte code offset #27
      //   Java source line #161	-> byte code offset #35
      //   Java source line #162	-> byte code offset #46
      //   Java source line #163	-> byte code offset #57
      //   Java source line #165	-> byte code offset #71
      //   Java source line #166	-> byte code offset #79
      //   Java source line #167	-> byte code offset #88
      //   Java source line #168	-> byte code offset #97
      //   Java source line #170	-> byte code offset #108
      //   Java source line #171	-> byte code offset #109
      //   Java source line #172	-> byte code offset #114
      //   Java source line #171	-> byte code offset #116
      //   Java source line #173	-> byte code offset #121
      //   Java source line #174	-> byte code offset #125
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	126	0	this	CertificateCredentialsListener
      //   22	40	1	credentials	CertificateCredentials
      //   108	7	2	localObject	Object
      // Exception table:
      //   from	to	target	type
      //   0	108	108	finally
    }
    
    private void setInputFieldsEnabled(boolean enabled)
    {
      keyStoreFileNameText.setEnabled(enabled);
      passwordText.setEnabled(enabled);
      savePasswordButton.setEnabled(enabled);
    }
    
    private void updateWidgetEnablement()
    {
      setInputFieldsEnabled(getEnabledButtonSelection());
    }
    
    protected boolean getEnabledButtonSelection()
    {
      return enabledButton.getSelection();
    }
    
    protected void init()
    {
      enabledButton.addSelectionListener(this);
      keyStoreFileNameText.addModifyListener(this);
      passwordText.addModifyListener(this);
      savePasswordButton.addSelectionListener(this);
    }
  }
  
  private class ResizingSectionComposite
    extends SectionComposite
  {
    private boolean ignoreUpdate;
    
    public ResizingSectionComposite(Composite parent, int style)
    {
      super(style);
    }
    
    public void reflow(boolean flushCache)
    {
      super.reflow(flushCache);
      updateLayout();
    }
    
    /* Error */
    public void updateLayout()
    {
      // Byte code:
      //   0: aload_0
      //   1: getfield 56	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:ignoreUpdate	Z
      //   4: ifeq +4 -> 8
      //   7: return
      //   8: aload_0
      //   9: iconst_1
      //   10: putfield 56	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:ignoreUpdate	Z
      //   13: aload_0
      //   14: invokevirtual 61	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:getLayoutData	()Ljava/lang/Object;
      //   17: checkcast 33	org/eclipse/swt/layout/GridData
      //   20: iconst_1
      //   21: putfield 59	org/eclipse/swt/layout/GridData:grabExcessVerticalSpace	Z
      //   24: aload_0
      //   25: invokevirtual 62	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:getSize	()Lorg/eclipse/swt/graphics/Point;
      //   28: getfield 58	org/eclipse/swt/graphics/Point:y	I
      //   31: aload_0
      //   32: iconst_m1
      //   33: iconst_m1
      //   34: iconst_0
      //   35: invokevirtual 63	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:computeSize	(IIZ)Lorg/eclipse/swt/graphics/Point;
      //   38: getfield 58	org/eclipse/swt/graphics/Point:y	I
      //   41: if_icmpgt +7 -> 48
      //   44: iconst_1
      //   45: goto +4 -> 49
      //   48: iconst_0
      //   49: istore_1
      //   50: iload_1
      //   51: aload_0
      //   52: invokevirtual 61	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:getLayoutData	()Ljava/lang/Object;
      //   55: checkcast 33	org/eclipse/swt/layout/GridData
      //   58: getfield 59	org/eclipse/swt/layout/GridData:grabExcessVerticalSpace	Z
      //   61: if_icmpeq +34 -> 95
      //   64: aload_0
      //   65: invokevirtual 61	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:getLayoutData	()Ljava/lang/Object;
      //   68: checkcast 33	org/eclipse/swt/layout/GridData
      //   71: iload_1
      //   72: putfield 59	org/eclipse/swt/layout/GridData:grabExcessVerticalSpace	Z
      //   75: aload_0
      //   76: invokevirtual 64	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:getParent	()Lorg/eclipse/swt/widgets/Composite;
      //   79: iconst_1
      //   80: iconst_1
      //   81: invokevirtual 67	org/eclipse/swt/widgets/Composite:layout	(ZZ)V
      //   84: goto +11 -> 95
      //   87: astore_2
      //   88: aload_0
      //   89: iconst_0
      //   90: putfield 56	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:ignoreUpdate	Z
      //   93: aload_2
      //   94: athrow
      //   95: aload_0
      //   96: iconst_0
      //   97: putfield 56	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$ResizingSectionComposite:ignoreUpdate	Z
      //   100: return
      // Line number table:
      //   Java source line #214	-> byte code offset #0
      //   Java source line #215	-> byte code offset #7
      //   Java source line #219	-> byte code offset #8
      //   Java source line #222	-> byte code offset #13
      //   Java source line #223	-> byte code offset #24
      //   Java source line #224	-> byte code offset #50
      //   Java source line #226	-> byte code offset #64
      //   Java source line #227	-> byte code offset #75
      //   Java source line #229	-> byte code offset #87
      //   Java source line #230	-> byte code offset #88
      //   Java source line #231	-> byte code offset #93
      //   Java source line #230	-> byte code offset #95
      //   Java source line #232	-> byte code offset #100
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	101	0	this	ResizingSectionComposite
      //   49	23	1	grab	boolean
      //   87	7	2	localObject	Object
      // Exception table:
      //   from	to	target	type
      //   8	87	87	finally
    }
  }
  
  private class UserCredentialsListener
    implements ModifyListener, SelectionListener
  {
    private final AuthenticationType<UserCredentials> authenticationType;
    private final Text domainText;
    private final Button enabledButton;
    private boolean enablementReversed;
    private final Text passwordText;
    private final Button savePasswordButton;
    private boolean updating;
    private final Text userText;
    
    public UserCredentialsListener(Button authenticationType, Text enabledButton, Text userText, Text passwordText, Button domainText)
    {
      Assert.isNotNull(authenticationType);
      Assert.isNotNull(enabledButton);
      Assert.isNotNull(userText);
      Assert.isNotNull(passwordText);
      this.authenticationType = authenticationType;
      this.enabledButton = enabledButton;
      this.userText = userText;
      this.passwordText = passwordText;
      this.domainText = domainText;
      this.savePasswordButton = savePasswordButton;
      init();
    }
    
    public boolean isEnablementReversed()
    {
      return enablementReversed;
    }
    
    public void modifyText(ModifyEvent event)
    {
      apply();
    }
    
    public void setEnabled(boolean enabled)
    {
      if (!enabled)
      {
        enabledButton.setEnabled(false);
        setInputFieldsEnabled(false);
      }
      else
      {
        enabledButton.setEnabled(true);
        updateWidgetEnablement();
      }
    }
    
    public void setEnablementReversed(boolean enablementReversed)
    {
      this.enablementReversed = enablementReversed;
    }
    
    public void widgetDefaultSelected(SelectionEvent event)
    {
      apply();
    }
    
    public void widgetSelected(SelectionEvent event)
    {
      apply();
      if (widget == enabledButton) {
        updateWidgetEnablement();
      }
    }
    
    private void apply()
    {
      if (updating) {
        return;
      }
      if (getEnabledButtonSelection())
      {
        String domain = domainText != null ? domainText.getText() : null;
        UserCredentials credentials = new UserCredentials(userText.getText(), passwordText.getText(), domain, 
          savePasswordButton.getSelection());
        getWorkingCopy().setCredentials(authenticationType, credentials);
      }
      else
      {
        getWorkingCopy().setCredentials(authenticationType, null);
      }
    }
    
    /* Error */
    private void restore()
    {
      // Byte code:
      //   0: aload_0
      //   1: iconst_1
      //   2: putfield 132	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updating	Z
      //   5: aload_0
      //   6: getfield 134	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:this$0	Lorg/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart;
      //   9: invokevirtual 150	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart:getWorkingCopy	()Lorg/eclipse/mylyn/commons/repositories/core/RepositoryLocation;
      //   12: aload_0
      //   13: getfield 133	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:authenticationType	Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationType;
      //   16: invokevirtual 143	org/eclipse/mylyn/commons/repositories/core/RepositoryLocation:getCredentials	(Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationType;)Lorg/eclipse/mylyn/commons/repositories/core/auth/AuthenticationCredentials;
      //   19: checkcast 64	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials
      //   22: astore_1
      //   23: aload_1
      //   24: ifnull +88 -> 112
      //   27: aload_0
      //   28: getfield 135	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:enabledButton	Lorg/eclipse/swt/widgets/Button;
      //   31: aload_0
      //   32: invokevirtual 156	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:isEnablementReversed	()Z
      //   35: ifeq +7 -> 42
      //   38: iconst_0
      //   39: goto +4 -> 43
      //   42: iconst_1
      //   43: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   46: aload_0
      //   47: getfield 139	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:userText	Lorg/eclipse/swt/widgets/Text;
      //   50: aload_1
      //   51: invokevirtual 148	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getUserName	()Ljava/lang/String;
      //   54: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   57: aload_0
      //   58: getfield 138	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:passwordText	Lorg/eclipse/swt/widgets/Text;
      //   61: aload_1
      //   62: invokevirtual 147	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getPassword	()Ljava/lang/String;
      //   65: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   68: aload_0
      //   69: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
      //   72: ifnull +26 -> 98
      //   75: aload_0
      //   76: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
      //   79: aload_1
      //   80: invokevirtual 146	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getDomain	()Ljava/lang/String;
      //   83: ifnull +10 -> 93
      //   86: aload_1
      //   87: invokevirtual 146	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getDomain	()Ljava/lang/String;
      //   90: goto +5 -> 95
      //   93: ldc 1
      //   95: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   98: aload_0
      //   99: getfield 136	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:savePasswordButton	Lorg/eclipse/swt/widgets/Button;
      //   102: aload_1
      //   103: invokevirtual 145	org/eclipse/mylyn/commons/repositories/core/auth/UserCredentials:getSavePassword	()Z
      //   106: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   109: goto +67 -> 176
      //   112: aload_0
      //   113: getfield 135	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:enabledButton	Lorg/eclipse/swt/widgets/Button;
      //   116: aload_0
      //   117: invokevirtual 156	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:isEnablementReversed	()Z
      //   120: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   123: aload_0
      //   124: getfield 139	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:userText	Lorg/eclipse/swt/widgets/Text;
      //   127: ldc 1
      //   129: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   132: aload_0
      //   133: getfield 138	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:passwordText	Lorg/eclipse/swt/widgets/Text;
      //   136: ldc 1
      //   138: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   141: aload_0
      //   142: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
      //   145: ifnull +12 -> 157
      //   148: aload_0
      //   149: getfield 137	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:domainText	Lorg/eclipse/swt/widgets/Text;
      //   152: ldc 1
      //   154: invokevirtual 164	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
      //   157: aload_0
      //   158: getfield 136	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:savePasswordButton	Lorg/eclipse/swt/widgets/Button;
      //   161: iconst_1
      //   162: invokevirtual 160	org/eclipse/swt/widgets/Button:setSelection	(Z)V
      //   165: goto +11 -> 176
      //   168: astore_2
      //   169: aload_0
      //   170: iconst_0
      //   171: putfield 132	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updating	Z
      //   174: aload_2
      //   175: athrow
      //   176: aload_0
      //   177: iconst_0
      //   178: putfield 132	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updating	Z
      //   181: aload_0
      //   182: invokespecial 154	org/eclipse/mylyn/commons/repositories/ui/RepositoryLocationPart$UserCredentialsListener:updateWidgetEnablement	()V
      //   185: return
      // Line number table:
      //   Java source line #318	-> byte code offset #0
      //   Java source line #319	-> byte code offset #5
      //   Java source line #320	-> byte code offset #23
      //   Java source line #321	-> byte code offset #27
      //   Java source line #322	-> byte code offset #46
      //   Java source line #323	-> byte code offset #57
      //   Java source line #324	-> byte code offset #68
      //   Java source line #325	-> byte code offset #75
      //   Java source line #327	-> byte code offset #98
      //   Java source line #329	-> byte code offset #112
      //   Java source line #330	-> byte code offset #123
      //   Java source line #331	-> byte code offset #132
      //   Java source line #332	-> byte code offset #141
      //   Java source line #333	-> byte code offset #148
      //   Java source line #335	-> byte code offset #157
      //   Java source line #337	-> byte code offset #168
      //   Java source line #338	-> byte code offset #169
      //   Java source line #339	-> byte code offset #174
      //   Java source line #338	-> byte code offset #176
      //   Java source line #340	-> byte code offset #181
      //   Java source line #341	-> byte code offset #185
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	186	0	this	UserCredentialsListener
      //   22	81	1	credentials	UserCredentials
      //   168	7	2	localObject	Object
      // Exception table:
      //   from	to	target	type
      //   0	168	168	finally
    }
    
    private void setInputFieldsEnabled(boolean enabled)
    {
      userText.setEnabled(enabled);
      passwordText.setEnabled(enabled);
      if (domainText != null) {
        domainText.setEnabled(enabled);
      }
      savePasswordButton.setEnabled(enabled);
    }
    
    private void updateWidgetEnablement()
    {
      setInputFieldsEnabled(getEnabledButtonSelection());
    }
    
    protected boolean getEnabledButtonSelection()
    {
      return enabledButton.getSelection() ^ isEnablementReversed();
    }
    
    protected void init()
    {
      enabledButton.addSelectionListener(this);
      userText.addModifyListener(this);
      passwordText.addModifyListener(this);
      if (domainText != null) {
        domainText.addModifyListener(this);
      }
      savePasswordButton.addSelectionListener(this);
    }
  }
  
  public RepositoryLocationPart(RepositoryLocation workingCopy)
  {
    this.workingCopy = workingCopy;
    setNeedsProxy(false);
    setNeedsHttpAuth(false);
    setNeedsCertificateAuth(false);
    setNeedsValidation(tru
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