org.eclipse.jst.common.annotations.controller_1.1.300.v200908252030

16:45:39.420 INFO  jd.cli.Main - Decompiling org.eclipse.jst.common.annotations.controller_1.1.300.v200908252030.jar
package org.eclipse.jst.common.internal.annotations.controller;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.ecore.EObject;

public abstract interface AnnotationsController
{
  public abstract boolean isTagHandlerInstalled(String paramString);
  
  public abstract IStatus disableAnnotations(EObject paramEObject, String paramString);
  
  public abstract IFile getEnabledAnnotationFile(EObject paramEObject);
  
  public abstract IFile[] process(IResource paramIResource)
    throws CoreException;
  
  public abstract IFile[] process(IResource[] paramArrayOfIResource)
    throws CoreException;
  
  public abstract void initialize(IProject paramIProject);
  
  public abstract void dispose();
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.controller.AnnotationsController
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.controller;

import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jem.workbench.utility.JemProjectUtilities;
import org.eclipse.jst.common.internal.annotations.core.AnnotationsAdapter;
import org.eclipse.jst.common.internal.annotations.core.AnnotationsProviderManager;
import org.eclipse.jst.common.internal.annotations.core.IAnnotationsProvider;

public class AnnotationsControllerHelper
{
  public static final AnnotationsControllerHelper INSTANCE = new AnnotationsControllerHelper();
  
  public boolean isAnnotated(EObject eObject)
  {
    if (AnnotationsAdapter.getAnnotations(eObject, "generated") != null) {
      return true;
    }
    List annotationsProviders = AnnotationsProviderManager.INSTANCE.getAnnotationsProviders();
    for (int i = 0; i < annotationsProviders.size(); i++)
    {
      IAnnotationsProvider provider = (IAnnotationsProvider)annotationsProviders.get(i);
      if ((provider != null) && (provider.isAnnotated(eObject))) {
        return true;
      }
    }
    return false;
  }
  
  public void setAnnotated(EObject eObject, String value)
  {
    AnnotationsAdapter.addAnnotations(eObject, "generated", value);
  }
  
  public void addAnnotations(EObject eObject, String name, Object value)
  {
    AnnotationsAdapter.addAnnotations(eObject, name, value);
  }
  
  public Object getAnnotations(EObject eObject, String name)
  {
    return AnnotationsAdapter.getAnnotations(eObject, name);
  }
  
  public String getTagset(EObject eObject)
  {
    String tagset = getTagsetFromProviders(eObject);
    if (tagset == null) {
      tagset = getTagsetFromFragment(eObject);
    }
    return tagset;
  }
  
  private String getTagsetFromFragment(EObject eObject)
  {
    String generatedComment = (String)AnnotationsAdapter.getAnnotations(eObject, "generated");
    if ((generatedComment == null) || (generatedComment.length() == 0)) {
      return null;
    }
    int poundit = generatedComment.indexOf('#');
    int slash = generatedComment.indexOf('/');
    if ((poundit < 0) || (slash < 0) || (poundit >= slash)) {
      return null;
    }
    return generatedComment.substring(poundit + 1, slash);
  }
  
  private String getTagsetFromProviders(EObject eObject)
  {
    String tagset = null;
    List annotationProviders = AnnotationsProviderManager.INSTANCE.getAnnotationsProviders();
    int size = annotationProviders.size();
    for (int i = 0; (i < size) && (tagset == null); i++)
    {
      IAnnotationsProvider provider = (IAnnotationsProvider)annotationProviders.get(i);
      tagset = provider != null ? provider.getPrimaryTagset(eObject) : null;
    }
    return tagset;
  }
  
  public ICompilationUnit getAnnotatedCU(EObject eObject)
  {
    ICompilationUnit cu = getAnnotatedCUFromProvider(eObject);
    if (cu == null) {
      cu = getAnnotatedCUFromFragment(eObject);
    }
    return cu;
  }
  
  private ICompilationUnit getAnnotatedCUFromFragment(EObject eObject)
  {
    String fragmentString = (String)AnnotationsAdapter.getAnnotations(eObject, "generated");
    if (fragmentString == null) {
      return null;
    }
    String typeString = fragmentString;
    if (fragmentString.indexOf('#') > 0) {
      typeString = fragmentString.substring(0, fragmentString.indexOf('#'));
    }
    IType itype;
    if ((typeString != null) && ((itype = findType(typeString, eObject)) != null)) {
      return itype.getCompilationUnit();
    }
    return null;
  }
  
  private ICompilationUnit getAnnotatedCUFromProvider(EObject eObject)
  {
    ICompilationUnit primaryCU = null;
    List annotationProviders = AnnotationsProviderManager.INSTANCE.getAnnotationsProviders();
    int size = annotationProviders.size();
    for (int i = 0; (i < size) && (primaryCU == null); i++)
    {
      IAnnotationsProvider provider = (IAnnotationsProvider)annotationProviders.get(i);
      primaryCU = provider != null ? provider.getPrimaryAnnotatedCompilationUnit(eObject) : null;
    }
    return primaryCU;
  }
  
  protected IType findType(String type, EObject eObject)
  {
    IType result = null;
    IProject project = ProjectUtilities.getProject(eObject);
    IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
    if (javaProject != null) {
      try
      {
        result = javaProject.findType(type);
      }
      catch (JavaModelException e)
      {
        Logger.getLogger().logError(e);
      }
    }
    return result;
  }
  
  public boolean hasAnnotationSupport(IProject project)
  {
    return AnnotationsControllerManager.INSTANCE.hasAnnotationsBuilder(project);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.controller;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.common.internal.annotations.registry.AnnotationsControllerResources;
import org.eclipse.wst.common.frameworks.internal.enablement.Identifiable;
import org.eclipse.wst.common.internal.emf.utilities.Assert;

public class AnnotationsControllerManager$Descriptor
  implements Identifiable
{
  public static final String ANNOTATIONS_CONTROLLER = "annotationsController";
  public static final String ATT_ID = "id";
  public static final String CLASS = "class";
  public static final String BUILDER_ID = "builderID";
  private final IConfigurationElement configElement;
  private final String ID;
  private String builderID;
  private final int loadOrder;
  private static int loadOrderCounter = 0;
  
  public AnnotationsControllerManager$Descriptor(IConfigurationElement aConfigElement)
  {
    Assert.isLegal("annotationsController".equals(aConfigElement.getName()), AnnotationsControllerResources.AnnotationsControllerManager_ERROR_0);
    configElement = aConfigElement;
    ID = configElement.getAttribute("id");
    builderID = configElement.getAttribute("builderID");
    loadOrder = (loadOrderCounter++);
  }
  
  public String getID()
  {
    return ID;
  }
  
  public String getBuilderID()
  {
    return builderID;
  }
  
  public int getLoadOrder()
  {
    return loadOrder;
  }
  
  public AnnotationsController createInstance()
  {
    AnnotationsController instance = null;
    try
    {
      instance = (AnnotationsController)configElement.createExecutableExtension("class");
    }
    catch (CoreException e)
    {
      Logger.getLogger().logError(e);
    }
    return instance;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager.Descriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.controller;

import java.util.Iterator;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.WeakHashMap;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jem.util.RegistryReader;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.common.internal.annotations.registry.AnnotationsControllerResources;
import org.eclipse.wst.common.frameworks.internal.enablement.EnablementIdentifier;
import org.eclipse.wst.common.frameworks.internal.enablement.EnablementIdentifierEvent;
import org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager;
import org.eclipse.wst.common.frameworks.internal.enablement.IEnablementIdentifier;
import org.eclipse.wst.common.frameworks.internal.enablement.IEnablementIdentifierListener;
import org.eclipse.wst.common.frameworks.internal.enablement.IEnablementManager;
import org.eclipse.wst.common.frameworks.internal.enablement.Identifiable;
import org.eclipse.wst.common.frameworks.internal.enablement.IdentifiableComparator;
import org.eclipse.wst.common.internal.emf.utilities.Assert;

public class AnnotationsControllerManager
  extends RegistryReader
  implements IEnablementIdentifierListener
{
  public static final AnnotationsControllerManager INSTANCE = new AnnotationsControllerManager();
  private SortedSet descriptors;
  private Map annotationsControllers;
  
  static
  {
    INSTANCE.readRegistry();
  }
  
  public static class Descriptor
    implements Identifiable
  {
    public static final String ANNOTATIONS_CONTROLLER = "annotationsController";
    public static final String ATT_ID = "id";
    public static final String CLASS = "class";
    public static final String BUILDER_ID = "builderID";
    private final IConfigurationElement configElement;
    private final String ID;
    private String builderID;
    private final int loadOrder;
    private static int loadOrderCounter = 0;
    
    public Descriptor(IConfigurationElement aConfigElement)
    {
      Assert.isLegal("annotationsController".equals(aConfigElement.getName()), AnnotationsControllerResources.AnnotationsControllerManager_ERROR_0);
      configElement = aConfigElement;
      ID = configElement.getAttribute("id");
      builderID = configElement.getAttribute("builderID");
      loadOrder = (loadOrderCounter++);
    }
    
    public String getID()
    {
      return ID;
    }
    
    public String getBuilderID()
    {
      return builderID;
    }
    
    public int getLoadOrder()
    {
      return loadOrder;
    }
    
    public AnnotationsController createInstance()
    {
      AnnotationsController instance = null;
      try
      {
        instance = (AnnotationsController)configElement.createExecutableExtension("class");
      }
      catch (CoreException e)
      {
        Logger.getLogger().logError(e);
      }
      return instance;
    }
  }
  
  public AnnotationsControllerManager()
  {
    super("org.eclipse.jst.common.annotations.controller", "annotationsController");
  }
  
  public boolean readElement(IConfigurationElement element)
  {
    if (!element.getName().equals("annotationsController")) {
      return false;
    }
    addAnnotationController(new Descriptor(element));
    return true;
  }
  
  protected void addAnnotationController(Descriptor descriptor)
  {
    EnablementManager.INSTANCE.getIdentifier(descriptor.getID(), null).addIdentifierListener(this);
    getDescriptors().add(descriptor);
  }
  
  protected SortedSet getDescriptors()
  {
    if (descriptors == null) {
      descriptors = new TreeSet(IdentifiableComparator.getInstance());
    }
    return descriptors;
  }
  
  public Descriptor getDescriptor(IProject project)
  {
    for (Iterator iter = getDescriptors().iterator(); iter.hasNext();)
    {
      Descriptor descriptor = (Descriptor)iter.next();
      IEnablementIdentifier identifier = EnablementManager.INSTANCE.getIdentifier(descriptor.getID(), project);
      if (identifier.isEnabled()) {
        return descriptor;
      }
    }
    return null;
  }
  
  public boolean isAnyAnnotationsSupported()
  {
    return getDescriptors().size() > 0;
  }
  
  public void identifierChanged(EnablementIdentifierEvent identifierEvent)
  {
    IProject project = ((EnablementIdentifier)identifierEvent.getIdentifier()).getProject();
    getAnnotationsControllers().remove(project);
  }
  
  public AnnotationsController getAnnotationsController(IProject project)
  {
    AnnotationsController controller = (AnnotationsController)getAnnotationsControllers().get(project);
    if (controller == null)
    {
      if (!hasAnnotationsBuilder(project)) {
        return null;
      }
      Descriptor descriptor = getDescriptor(project);
      if (descriptor != null) {
        getAnnotationsControllers().put(project, controller = descriptor.createInstance());
      }
    }
    return controller;
  }
  
  public Map getAnnotationsControllers()
  {
    if (annotationsControllers == null) {
      annotationsControllers = new WeakHashMap();
    }
    return annotationsControllers;
  }
  
  public boolean hasAnnotationsBuilder(IProject project)
  {
    Descriptor annotationsDescriptor = getDescriptor(project);
    if (annotationsDescriptor == null) {
      return false;
    }
    return hasBuilder(project, annotationsDescriptor.getBuilderID());
  }
  
  public boolean hasBuilder(IProject project, String builderName)
  {
    try
    {
      ICommand[] builders = project.getDescription().getBuildSpec();
      for (int i = 0; i < builders.length; i++)
      {
        ICommand builder = builders[i];
        if ((builder != null) && 
          (builder.getBuilderName().equals(builderName))) {
          return true;
        }
      }
    }
    catch (Exception localException) {}
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

public abstract interface AnnotationTagDynamicInitializer
{
  public abstract void registerTags();
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AnnotationTagDynamicInitializer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

class AnnotationTagRegistry$1
  extends ArrayList
{
  private static final long serialVersionUID = 8683452581122892190L;
  
  private void scopeAll(Collection c, boolean forAdd)
  {
    Iterator iter = c.iterator();
    while (iter.hasNext())
    {
      TagSpec ts = (TagSpec)iter.next();
      if (forAdd) {
        addScope(ts);
      } else {
        removeScope(ts);
      }
    }
  }
  
  private void addScope(TagSpec ts)
  {
    if (ts == null) {
      return;
    }
    switch (ts.getScope())
    {
    case 2: 
      AnnotationTagRegistry.access$0().put(ts.getTagName(), ts);
      break;
    case 0: 
      AnnotationTagRegistry.access$1().put(ts.getTagName(), ts);
      break;
    case 1: 
      AnnotationTagRegistry.access$2().put(ts.getTagName(), ts);
    }
  }
  
  private void removeScope(TagSpec ts)
  {
    if (ts == null) {
      return;
    }
    switch (ts.getScope())
    {
    case 2: 
      AnnotationTagRegistry.access$0().remove(ts.getTagName());
      break;
    case 0: 
      AnnotationTagRegistry.access$1().remove(ts.getTagName());
      break;
    case 1: 
      AnnotationTagRegistry.access$2().remove(ts.getTagName());
    }
  }
  
  public void add(int index, Object element)
  {
    super.add(index, element);
    addScope((TagSpec)element);
  }
  
  public boolean add(Object o)
  {
    TagSpec newTagSpec = (TagSpec)o;
    for (int i = 0; i < size(); i++)
    {
      TagSpec tagSpec = (TagSpec)get(i);
      if ((tagSpec.getTagName().equals(newTagSpec.getTagName())) && (tagSpec.getScope() == newTagSpec.getScope()))
      {
        remove(tagSpec);
        removeScope(tagSpec);
      }
    }
    addScope(newTagSpec);
    return super.add(newTagSpec);
  }
  
  public boolean addAll(Collection c)
  {
    scopeAll(c, true);
    return super.addAll(c);
  }
  
  public boolean addAll(int index, Collection c)
  {
    scopeAll(c, true);
    return super.addAll(index, c);
  }
  
  public Object remove(int index)
  {
    Object result = super.remove(index);
    removeScope((TagSpec)result);
    return result;
  }
  
  public boolean remove(Object o)
  {
    removeScope((TagSpec)o);
    return super.remove(o);
  }
  
  public boolean removeAll(Collection c)
  {
    scopeAll(c, false);
    return super.removeAll(c);
  }
  
  public boolean retainAll(Collection c)
  {
    Iterator iter = iterator();
    while (iter.hasNext())
    {
      TagSpec ts = (TagSpec)iter.next();
      if (!c.contains(ts)) {
        removeScope(ts);
      }
    }
    return super.retainAll(c);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AnnotationTagRegistry.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

import java.util.List;
import org.osgi.framework.Bundle;

class AnnotationTagRegistry$InitTagInfo
{
  private String name;
  private List attributes;
  private Bundle bundle;
  private String scope;
  
  public AnnotationTagRegistry$InitTagInfo(String name, String scope, List att)
  {
    attributes = att;
    this.name = name;
    this.scope = scope;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof InitTagInfo)) {
      return false;
    }
    return (name.equals(name)) || (scope.equals(name));
  }
  
  public int hashCode()
  {
    return super.hashCode() + name.hashCode();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AnnotationTagRegistry.InitTagInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;

public class AnnotationTagRegistry
{
  private static boolean initialized = false;
  private static final String ANNOTATION_TAG_INFO = "org.eclipse.jst.common.annotations.controller.AnnotationTagInfo";
  private static ArrayList allTagSpecs = new ArrayList()
  {
    private static final long serialVersionUID = 8683452581122892190L;
    
    private void scopeAll(Collection c, boolean forAdd)
    {
      Iterator iter = c.iterator();
      while (iter.hasNext())
      {
        TagSpec ts = (TagSpec)iter.next();
        if (forAdd) {
          addScope(ts);
        } else {
          removeScope(ts);
        }
      }
    }
    
    private void addScope(TagSpec ts)
    {
      if (ts == null) {
        return;
      }
      switch (ts.getScope())
      {
      case 2: 
        AnnotationTagRegistry.fieldTags.put(ts.getTagName(), ts);
        break;
      case 0: 
        AnnotationTagRegistry.methodTags.put(ts.getTagName(), ts);
        break;
      case 1: 
        AnnotationTagRegistry.typeTags.put(ts.getTagName(), ts);
      }
    }
    
    private void removeScope(TagSpec ts)
    {
      if (ts == null) {
        return;
      }
      switch (ts.getScope())
      {
      case 2: 
        AnnotationTagRegistry.fieldTags.remove(ts.getTagName());
        break;
      case 0: 
        AnnotationTagRegistry.methodTags.remove(ts.getTagName());
        break;
      case 1: 
        AnnotationTagRegistry.typeTags.remove(ts.getTagName());
      }
    }
    
    public void add(int index, Object element)
    {
      super.add(index, element);
      addScope((TagSpec)element);
    }
    
    public boolean add(Object o)
    {
      TagSpec newTagSpec = (TagSpec)o;
      for (int i = 0; i < size(); i++)
      {
        TagSpec tagSpec = (TagSpec)get(i);
        if ((tagSpec.getTagName().equals(newTagSpec.getTagName())) && (tagSpec.getScope() == newTagSpec.getScope()))
        {
          remove(tagSpec);
          removeScope(tagSpec);
        }
      }
      addScope(newTagSpec);
      return super.add(newTagSpec);
    }
    
    public boolean addAll(Collection c)
    {
      scopeAll(c, true);
      return super.addAll(c);
    }
    
    public boolean addAll(int index, Collection c)
    {
      scopeAll(c, true);
      return super.addAll(index, c);
    }
    
    public Object remove(int index)
    {
      Object result = super.remove(index);
      removeScope((TagSpec)result);
      return result;
    }
    
    public boolean remove(Object o)
    {
      removeScope((TagSpec)o);
      return super.remove(o);
    }
    
    public boolean removeAll(Collection c)
    {
      scopeAll(c, false);
      return super.removeAll(c);
    }
    
    public boolean retainAll(Collection c)
    {
      Iterator iter = iterator();
      while (iter.hasNext())
      {
        TagSpec ts = (TagSpec)iter.next();
        if (!c.contains(ts)) {
          removeScope(ts);
        }
      }
      return super.retainAll(c);
    }
  };
  private static Hashtable tagAttribs = new Hashtable();
  private static Map methodTags = new HashMap();
  private static Map typeTags = new HashMap();
  private static Map fieldTags = new HashMap();
  private static final String CLASS_PROP = "class";
  private static final String DYNAMIC_INITIALIZER_EX_PT = "annotationTagDynamicInitializer";
  private static final String ANNOTATIONS_CONTROLLER_NAMESPACE = "org.eclipse.jst.common.annotations.controller";
  
  private static InitTagInfo parseTagAttribs(IConfigurationElement[] elems, String tagName, String scope)
  {
    ArrayList attribList = new ArrayList();
    
    InitTagInfo tagInf = new InitTagInfo(tagName, scope, attribList);
    for (int i = 0; i < elems.length; i++)
    {
      IConfigurationElement elem = elems[i];
      if (elem.getName().equalsIgnoreCase("attrib"))
      {
        TagAttribSpec tas = new TagAttribSpec(elem.getAttribute("name"), elem.getAttribute("description"));
        String use = elem.getAttribute("use");
        
        tas.setType(elem.getAttribute("type"));
        if ("enum".equals(elem.getAttribute("type")))
        {
          IConfigurationElement[] validValues = elem.getChildren("enumValues");
          List valuesList = new ArrayList();
          for (int j = 0; j < validValues.length; j++)
          {
            String value = validValues[j].getAttribute("value");
            valuesList.add(value);
          }
          String[] validValuesArray = new String[valuesList.size()];
          validValuesArray = (String[])valuesList.toArray(validValuesArray);
          
          tas.setValidValues(validValuesArray);
        }
        if (use == null)
        {
          tas.clearRequired();
        }
        else if (use.equalsIgnoreCase("required"))
        {
          tas.setRequired();
        }
        else if (use.equalsIgnoreCase("optional"))
        {
          tas.clearRequired();
        }
        else
        {
          System.err.println(AnnotationsControllerResources.AnnotationTagRegistry_9 + use);
          return null;
        }
        IConfigurationElement[] elemUniqueArray = elem.getChildren("unique");
        if (elemUniqueArray.length > 0)
        {
          tas.setUnique();
          if (elemUniqueArray[0].getAttribute("scope") != null) {
            tas.getUnique().setScope(TagAttribSpec.uniqueScopeFromString(elemUniqueArray[0].getAttribute("scope")));
          }
          if (elemUniqueArray.length > 1) {
            Logger.getLogger().logError(AnnotationsControllerResources.TagAttribSpec_2 + elemUniqueArray.length);
          }
        }
        else
        {
          tas.clearUnique();
        }
        attribList.add(tas);
      }
    }
    return tagInf;
  }
  
  public static String tagSetFromTagName(String name)
  {
    if (name == null) {
      return null;
    }
    int idx = name.lastIndexOf('.');
    if (idx != -1) {
      return name.substring(0, idx);
    }
    return "";
  }
  
  public static String tagFromTagName(String name)
  {
    if (name == null) {
      return null;
    }
    int idx = name.indexOf('.');
    if (idx != -1) {
      return name.substring(idx + 1);
    }
    return name;
  }
  
  private static void readAllAttributeInfo(IExtensionPoint xp)
  {
    if (xp == null) {
      return;
    }
    IExtension[] exts = xp.getExtensions();
    Bundle bundle = null;
    for (int i = 0; i < exts.length; i++)
    {
      IConfigurationElement[] elems = exts[i].getConfigurationElements();
      bundle = Platform.getBundle(exts[i].getNamespace());
      String identifier = exts[i].getUniqueIdentifier();
      
      IConfigurationElement elem = null;
      String tagName = null;
      String scope = null;
      String tagSet = null;
      String fullTagName = null;
      for (int j = 0; j < elems.length; j++)
      {
        elem = elems[j];
        if (elem.getName().equalsIgnoreCase("AnnotationTagInfo"))
        {
          tagSet = elem.getAttribute("tagSet");
          tagName = elem.getAttribute("tagName");
          scope = elem.getAttribute("scope");
          if ((isNullOrEmpty(tagSet)) || (isNullOrEmpty(tagName)) || (isNullOrEmpty(scope)))
          {
            Logger.getLogger().log(NLS.bind(AnnotationsControllerResources.AnnotationTagRegistry_10, new Object[] { identifier }));
          }
          else
          {
            fullTagName = tagSet + "." + tagName;
            
            InitTagInfo tagInf = parseTagAttribs(elem.getChildren(), fullTagName.toLowerCase(), scope);
            String key = (fullTagName + "#" + scope).toLowerCase();
            if (tagAttribs.containsKey(key))
            {
              Logger.getLogger().log(AnnotationsControllerResources.AnnotationTagRegistry_0 + tagName + "'.");
            }
            else
            {
              bundle = bundle;
              tagAttribs.put(key, tagInf);
            }
          }
        }
      }
    }
  }
  
  private static boolean isNullOrEmpty(String aString)
  {
    return (aString == null) || (aString.length() == 0);
  }
  
  private static boolean init()
    throws CoreException
  {
    if (initialized) {
      return true;
    }
    initializeStaticTagDefinitions();
    initiaizeDynamicTagDefinitions();
    initialized = true;
    
    tagAttribs = null;
    
    return true;
  }
  
  private static void initializeStaticTagDefinitions()
    throws CoreException
  {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    
    IExtensionPoint xp = registry.getExtensionPoint("org.eclipse.jst.common.annotations.controller.AnnotationTagInfo");
    if (xp == null) {
      return;
    }
    IExtension[] x = xp.getExtensions();
    
    readAllAttributeInfo(xp);
    for (int j = 0; j < x.length; j++)
    {
      IConfigurationElement[] tagSpecs = x[j].getConfigurationElements();
      for (int i = 0; i < tagSpecs.length; i++)
      {
        IConfigurationElement tagSpec = tagSpecs[i];
        String tagName = tagSpec.getAttribute("tagSet") + "." + tagSpec.getAttribute("tagName");
        String scope = tagSpec.getAttribute("scope");
        String multiplicity = tagSpec.getAttribute("multiplicity");
        TagSpec ts = null;
        if (multiplicity != null) {
          ts = new TagSpec(tagName, TagSpec.scopeFromString(scope), TagSpec.multiplicityFromString(multiplicity));
        } else {
          ts = new TagSpec(tagName, TagSpec.scopeFromString(scope), 1);
        }
        String key = (tagName + "#" + scope).toLowerCase();
        InitTagInfo tagInf = (InitTagInfo)tagAttribs.get(key);
        
        allTagSpecs.add(ts);
        if (tagInf != null)
        {
          ts.setAttributes(attributes);
          ts.setBundle(bundle);
        }
      }
    }
  }
  
  private static void initiaizeDynamicTagDefinitions()
  {
    IExtensionPoint xp = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.jst.common.annotations.controller", "annotationTagDynamicInitializer");
    if (xp == null) {
      return;
    }
    IExtension[] extensions = xp.getExtensions();
    for (int i = 0; i < extensions.length; i++)
    {
      IExtension extension = extensions[i];
      IConfigurationElement[] elements = extension.getConfigurationElements();
      for (int j = 0; j < elements.length; j++) {
        try
        {
          AnnotationTagDynamicInitializer initializer = (AnnotationTagDynamicInitializer)elements[j].createExecutableExtension("class");
          initializer.registerTags();
        }
        catch (CoreException e)
        {
          Logger.getLogger().logError(e);
        }
      }
    }
  }
  
  public static synchronized List getAllTagSpecs()
  {
    return allTagSpecs;
  }
  
  public static synchronized boolean isMethodTag(String tagName)
  {
    return methodTags.containsKey(tagName);
  }
  
  public static synchronized boolean isFieldTag(String tagName)
  {
    return fieldTags.containsKey(tagName);
  }
  
  public static synchronized boolean isTypeTag(String tagName)
  {
    return typeTags.containsKey(tagName);
  }
  
  public static synchronized TagSpec getMethodTag(String tagName)
  {
    return (TagSpec)methodTags.get(tagName);
  }
  
  public static synchronized TagSpec getFieldTag(String tagName)
  {
    return (TagSpec)fieldTags.get(tagName);
  }
  
  public static synchronized TagSpec getTypeTag(String tagName)
  {
    return (TagSpec)typeTags.get(tagName);
  }
  
  private static class InitTagInfo
  {
    private String name;
    private List attributes;
    private Bundle bundle;
    private String scope;
    
    public InitTagInfo(String name, String scope, List att)
    {
      attributes = att;
      this.name = name;
      this.scope = scope;
    }
    
    public boolean equals(Object obj)
    {
      if (this == obj) {
        return true;
      }
      if (!(obj instanceof InitTagInfo)) {
        return false;
      }
      return (name.equals(name)) || (scope.equals(name));
    }
    
    public int hashCode()
    {
      return super.hashCode() + name.hashCode();
    }
  }
  
  static
  {
    try
    {
      init();
    }
    catch (CoreException e)
    {
      Logger.getLogger().logError(AnnotationsControllerResources.AnnotationTagRegistry_ERROR_1);
      Logger.getLogger().logError(e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AnnotationTagRegistry
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jem.util.RegistryReader;

public class AnnotationTagsetRegistry
  extends RegistryReader
{
  public static final AnnotationTagsetRegistry INSTANCE = new AnnotationTagsetRegistry();
  private Map index;
  private List descriptors;
  
  protected AnnotationTagsetRegistry()
  {
    super("org.eclipse.wst.common.internal.annotations.controller", "AnnotationTagSet");
    readRegistry();
  }
  
  public boolean readElement(IConfigurationElement element)
  {
    if ("AnnotationTagSet".equals(element.getName()))
    {
      getDescriptors().add(new TagsetDescriptor(element));
      return true;
    }
    return false;
  }
  
  public TagsetDescriptor getDescriptor(String name)
  {
    if ((name != null) && (name.length() > 0))
    {
      TagsetDescriptor descriptor = (TagsetDescriptor)getIndex().get(name);
      if (descriptor != null) {
        return descriptor;
      }
      for (Iterator itr = INSTANCE.getDescriptors().iterator(); itr.hasNext();)
      {
        descriptor = (TagsetDescriptor)itr.next();
        if (name.equals(descriptor.getName()))
        {
          getIndex().put(descriptor.getName(), descriptor);
          return descriptor;
        }
      }
    }
    return null;
  }
  
  protected List getDescriptors()
  {
    if (descriptors == null) {
      descriptors = new ArrayList();
    }
    return descriptors;
  }
  
  protected Map getIndex()
  {
    if (index == null) {
      index = new HashMap();
    }
    return index;
  }
  
  public void registerTagset(TagsetDescriptor descriptor)
  {
    if ((descriptor != null) && (getDescriptor(descriptor.getName()) == null)) {
      getDescriptors().add(descriptor);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AnnotationTagsetRegistry
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

import org.eclipse.osgi.util.NLS;

public class AnnotationsControllerResources
  extends NLS
{
  private static final String BUNDLE_NAME = "annotationcontroller";
  public static String TagSpec_3;
  public static String TagSpec_4;
  public static String TagSpec_5;
  public static String TagSpec_6;
  public static String TagAttribSpec_1;
  public static String TagAttribSpec_2;
  public static String AnnotationTagParser_0;
  public static String AnnotationTagParser_1;
  public static String AnnotationTagRegistry_0;
  public static String AnnotationTagRegistry_9;
  public static String AnnotationTagRegistry_10;
  public static String AnnotationTagRegistry_11;
  public static String AnnotationsControllerManager_ERROR_0;
  public static String AnnotationTagRegistry_ERROR_1;
  
  static
  {
    NLS.initializeMessages("annotationcontroller", AnnotationsControllerResources.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AnnotationsControllerResources
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

public class AttributeValueProposalHelper
{
  private String replacementString;
  private int valueOffset = 0;
  private int replacementLength = 0;
  private String valueDisplayString;
  private boolean ensureBeginQuote = true;
  private boolean ensureEndQuote = true;
  
  public AttributeValueProposalHelper(String replacementString, int valueOffset, int replacementLength, String valueDisplayString)
  {
    this.replacementString = replacementString;
    this.valueOffset = valueOffset;
    this.replacementLength = replacementLength;
    this.valueDisplayString = valueDisplayString;
  }
  
  public int getReplacementLength()
  {
    return replacementLength;
  }
  
  public void setReplacementLength(int replacementLength)
  {
    this.replacementLength = replacementLength;
  }
  
  public String getReplacementString()
  {
    return replacementString;
  }
  
  public void setReplacementString(String replacementString)
  {
    this.replacementString = replacementString;
  }
  
  public String getValueDisplayString()
  {
    return valueDisplayString;
  }
  
  public void setValueDisplayString(String valueDisplayString)
  {
    this.valueDisplayString = valueDisplayString;
  }
  
  public int getValueOffset()
  {
    return valueOffset;
  }
  
  public void setValueOffset(int valueOffset)
  {
    this.valueOffset = valueOffset;
  }
  
  public boolean ensureBeginQuote()
  {
    return ensureBeginQuote;
  }
  
  public void setEnsureBeginQuote(boolean ensureBeginQuote)
  {
    this.ensureBeginQuote = ensureBeginQuote;
  }
  
  public boolean ensureEndQuote()
  {
    return ensureEndQuote;
  }
  
  public void setEnsureEndQuote(boolean ensureEndQuote)
  {
    this.ensureEndQuote = ensureEndQuote;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AttributeValueProposalHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

import org.eclipse.jdt.core.IJavaElement;

public abstract interface AttributeValuesHelper
{
  public static final String[] EMPTY_VALUES = new String[0];
  public static final AttributeValueProposalHelper[] EMPTY_PROPOSAL_HELPERS = new AttributeValueProposalHelper[0];
  
  public abstract String[] getValidValues(TagAttribSpec paramTagAttribSpec, IJavaElement paramIJavaElement);
  
  public abstract AttributeValueProposalHelper[] getAttributeValueProposalHelpers(TagAttribSpec paramTagAttribSpec, String paramString, int paramInt, IJavaElement paramIJavaElement);
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.AttributeValuesHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

public abstract interface TagAttribSpec$Type
{
  public static final int TEXT = 0;
  public static final int BOOLEAN = 1;
  public static final int JAVATYPE = 2;
  public static final int ENUM = 3;
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.TagAttribSpec.Type
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

public class TagAttribSpec$Unique
{
  public static final int MODULE = 0;
  public static final int FILE = 1;
  public static final int TYPE = 2;
  public static final int METHOD = 3;
  public static final int FIELD = 4;
  private int scope = 0;
  
  public TagAttribSpec$Unique(TagAttribSpec paramTagAttribSpec) {}
  
  public int getScope()
  {
    return scope;
  }
  
  public void setScope(int in)
  {
    scope = in;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.common.internal.annotations.registry.TagAttribSpec.Unique
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.common.internal.annotations.registry;

import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.common.internal.annotations.core.AnnotationsCoreResources;

public class TagAttribSpec
{
  private String attribName;
  private int flags;
  private String helpKey;
  private int type = 0;
  private static final int FLG_REQUIRED = 1;
  private String[] validValues;
  private TagSpec tagSpec;
  private Unique unique;
  
  public static abstract interface Type
  {
    public static final int TEXT = 0;
    public static final int BOOLEAN = 1;
    public static final int JAVATYPE = 2;
    public static final int ENUM = 3;
  }
  
  public class Unique
  {
    public static final int MODULE = 0;
    public static final int FILE = 1;
    public static final int TYPE = 2;
    public static final int METHOD = 3;
    public static final int FIELD = 4;
    private int scope = 0;
    
    public Unique() {}
    
    public int getS
1 2

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