org.eclipse.jst.jsf.facesconfig.ui_1.2.2.v201103292152

ublic String getName()
  {
    return name;
  }
  
  public IMethod getSetterMethod()
  {
    return setterMethod;
  }
  
  public IMethod getGetterMethod()
  {
    return getterMethod;
  }
  
  public String getQualifiedType()
  {
    if (qualifiedType == null)
    {
      IMethod getterSetterMethod = getterMethod != null ? getterMethod : 
        setterMethod;
      
      qualifiedType = JavaClassUtils.getQualifiedTypeNameInTypeHierarchy(
        getterSetterMethod.getDeclaringType(), signatureType);
    }
    return qualifiedType;
  }
  
  public String getSignatureType()
  {
    return signatureType;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.JavaBeanProperty
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.util;

import java.util.Comparator;

class JavaBeanUtils$1
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    String name1 = ((JavaBeanProperty)o1).getName();
    String name2 = ((JavaBeanProperty)o2).getName();
    return name1.compareTo(name2);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.JavaBeanUtils.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.util;

import java.beans.Introspector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jst.jsf.common.ui.internal.utils.JavaModelUtil;

public final class JavaBeanUtils
{
  private static final String JAVA_UTIL_LIST = "java.util.List";
  private static final String JAVA_UTIL_MAP = "java.util.Map";
  
  private static IMethod getPropertyGetterMethod(IType type, String propertyName)
  {
    if ((type == null) || (!type.exists()) || (propertyName == null)) {
      return null;
    }
    IMethod getterMethod = null;
    
    String methodBaseName = null;
    if (propertyName.length() == 1) {
      methodBaseName = propertyName.substring(0, 1).toUpperCase();
    } else {
      methodBaseName = 
        propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
    }
    String getterMethodName = "get" + methodBaseName;
    
    getterMethod = type.getMethod(getterMethodName, null);
    if ((getterMethod == null) || (!getterMethod.exists()) || 
      (!JavaClassUtils.isPublicMethod(getterMethod)))
    {
      getterMethodName = "is" + methodBaseName;
      getterMethod = type.getMethod(getterMethodName, null);
      if ((getterMethod == null) || (!getterMethod.exists()) || 
        (!JavaClassUtils.isPublicMethod(getterMethod))) {
        getterMethod = null;
      }
    }
    return getterMethod;
  }
  
  private static IMethod getPropertyGetterMethodInTypeHierarchy(IType type, String propertyName)
    throws JavaModelException
  {
    if ((type == null) || (!type.exists()) || (propertyName == null)) {
      return null;
    }
    IMethod getterMethod = null;
    
    getterMethod = getPropertyGetterMethod(type, propertyName);
    if (getterMethod == null)
    {
      ITypeHierarchy typeHierarchy = null;
      typeHierarchy = type.newSupertypeHierarchy(null);
      if (typeHierarchy == null) {
        return null;
      }
      IType[] superTypes = typeHierarchy.getAllSuperclasses(type);
      if ((superTypes == null) || (superTypes.length == 0)) {
        return null;
      }
      for (int i = 0; i < superTypes.length; i++) {
        if (!superTypes[i].getFullyQualifiedName().equals(
          "java.lang.Object"))
        {
          getterMethod = getPropertyGetterMethod(superTypes[i], 
            propertyName);
          if (getterMethod != null) {
            break;
          }
        }
      }
    }
    return getterMethod;
  }
  
  private static IMethod getPropertySetterMethodInTypeHierarchy(IType type, String propertyName)
    throws JavaModelException
  {
    if ((type == null) || (!type.exists()) || (propertyName == null)) {
      return null;
    }
    IMethod setterMethod = null;
    
    setterMethod = getPropertySetterMethod(type, propertyName);
    if (setterMethod == null)
    {
      ITypeHierarchy typeHierarchy = null;
      typeHierarchy = type.newSupertypeHierarchy(null);
      if (typeHierarchy == null) {
        return null;
      }
      IType[] superTypes = typeHierarchy.getAllSuperclasses(type);
      if ((superTypes == null) || (superTypes.length == 0)) {
        return null;
      }
      for (int i = 0; i < superTypes.length; i++) {
        if (!superTypes[i].getFullyQualifiedName().equals(
          "java.lang.Object"))
        {
          setterMethod = getPropertySetterMethod(superTypes[i], 
            propertyName);
          if (setterMethod != null) {
            break;
          }
        }
      }
    }
    return setterMethod;
  }
  
  private static IMethod getPropertySetterMethod(IType type, String propertyName)
    throws JavaModelException
  {
    if ((type == null) || (!type.exists()) || (propertyName == null)) {
      return null;
    }
    IMethod setterMethod = null;
    
    String methodBaseName = null;
    if (propertyName.length() == 1) {
      methodBaseName = propertyName.substring(0, 1).toUpperCase();
    } else {
      methodBaseName = 
        propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
    }
    String setterMethodName = "set" + methodBaseName;
    
    IMethod[] methods = (IMethod[])null;
    
    methods = type.getMethods();
    if ((methods == null) || (methods.length == 0)) {
      return null;
    }
    for (int i = 0; i < methods.length; i++) {
      if ((methods[i].getElementName().equals(setterMethodName)) && 
        (methods[i] != null) && (methods[i].exists()) && 
        (JavaClassUtils.isPublicMethod(methods[i])))
      {
        String returnType = methods[i].getReturnType();
        if (returnType.equals("V"))
        {
          String[] params = methods[i].getParameterTypes();
          if (params.length == 1) {
            setterMethod = methods[i];
          }
        }
      }
    }
    return setterMethod;
  }
  
  public static boolean isBeanProperty(IType baseType, String propertyName)
  {
    if ((baseType == null) || (!baseType.exists()) || (propertyName == null)) {
      return false;
    }
    return getBeanPropertyType(baseType, propertyName) != null;
  }
  
  public static IType getBeanPropertyType(IType baseType, String propertyName)
  {
    if ((baseType == null) || (!baseType.exists()) || (propertyName == null)) {
      return null;
    }
    String typeSignature = null;
    IMethod getterMethod = null;
    IMethod setterMethod = null;
    
    IType declaredType = baseType;
    try
    {
      getterMethod = getPropertyGetterMethodInTypeHierarchy(baseType, 
        propertyName);
      setterMethod = getPropertySetterMethodInTypeHierarchy(baseType, 
        propertyName);
    }
    catch (JavaModelException localJavaModelException1) {}
    if ((getterMethod != null) && (setterMethod == null))
    {
      declaredType = getterMethod.getDeclaringType();
      try
      {
        typeSignature = getterMethod.getReturnType();
      }
      catch (JavaModelException localJavaModelException2) {}
    }
    else if ((setterMethod != null) && (getterMethod == null))
    {
      declaredType = setterMethod.getDeclaringType();
      typeSignature = setterMethod.getParameterTypes()[0];
    }
    else if ((setterMethod != null) && (getterMethod != null))
    {
      declaredType = getterMethod.getDeclaringType();
      try
      {
        if (getterMethod.getReturnType().equals(
          setterMethod.getParameterTypes()[0])) {
          typeSignature = getterMethod.getReturnType();
        }
      }
      catch (JavaModelException localJavaModelException3) {}
    }
    if (typeSignature == null) {
      return null;
    }
    IType type = null;
    try
    {
      String typeName = JavaModelUtil.getResolvedTypeName(typeSignature, 
        declaredType);
      if (typeName != null) {
        type = baseType.getJavaProject().findType(typeName);
      }
    }
    catch (JavaModelException localJavaModelException4) {}
    return type;
  }
  
  public static IMethod[] getBeanPropertyMethods(IType baseType, String propertyName)
  {
    if ((baseType == null) || (!baseType.exists()) || (propertyName == null)) {
      return null;
    }
    IMethod[] methods = new IMethod[2];
    
    IMethod getterMethod = null;
    IMethod setterMethod = null;
    try
    {
      getterMethod = getPropertyGetterMethodInTypeHierarchy(baseType, 
        propertyName);
      
      setterMethod = getPropertySetterMethodInTypeHierarchy(baseType, 
        propertyName);
    }
    catch (JavaModelException localJavaModelException1) {}
    if ((getterMethod != null) && (setterMethod == null)) {
      methods[0] = getterMethod;
    } else if ((setterMethod != null) && (getterMethod == null)) {
      methods[1] = setterMethod;
    } else if ((setterMethod != null) && (getterMethod != null)) {
      try
      {
        if (getterMethod.getReturnType().equals(
          setterMethod.getParameterTypes()[0]))
        {
          methods[0] = getterMethod;
          methods[1] = setterMethod;
        }
      }
      catch (JavaModelException localJavaModelException2) {}
    }
    return methods;
  }
  
  public static boolean isListType(IType type)
  {
    if (type == null) {
      return false;
    }
    if (type.getFullyQualifiedName().equalsIgnoreCase("java.util.List")) {
      return true;
    }
    return JavaClassUtils.isSubClassOf(type.getJavaProject(), type
      .getFullyQualifiedName(), "java.util.List");
  }
  
  public static boolean isMapType(IType type)
  {
    if (type == null) {
      return false;
    }
    if (type.getFullyQualifiedName().equalsIgnoreCase("java.util.Map")) {
      return true;
    }
    return JavaClassUtils.isSubClassOf(type.getJavaProject(), type
      .getFullyQualifiedName(), "java.util.Map");
  }
  
  public static boolean isGetterMethod(IMethod method)
  {
    try
    {
      if (!JavaClassUtils.isPublicMethod(method)) {
        return false;
      }
      String[] params = method.getParameterTypes();
      if (params.length > 0) {
        return false;
      }
      if ((!method.getElementName().startsWith("get")) && (!method.getElementName().startsWith("is"))) {
        return false;
      }
      String rtn = method.getReturnType();
      if (!rtn.equals("V")) {
        return true;
      }
    }
    catch (JavaModelException localJavaModelException) {}
    return false;
  }
  
  public static boolean isSetterMethod(IMethod method)
  {
    try
    {
      if (!JavaClassUtils.isPublicMethod(method)) {
        return false;
      }
      if (!method.getElementName().startsWith("set")) {
        return false;
      }
      if (method.getParameterTypes().length != 1) {
        return false;
      }
      String rtn = method.getReturnType();
      if (rtn.equals("V")) {
        return true;
      }
    }
    catch (JavaModelException localJavaModelException) {}
    return false;
  }
  
  public static String toLowCaseFirstChar(String str)
  {
    if ((str != null) && (str.length() > 0)) {
      if (str.length() == 1) {
        str = str.toLowerCase();
      } else {
        str = str.substring(0, 1).toLowerCase() + str.substring(1);
      }
    }
    return str;
  }
  
  public static String toUpperCaseFirstChar(String str)
  {
    if ((str != null) && (str.length() > 0)) {
      if (str.length() == 1) {
        str = str.toUpperCase();
      } else {
        str = str.substring(0, 1).toUpperCase() + str.substring(1);
      }
    }
    return str;
  }
  
  public static String getPropertyNameFromGetterMethod(IMethod method)
  {
    if (!isGetterMethod(method)) {
      return null;
    }
    String methodName = method.getElementName();
    String propertyName = null;
    if ((methodName.startsWith("get")) && (methodName.length() > 3)) {
      propertyName = methodName.substring(3);
    } else if ((methodName.startsWith("is")) && (methodName.length() > 2)) {
      propertyName = methodName.substring(2);
    }
    propertyName = Introspector.decapitalize(propertyName);
    return propertyName;
  }
  
  public static String getPropertyNameFromSetterMethod(IMethod method)
  {
    if (!isSetterMethod(method)) {
      return null;
    }
    String methodName = method.getElementName();
    String propertyName = null;
    if ((methodName.startsWith("set")) && (methodName.length() > 3)) {
      propertyName = methodName.substring(3);
    }
    propertyName = Introspector.decapitalize(propertyName);
    return propertyName;
  }
  
  private static IMethod getMethodWithSameParamters(IMethod[] methods, Map visitedMethods, IMethod foundMethod, String foundMethodName, String[] foundParamTypes)
  {
    String[] foundParamQulifiedTypeNames = (String[])null;
    if ((foundParamTypes != null) && (foundParamTypes.length > 0))
    {
      foundParamQulifiedTypeNames = new String[foundParamTypes.length];
      for (int i = 0; i < foundParamTypes.length; i++) {
        foundParamQulifiedTypeNames[i] = 
          JavaClassUtils.getQualifiedTypeNameInTypeHierarchy(foundMethod
          .getDeclaringType(), foundParamTypes[i]);
      }
    }
    for (int i = 0; i < methods.length; i++) {
      if (visitedMethods.get(methods[i]) == null) {
        if (methods[i].getElementName().equals(foundMethodName))
        {
          if ((methods[i].getParameterTypes() == null) && 
            (foundParamTypes == null)) {
            return methods[i];
          }
          if ((methods[i].getParameterTypes() != null) && 
            (foundParamTypes != null) && 
            (foundParamTypes.length == methods[i].getParameterTypes().length))
          {
            boolean bSameParams = true;
            String[] methodParamTypes = methods[i].getParameterTypes();
            for (int j = 0; j < foundParamQulifiedTypeNames.length; j++)
            {
              String methodParamQualifiedTypeName = 
                JavaClassUtils.getQualifiedTypeNameInTypeHierarchy(methods[i]
                .getDeclaringType(), methodParamTypes[j]);
              if ((!methodParamQualifiedTypeName.equals(foundParamQulifiedTypeNames[j])) && 
                (!JavaClassUtils.isSubClassOf(methods[i]
                .getJavaProject(), 
                methodParamQualifiedTypeName, 
                foundParamQulifiedTypeNames[j]))) {
                if (!JavaClassUtils.isSubClassOf(methods[i]
                  .getJavaProject(), 
                  foundParamQulifiedTypeNames[j], 
                  methodParamQualifiedTypeName))
                {
                  bSameParams = false;
                  break;
                }
              }
            }
            if (bSameParams) {
              return methods[i];
            }
          }
        }
      }
    }
    return null;
  }
  
  public static JavaBeanProperty[] getBeanProperties(IType classType)
  {
    try
    {
      methods = JavaClassUtils.getMethods(classType);
    }
    catch (JavaModelException localJavaModelException)
    {
      IMethod[] methods;
      return null;
    }
    IMethod[] methods;
    return getBeanProperties(classType, methods);
  }
  
  public static JavaBeanProperty[] getBeanProperties(IType type, IMethod[] methods)
  {
    if ((methods == null) || (methods.length == 0)) {
      return null;
    }
    List properties = new ArrayList();
    Map visitedMethods = new HashMap();
    for (int m = 0; m < methods.length; m++)
    {
      String propertyName = null;
      if (visitedMethods.get(methods[m]) == null)
      {
        visitedMethods.put(methods[m], methods[m]);
        
        propertyName = 
          getPropertyNameFromGetterMethod(methods[m]);
        if ((propertyName != null) && (propertyName.length() > 0))
        {
          String setterMethodName = "set" + 
            toUpperCaseFirstChar(propertyName);
          
          String getterReturnType = null;
          try
          {
            getterReturnType = methods[m].getReturnType();
          }
          catch (JavaModelException localJavaModelException1)
          {
            continue;
          }
          IMethod setterMethod = getMethodWithSameParamters(methods, 
            visitedMethods, methods[m], setterMethodName, 
            new String[] { getterReturnType });
          if ((setterMethod != null) && (setterMethod.exists())) {
            visitedMethods.put(setterMethod, setterMethod);
          }
          properties.add(new JavaBeanProperty(propertyName, 
            getterReturnType, methods[m], setterMethod));
        }
        else
        {
          propertyName = 
            getPropertyNameFromSetterMethod(methods[m]);
          if ((propertyName != null) && (propertyName.length() > 0))
          {
            String getterMethodName = "get" + 
              toUpperCaseFirstChar(propertyName);
            IMethod getterMethod = getMethodWithSameParamters(methods, 
              visitedMethods, methods[m], getterMethodName, null);
            if ((getterMethod != null) && (getterMethod.exists()))
            {
              try
              {
                if (!getterMethod.getReturnType().equals(
                  methods[m].getParameterTypes()[0])) {
                  break label412;
                }
                visitedMethods.put(getterMethod, getterMethod);
              }
              catch (JavaModelException localJavaModelException2) {}
            }
            else
            {
              getterMethodName = 
                "is" + toUpperCaseFirstChar(propertyName);
              getterMethod = getMethodWithSameParamters(methods, 
                visitedMethods, methods[m], getterMethodName, null);
              try
              {
                if ((getterMethod != null) && 
                  (getterMethod.exists()) && 
                  (getterMethod.getReturnType().equals(
                  methods[m].getParameterTypes()[0]))) {
                  visitedMethods.put(getterMethod, getterMethod);
                }
              }
              catch (JavaModelException localJavaModelException3) {}
            }
            label412:
            properties.add(new JavaBeanProperty(propertyName, methods[m]
              .getParameterTypes()[0], getterMethod, methods[m]));
          }
        }
      }
    }
    JavaBeanProperty[] propertyArray = 
      (JavaBeanProperty[])properties.toArray(new JavaBeanProperty[properties.size()]);
    
    Arrays.sort(propertyArray, new Comparator()
    {
      public int compare(Object o1, Object o2)
      {
        String name1 = ((JavaBeanProperty)o1).getName();
        String name2 = ((JavaBeanProperty)o2).getName();
        return name1.compareTo(name2);
      }
    });
    return propertyArray;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.JavaBeanUtils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.util;

import java.util.Comparator;
import org.eclipse.jdt.core.IMethod;

class JavaClassUtils$1
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    String name1 = ((IMethod)o1).getElementName();
    String name2 = ((IMethod)o2).getElementName();
    return name1.compareTo(name2);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.JavaClassUtils.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jst.jsf.common.ui.internal.utils.JavaModelUtil;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;

public class JavaClassUtils
{
  public static boolean hasIllegalCharacters(String text)
  {
    if ((text.length() == 0) || 
      (!Character.isJavaIdentifierStart(text.charAt(0)))) {
      return true;
    }
    for (int i = 1; i < text.length(); i++) {
      if (!Character.isJavaIdentifierPart(text.charAt(i))) {
        return true;
      }
    }
    return false;
  }
  
  public static boolean hasNoConstructor(IMethod[] methods)
  {
    for (int m = 0; m < methods.length; m++) {
      try
      {
        if (methods[m].isConstructor()) {
          return false;
        }
      }
      catch (JavaModelException localJavaModelException) {}
    }
    return true;
  }
  
  public static boolean isPublicMethod(IMethod method)
  {
    int accessFlags = 0;
    try
    {
      accessFlags = method.getFlags();
    }
    catch (JavaModelException localJavaModelException)
    {
      return false;
    }
    boolean isPublic = Flags.isPublic(accessFlags);
    if ((!Flags.isPrivate(accessFlags)) && 
      (!Flags.isProtected(accessFlags)) && 
      (!Flags.isPublic(accessFlags))) {
      isPublic = true;
    }
    if (!isPublic) {
      return false;
    }
    return true;
  }
  
  public static boolean hasPublicConstructor(IMethod[] methods)
  {
    for (int m = 0; m < methods.length; m++) {
      try
      {
        if ((methods[m].isConstructor()) && (isPublicMethod(methods[m])))
        {
          String[] params = methods[m].getParameterTypes();
          if (params.length == 0)
          {
            String rtn = methods[m].getReturnType();
            if (!rtn.equals("V")) {
              break;
            }
            return true;
          }
        }
      }
      catch (JavaModelException localJavaModelException) {}
    }
    return false;
  }
  
  public static boolean isPrimitiveType(IType classType, String signatureName)
  {
    while (signatureName.startsWith("[")) {
      signatureName = signatureName.substring(1);
    }
    int kind = Signature.getTypeSignatureKind(signatureName);
    if ((kind == 2) || 
      (signatureName.equals("V"))) {
      return true;
    }
    String qualifiedName = getQualifiedTypeNameInTypeHierarchy(classType, 
      signatureName);
    if ((qualifiedName.startsWith("java.lang")) || (qualifiedName.startsWith("java.util"))) {
      return true;
    }
    return false;
  }
  
  public static IType getType(IProject project, String className)
  {
    if (project == null) {
      return null;
    }
    IType cunit = null;
    if (className.length() > 0)
    {
      IJavaProject jProject = JavaCore.create(project);
      try
      {
        cunit = jProject.findType(className);
      }
      catch (JavaModelException localJavaModelException) {}
    }
    return cunit;
  }
  
  public static boolean openType(IType type)
  {
    if ((type == null) || (!type.exists())) {
      return false;
    }
    try
    {
      IEditorPart editorPart = JavaUI.openInEditor(type
        .getPrimaryElement());
      if (editorPart != null)
      {
        JavaUI.revealInEditor(editorPart, type.getPrimaryElement());
        return true;
      }
    }
    catch (PartInitException localPartInitException) {}catch (JavaModelException localJavaModelException) {}
    return false;
  }
  
  public static String getPackageName(IFile javaFile)
  {
    if (javaFile == null) {
      return null;
    }
    String ext = "." + javaFile.getFileExtension();
    if (!ext.equalsIgnoreCase("java")) {
      return null;
    }
    String packagename = new String();
    ICompilationUnit cunit = JavaCore.createCompilationUnitFrom(javaFile);
    try
    {
      IPackageDeclaration[] packages = cunit.getPackageDeclarations();
      if (packages.length == 0) {
        packagename = new String();
      } else {
        packagename = packages[0].getElementName();
      }
    }
    catch (JavaModelException localJavaModelException) {}
    return packagename;
  }
  
  private static void copyToMethodList(List methodList, IMethod[] methods)
  {
    if ((methods != null) && (methods.length > 0)) {
      for (int i = 0; i < methods.length; i++) {
        if (!isDuplicateMethod(methodList, methods[i])) {
          methodList.add(methods[i]);
        }
      }
    }
  }
  
  private static boolean isDuplicateMethod(List methodList, IMethod method)
  {
    if ((method == null) || (!method.exists())) {
      return false;
    }
    String[] paramTypes = method.getParameterTypes();
    String methodName = method.getElementName();
    for (Iterator iter = methodList.iterator(); iter.hasNext();)
    {
      IMethod existedMethod = (IMethod)iter.next();
      if (isSameMethodSignature(methodName, paramTypes, existedMethod)) {
        return true;
      }
    }
    return false;
  }
  
  public static boolean isSameMethodSignature(String name, String[] paramTypes, IMethod curr)
  {
    if (name.equals(curr.getElementName()))
    {
      String[] currParamTypes = curr.getParameterTypes();
      if (paramTypes.length == currParamTypes.length)
      {
        for (int i = 0; i < paramTypes.length; i++)
        {
          String t1 = Signature.getSimpleName(
            Signature.toString(paramTypes[i]));
          String t2 = Signature.getSimpleName(
            Signature.toString(currParamTypes[i]));
          if (!t1.equals(t2)) {
            return false;
          }
        }
        return true;
      }
    }
    return false;
  }
  
  public static IMethod[] getMethods(IType classType)
    throws JavaModelException
  {
    if (classType == null) {
      return null;
    }
    List methodList = new ArrayList();
    IMethod[] methods = classType.getMethods();
    copyToMethodList(methodList, methods);
    
    ITypeHierarchy typeHierarchy = classType.newSupertypeHierarchy(null);
    if (typeHierarchy != null)
    {
      IType[] superTypes = typeHierarchy.getAllSuperclasses(classType);
      if ((superTypes != null) && (superTypes.length > 0)) {
        for (int i = 0; i < superTypes.length; i++) {
          if (!superTypes[i].getFullyQualifiedName().equals(
            "java.lang.Object"))
          {
            methods = superTypes[i].getMethods();
            
            copyToMethodList(methodList, methods);
          }
        }
      }
    }
    if ((methodList != null) && (methodList.size() > 0))
    {
      IMethod[] validMethods = 
        (IMethod[])methodList.toArray(new IMethod[methodList.size()]);
      
      Arrays.sort(validMethods, new Comparator()
      {
        public int compare(Object o1, Object o2)
        {
          String name1 = ((IMethod)o1).getElementName();
          String name2 = ((IMethod)o2).getElementName();
          return name1.compareTo(name2);
        }
      });
      return validMethods;
    }
    return null;
  }
  
  public static String getQualifiedTypeNameInTypeHierarchy(IType classType, String signatureName)
  {
    int arrayNum = 0;
    while (signatureName.startsWith("["))
    {
      arrayNum++;
      signatureName = signatureName.substring(1);
    }
    String qualifiedTypeName = Signature.toString(signatureName);
    int kind = Signature.getTypeSignatureKind(signatureName);
    if (kind != 2)
    {
      if (!signatureName.equals("V")) {}
    }
    else
    {
      while (arrayNum > 0)
      {
        qualifiedTypeName = qualifiedTypeName + "[]";
        arrayNum--;
      }
      return qualifiedTypeName;
    }
    String typeName = Signature.toString(signatureName);
    
    String foundName = getQualifiedTypeName(classType, typeName);
    if (foundName != null)
    {
      qualifiedTypeName = foundName;
    }
    else
    {
      ITypeHierarchy typeHierarchy = null;
      try
      {
        typeHierarchy = classType.newSupertypeHierarchy(null);
      }
      catch (JavaModelException localJavaModelException) {}
      if (typeHierarchy != null)
      {
        IType[] superTypes = typeHierarchy.getAllSupertypes(classType);
        if ((superTypes != null) && (superTypes.length > 0)) {
          for (int i = 0; i < superTypes.length; i++) {
            if (!superTypes[i].getFullyQualifiedName().equals(
              "java.lang.Object"))
            {
              foundName = getQualifiedTypeName(superTypes[i], 
                typeName);
              if (foundName != null)
              {
                qualifiedTypeName = foundName;
                break;
              }
            }
          }
        }
      }
    }
    while (arrayNum > 0)
    {
      qualifiedTypeName = qualifiedTypeName + "[]";
      arrayNum--;
    }
    return qualifiedTypeName;
  }
  
  public static String getQualifiedTypeName(IType classType, String typeName)
  {
    String qualifiedTypeName = null;
    try
    {
      String[][] resolvedNames = classType.resolveType(typeName);
      if ((resolvedNames != null) && (resolvedNames.length > 0)) {
        qualifiedTypeName = JavaModelUtil.concatenateName(
          resolvedNames[0][0], resolvedNames[0][1]);
      }
    }
    catch (JavaModelException localJavaModelException) {}
    return qualifiedTypeName;
  }
  
  public static boolean isSubClassOf(IJavaProject jProject, String subClass, String superClass)
  {
    if ((jProject == null) || (subClass == null) || (superClass == null)) {
      return false;
    }
    try
    {
      IType subClassType = jProject.findType(subClass);
      if (subClassType != null)
      {
        ITypeHierarchy typeHierarchy = null;
        try
        {
          typeHierarchy = subClassType.newSupertypeHierarchy(null);
        }
        catch (JavaModelException localJavaModelException1) {}
        IType[] superTypes = typeHierarchy
          .getAllSupertypes(subClassType);
        if ((superTypes != null) && (superTypes.length > 0)) {
          for (int i = 0; i < superTypes.length; i++) {
            if (superTypes[i].getFullyQualifiedName().equals(
              superClass)) {
              return true;
            }
          }
        }
      }
    }
    catch (JavaModelException localJavaModelException2) {}
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.JavaClassUtils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.util;

import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanNameType;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;

public class ManagedBeanUtil
{
  public static boolean isBeanDuplicate(IProject project, String beanName)
  {
    IJSFAppConfigManager appCfgMgr = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(project);
    if (appCfgMgr != null)
    {
      List<ManagedBeanType> beans = appCfgMgr.getManagedBeans();
      for (ManagedBeanType mbti : beans) {
        if (mbti.getManagedBeanName() != null)
        {
          String name = mbti.getManagedBeanName()
            .getTextContent();
          if ((name != null) && (name.equals(beanName))) {
            return true;
          }
        }
      }
    }
    return false;
  }
  
  public static String getDefaultManagedBeanName(IProject project, String refName)
  {
    String defaultName = refName;
    
    int newRefNameIndex = 1;
    while (isBeanDuplicate(project, defaultName))
    {
      defaultName = refName + newRefNameIndex;
      newRefNameIndex++;
    }
    return defaultName;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.ManagedBeanUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.util;

import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

public class ModelUtil
{
  private static final String ENTITY_NEWLINE = "&#xA;";
  private static final String ENTITY_TAB = "&#x9;";
  private static final String ENTITY_CARRIAGE_RETURN = "&#xD;";
  private static final String ENTITY_AMPERSAND = "&amp;";
  private static final String ENTITY_DOUBLE_QUOTE = "&quot;";
  private static final String ENTITY_SINGLE_QUOTE = "&apos;";
  private static final String ENTITY_GREATER_THAN = "&gt;";
  private static final String ENTITY_LESS_THAN = "&lt;";
  
  public static String getSuperType(Object key)
  {
    if (key == FacesConfigPackage.eINSTANCE.getActionListenerType()) {
      return "javax.faces.event.ActionListener";
    }
    if (key == FacesConfigPackage.eINSTANCE.getNavigationHandlerType()) {
      return "javax.faces.application.NavigationHandler";
    }
    if (key == FacesConfigPackage.eINSTANCE.getPropertyResolverType()) {
      return "javax.faces.el.PropertyResolver";
    }
    if (key == FacesConfigPackage.eINSTANCE.getStateManagerType()) {
      return "javax.faces.application.StateManager";
    }
    if (key == FacesConfigPackage.eINSTANCE.getVariableResolverType()) {
      return "javax.faces.el.VariableResolver";
    }
    if (key == FacesConfigPackage.eINSTANCE.getViewHandlerType()) {
      return "javax.faces.application.ViewHandler";
    }
    if (key == FacesConfigPackage.eINSTANCE.getApplicationFactoryType()) {
      return "javax.faces.application.ApplicationFactory";
    }
    if (key == FacesConfigPackage.eINSTANCE.getFacesContextFactoryType()) {
      return "javax.faces.context.FacesContextFactory";
    }
    if (key == FacesConfigPackage.eINSTANCE.getLifecycleFactoryType()) {
      return "javax.faces.lifecycle.LifecycleFactory";
    }
    if (key == FacesConfigPackage.eINSTANCE.getRenderKitFactoryType()) {
      return "javax.faces.render.RenderKitFactory";
    }
    if (key == FacesConfigPackage.eINSTANCE.getPhaseListenerType()) {
      return "javax.faces.event.PhaseListener";
    }
    return null;
  }
  
  public static String escapeEntities(String str)
  {
    if (isEmptyString(str)) {
      return "";
    }
    StringBuffer buffer = null;
    int i = 0;
    for (int n = str.length(); i < n; i++)
    {
      char ch = str.charAt(i);
      String entity;
      String entity;
      String entity;
      String entity;
      String entity;
      String entity;
      String entity;
      String entity;
      String entity;
      switch (ch)
      {
      case '<': 
        entity = "&lt;";
        break;
      case '>': 
        entity = "&gt;";
        break;
      case '\'': 
        entity = "&apos;";
        break;
      case '"': 
        entity = "&quot;";
        break;
      case '&': 
        entity = "&amp;";
        break;
      case '\r': 
        entity = "&#xD;";
        break;
      case '\t': 
        entity = "&#x9;";
        break;
      case '\n': 
        entity = "&#xA;";
        break;
      default: 
        entity = null;
      }
      if (buffer == null)
      {
        if (entity != null)
        {
          buffer = new StringBuffer(str.length() + 20);
          
          buffer.append(str.substring(0, i));
          buffer.append(entity);
        }
      }
      else if (entity == null) {
        buffer.append(ch);
      } else {
        buffer.append(entity);
      }
    }
    return buffer == null ? str : buffer.toString();
  }
  
  public static String unEscapeEntities(String str)
  {
    if (isEmptyString(str)) {
      return "";
    }
    String result = new String(str);
    
    result = result.replaceAll("&amp;", "&");
    result = result.replaceAll("&lt;", "<");
    result = result.replaceAll("&gt;", ">");
    result = result.replaceAll("&apos;", "'");
    result = result.replaceAll("&quot;", "\"");
    result = result.replaceAll("&#xD;", "\r");
    result = result.replaceAll("&#x9;", "\t");
    result = result.replaceAll("&#xA;", "\n");
    
    return result;
  }
  
  private static boolean isEmptyString(String value)
  {
    if ((value == null) || (value.length() == 0)) {
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.ModelUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.util;

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.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;

public class WebrootUtil
  extends org.eclipse.jst.jsf.common.ui.internal.utils.WebrootUtil
{
  public static String getProjectPath(EObject model, String strPath)
  {
    IProject project = getProject(model);
    
    String strProjectPath = "";
    if (strPath != null)
    {
      IPath path = new Path(strPath);
      if (path.getFileExtension() != null)
      {
        IPath webContentPath = getWebContentPath(project);
        if (webContentPath != null) {
          strProjectPath = webContentPath.toString() + strPath;
        }
      }
      else
      {
        strPath = new String(strPath.getBytes(), 0, 
          strPath.length() - 1);
        IPath webContentPath = getWebContentPath(project);
        if (webContentPath != null) {
          strProjectPath = webContentPath.toString() + strPath;
        }
      }
    }
    return strProjectPath;
  }
  
  public static IResource getResource(EObject model)
  {
    IResource resource = null;
    if ((model != null) && (model.eResource() != null))
    {
      URI uri = model.eResource().getURI();
      IPath path = new Path(URI.decode(uri.devicePath()));
      
      path = path.removeFirstSegments(1);
      
      IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace()
        .getRoot();
      resource = workspaceRoot.findMember(path);
    }
    return resource;
  }
  
  public static IProject getProject(EObject model)
  {
    IProject project = null;
    
    IResource resource = getResource(model);
    if (resource != null) {
      project = resource.getProject();
    }
    return project;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.wizard;

import java.util.List;

public abstract interface ISummaryDataSource
{
  public abstract List getSummaryData();
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.wizard.ISummaryDataSource
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.wizard;

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

class ManagedBeanClassSelectionPage$1
  extends SelectionAdapter
{
  ManagedBeanClassSelectionPage$1(ManagedBeanClassSelectionPage paramManagedBeanClassSelectionPage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    ManagedBeanClassSelectionPage.access$0(this$0).setSelection(
      !ManagedBeanClassSelectionPage.access$1(this$0).getSelection());
    ManagedBeanClassSelectionPage.access$2(this$0, ManagedBeanClassSelectionPage.access$1(this$0).getSelection());
    ManagedBeanClassSelectionPage.access$3(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

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