Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.TypeDeclaration


        for (Object declaration : declarations) {
            if (!(declaration instanceof TypeDeclaration)) {
                continue;
            }
            TypeDeclaration type = (TypeDeclaration) declaration;
            if (!typeName.equals(type.getName().getFullyQualifiedName())) {
                continue;
            }
            if (index < 0) {
                return type;
            }
            return searchTypeDeclaration(type.bodyDeclarations(), innerClassName);
        }
        return null;
    }
View Full Code Here


        List<AbstractTypeDeclaration> topLevelType = unit.types();

        for (AbstractTypeDeclaration abstractTypeDeclaration : topLevelType) {
            // process TypeDeclaration (class, interface)
            if (abstractTypeDeclaration instanceof TypeDeclaration) {
                TypeDeclaration typeDeclaration = (TypeDeclaration)abstractTypeDeclaration;
                if (typeDeclaration.isInterface()) {
                    // is an interface top level type
                    InterfaceMetadata interfaceMetadata = new InterfaceMetadata();
                    interfaceMetadata.setName(JavaMetadataUtil.getName(typeDeclaration.getName()));
                    metadata.add(interfaceMetadata);
                } else {
                    // is a class top level type
                    ClassMetadata classMetadata = new ClassMetadata();
                    processModifiersOfTypDeclaration(typeDeclaration, classMetadata);
                    classMetadata.setName(JavaMetadataUtil.getName(typeDeclaration.getName()));
                    // fields of the class top level type
                    FieldDeclaration[] fieldDeclarations = typeDeclaration.getFields();
                    for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
                        FieldMetadata fieldMetadata = getFieldMetadataFrom(fieldDeclaration);
                        classMetadata.getFields().add(fieldMetadata);
                    }
                    // methods of the class top level type
                    MethodDeclaration[] methodDeclarations = typeDeclaration.getMethods();
                    for (MethodDeclaration methodDeclaration : methodDeclarations) {
                        MethodMetadata methodMetadata = getMethodMetadataFrom(methodDeclaration);
                        classMetadata.getMethods().add(methodMetadata);
                    }
                    metadata.add(classMetadata);
View Full Code Here

    }

    private IfStatement getThisStatement() throws Exception {
      MethodDeclaration method;
      {
        TypeDeclaration typeDeclaration = JavaInfoUtils.getTypeDeclaration(DialogInfo.this);
        method =
            AstNodeUtils.getMethodBySignature(
                typeDeclaration,
                "onButtonPressed(com.extjs.gxt.ui.client.widget.button.Button)");
        if (method == null) {
View Full Code Here

        if (status.getSeverity() == IStatus.ERROR) {
          return status.getMessage();
        }
      }
      // prepare TypeDeclaration
      TypeDeclaration typeDeclaration = getFormTypeDeclaration();
      // check for existing getter
      {
        String signature = m_exposedGetter + "()";
        if (AstNodeUtils.getMethodBySignature(typeDeclaration, signature) != null) {
          return MessageFormat.format(
View Full Code Here

    /**
     * Generates getter/setter for exposing property.
     */
    private void expose(boolean isPublic) throws Exception {
      AstEditor editor = getFormEditor();
      TypeDeclaration typeDeclaration = getFormTypeDeclaration();
      //
      BodyDeclarationTarget methodTarget = new BodyDeclarationTarget(typeDeclaration, false);
      String modifierSource = isPublic ? "public" : "protected";
      String name = NameSupport.ensureName(m_object);
      // getter
View Full Code Here

        m_object.getElement().setAttribute(nameAttribute, null);
      }
      // update Java
      {
        AstEditor editor = getEditor();
        TypeDeclaration typeDeclaration = editor.getPrimaryType();
        // remove handlers
        for (MethodDeclaration methodDeclaration : typeDeclaration.getMethods()) {
          if (EventHandlerProperty.isObjectHandler(methodDeclaration, name)) {
            editor.removeBodyDeclaration(methodDeclaration);
          }
        }
        // remove field
View Full Code Here

  /**
   * Sets new name for "@UiField" of the widget.
   */
  private void setName(String name) throws Exception {
    AstEditor editor = getEditor();
    TypeDeclaration typeDeclaration = editor.getPrimaryType();
    // prepare "old" state
    String oldName = getName();
    VariableDeclaration oldVariable = getBinderField(typeDeclaration, oldName);
    // set "ui:field" attribute
    {
View Full Code Here

  public void addUiFieldJava(Class<?> fieldClass,
      String fieldTypeName,
      String name,
      String initializer) throws Exception {
    AstEditor editor = getEditor();
    TypeDeclaration typeDeclaration = editor.getPrimaryType();
    // prepare source lines
    List<String> lines;
    {
      lines = Lists.newArrayList();
      String source = "@com.google.gwt.uibinder.client.UiField(provided=true) ";
View Full Code Here

      }
    });
    // add TypeDeclaration fields
    {
      AstEditor editor = getEditor();
      TypeDeclaration typeDeclaration = editor.getPrimaryType();
      for (FieldDeclaration fieldDeclaration : typeDeclaration.getFields()) {
        for (VariableDeclarationFragment fragment : DomGenerics.fragments(fieldDeclaration)) {
          String name = fragment.getName().getIdentifier();
          resultSet.add(name);
        }
      }
View Full Code Here

    super.morph_source(newComponent);
    // replace ui-field type
    AstEditor formEditor = newComponent.getContext().getFormEditor();
    if (!StringUtils.isEmpty(uiFieldName) && formEditor != null) {
      //NameSupport.setName(newComponent, uiFieldName);
      TypeDeclaration typeDeclaration = formEditor.getPrimaryType();
      VariableDeclaration variableDeclaration =
          NameSupport.getBinderField(typeDeclaration, uiFieldName);
      if (variableDeclaration != null) {
        formEditor.replaceVariableType(
            variableDeclaration,
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.TypeDeclaration

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.