コード例 #1
0
 private IASTCompositeTypeSpecifier findCurrentCompositeTypeSpecifier(IASTTranslationUnit ast)
     throws OperationCanceledException, CoreException {
   final int start = selectedRegion.getOffset();
   Container<IASTCompositeTypeSpecifier> container = new Container<IASTCompositeTypeSpecifier>();
   ast.accept(new CompositeTypeSpecFinder(start, container));
   return container.getObject();
 }
コード例 #2
0
    @Override
    public int visit(IASTDeclSpecifier declSpec) {
      if (declSpec instanceof IASTCompositeTypeSpecifier) {
        IASTFileLocation loc = declSpec.getFileLocation();
        if (start > loc.getNodeOffset() && start < loc.getNodeOffset() + loc.getNodeLength()) {
          container.setObject((IASTCompositeTypeSpecifier) declSpec);
          return ASTVisitor.PROCESS_ABORT;
        }
      }

      return super.visit(declSpec);
    }