Package org.eclipse.jdt.core.dom

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


          // prepare reference on ImageBundle
          String bundleSource;
          {
            String className = source.substring(index + IMAGE_BUNDLE.length(), indexEnd);
            ImageBundleInfo bundle = getBundle(className);
            TypeDeclaration typeDeclaration = JavaInfoUtils.getTypeDeclaration(root);
            NodeTarget target = new NodeTarget(new BodyDeclarationTarget(typeDeclaration, false));
            bundleSource = bundle.getVariableSupport().getReferenceExpression(target);
          }
          // replace
          source = source.substring(0, index) + bundleSource + source.substring(indexEnd + 1);
View Full Code Here


   */
  private void fixRowSpan() throws Exception {
    // prepare FlexTableHelper in same package
    final String helperClassName;
    {
      TypeDeclaration rootTypeDeclaration = JavaInfoUtils.getTypeDeclaration(this);
      String rootTypeName = AstNodeUtils.getFullyQualifiedName(rootTypeDeclaration, false);
      String packageName = CodeUtils.getPackage(rootTypeName);
      helperClassName = packageName + ".FlexTableHelper";
    }
    // if FlexTableHelper exists, use it
View Full Code Here

   public static JavaSource<?> getJavaSource(JavaSource<?> enclosingType, Document document, CompilationUnit unit,
            ASTNode declaration)
   {
      if (declaration instanceof TypeDeclaration)
      {
         TypeDeclaration typeDeclaration = (TypeDeclaration) declaration;
         if (typeDeclaration.isInterface())
         {
            return new JavaInterfaceImpl(enclosingType, document, unit, typeDeclaration);
         }
         else
         {
View Full Code Here

   public static JavaSource<?> getJavaSource(JavaSource<?> enclosingType, Document document, CompilationUnit unit,
            ASTNode declaration)
   {
      if (declaration instanceof TypeDeclaration)
      {
         TypeDeclaration typeDeclaration = (TypeDeclaration) declaration;
         if (typeDeclaration.isInterface())
         {
            return new JavaInterfaceImpl(enclosingType, document, unit, typeDeclaration);
         }
         else
         {
View Full Code Here

              monitor.worked(5);
              List<?> types = result.types();
              for(int i=0 ; i<types.size() ; i++) {
                ASTNode node = (ASTNode)types.get(i);
                if(node instanceof TypeDeclaration) {
                  TypeDeclaration type =
                    (TypeDeclaration)node;
                  /*
                   * We now know a type contained inside the
                   * compilation unit
                   * Then the following manufacturing
View Full Code Here

    protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException {
        assert rewrite != null;
        assert workingUnit != null;
        assert bug != null;

        TypeDeclaration type = getTypeDeclaration(workingUnit, bug.getPrimaryClass());
        MethodDeclaration method = getMethodDeclaration(type, bug.getPrimaryMethod());
        Modifier originalModifier = getPublicModifier(method);

        ListRewrite listRewrite = rewrite.getListRewrite(method, MethodDeclaration.MODIFIERS2_PROPERTY);
        Modifier protectedModifier = workingUnit.getAST().newModifier(PROTECTED_KEYWORD);
View Full Code Here

    protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException {
        assert rewrite != null;
        assert workingUnit != null;
        assert bug != null;

        TypeDeclaration type = getTypeDeclaration(workingUnit, bug.getPrimaryClass());
        MethodDeclaration method = getMethodDeclaration(type, bug.getPrimaryMethod());

        String fieldName = bug.getPrimaryField().getFieldName();
        SimpleName original = null;
View Full Code Here

    protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException {
        assert rewrite != null;
        assert workingUnit != null;
        assert bug != null;

        TypeDeclaration type = getTypeDeclaration(workingUnit, bug.getPrimaryClass());
        MethodDeclaration method = getMethodDeclaration(type, bug.getPrimaryMethod());
        rewrite.remove(method, null);
    }
View Full Code Here

    protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException {
        assert rewrite != null;
        assert workingUnit != null;
        assert bug != null;

        TypeDeclaration type = getTypeDeclaration(workingUnit, bug.getPrimaryClass());
        Modifier finalMod = workingUnit.getAST().newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD);

        ListRewrite modRewrite = rewrite.getListRewrite(type, TypeDeclaration.MODIFIERS2_PROPERTY);
        modRewrite.insertLast(finalMod, null);
    }
View Full Code Here

        if (!matchesPackage(compilationUnit.getPackage(), packageName)) {
            throw new TypeDeclarationNotFoundException(compilationUnit, typeName, "The package '" + packageName
                    + "' doesn't match the package of the compilation unit.");
        }

        TypeDeclaration type = searchTypeDeclaration(compilationUnit.types(), typeName.substring(index + 1));
        if (type == null) {
            throw new TypeDeclarationNotFoundException(compilationUnit, typeName);
        }
        return type;
    }
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.