Example usage for org.eclipse.jdt.core.dom IPackageBinding getNameComponents

List of usage examples for org.eclipse.jdt.core.dom IPackageBinding getNameComponents

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom IPackageBinding getNameComponents.

Prototype

public String[] getNameComponents();

Source Link

Document

Returns the list of name component making up the name of the package represented by this binding.

Usage

From source file:lang.java.jdt.internal.BindingConverter.java

License:Open Source License

private IList importPackageBinding(IPackageBinding pb) {
    IListWriter lw = VF.listWriter(ADT_ID);

    String components[] = pb.getNameComponents();
    for (String c : components) {
        lw.append(VF.constructor(CONS_PACKAGE, VF.string(c)));
    }/*  w  w  w. j a va2 s.c o  m*/

    return lw.done();
}

From source file:org.objectstyle.wolips.core.tobeintregrated.ASTMethodExplorer.java

License:Open Source License

public boolean visit(MethodDeclaration node) {
    IMethodBinding binding = node.resolveBinding();
    if (binding != null) {
        ITypeBinding[] params = binding.getParameterTypes();
        String paramString = "(";
        for (int i = 0; i < params.length; i++) {
            paramString += params[i].getName();
            if (i < params.length - 1)
                paramString += ",";
        }/* www.  j  a v  a 2s . com*/
        paramString += ")";
        String key = binding.getDeclaringClass().getName() + "." + binding.getName() + paramString;
        ITypeBinding declaredClassBinding = binding.getDeclaringClass();

        // overrides super method
        ITypeBinding superClassBinding = declaredClassBinding.getSuperclass();
        boolean skip = checkSuperClass(binding, superClassBinding);

        // is implementation of interface
        ITypeBinding[] interfaceBindings = declaredClassBinding.getInterfaces();
        skip = skip || checkInterfaces(binding, interfaceBindings);

        if (superClassBinding != null) {
            // classDependencies
            classDependencies.put(declaredClassBinding.getName(), superClassBinding.getName());

            // WOComponent && title()
            boolean isWOComponent = superClassBinding.getName().equals("WOComponent");
            skip = skip || (isWOComponent && binding.getName().equals("title"));
        }

        // DirectAction.Action()
        boolean isDirectAction = declaredClassBinding.getName().equals("DirectAction");
        skip = skip || (isDirectAction
                && (binding.getName().endsWith("Action") || binding.getName().equals("performActionNamed")));

        // app || logic && Constructor
        IPackageBinding packageBinding = declaredClassBinding.getPackage();
        String[] comps = packageBinding.getNameComponents();
        if (comps.length > 0) {
            String comp = comps[comps.length - 1];
            skip = skip || ((comp.equals("app") || comp.equals("logic")) && binding.isConstructor());
        }

        if (!usedMethods.containsKey(key)) {
            List<String> value = new ArrayList<String>();
            value.add(iCompUnit.getHandleIdentifier());
            value.add(binding.getName());
            value.add(binding.getReturnType().getName());
            value.add(skip + "");
            declaredMethods.put(key, value);
        }
    }
    return true;
}