Examples of IField


Examples of org.eclipse.jdt.core.IField

  {
    Vector<String> ret = new Vector<String>();

    IType thisType = compilationUnit.getAllTypes()[0];

    IField fields[] = thisType.getFields();

    for (int i = 0; i < fields.length; i++)
    {
      IMethod method = thisType.getMethod(makeGet(fields[i].getElementName()), null);
View Full Code Here

Examples of org.eclipse.jdt.core.IField

   
    IType Clazz = (IType) field.getParent();

      try
      {       
        IField fields[] = Clazz.getFields();

        for(int i=0; i<fields.length; i++)
        {
          IField item = fields[i];
         
          if (item.equals(field))
          {
            nextField = (IField)fields[i+1];
            // System.out.println("Next Field"+nextField);
          }
        }                       
View Full Code Here

Examples of org.eclipse.jdt.core.IField

     */
    public static IField find(IVariableBinding field, IJavaProject in) throws JavaModelException {
        IType declaringClass = find(field.getDeclaringClass(), in);
        if (declaringClass == null)
            return null;
        IField foundField= declaringClass.getField(field.getName());
        if (! foundField.exists())
            return null;
        return foundField;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IField

      case IJavaElement.INITIALIZER:
        IInitializer init = (IInitializer) child;
        processAnonymousInnerTypes(visitor, aenum, init, monitor);
        break;
      case IJavaElement.FIELD:
        IField field = (IField) child;
        processAnonymousInnerTypes(visitor, aenum, field, monitor);
        break;
      }
    }
    if (methodvisitor != null) {
View Full Code Here

Examples of org.eclipse.jdt.core.IField

      case IJavaElement.INITIALIZER:
        IInitializer init = (IInitializer) child;
        processAnonymousInnerTypes(visitor, aenum, init, monitor);
        break;
      case IJavaElement.FIELD:
        IField field = (IField) child;
        processAnonymousInnerTypes(visitor, aenum, field, monitor);
        break;
      }
    }
    if (methodvisitor != null) {
View Full Code Here

Examples of org.eclipse.jdt.core.IField

                .createFatalErrorStatus(Messages.ConvertConstantsToEnumRefactoring_FieldsHaveNotBeenSpecified));

      else {
        for (final Iterator it = this.fieldsToRefactor.listIterator(); it
            .hasNext();) {
          final IField field = (IField) it.next();
          if (!field.exists()) {
            String message = Messages.ConvertConstantsToEnumRefactoring_FileDoesNotExist;
            status.addWarning(MessageFormat.format(message, new Object[] {field.getElementName()}));
            it.remove();
          }

          else if (!field.isBinary()
              && !field.getCompilationUnit().isStructureKnown()) {
            String message = Messages.ConvertConstantsToEnumRefactoring_CUContainsCompileErrors;
            status.addWarning(MessageFormat.format(message, new Object[] {field.getCompilationUnit().getElementName()}));
            it.remove();
          }

          else if (field.getElementName().equals("serialVersionUID")) { //$NON-NLS-1$
            String message = Messages.ConvertConstantsToEnumRefactoring_FieldNotEligibleForEnum;
            status.addWarning(MessageFormat.format(message, new Object[] {field.getElementName()}));
            it.remove();
          }

          else if (Signature.getTypeSignatureKind(field
              .getTypeSignature()) != Signature.BASE_TYPE_SIGNATURE) {
            String message = Messages.ConvertConstantsToEnumRefactoring_FieldMustBePrimitive;
            status.addWarning(MessageFormat.format(message, new Object[] {field.getElementName()}));
            it.remove();
          }

          else if (!Util.isConstantField(field)) {
            String message = Messages.ConvertConstantsToEnumRefactoring_FieldIsNotAConstant;
            status.addWarning(MessageFormat.format(message, new Object[] {field.getElementName()}));
            it.remove();
          }

          else if (Flags.isVolatile(field.getFlags())
              || Flags.isTransient(field.getFlags())) {
            String message = Messages.ConvertConstantsToEnumRefactoring_FieldCannotBeExpressedAsEnum;
            status.addWarning(MessageFormat.format(message, new Object[] {field.getElementName()}));
            it.remove();
          }

          if (Signature.getElementType(field.getTypeSignature()) == Signature.SIG_BOOLEAN) {
            String message = Messages.ConvertConstantsToEnumRefactoring_FieldIsBoolean;
            status
                .addWarning(message);
            status.addWarning(MessageFormat.format(message, new Object[] {field.getElementName()}));
            it.remove();
          }
        }
        if (this.fieldsToRefactor.isEmpty())
          status
View Full Code Here

Examples of org.eclipse.jdt.core.IField

          comparator);

      final Map annotationToQualifiedNameMap = new HashMap();

      for (final Iterator cit = constants.iterator(); cit.hasNext();) {
        final IField constantField = (IField) cit.next();
        final FieldDeclaration originalFieldDeclaration = (FieldDeclaration) this.removedFieldNodes
            .get(constantField);

        // Get annotations.
        final Collection annotationCollection = new LinkedHashSet();
        for (final Iterator mit = originalFieldDeclaration.modifiers()
            .iterator(); mit.hasNext();) {
          final Object o = mit.next();
          if (o instanceof Annotation) {
            final Annotation oldAnnotation = (Annotation) o;
            final Annotation newAnnotation = (Annotation) ASTNode
                .copySubtree(ast, oldAnnotation);
            annotationToQualifiedNameMap.put(newAnnotation,
                oldAnnotation.resolveTypeBinding()
                    .getQualifiedName());
            annotationCollection.add(newAnnotation);
          }
        }

        // Get the javadoc.
        final Javadoc originalJavadoc = originalFieldDeclaration
            .getJavadoc();
        final Javadoc newJavadoc = (Javadoc) ASTNode.copySubtree(ast,
            originalJavadoc);

        final EnumConstantDeclaration constDecl = createNewEnumConstantDeclarataion(
            ast, ast.newSimpleName(constantField.getElementName()),
            newJavadoc, annotationCollection);

        newEnumConstantToOldConstantFieldMap.put(constDecl, constantField);
        enumConstantDeclarationCollection.add(constDecl);
      }
View Full Code Here

Examples of org.eclipse.jdt.core.IField

  private RefactoringStatus reportNonEnumerizableInputConstants() {
    final RefactoringStatus ret = new RefactoringStatus();
    final Collection enumerizableElements = Util
        .flattenForest(this.computer.getEnumerizationForest());
    for (final Iterator it = this.fieldsToRefactor.iterator(); it.hasNext();) {
      final IField field = (IField) it.next();
      if (!enumerizableElements.contains(field)) {
        String message = Messages.ConvertConstantsToEnumRefactoring_RefactoringNotPossible;
        ret.addWarning(MessageFormat.format(message, new Object[] {field.getElementName()}));
      }
    }
    return ret;
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IField

    if (!(o2 instanceof EnumConstantDeclaration && o2 instanceof EnumConstantDeclaration)) {
      String message = Messages.EnumConstantComparator_BothObjectsMustMatch;
      throw new IllegalArgumentException(MessageFormat.format(message, new Object[]{EnumConstantDeclaration.class.getName()}));
    }

    final IField f1 = (IField) this.newEnumConstantToOldConstantFieldMap.get(o1);
    final IField f2 = (IField) this.newEnumConstantToOldConstantFieldMap.get(o2);

    Object v1 = null;
    Object v2 = null;

    try {
      v1 = f1.getConstant();
      v2 = f2.getConstant();
    } catch (final JavaModelException E) {
      final ClassCastException ce = new ClassCastException(
          Messages.EnumConstantComparator_CannotCompare);
      ce.initCause(E);
      throw ce;
View Full Code Here

Examples of org.eclipse.jdt.core.IField

            + o);
      break;
    }

    case IJavaElement.FIELD: {
      final IField f = (IField) o;
      final String sig = f.getTypeSignature();
      if (!isValidTypeSignature(sig))
        throw new IllegalArgumentException(Messages.Worklist_IllegalWorklistElement
            + o);
      break;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.