org.eclipselabs.jsdt.jquery.api_1.4.1.201311011708

16:49:39.372 INFO  jd.cli.Main - Decompiling org.eclipselabs.jsdt.jquery.api_1.4.1.201311011708.jar
package org.eclipselabs.jsdt.jquery.api;

import org.eclipse.osgi.util.NLS;

public class JQueryApiMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipselabs.jsdt.jquery.api.messages";
  public static String container_genericDescription;
  public static String container_conflictDescription;
  public static String container_noConflictDescription;
  
  static
  {
    NLS.initializeMessages("org.eclipselabs.jsdt.jquery.api.messages", JQueryApiMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.JQueryApiMessages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;

public final class JQueryApiPlugin
  extends Plugin
{
  static final int MAX_MINOR = 7;
  static final List<Version> ALL_VERSIONS;
  
  static
  {
    List<Version> versions = new ArrayList(8);
    for (int i = 7; i >= 0; i--) {
      versions.add(new SimpleVersion(i));
    }
    ALL_VERSIONS = Collections.unmodifiableList(versions);
  }
  
  public static final Version MAX_VERSION = (Version)ALL_VERSIONS.get(0);
  private static volatile JQueryApiPlugin instance;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    instance = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    instance = null;
    super.stop(context);
  }
  
  public static JQueryApiPlugin getDefault()
  {
    return instance;
  }
  
  private static final JQuerySupport SUPPORT = new SimpleJQuerySupport();
  
  public static JQuerySupport getJQuerySupport()
  {
    return SUPPORT;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.JQueryApiPlugin
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

public final class JQueryContainer
{
  private static final char SEPARATOR = '_';
  private static final String NO_CONFLICT_CONTAINER_PREFIX = "org.eclipselabs.jsdt.jquery.core.NoCoflictLibrary";
  private static final String CONFLICT_CONTAINER_PREFIX = "org.eclipselabs.jsdt.jquery.core.CoflictLibrary";
  
  public static boolean isQueryContainer(String containerId)
  {
    return (isContainer(containerId, "org.eclipselabs.jsdt.jquery.core.CoflictLibrary")) || (isContainer(containerId, "org.eclipselabs.jsdt.jquery.core.NoCoflictLibrary"));
  }
  
  private static boolean isContainer(String containerId, String expectedContainerId)
  {
    return (containerId.startsWith(expectedContainerId)) && (containerId.length() > expectedContainerId.length()) && (containerId.charAt(expectedContainerId.length()) == '_');
  }
  
  public static Version extractVersion(IPath path)
  {
    String container = path.segment(0);
    int separatorIndex = container.indexOf('_');
    String versionString = container.substring(separatorIndex + 1);
    return SimpleVersion.fromString(versionString);
  }
  
  public static boolean isQueryConflict(IPath path)
  {
    return isContainer(path, "org.eclipselabs.jsdt.jquery.core.CoflictLibrary");
  }
  
  public static boolean isQueryNoConflict(IPath path)
  {
    return isContainer(path, "org.eclipselabs.jsdt.jquery.core.NoCoflictLibrary");
  }
  
  private static boolean isContainer(IPath path, String containerId)
  {
    if (path == null) {
      return false;
    }
    if (path.segmentCount() != 1) {
      return false;
    }
    String segment = path.segment(0);
    return segment.startsWith(containerId);
  }
  
  public static boolean extractNoConflict(IPath path)
  {
    String container = path.segment(0);
    int separatorIndex = container.indexOf('_');
    return "org.eclipselabs.jsdt.jquery.core.NoCoflictLibrary".equals(container.substring(0, separatorIndex));
  }
  
  public static IPath createIncludePath(Version version, boolean noConflict)
  {
    return new Path(createContainerId(version, noConflict));
  }
  
  private static String createContainerId(Version version, boolean noConflict)
  {
    if (noConflict) {
      return "org.eclipselabs.jsdt.jquery.core.NoCoflictLibrary_" + version.toString();
    }
    return "org.eclipselabs.jsdt.jquery.core.CoflictLibrary_" + version.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.JQueryContainer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api;

import java.util.List;

public abstract interface JQuerySupport
{
  public abstract List<Version> getAllVersions();
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.JQuerySupport
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api;

import java.util.List;

final class SimpleJQuerySupport
  implements JQuerySupport
{
  public List<Version> getAllVersions()
  {
    return JQueryApiPlugin.ALL_VERSIONS;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.SimpleJQuerySupport
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api;

import java.util.List;
import org.eclipse.core.runtime.Assert;

public class SimpleVersion
  implements Version
{
  private final int minor;
  
  SimpleVersion(int minor)
  {
    this.minor = minor;
  }
  
  private int getMinor()
  {
    return minor;
  }
  
  private int getMajor()
  {
    return 1;
  }
  
  public int compareTo(Version other)
  {
    if ((other instanceof SimpleVersion)) {
      return minor - minor;
    }
    throw new IllegalArgumentException();
  }
  
  public String toString()
  {
    return getMajor() + "." + getMinor();
  }
  
  public static boolean isVersionString(String s)
  {
    return (s != null) && (s.length() >= 3) && (s.charAt(0) == '1') && (s.charAt(1) == '.');
  }
  
  public static Version fromString(String s)
  {
    Assert.isTrue(isVersionString(s));
    return (Version)JQueryApiPlugin.ALL_VERSIONS.get('7' - s.charAt(2));
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.SimpleVersion
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api;

public abstract interface Version
  extends Comparable<Version>
{}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.Version
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

public class ConflictJQueryEventInferenceProvider
  extends JQueryEventInferenceProvider
{
  boolean getNoConflict()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.ConflictJQueryEventInferenceProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

final class JQueryCallbackMethods$CallbackLocator
{
  final String selector;
  final int argmentCount;
  
  JQueryCallbackMethods$CallbackLocator(String selector, int argmentCount)
  {
    this.selector = selector;
    this.argmentCount = argmentCount;
  }
  
  public String toString()
  {
    return selector + ":(" + argmentCount + ')';
  }
  
  public int hashCode()
  {
    return selector.hashCode() ^ argmentCount;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof CallbackLocator)) {
      return false;
    }
    CallbackLocator other = (CallbackLocator)obj;
    
    return (selector.equals(selector)) && (argmentCount == argmentCount);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.JQueryCallbackMethods.CallbackLocator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class JQueryCallbackMethods
{
  public static final int NO_CALLBACK = -1;
  private final Map<CallbackLocator, Set<Integer>> callbackFunctions;
  private final Set<String> callbackSelectors;
  
  public JQueryCallbackMethods()
  {
    callbackFunctions = new ConcurrentHashMap();
    
    callbackSelectors = new HashSet();
  }
  
  public void addCallbackMethod(String selector, int argumentAcount, int eventIndex)
  {
    callbackSelectors.add(selector);
    CallbackLocator key = new CallbackLocator(selector, argumentAcount);
    Set<Integer> indices = (Set)callbackFunctions.get(key);
    if (indices == null)
    {
      indices = new HashSet(3);
      callbackFunctions.put(key, indices);
    }
    indices.add(Integer.valueOf(eventIndex));
  }
  
  public Set<Integer> getCallbackIndices(String selector, int argumentCount)
  {
    CallbackLocator key = new CallbackLocator(selector, argumentCount);
    return (Set)callbackFunctions.get(key);
  }
  
  public boolean isEventSelector(String selector)
  {
    return callbackSelectors.contains(selector);
  }
  
  static final class CallbackLocator
  {
    final String selector;
    final int argmentCount;
    
    CallbackLocator(String selector, int argmentCount)
    {
      this.selector = selector;
      this.argmentCount = argmentCount;
    }
    
    public String toString()
    {
      return selector + ":(" + argmentCount + ')';
    }
    
    public int hashCode()
    {
      return selector.hashCode() ^ argmentCount;
    }
    
    public boolean equals(Object obj)
    {
      if (this == obj) {
        return true;
      }
      if (!(obj instanceof CallbackLocator)) {
        return false;
      }
      CallbackLocator other = (CallbackLocator)obj;
      
      return (selector.equals(selector)) && (argmentCount == argmentCount);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.JQueryCallbackMethods
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

public class JQueryCallbackMethodsGenerator
{
  public JQueryCallbackMethods createCallbackMethods()
  {
    JQueryCallbackMethods callbacks = new JQueryCallbackMethods();
    callbacks.addCallbackMethod("off", 3, 2);
    callbacks.addCallbackMethod("on", 4, 3);
    callbacks.addCallbackMethod("on", 3, 2);
    callbacks.addCallbackMethod("on", 2, 1);
    callbacks.addCallbackMethod("toggle", 3, 0);
    callbacks.addCallbackMethod("toggle", 3, 1);
    callbacks.addCallbackMethod("toggle", 3, 2);
    callbacks.addCallbackMethod("toggle", 2, 0);
    callbacks.addCallbackMethod("toggle", 2, 1);
    callbacks.addCallbackMethod("undelegate", 3, 2);
    callbacks.addCallbackMethod("delegate", 3, 2);
    callbacks.addCallbackMethod("delegate", 4, 3);
    callbacks.addCallbackMethod("focusout", 1, 0);
    callbacks.addCallbackMethod("focusout", 2, 1);
    callbacks.addCallbackMethod("focusout", 1, 0);
    callbacks.addCallbackMethod("focusin", 1, 0);
    callbacks.addCallbackMethod("focusin", 2, 1);
    callbacks.addCallbackMethod("focusin", 1, 0);
    callbacks.addCallbackMethod("keydown", 1, 0);
    callbacks.addCallbackMethod("keydown", 2, 1);
    callbacks.addCallbackMethod("keydown", 1, 0);
    callbacks.addCallbackMethod("scroll", 1, 0);
    callbacks.addCallbackMethod("scroll", 2, 1);
    callbacks.addCallbackMethod("scroll", 1, 0);
    callbacks.addCallbackMethod("resize", 1, 0);
    callbacks.addCallbackMethod("resize", 2, 1);
    callbacks.addCallbackMethod("resize", 1, 0);
    callbacks.addCallbackMethod("keyup", 1, 0);
    callbacks.addCallbackMethod("keyup", 2, 1);
    callbacks.addCallbackMethod("keyup", 1, 0);
    callbacks.addCallbackMethod("keypress", 1, 0);
    callbacks.addCallbackMethod("keypress", 2, 1);
    callbacks.addCallbackMethod("keypress", 1, 0);
    callbacks.addCallbackMethod("submit", 1, 0);
    callbacks.addCallbackMethod("submit", 2, 1);
    callbacks.addCallbackMethod("submit", 1, 0);
    callbacks.addCallbackMethod("select", 1, 0);
    callbacks.addCallbackMethod("select", 2, 1);
    callbacks.addCallbackMethod("select", 1, 0);
    callbacks.addCallbackMethod("change", 1, 0);
    callbacks.addCallbackMethod("change", 2, 1);
    callbacks.addCallbackMethod("change", 1, 0);
    callbacks.addCallbackMethod("blur", 1, 0);
    callbacks.addCallbackMethod("blur", 2, 1);
    callbacks.addCallbackMethod("blur", 1, 0);
    callbacks.addCallbackMethod("focus", 1, 0);
    callbacks.addCallbackMethod("focus", 2, 1);
    callbacks.addCallbackMethod("focus", 1, 0);
    callbacks.addCallbackMethod("mousemove", 1, 0);
    callbacks.addCallbackMethod("mousemove", 2, 1);
    callbacks.addCallbackMethod("mousemove", 1, 0);
    callbacks.addCallbackMethod("mouseleave", 1, 0);
    callbacks.addCallbackMethod("mouseleave", 2, 1);
    callbacks.addCallbackMethod("mouseleave", 1, 0);
    callbacks.addCallbackMethod("mouseenter", 1, 0);
    callbacks.addCallbackMethod("mouseenter", 2, 1);
    callbacks.addCallbackMethod("mouseenter", 1, 0);
    callbacks.addCallbackMethod("mouseout", 1, 0);
    callbacks.addCallbackMethod("mouseout", 2, 1);
    callbacks.addCallbackMethod("mouseout", 1, 0);
    callbacks.addCallbackMethod("mouseover", 1, 0);
    callbacks.addCallbackMethod("mouseover", 2, 1);
    callbacks.addCallbackMethod("mouseover", 1, 0);
    callbacks.addCallbackMethod("dblclick", 1, 0);
    callbacks.addCallbackMethod("dblclick", 2, 1);
    callbacks.addCallbackMethod("dblclick", 1, 0);
    callbacks.addCallbackMethod("click", 1, 0);
    callbacks.addCallbackMethod("click", 2, 1);
    callbacks.addCallbackMethod("click", 1, 0);
    callbacks.addCallbackMethod("mouseup", 1, 0);
    callbacks.addCallbackMethod("mouseup", 2, 1);
    callbacks.addCallbackMethod("mouseup", 1, 0);
    callbacks.addCallbackMethod("mousedown", 1, 0);
    callbacks.addCallbackMethod("mousedown", 2, 1);
    callbacks.addCallbackMethod("mousedown", 1, 0);
    callbacks.addCallbackMethod("error", 1, 0);
    callbacks.addCallbackMethod("error", 2, 1);
    callbacks.addCallbackMethod("error", 1, 0);
    callbacks.addCallbackMethod("unload", 1, 0);
    callbacks.addCallbackMethod("unload", 2, 1);
    callbacks.addCallbackMethod("unload", 1, 0);
    callbacks.addCallbackMethod("load", 1, 0);
    callbacks.addCallbackMethod("load", 2, 1);
    callbacks.addCallbackMethod("load", 1, 0);
    callbacks.addCallbackMethod("live", 2, 1);
    callbacks.addCallbackMethod("live", 3, 2);
    callbacks.addCallbackMethod("one", 3, 2);
    callbacks.addCallbackMethod("one", 2, 1);
    callbacks.addCallbackMethod("one", 4, 3);
    callbacks.addCallbackMethod("one", 3, 2);
    callbacks.addCallbackMethod("one", 2, 1);
    callbacks.addCallbackMethod("unbind", 2, 1);
    callbacks.addCallbackMethod("bind", 3, 2);
    callbacks.addCallbackMethod("bind", 2, 1);
    return callbacks;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.JQueryCallbackMethodsGenerator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

import org.eclipse.wst.jsdt.core.ast.ASTVisitor;
import org.eclipse.wst.jsdt.core.infer.IInferEngine;
import org.eclipse.wst.jsdt.core.infer.InferOptions;
import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration;

public class JQueryEventInferEngine
  implements IInferEngine
{
  private final JQueryCallbackMethods callbackMethods;
  private final boolean noConflict;
  private CompilationUnitDeclaration compilationUnit;
  private InferOptions options;
  
  public JQueryEventInferEngine(JQueryCallbackMethods callbackMethods, boolean noConflict)
  {
    this.callbackMethods = callbackMethods;
    this.noConflict = noConflict;
  }
  
  public void doInfer()
  {
    ASTVisitor inferer = new JQueryEventInferer(callbackMethods, noConflict);
    compilationUnit.traverse(inferer);
  }
  
  public void initialize() {}
  
  public void initializeOptions(InferOptions inferOptions)
  {
    options = inferOptions;
  }
  
  public void setCompilationUnit(CompilationUnitDeclaration parsedUnit)
  {
    compilationUnit = parsedUnit;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.JQueryEventInferEngine
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.jsdt.core.IIncludePathEntry;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.jsdt.core.infer.IInferEngine;
import org.eclipse.wst.jsdt.core.infer.IInferenceFile;
import org.eclipse.wst.jsdt.core.infer.InferrenceProvider;
import org.eclipse.wst.jsdt.core.infer.RefactoringSupport;
import org.eclipse.wst.jsdt.core.infer.ResolutionConfiguration;
import org.eclipselabs.jsdt.jquery.api.JQueryApiPlugin;
import org.eclipselabs.jsdt.jquery.api.JQueryContainer;
import org.osgi.framework.Bundle;

public abstract class JQueryEventInferenceProvider
  implements InferrenceProvider
{
  private static final String ID = JQueryEventInferenceProvider.class.getName();
  private final JQueryCallbackMethods callbackMethods;
  
  public JQueryEventInferenceProvider()
  {
    callbackMethods = new JQueryCallbackMethodsGenerator().createCallbackMethods();
  }
  
  public IInferEngine getInferEngine()
  {
    return new JQueryEventInferEngine(callbackMethods, getNoConflict());
  }
  
  abstract boolean getNoConflict();
  
  public int applysTo(IInferenceFile scriptFile)
  {
    char[] fileName = scriptFile.getFileName();
    if (fileName == null) {
      return 2;
    }
    IPath path = new Path(new String(fileName));
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    IResource member = workspaceRoot.findMember(path);
    if (member == null) {
      return 2;
    }
    IProject project = member.getProject();
    if (project == null) {
      return 2;
    }
    try
    {
      if (!project.hasNature("org.eclipse.wst.jsdt.core.jsNature")) {
        return 2;
      }
      IJavaScriptProject javaScriptProject = JavaScriptCore.create(project);
      if (!javaScriptProject.exists()) {
        return 2;
      }
      IIncludePathEntry[] rawIncludepath = javaScriptProject.getRawIncludepath();
      if (rawIncludepath == null) {
        return 2;
      }
      IIncludePathEntry[] arrayOfIIncludePathEntry1;
      int j = (arrayOfIIncludePathEntry1 = rawIncludepath).length;
      for (int i = 0; i < j; i++)
      {
        IIncludePathEntry includePathEntry = arrayOfIIncludePathEntry1[i];
        if ((includePathEntry.getEntryKind() == 5) && 
          (includePathEntry.getContentKind() == 1))
        {
          IPath includePath = includePathEntry.getPath();
          if (isHit(includePath)) {
            return 3;
          }
        }
      }
    }
    catch (CoreException e)
    {
      logException("failed to determine whether project uses jQuery", e);
      return 2;
    }
    return 2;
  }
  
  boolean isHit(IPath includePath)
  {
    return (JQueryContainer.isQueryNoConflict(includePath)) || ((!getNoConflict()) && (JQueryContainer.isQueryConflict(includePath)));
  }
  
  private void logException(String message, Exception cause)
  {
    JQueryApiPlugin plugin = JQueryApiPlugin.getDefault();
    String pluginId = plugin.getBundle().getSymbolicName();
    Status status = new Status(4, pluginId, message, cause);
    ILog log = plugin.getLog();
    log.log(status);
  }
  
  public String getID()
  {
    return ID;
  }
  
  public ResolutionConfiguration getResolutionConfiguration()
  {
    return new ResolutionConfiguration();
  }
  
  public RefactoringSupport getRefactoringSupport()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.JQueryEventInferenceProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

import java.util.Set;
import org.eclipse.wst.jsdt.core.ast.ASTVisitor;
import org.eclipse.wst.jsdt.core.ast.IArgument;
import org.eclipse.wst.jsdt.core.ast.IExpression;
import org.eclipse.wst.jsdt.core.ast.IFunctionCall;
import org.eclipse.wst.jsdt.core.ast.IFunctionExpression;
import org.eclipse.wst.jsdt.core.infer.InferredType;
import org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration;

public class JQueryEventInferer
  extends ASTVisitor
{
  private InferredType jQueryEvent;
  private final JQueryCallbackMethods callbackMethods;
  private final boolean noConflict;
  
  public JQueryEventInferer(JQueryCallbackMethods callbackMethods, boolean noConflict)
  {
    this.callbackMethods = callbackMethods;
    this.noConflict = noConflict;
    jQueryEvent = new InferredType("jQueryEvent".toCharArray());
  }
  
  public boolean visit(IFunctionCall functionCall)
  {
    IExpression receiver = functionCall.getReceiver();
    if (isJQueryObject(receiver))
    {
      String selector = new String(functionCall.getSelector());
      if (isJQueryEventSelector(selector)) {
        inferJQueryFunctionCall(functionCall, selector);
      }
    }
    return super.visit(functionCall);
  }
  
  private void inferJQueryFunctionCall(IFunctionCall functionCall, String selector)
  {
    IExpression[] functionCallArguments = functionCall.getArguments();
    if (functionCallArguments != null)
    {
      int argumentCount = functionCallArguments.length;
      Set<Integer> callbackIndices = getCallbackIndices(selector, argumentCount);
      for (int i = 0; i < argumentCount; i++)
      {
        IExpression expression = functionCallArguments[i];
        if ((expression.getASTType() == 44) && (callbackIndices.contains(Integer.valueOf(i)))) {
          setInferredTypeEvent(expression);
        }
      }
    }
  }
  
  private void setInferredTypeEvent(IExpression expression)
  {
    IFunctionExpression functionExpression = (IFunctionExpression)expression;
    IArgument[] functionExpressionArguments = functionExpression.getMethodDeclaration().getArguments();
    if ((functionExpressionArguments != null) && (functionExpressionArguments.length == 1))
    {
      IArgument argument = functionExpressionArguments[0];
      argument.setInferredType(jQueryEvent);
    }
  }
  
  private Set<Integer> getCallbackIndices(String selector, int argumentCount)
  {
    return callbackMethods.getCallbackIndices(selector, argumentCount);
  }
  
  private boolean isJQueryObject(IExpression expression)
  {
    IExpression current = expression;
    while ((current != null) && (current.getASTType() == 42))
    {
      IFunctionCall call = (IFunctionCall)current;
      if (isJQuery(call.getSelector())) {
        return true;
      }
      current = call.getReceiver();
    }
    return false;
  }
  
  private boolean isJQueryEventSelector(String selector)
  {
    return callbackMethods.isEventSelector(selector);
  }
  
  private boolean isJQuery(char[] token)
  {
    if (token == null) {
      return false;
    }
    if ((!noConflict) && (token.length == 1)) {
      return token[0] == '$';
    }
    if (token.length == 6) {
      return (token[0] == 'j') && (token[1] == 'Q') && (token[2] == 'u') && (token[3] == 'e') && (token[4] == 'r') && (token[5] == 'y');
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.JQueryEventInferer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.infer;

public class NoConflictJQueryEventInferenceProvider
  extends JQueryEventInferenceProvider
{
  boolean getNoConflict()
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.infer.NoConflictJQueryEventInferenceProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery10ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery10ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.0"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery10ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery10NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery10NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.0"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery10NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery11ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery11ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.1"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery11ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery11NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery11NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.1"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery11NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery12ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery12ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.2"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery12ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery12NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery12NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.2"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery12NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery13ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery13ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.3"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery13ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery13NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery13NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.3"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery13NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery14ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery14ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.4"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery14ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery14NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery14NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.4"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery14NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery15ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery15ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.5"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery15ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public final class JQuery15NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery15NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.5"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery15NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public class JQuery16ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery16ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.6"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery16ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public class JQuery16NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery16NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.6"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery16NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public class JQuery17ConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery17ConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.7"), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery17ConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipselabs.jsdt.jquery.api.SimpleVersion;

public class JQuery17NoConflictGlobalScopeContainerInitializer
  extends JQueryGlobalScopeContainerInitializer
{
  public JQuery17NoConflictGlobalScopeContainerInitializer()
  {
    super(SimpleVersion.fromString("1.7"), true);
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQuery17NoConflictGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipse.wst.jsdt.core.compiler.libraries.SystemLibraryLocation;
import org.eclipselabs.jsdt.jquery.api.JQueryApiPlugin;
import org.osgi.framework.Bundle;

final class JQueryGlobalScopeContainerInitializer$JQueryLibraryLocation
  extends SystemLibraryLocation
{
  JQueryGlobalScopeContainerInitializer$JQueryLibraryLocation(JQueryGlobalScopeContainerInitializer paramJQueryGlobalScopeContainerInitializer) {}
  
  public char[][] getLibraryFileNames()
  {
    return JQueryGlobalScopeContainerInitializer.access$0(this$0);
  }
  
  protected String getPluginId()
  {
    return JQueryApiPlugin.getDefault().getBundle().getSymbolicName();
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQueryGlobalScopeContainerInitializer.JQueryLibraryLocation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipselabs.jsdt.jquery.api.js;

import org.eclipse.core.runtime.IPath;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainerInitializer;
import org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer;
import org.eclipse.wst.jsdt.core.compiler.libraries.LibraryLocation;
import org.eclipse.wst.jsdt.core.compiler.libraries.SystemLibraryLocation;
import org.eclipselabs.jsdt.jquery.api.JQueryApiMessages;
import org.eclipselabs.jsdt.jquery.api.JQueryApiPlugin;
import org.eclipselabs.jsdt.jquery.api.Version;
import org.osgi.framework.Bundle;

abstract class JQueryGlobalScopeContainerInitializer
  extends JsGlobalScopeContainerInitializer
  implements IJsGlobalScopeContainerInitializer
{
  private final Version version;
  private final boolean noConflict;
  private final LibraryLocation libraryLocation;
  private final char[][] libraryFileNames;
  
  JQueryGlobalScopeContainerInitializer(Version version, boolean noConflict)
  {
    this.version = version;
    this.noConflict = noConflict;
    libraryFileNames = new char[][] { getLibraryFileName(version, noConflict).toCharArray() };
    libraryLocation = new JQueryLibraryLocation();
  }
  
  private static String getLibraryFileName(Version version, boolean noConflict)
  {
    if (noConflict) {
      return "jquery-doc-noconflict-" + version + ".js";
    }
    return "jquery-doc-" + version + ".js";
  }
  
  public String getDescription()
  {
    if (noConflict) {
      return NLS.bind(JQueryApiMessages.container_noConflictDescription, version.toString());
    }
    return NLS.bind(JQueryApiMessages.container_conflictDescription, version.toString());
  }
  
  public LibraryLocation getLibraryLocation()
  {
    return libraryLocation;
  }
  
  public boolean allowAttachJsDoc()
  {
    return false;
  }
  
  public boolean canUpdateJsGlobalScopeContainer(IPath containerPath, IJavaScriptProject project)
  {
    return true;
  }
  
  final class JQueryLibraryLocation
    extends SystemLibraryLocation
  {
    JQueryLibraryLocation() {}
    
    public char[][] getLibraryFileNames()
    {
      return libraryFileNames;
    }
    
    protected String getPluginId()
    {
      return JQueryApiPlugin.getDefault().getBundle().getSymbolicName();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipselabs.jsdt.jquery.api.js.JQueryGlobalScopeContainerInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

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