org.eclipse.equinox.security.ui_1.1.100.v20120522-2049

16:44:45.422 INFO  jd.cli.Main - Decompiling org.eclipse.equinox.security.ui_1.1.100.v20120522-2049.jar
package org.eclipse.equinox.internal.provisional.security.ui;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.ui.IWorkbenchWindow;

public abstract class AuthorizationManager
{
  public abstract boolean isEnabled();
  
  public abstract boolean needsAttention();
  
  public abstract IStatus getStatus();
  
  public abstract void displayManager(IWorkbenchWindow paramIWorkbenchWindow);
}

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

import org.eclipse.equinox.internal.security.ui.SecurityStatusControl;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ContributionItemFactory;

class SecurityContributionItemFactory$1
  extends ContributionItemFactory
{
  SecurityContributionItemFactory$1(String $anonymous0)
  {
    super($anonymous0);
  }
  
  public IContributionItem create(IWorkbenchWindow window)
  {
    if (window == null) {
      throw new IllegalArgumentException();
    }
    return new SecurityStatusControl(window, getId());
  }
}

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

import org.eclipse.equinox.internal.security.ui.SecurityStatusControl;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ContributionItemFactory;

public abstract class SecurityContributionItemFactory
{
  private final String contributionItemId;
  
  protected SecurityContributionItemFactory(String contributionItemId)
  {
    this.contributionItemId = contributionItemId;
  }
  
  public String getId()
  {
    return contributionItemId;
  }
  
  public static final ContributionItemFactory SECURITY_STATUS = new ContributionItemFactory("securityStatus")
  {
    public IContributionItem create(IWorkbenchWindow window)
    {
      if (window == null) {
        throw new IllegalArgumentException();
      }
      return new SecurityStatusControl(window, getId());
    }
  };
}

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

import java.util.ArrayList;
import java.util.Iterator;
import javax.security.auth.x500.X500Principal;

public class X500PrincipalHelper
{
  public static int LEASTSIGNIFICANT = 0;
  public static int MOSTSIGNIFICANT = 1;
  public static final String attrCN = "CN";
  public static final String attrOU = "OU";
  public static final String attrO = "O";
  public static final String attrC = "C";
  public static final String attrL = "L";
  public static final String attrST = "ST";
  public static final String attrSTREET = "STREET";
  public static final String attrEMAIL = "EMAILADDRESS";
  public static final String attrUID = "UID";
  ArrayList rdnNameArray = new ArrayList();
  private static final String attrTerminator = "=";
  
  public X500PrincipalHelper() {}
  
  public X500PrincipalHelper(X500Principal principal)
  {
    parseDN(principal.getName("RFC2253"));
  }
  
  public void setPrincipal(X500Principal principal)
  {
    parseDN(principal.getName("RFC2253"));
  }
  
  public String getCN()
  {
    return findPart("CN");
  }
  
  public String getOU()
  {
    return findPart("OU");
  }
  
  public String getO()
  {
    return findPart("O");
  }
  
  public String getC()
  {
    return findPart("C");
  }
  
  public String getL()
  {
    return findPart("L");
  }
  
  public String getST()
  {
    return findPart("ST");
  }
  
  public String getSTREET()
  {
    return findPart("STREET");
  }
  
  public String getEMAILDDRESS()
  {
    return findPart("EMAILADDRESS");
  }
  
  public String getUID()
  {
    return findPart("UID");
  }
  
  private void parseDN(String dn)
    throws IllegalArgumentException
  {
    int startIndex = 0;
    char c = '\000';
    ArrayList nameValues = new ArrayList();
    
    rdnNameArray.clear();
    while (startIndex < dn.length())
    {
      for (int endIndex = startIndex; endIndex < dn.length(); endIndex++)
      {
        c = dn.charAt(endIndex);
        if ((c == ',') || (c == '+')) {
          break;
        }
        if (c == '\\') {
          endIndex++;
        }
      }
      if (endIndex > dn.length()) {
        throw new IllegalArgumentException("unterminated escape " + dn);
      }
      nameValues.add(dn.substring(startIndex, endIndex));
      if (c != '+')
      {
        rdnNameArray.add(nameValues);
        if (endIndex != dn.length()) {
          nameValues = new ArrayList();
        } else {
          nameValues = null;
        }
      }
      startIndex = endIndex + 1;
    }
    if (nameValues != null) {
      throw new IllegalArgumentException("improperly terminated DN " + dn);
    }
  }
  
  public ArrayList getAllValues(String attributeID)
  {
    ArrayList retList = new ArrayList();
    String searchPart = attributeID + "=";
    for (Iterator iter = rdnNameArray.iterator(); iter.hasNext();)
    {
      ArrayList nameList = (ArrayList)iter.next();
      String namePart = (String)nameList.get(0);
      if (namePart.startsWith(searchPart)) {
        retList.add(namePart.toString().substring(searchPart.length()));
      }
    }
    return retList;
  }
  
  private String findPart(String attributeID)
  {
    return findSignificantPart(attributeID, MOSTSIGNIFICANT);
  }
  
  private String findSignificantPart(String attributeID, int significance)
  {
    String retNamePart = null;
    String searchPart = attributeID + "=";
    for (Iterator iter = rdnNameArray.iterator(); iter.hasNext();)
    {
      ArrayList nameList = (ArrayList)iter.next();
      String namePart = (String)nameList.get(0);
      if (namePart.startsWith(searchPart))
      {
        retNamePart = namePart.toString().substring(searchPart.length());
        if (significance == MOSTSIGNIFICANT) {
          break;
        }
      }
    }
    return retNamePart;
  }
}

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

import java.security.cert.X509Certificate;
import java.text.DateFormat;
import org.eclipse.equinox.internal.security.ui.Activator;
import org.eclipse.equinox.internal.security.ui.SecurityUIMsg;
import org.eclipse.equinox.internal.security.ui.wizard.CertificateViewer;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
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.TabFolder;
import org.eclipse.swt.widgets.TabItem;

public class X509CertificateViewDialog
  extends TitleAreaDialog
{
  private static final String titleImageName = "/titleAreaCert.gif";
  private X509Certificate theCert;
  private static final DateFormat _df = DateFormat.getDateInstance(1);
  private X500PrincipalHelper nameHelper = new X500PrincipalHelper();
  private static Font boldFont = JFaceResources.getBannerFont();
  private Image titleImage;
  
  public X509CertificateViewDialog(Shell parentShell, X509Certificate cert)
  {
    super(parentShell);
    theCert = cert;
  }
  
  protected Control createContents(Composite parent)
  {
    return super.createContents(parent);
  }
  
  protected Control createDialogArea(Composite parent)
  {
    nameHelper.setPrincipal(theCert.getSubjectX500Principal());
    
    setTitle(nameHelper.getCN() != null ? nameHelper.getCN() : nameHelper.getOU());
    
    titleImage = Activator.getImageDescriptor("/titleAreaCert.gif").createImage();
    if (titleImage != null) {
      setTitleImage(titleImage);
    }
    Composite composite = (Composite)super.createDialogArea(parent);
    
    TabFolder tabFolder = new TabFolder(composite, 2048);
    GridData bdata = new GridData(1296);
    tabFolder.setLayoutData(bdata);
    
    createBasicTab(tabFolder);
    
    createAdvancedTab(tabFolder);
    
    return composite;
  }
  
  private void createBasicTab(TabFolder tabFolder)
  {
    String displayName = null;
    int labelIndent = 10;
    int dataIdent = 10;
    
    TabItem basicTab = new TabItem(tabFolder, 0);
    basicTab.setText(SecurityUIMsg.CERTVIEW_LABEL_BASIC);
    Composite basicTabComposite = new Composite(tabFolder, 0);
    
    GridLayout tabLayout = new GridLayout();
    numColumns = 2;
    basicTabComposite.setLayout(tabLayout);
    
    Label issueToLabel = new Label(basicTabComposite, 0);
    issueToLabel.setText(SecurityUIMsg.CERTPROP_X509_ISSUED_TO);
    issueToLabel.setFont(boldFont);
    configureLayout(issueToLabel, 2, 0, 0, 0);
    
    nameHelper.setPrincipal(theCert.getSubjectX500Principal());
    
    Label CNLabel = new Label(basicTabComposite, 0);
    CNLabel.setText(SecurityUIMsg.X500_LABEL_CN);
    configureLayout(CNLabel, 0, 0, labelIndent, 0);
    
    Label subjectCN = new Label(basicTabComposite, 0);
    displayName = nameHelper.getCN();
    subjectCN.setText(displayName != null ? displayName : SecurityUIMsg.CERTVAL_UNDEFINED);
    configureLayout(subjectCN, 0, 0, dataIdent, 0);
    
    Label OLabel = new Label(basicTabComposite, 0);
    OLabel.setText(SecurityUIMsg.X500_LABEL_O);
    configureLayout(OLabel, 0, 0, labelIndent, 0);
    
    Label subjectO = new Label(basicTabComposite, 0);
    displayName = nameHelper.getO();
    subjectO.setText(displayName != null ? displayName : SecurityUIMsg.CERTVAL_UNDEFINED);
    configureLayout(subjectO, 0, 0, dataIdent, 0);
    
    Label OULabel = new Label(basicTabComposite, 0);
    OULabel.setText(SecurityUIMsg.X500_LABEL_OU);
    configureLayout(OULabel, 0, 0, labelIndent, 0);
    
    Label subjectOU = new Label(basicTabComposite, 0);
    displayName = nameHelper.getOU();
    subjectOU.setText(displayName != null ? displayName : SecurityUIMsg.CERTVAL_UNDEFINED);
    configureLayout(subjectOU, 0, 0, dataIdent, 0);
    
    Label issueByLabel = new Label(basicTabComposite, 0);
    issueByLabel.setText(SecurityUIMsg.CERTPROP_X509_ISSUED_BY);
    configureLayout(issueByLabel, 2, 0, 0, 0);
    issueByLabel.setFont(boldFont);
    
    nameHelper.setPrincipal(theCert.getIssuerX500Principal());
    
    Label CNLabel2 = new Label(basicTabComposite, 0);
    CNLabel2.setText(SecurityUIMsg.X500_LABEL_CN);
    configureLayout(CNLabel2, 0, 0, labelIndent, 0);
    
    Label issuerCN = new Label(basicTabComposite, 0);
    displayName = nameHelper.getCN();
    issuerCN.setText(displayName != null ? displayName : SecurityUIMsg.CERTVAL_UNDEFINED);
    configureLayout(issuerCN, 0, 0, dataIdent, 0);
    
    Label OLabel2 = new Label(basicTabComposite, 0);
    OLabel2.setText(SecurityUIMsg.X500_LABEL_O);
    configureLayout(OLabel2, 0, 0, labelIndent, 0);
    
    Label issuerO = new Label(basicTabComposite, 0);
    displayName = nameHelper.getO();
    issuerO.setText(displayName != null ? displayName : SecurityUIMsg.CERTVAL_UNDEFINED);
    configureLayout(issuerO, 0, 0, dataIdent, 0);
    
    Label OULabel2 = new Label(basicTabComposite, 0);
    OULabel2.setText(SecurityUIMsg.X500_LABEL_OU);
    configureLayout(OULabel2, 0, 0, labelIndent, 0);
    
    Label issuerOU = new Label(basicTabComposite, 0);
    displayName = nameHelper.getOU();
    issuerOU.setText(displayName != null ? displayName : SecurityUIMsg.CERTVAL_UNDEFINED);
    configureLayout(issuerOU, 0, 0, dataIdent, 0);
    
    Label datesLabel = new Label(basicTabComposite, 0);
    datesLabel.setText(SecurityUIMsg.CERTVIEW_LABEL_VALIDITY_DATES);
    configureLayout(datesLabel, 2, 0, 0, 0);
    datesLabel.setFont(boldFont);
    
    Label validFrom = new Label(basicTabComposite, 0);
    validFrom.setText(SecurityUIMsg.CERTPROP_X509_VALID_FROM);
    configureLayout(validFrom, 0, 0, labelIndent, 0);
    
    Label fromDate = new Label(basicTabComposite, 0);
    fromDate.setText(_df.format(theCert.getNotBefore()));
    configureLayout(fromDate, 0, 0, dataIdent, 0);
    
    Label validTo = new Label(basicTabComposite, 0);
    validTo.setText(SecurityUIMsg.CERTPROP_X509_VALID_TO);
    configureLayout(validTo, 0, 0, labelIndent, 0);
    
    Label toDate = new Label(basicTabComposite, 0);
    toDate.setText(_df.format(theCert.getNotAfter()));
    configureLayout(toDate, 0, 0, dataIdent, 0);
    
    basicTab.setControl(basicTabComposite);
  }
  
  protected static void configureLayout(Control c, int horizontalSpan, int verticalSpan, int horizontalIndent, int vertIndent)
  {
    GridData gd = new GridData(36);
    
    horizontalSpan = horizontalSpan;
    verticalSpan = verticalSpan;
    horizontalIndent = horizontalIndent;
    verticalIndent = vertIndent;
    
    c.setLayoutData(gd);
  }
  
  private void createAdvancedTab(TabFolder tabFolder)
  {
    TabItem advancedTab = new TabItem(tabFolder, 0);
    advancedTab.setText(SecurityUIMsg.CERTVIEW_LABEL_DETAILS);
    Composite advTabComposite = new Composite(tabFolder, 0);
    advTabComposite.setLayout(new FillLayout(512));
    
    CertificateViewer certViewer = new CertificateViewer(advTabComposite);
    certViewer.setCertificate(theCert);
    advancedTab.setControl(advTabComposite);
  }
  
  protected void setShellStyle(int newShellStyle)
  {
    super.setShellStyle(newShellStyle | 0x10 | 0x860);
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    createButton(parent, 1, IDialogConstants.CLOSE_LABEL, true);
  }
  
  public boolean close()
  {
    if (titleImage != null) {
      titleImage.dispose();
    }
    return super.close();
  }
}

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

import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.provisional.security.ui.AuthorizationManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.internal.provisional.service.security.AuthorizationEngine;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.eclipse.osgi.service.security.TrustEngine;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.ServiceTracker;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.equinox.security.ui";
  private static final String PROP_TRUST_ENGINE = "osgi.signedcontent.trust.engine";
  private static final String PROP_AUTHZ_ENGINE = "osgi.signedcontent.authorization.engine";
  private static final String PROP_AUTHZ_MANAGER = "osgi.signedcontent.authorization.manager";
  private static final String PROP_DEFAULT_SERVICE = "org.eclipse.osgi";
  private static ServiceTracker trustEngineTracker;
  private static ServiceTracker authzEngineTracker;
  private static ServiceTracker authzManagerTracker;
  private static ServiceTracker platformAdminTracker;
  private static ServiceTracker debugTracker;
  private static Activator plugin;
  private static BundleContext bundleContext;
  private ServiceRegistration defaultAuthzManagerReg;
  private static final String OPTION_DEBUG = "org.eclipse.equinox.security.ui/debug";
  private static final String OPTION_DEBUG_STORAGE = "org.eclipse.equinox.security.ui/debug/storage";
  
  public static BundleContext getBundleContext()
  {
    return bundleContext;
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
  
  public static String getSymbolicName()
  {
    return plugin.getBundle().getSymbolicName();
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    bundleContext = context;
    plugin = this;
    
    Hashtable properties = new Hashtable(7);
    properties.put("service.ranking", new Integer(Integer.MIN_VALUE));
    properties.put("osgi.signedcontent.authorization.manager", "org.eclipse.osgi");
    defaultAuthzManagerReg = bundleContext.registerService(AuthorizationManager.class.getName(), new DefaultAuthorizationManager(), properties);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
    bundleContext = null;
    plugin = null;
    if (defaultAuthzManagerReg != null)
    {
      defaultAuthzManagerReg.unregister();
      defaultAuthzManagerReg = null;
    }
    if (authzEngineTracker != null)
    {
      authzEngineTracker.close();
      authzEngineTracker = null;
    }
    if (authzManagerTracker != null)
    {
      authzManagerTracker.close();
      authzManagerTracker = null;
    }
    if (platformAdminTracker != null)
    {
      platformAdminTracker.close();
      platformAdminTracker = null;
    }
    if (debugTracker != null)
    {
      debugTracker.close();
      debugTracker = null;
    }
  }
  
  public static TrustEngine[] getTrustEngines()
  {
    if (trustEngineTracker == null)
    {
      String trustAuthorityProp = getBundleContext().getProperty("osgi.signedcontent.trust.engine");
      Filter filter = null;
      if (trustAuthorityProp != null) {
        try
        {
          filter = FrameworkUtil.createFilter("(&(objectClass=" + TrustEngine.class.getName() + ")(" + "osgi.signedcontent.trust.engine" + "=" + trustAuthorityProp + "))");
        }
        catch (InvalidSyntaxException e)
        {
          e.printStackTrace();
        }
      }
      if (filter != null) {
        trustEngineTracker = new ServiceTracker(bundleContext, filter, null);
      } else {
        trustEngineTracker = new ServiceTracker(bundleContext, TrustEngine.class.getName(), null);
      }
      trustEngineTracker.open();
    }
    Object[] services = trustEngineTracker.getServices();
    if (services != null) {
      return (TrustEngine[])Arrays.asList(services).toArray(new TrustEngine[0]);
    }
    return new TrustEngine[0];
  }
  
  public static AuthorizationEngine getAuthorizationEngine()
  {
    if (authzEngineTracker == null)
    {
      String implProp = getBundleContext().getProperty("osgi.signedcontent.authorization.engine");
      Filter filter = null;
      if (implProp != null) {
        try
        {
          filter = FrameworkUtil.createFilter("(&(objectClass=" + AuthorizationEngine.class.getName() + ")(" + "osgi.signedcontent.authorization.engine" + "=" + implProp + "))");
        }
        catch (InvalidSyntaxException localInvalidSyntaxException) {}
      }
      if (filter != null) {
        authzEngineTracker = new ServiceTracker(getBundleContext(), filter, null);
      } else {
        authzEngineTracker = new ServiceTracker(getBundleContext(), AuthorizationEngine.class.getName(), null);
      }
      authzEngineTracker.open();
    }
    return (AuthorizationEngine)authzEngineTracker.getService();
  }
  
  public static AuthorizationManager getAuthorizationManager()
  {
    if (authzManagerTracker == null)
    {
      String implProp = getBundleContext().getProperty("osgi.signedcontent.authorization.manager");
      Filter filter = null;
      if (implProp != null) {
        try
        {
          filter = FrameworkUtil.createFilter("(&(objectClass=" + AuthorizationManager.class.getName() + ")(" + "osgi.signedcontent.authorization.manager" + "=" + implProp + "))");
        }
        catch (InvalidSyntaxException localInvalidSyntaxException) {}
      }
      if (filter != null) {
        authzManagerTracker = new ServiceTracker(getBundleContext(), filter, null);
      } else {
        authzManagerTracker = new ServiceTracker(getBundleContext(), AuthorizationManager.class.getName(), null);
      }
      authzManagerTracker.open();
    }
    return (AuthorizationManager)authzManagerTracker.getService();
  }
  
  public static PlatformAdmin getPlatformAdmin()
  {
    if (platformAdminTracker == null)
    {
      platformAdminTracker = new ServiceTracker(getBundleContext(), PlatformAdmin.class.getName(), null);
      platformAdminTracker.open();
    }
    return (PlatformAdmin)platformAdminTracker.getService();
  }
  
  public static ImageDescriptor getImageDescriptor(String relativePath)
  {
    return imageDescriptorFromPlugin("org.eclipse.equinox.security.ui", "icons" + relativePath);
  }
  
  public static void log(int severity, String key, Object[] args, Throwable throwable)
  {
    plugin.getLog().log(new Status(severity, getSymbolicName(), 0, NLS.bind(key, args), throwable));
  }
  
  public DebugOptions getDebugOptions()
  {
    if (debugTracker == null)
    {
      debugTracker = new ServiceTracker(bundleContext, DebugOptions.class.getName(), null);
      debugTracker.open();
    }
    return (DebugOptions)debugTracker.getService();
  }
  
  public boolean debugStorageContents()
  {
    DebugOptions debugOptions = getDebugOptions();
    if (debugOptions == null) {
      return false;
    }
    return (debugOptions.getBooleanOption("org.eclipse.equinox.security.ui/debug", false)) && (debugOptions.getBooleanOption("org.eclipse.equinox.security.ui/debug/storage", false));
  }
}

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

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

class ConfirmationDialog$1
  extends SelectionAdapter
{
  final ConfirmationDialog this$0;
  
  ConfirmationDialog$1(ConfirmationDialog paramConfirmationDialog)
  {
    this$0 = paramConfirmationDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ConfirmationDialog.access$0(this$0, 100);
    this$0.close();
  }
}

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

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

class ConfirmationDialog$2
  extends SelectionAdapter
{
  final ConfirmationDialog this$0;
  
  ConfirmationDialog$2(ConfirmationDialog paramConfirmationDialog)
  {
    this$0 = paramConfirmationDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ConfirmationDialog.access$0(this$0, 101);
    this$0.close();
  }
}

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

import java.security.cert.Certificate;
import org.eclipse.equinox.internal.security.ui.wizard.CertificateViewer;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class ConfirmationDialog
  extends TitleAreaDialog
{
  public static final int YES = 100;
  public static final int NO = 101;
  private Certificate cert;
  
  public ConfirmationDialog(Shell parentShell, Certificate cert)
  {
    super(parentShell);
    this.cert = cert;
  }
  
  protected Control createContents(Composite parent)
  {
    return super.createContents(parent);
  }
  
  protected Control createDialogArea(Composite parent)
  {
    setTitle(SecurityUIMsg.CONFIRMATION_DIALOG_TITLE);
    setMessage(SecurityUIMsg.CONFIRMATION_DIALOG_MSG);
    
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new FillLayout());
    
    CertificateViewer certViewer = new CertificateViewer(composite);
    certViewer.setCertificate(cert);
    
    return composite;
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    Button yesBtn = createButton(parent, 100, SecurityUIMsg.CONFIRMATION_DIALGO_YES, true);
    yesBtn.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        setReturnCode(100);
        close();
      }
    });
    Button noBtn = createButton(parent, 101, SecurityUIMsg.CONFIRMATION_DIALGO_NO, false);
    noBtn.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        setReturnCode(101);
        close();
      }
    });
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.provisional.security.ui.AuthorizationManager;
import org.eclipse.osgi.internal.provisional.service.security.AuthorizationEngine;
import org.eclipse.ui.IWorkbenchWindow;

public class DefaultAuthorizationManager
  extends AuthorizationManager
{
  boolean enabled = Activator.getAuthorizationEngine() != null;
  private int currentStatus = 0;
  private boolean needsAttention = false;
  
  public DefaultAuthorizationManager()
  {
    currentStatus = (enabled ? Activator.getAuthorizationEngine().getStatus() : 0);
  }
  
  public boolean isEnabled()
  {
    return true;
  }
  
  public boolean needsAttention()
  {
    return needsAttention;
  }
  
  public IStatus getStatus()
  {
    currentStatus = (enabled ? Activator.getAuthorizationEngine().getStatus() : 0);
    return transformStatus(currentStatus);
  }
  
  public void displayManager(IWorkbenchWindow workbenchWindow) {}
  
  private IStatus transformStatus(int engineStatus)
  {
    Status status = null;
    switch (engineStatus)
    {
    case 0: 
      status = new Status(0, Activator.getSymbolicName(), "");
      break;
    case 1: 
      status = new Status(4, Activator.getSymbolicName(), "");
      break;
    default: 
      status = null;
    }
    return status;
  }
}

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

import java.util.List;
import java.util.Map;

class SecurityConfigurationSection$ProviderService
{
  private final String type;
  private final String algorithm;
  private final String className;
  private final List aliases;
  private final Map attributes;
  
  public SecurityConfigurationSection$ProviderService(String type, String algorithm, String className, List aliases, Map attributes)
  {
    this.type = type;
    this.algorithm = algorithm;
    this.className = className;
    this.aliases = aliases;
    this.attributes = attributes;
  }
  
  public String getType()
  {
    return type;
  }
  
  public String getAlgorithm()
  {
    return algorithm;
  }
  
  public String getClassName()
  {
    return className;
  }
  
  public List getAliases()
  {
    return aliases;
  }
  
  public Map getAttributes()
  {
    return attributes;
  }
}

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

import java.io.PrintWriter;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.ui.about.ISystemSummarySection;

public class SecurityConfigurationSection
  implements ISystemSummarySection
{
  private static final String ALG_ALIAS = "Alg.Alias.";
  private static final String PROVIDER = "Provider.";
  
  public void write(PrintWriter writer)
  {
    Provider[] providers = Security.getProviders();
    writer.println("Providers (" + providers.length + "): ");
    writer.println();
    for (int i = 0; i < providers.length; i++) {
      appendProvider(writer, providers[i], i);
    }
  }
  
  private void appendProvider(PrintWriter writer, Provider provider, int index)
  {
    writer.println(" Provider: " + provider.getName() + ", Version: " + provider.getVersion() + ", Class: " + provider.getClass().getName());
    writer.println("  Description: " + provider.getInfo());
    ProviderService[] services = getServices(provider);
    writer.println("  Services (" + services.length + "):");
    for (int i = 0; i < services.length; i++) {
      appendService(writer, services[i], i);
    }
    writer.println();
  }
  
  private void appendService(PrintWriter writer, ProviderService service, int index)
  {
    writer.println("   Service: " + service.getType() + ", Algorithm: " + service.getAlgorithm() + ", Class: " + service.getClassName());
    List aliases = service.getAliases();
    if ((aliases != null) && (aliases.size() > 0))
    {
      writer.print("    Aliases: ");
      for (Iterator it = aliases.iterator(); it.hasNext();)
      {
        writer.print((String)it.next());
        if (it.hasNext()) {
          writer.print(", ");
        }
      }
      writer.println();
    }
    Map attributes = service.getAttributes();
    if ((attributes != null) && (attributes.size() > 0))
    {
      writer.println("    Attributes:");
      Set keys = attributes.keySet();
      for (Iterator it = keys.iterator(); it.hasNext();)
      {
        String key = (String)it.next();
        writer.print("      " + key + ": ");
        writer.println((String)attributes.get(key));
      }
    }
  }
  
  private static ProviderService[] getServices(Provider provider)
  {
    Set providerKeys = provider.keySet();
    Hashtable serviceList = new Hashtable();
    Hashtable attributeMap = new Hashtable();
    Hashtable aliasMap = new Hashtable();
    for (Iterator it = providerKeys.iterator(); it.hasNext();)
    {
      String key = (String)it.next();
      if (!key.startsWith("Provider.")) {
        if (key.startsWith("Alg.Alias."))
        {
          String value = key.substring(key.indexOf("Alg.Alias.") + "Alg.Alias.".length(), key.length());
          String type = (String)provider.get(key);
          String algo = value.substring(0, value.indexOf('.'));
          String alias = value.substring(value.indexOf('.') + 1, value.length());
          ArrayList aliasList = (ArrayList)aliasMap.get(type + '.' + algo);
          if (aliasList == null)
          {
            aliasList = new ArrayList();
            aliasList.add(alias);
            aliasMap.put(type, aliasList);
          }
          else
          {
            aliasList.add(alias);
          }
        }
        else if (key.indexOf(' ') > -1)
        {
          String type = key.substring(0, key.indexOf('.'));
          String algorithm = key.substring(key.indexOf('.') + 1, key.indexOf(' '));
          String attribute = key.substring(key.indexOf(' ') + 1, key.length());
          String value = (String)provider.get(key);
          Hashtable attributeTable = (Hashtable)attributeMap.get(type + '.' + algorithm);
          if (attributeTable == null)
          {
            attributeTable = new Hashtable();
            attributeTable.put(attribute, value);
            attributeMap.put(type + '.' + algorithm, attributeTable);
          }
          else
          {
            attributeTable.put(attribute, value);
          }
        }
        else
        {
          serviceList.put(key, provider.get(key));
        }
      }
    }
    ProviderService[] serviceArray = new ProviderService[serviceList.size()];
    Set serviceKeys = serviceList.keySet();
    int serviceCount = 0;
    for (Iterator it = serviceKeys.iterator(); it.hasNext();)
    {
      String key = (String)it.next();
      String type = key.substring(0, key.indexOf('.'));
      String algo = key.substring(key.indexOf('.') + 1, key.length());
      String className = (String)serviceList.get(key);
      List aliases = (List)aliasMap.get(algo);
      Map attributes = (Map)attributeMap.get(key);
      
      serviceArray[serviceCount] = new ProviderService(type, algo, className, aliases, attributes);
      serviceCount++;
    }
    return serviceArray;
  }
  
  private static class ProviderService
  {
    private final String type;
    private final String algorithm;
    private final String className;
    private final List aliases;
    private final Map attributes;
    
    public ProviderService(String type, String algorithm, String className, List aliases, Map attributes)
    {
      this.type = type;
      this.algorithm = algorithm;
      this.className = className;
      this.aliases = aliases;
      this.attributes = attributes;
    }
    
    public String getType()
    {
      return type;
    }
    
    public String getAlgorithm()
    {
      return algorithm;
    }
    
    public String getClassName()
    {
      return className;
    }
    
    public List getAliases()
    {
      return aliases;
    }
    
    public Map getAttributes()
    {
      return attributes;
    }
  }
}

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

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;

class SecurityStatusControl$1
  implements MouseListener
{
  final SecurityStatusControl this$0;
  
  SecurityStatusControl$1(SecurityStatusControl paramSecurityStatusControl)
  {
    this$0 = paramSecurityStatusControl;
  }
  
  public void mouseDoubleClick(MouseEvent e) {}
  
  public void mouseDown(MouseEvent e) {}
  
  public void mouseUp(MouseEvent e) {}
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;

class SecurityStatusControl$2
  extends Job
{
  final SecurityStatusControl this$0;
  
  SecurityStatusControl$2(SecurityStatusControl paramSecurityStatusControl, String $anonymous0)
  {
    super($anonymous0);this$0 = paramSecurityStatusControl;
  }
  
  public IStatus run(IProgressMonitor monitor)
  {
    for (;;)
    {
      SecurityStatusControl.IconState newState = SecurityStatusControl.access$0();
      if (!SecurityStatusControl.access$1(this$0).equals(newState))
      {
        Display display = SecurityStatusControl.access$3(SecurityStatusControl.access$2(this$0));
        if (display != null) {
          display.asyncExec(new SecurityStatusControl.3(this));
        }
        SecurityStatusControl.access$5(this$0, newState);
      }
      try
      {
        Thread.sleep(500L);
      }
      catch (InterruptedException localInterruptedException) {}
    }
    return null;
  }
}

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

import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Image;

class SecurityStatusControl$3
  implements Runnable
{
  final SecurityStatusControl.2 this$1;
  
  SecurityStatusControl$3(SecurityStatusControl.2 param2)
  {
    this$1 = param2;
  }
  
  public void run()
  {
    if (!SecurityStatusControl.access$4(SecurityStatusControl.2.access$0(this$1)).isDisposed())
    {
      Image oldIcon = SecurityStatusControl.access$4(SecurityStatusControl.2.access$0(this$1)).getImage();
      SecurityStatusControl.access$4(SecurityStatusControl.2.access$0(this$1)).setImage(SecurityStatusControl.getIcon(SecurityStatusControl.access$1(SecurityStatusControl.2.access$0(this$1))));
      oldIcon.dispose();
    }
  }
}

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

import org.eclipse.core.runtime.IStatus;

class SecurityStatusControl$IconState
{
  boolean enabled;
  boolean needsAttention;
  IStatus status;
  
  SecurityStatusControl$IconState(boolean enabled, IStatus status, boolean needsAttention)
  {
    if (status == null) {
      throw new IllegalArgumentException();
    }
    this.enabled = enabled;
    this.status = status;
    this.needsAttention = needsAttention;
  }
  
  public boolean isEnabled()
  {
    return enabled;
  }
  
  public IStatus getStatus()
  {
    return status;
  }
  
  public boolean equals(Object another)
  {
    boolean returnValue = false;
    if (((another instanceof IconState)) && 
      (enabled == enabled) && 
      (needsAttention == needsAttention) && 
      (status.equals(((IconState)another).getStatus()))) {
      returnValue = true;
    }
    return returnValue;
  }
  
  public int hashCode()
  {
    return Boolean.valueOf(enabled).hashCode() + status.hashCode() + Boolean.valueOf(needsAttention).hashCode();
  }
}

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

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.equinox.internal.provisional.security.ui.AuthorizationManager;
import org.eclipse.jface.action.ControlContribution;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;

public class SecurityStatusControl
  extends ControlContribution
{
  private static final String IMAGE_PATH_OK = "/full/obj16/green.GIF";
  private static final String IMAGE_PATH_ERROR = "/full/obj16/red.GIF";
  private static final String IMAGE_PATH_DISABLED = "/full/obj16/red.GIF";
  private static final String IMAGE_PATH_UNKNOWN = "/full/obj16/red.GIF";
  private static final String ID = "org.eclipse.ui.securityStatus";
  private IWorkbenchWindow window;
  private CLabel label;
  private IconState currentState;
  
  public SecurityStatusControl(IWo
1 2 3 4 5 6 7 8

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