Beispiel #1
0
  @Override
  public boolean visit(ClassDataDeclaration classDataDeclaration) {
    classDataDeclaration.accept(
        new ClassDataDeclarationValidator(problemRequestor, compilerOptions, partBinding));

    //		if(classDataDeclaration.hasInitializer()) {
    //			problemRequestor.acceptProblem(
    //				classDataDeclaration.getInitializer(),
    //				IProblemRequestor.INITIALIZER_NOT_ALLOWED_FOR_EXTERNALTYPE_FIELD);
    //		}
    return false;
  }
Beispiel #2
0
  private void fillPageDataModel(EGLEditor editor, PageDataModel model) {
    if (editor != null) {
      IEditorInput editorInput = editor.getEditorInput();
      if (editorInput instanceof FileEditorInput) {
        FileEditorInput fileEditorInput = (FileEditorInput) editorInput;

        // process handler
        HandlerFieldsResolver handlerFieldsResolver =
            new HandlerFieldsResolver(fileEditorInput.getFile());
        handlerFieldsResolver.resolve();
        Handler handler = handlerFieldsResolver.getRUIHandler();
        if (handler != null) {
          HandlerPageDataNode handlerPageDataNode =
              (HandlerPageDataNode)
                  PageDataNodeFactory.newPageDataNode(
                      getName(handler), PageDataNodeFactory.HANDLER_PAGE_DATA_NODE);
          model.addRootPageDataNode(handlerPageDataNode);

          // process class fields
          List contents = handler.getContents();
          for (int i = 0; i < contents.size(); i++) {
            if (contents.get(i) instanceof ClassDataDeclaration) {
              ClassDataDeclaration classDataDeclaration = (ClassDataDeclaration) contents.get(i);
              List names = classDataDeclaration.getNames();
              for (int j = 0; j < names.size(); j++) {
                Object oName = names.get(j);
                if (oName instanceof SimpleName) {
                  SimpleName simpleName = (SimpleName) oName;
                  Member dataBinding = simpleName.resolveMember();
                  Type typeBinding = simpleName.resolveType();
                  if (dataBinding != null) {
                    if (typeBinding != null && isAcceptType(typeBinding)) {
                      if (typeBinding instanceof ParameterizedType) {
                        typeBinding = ((ParameterizedType) typeBinding).getParameterizableType();
                      }

                      // Single
                      if (TypeUtils.isPrimitive(typeBinding)
                          //													|| typeBinding.getKind() == ITypeBinding.DATAITEM_BINDING
                          || typeBinding instanceof Record) {
                        if (!TypeUtils.Type_ANY.equals(typeBinding)) {
                          DataFieldPageDataNode dataFieldPageDataNode = null;
                          if (classDataDeclaration.isPrivate()) {
                            dataFieldPageDataNode =
                                (DataFieldPageDataNode)
                                    PageDataNodeFactory.newPageDataNode(
                                        getName(dataBinding),
                                        PageDataNodeFactory.DATA_FIELD_PAGE_DATA_NODE_PRIVATE);
                          } else {
                            dataFieldPageDataNode =
                                (DataFieldPageDataNode)
                                    PageDataNodeFactory.newPageDataNode(
                                        getName(dataBinding),
                                        PageDataNodeFactory.DATA_FIELD_PAGE_DATA_NODE_PUBLIC);
                          }
                          dataFieldPageDataNode.setDataBindingName(
                              dataBinding.getCaseSensitiveName());
                          handlerPageDataNode.addChild(dataFieldPageDataNode);
                        }
                      }
                      // Array
                      if (typeBinding instanceof ArrayType) {
                        ArrayType arrayTypeBinding = (ArrayType) typeBinding;
                        Type elementTypeBinding = arrayTypeBinding.getElementType();
                        if (TypeUtils.isPrimitive(elementTypeBinding)
                            //														|| elementTypeBinding.getKind() ==
                            // ITypeBinding.DATAITEM_BINDING
                            || elementTypeBinding instanceof Record) {
                          if (!TypeUtils.Type_ANY.equals(elementTypeBinding)) {
                            DataFieldPageDataNode dataFieldPageDataNode = null;
                            if (classDataDeclaration.isPrivate()) {
                              dataFieldPageDataNode =
                                  (DataFieldPageDataNode)
                                      PageDataNodeFactory.newPageDataNode(
                                          getName(dataBinding),
                                          PageDataNodeFactory.DATA_FIELD_PAGE_DATA_NODE_PRIVATE);
                            } else {
                              dataFieldPageDataNode =
                                  (DataFieldPageDataNode)
                                      PageDataNodeFactory.newPageDataNode(
                                          getName(dataBinding),
                                          PageDataNodeFactory.DATA_FIELD_PAGE_DATA_NODE_PUBLIC);
                            }
                            dataFieldPageDataNode.setDataBindingName(
                                dataBinding.getCaseSensitiveName());
                            handlerPageDataNode.addChild(dataFieldPageDataNode);
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }