Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IField


  }

  @Override
  public void changeVisibility(String visibilityLiteral) {
    if(javaElement instanceof IField) {
      IField field = (IField)javaElement;
      try {
        SelfEncapsulateFieldRefactoring encapsulation =
          new SelfEncapsulateFieldRefactoring(field);
        int visiblityInt = VisibilityKind.PRIVATE;
        if(
            visibilityLiteral.equals(
                VisibilityKind
                .PRIVATE_LITERAL
                .getLiteral()
            )
        ) {
          // visiblityInt = Flags.AccPrivate;
          visiblityInt = Flags.AccPublic;
        }
        else if(
            visibilityLiteral.equals(
                VisibilityKind
                .PROTECTED_LITERAL
                .getLiteral()
            )
        ) {
          visiblityInt = Flags.AccProtected;
        }
        else if(
            visibilityLiteral.equals(
                VisibilityKind
                .PUBLIC_LITERAL
                .getLiteral()
            )
        ) {
          visiblityInt = Flags.AccPublic;
        }
        encapsulation.setVisibility(visiblityInt);
        encapsulation.setGetterName("get" + field.getElementName());
        encapsulation.setSetterName("set" + field.getElementName());
        // encapsulation.setGenerateJavadoc(true);
        // encapsulation.setConsiderVisibility(true);
        Refactoring r = encapsulation;
        PerformRefactoringOperation op =
          new PerformRefactoringOperation(
View Full Code Here


          if(parent instanceof IType) {
            IType t = (IType)parent;
            // From its children, we get the new property
            IField[] fields = t.getFields();
            if(fields!=null) {
              IField f = null;
              for(int i=0 ; i<fields.length ; i++) {
                f = fields[i];
                if(f!=null) {
                  String n = f.getElementName();
                  if((n!=null)&&(n.equals(newName))) {
                    javaElement = f;
                    break;
                  }
                }
View Full Code Here

          if(parent instanceof IType) {
            IType t = (IType)parent;
            // From its children, we get the new property
            IField[] fields = t.getFields();
            if(fields!=null) {
              IField f = null;
              for(int i=0 ; i<fields.length ; i++) {
                f = fields[i];
                if(f!=null) {
                  String n = f.getElementName();
                  if((n!=null)&&(n.equals(newName))) {
                    javaElement = f;
                    break;
                  }
                }
View Full Code Here

              + ' '
              + simpleName
              + Resources.getCodeConstant(
                  "constants.endStatement"
              );
            IField f =
              javaElement.createField(
                  content,
                  null,
                  false,
                  new NullProgressMonitor()
View Full Code Here

        String qualifiedName =
          PropertyHandler.resolveFullyQualifiedName(oldProperty);
         */
        IAttributeService tp = getPropertyService(qualifiedName);
        if (tp != null) {
          IField jEl = tp.getJavaElement();
          if (jEl != null) {
            try {
              jEl.delete(false, new NullProgressMonitor());
              properties.remove(tp);
            } catch (JavaModelException e) {
              e.printStackTrace();
            }
          }
View Full Code Here

        FieldAnnotation field = bug.getPrimaryField();
        if (field == null || type == null) {
            return;
        }

        IField ifield = type.getField(field.getFieldName());
        ISourceRange sourceRange = null;
        IScanner scanner = null;
        JavaModelException ex = null;
        try {
            sourceRange = ifield.getNameRange();
        } catch (JavaModelException e) {
            ex = e;
        }
        try {
            // second try...
            if (sourceRange == null) {
                sourceRange = ifield.getSourceRange();
            }
            scanner = initScanner(type, sourceRange);
        } catch (JavaModelException e) {
            String message = "Can not complete field annotation " + field + " for the field: " + ifield + " in class: "
                    + qualifiedClassName + ", type " + type + ", bug " + bug;
View Full Code Here

                        IType type = project.findType(className);
                        if (type == null) {
                            break findLocation;
                        }

                        IField f = type.getField(fa.getFieldName());
                        if (f != null) {
                            JavaUI.openInEditor(f, true, true);
                        } else {
                            activeEditor = JavaUI.openInEditor(type, true, true);
                            SourceLineAnnotation sla = fa.getSourceLines();
View Full Code Here

      m_object.setAttribute(nameAttribute, name);
    }
    // update Java
    if (oldVariable != null) {
      IType modelType = m_context.getFormType();
      IField modelField = modelType.getField(oldName);
      RenameSupport renameSupport =
          RenameSupport.create(modelField, name, RenameSupport.UPDATE_REFERENCES);
      renameSupport.perform(DesignerPlugin.getShell(), DesignerPlugin.getActiveWorkbenchWindow());
      return;
    } else {
View Full Code Here

    String bundleClassName = bundleClass.getName();
    // prepare JavaDoc lines
    List<String> javaDocLines;
    {
      String fieldName = fieldRef.getName();
      IField fieldModel = withObject.withType.getField(fieldName);
      javaDocLines = JavaDocUtils.getJavaDocLines(fieldModel, false);
    }
    // check GWT specific JavaDoc marker
    for (String javaDocLine : javaDocLines) {
      javaDocLine = javaDocLine.trim();
View Full Code Here

        "</ui:UiBinder>");
    refresh();
    // do @UiField rename
    {
      UiBinderContext context = (UiBinderContext) m_lastContext;
      IField modelField = context.getFormType().getField("oldName");
      RenameSupport renameSupport =
          RenameSupport.create(modelField, "newName", RenameSupport.UPDATE_REFERENCES);
      renameSupport.perform(DesignerPlugin.getShell(), DesignerPlugin.getActiveWorkbenchWindow());
    }
    assertEquals(
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IField

Copyright © 2018 www.massapicom. 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.