Examples of IProblem


Examples of org.eclipse.dltk.compiler.problem.IProblem

      RutaFunction f = (RutaFunction) element;
      String name = f.getName();
      boolean ok = true;
      List<Expression> childs = f.getChilds();
      if (childs.size() < 1) {
        IProblem problem = problemFactory.createWrongNumberOfArgumentsProblem(name, element, 1);
        rep.reportProblem(problem);
        ok = false;
      }
      Expression expr = childs.get(0);
      if (expr.getKind() != RutaTypeConstants.RUTA_TYPE_S) {
        IProblem problem = problemFactory.createWrongArgumentTypeProblem(expr, "TypeExpression");
        rep.reportProblem(problem);
        ok = false;
      }
      return ok;
    }
View Full Code Here

Examples of org.eclipse.dltk.compiler.problem.IProblem

    if (element instanceof RutaFunction) {
      RutaFunction f = (RutaFunction) element;
      String name = f.getName();
      // TODO
      if (!name.equals(strings[0])) {
        IProblem problem = problemFactory.createUnknownFunctionProblem(f);
        rep.reportProblem(problem);
        return false;
      }
      boolean ok = true;
      List<Expression> childs = f.getChilds();
      if (childs.size() != 1) {
        IProblem problem = problemFactory.createWrongNumberOfArgumentsProblem(name, element, 1);
        rep.reportProblem(problem);
        ok = false;
      }
      Expression expr = childs.get(0);
      if (expr.getKind() != RutaTypeConstants.RUTA_TYPE_AT) {
        IProblem problem = problemFactory.createWrongArgumentTypeProblem(expr, "TypeExpression");
        rep.reportProblem(problem);
        ok = false;
      }
      return ok;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

            String sourceCode = units[classIdx].getSourceCode();
           
            IProblem[] problems = getJavaCompilationErrors(result);
            for (int i = 0; i < problems.length; i++)
            {
              IProblem problem = problems[i];
              //if (problem.isError())
              {
                problemBuffer.append(i + 1);
                problemBuffer.append(". ");
                problemBuffer.append(problem.getMessage());

                if (
                  problem.getSourceStart() >= 0
                  && problem.getSourceEnd() >= 0
                  )
                {                 
                  int problemStartIndex = sourceCode.lastIndexOf("\n", problem.getSourceStart()) + 1;
                  int problemEndIndex = sourceCode.indexOf("\n", problem.getSourceEnd());
                  if (problemEndIndex < 0)
                  {
                    problemEndIndex = sourceCode.length();
                  }
                 
                  problemBuffer.append("\n");
                  problemBuffer.append(
                    sourceCode.substring(
                      problemStartIndex,
                      problemEndIndex
                      )
                    );
                  problemBuffer.append("\n");
                  for(int j = problemStartIndex; j < problem.getSourceStart(); j++)
                  {
                    problemBuffer.append(" ");
                  }
                  if (problem.getSourceStart() == problem.getSourceEnd())
                  {
                    problemBuffer.append("^");
                  }
                  else
                  {
                    problemBuffer.append("<");
                    for(int j = problem.getSourceStart() + 1; j < problem.getSourceEnd(); j++)
                    {
                      problemBuffer.append("-");
                    }
                    problemBuffer.append(">");
                  }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

        ImportsManager imports = new ImportsManager(root);

        int importsEnd = ASTNodes.getExclusiveEnd(importsDecls.get(importsDecls.size() - 1));
        IProblem[] problems = root.getProblems();
        for (int i = 0; i < problems.length; i++) {
            IProblem curr = problems[i];
            if (curr.getSourceEnd() < importsEnd) {
                int id = curr.getID();
                if (id == IProblem.UnusedImport || id == IProblem.NotVisibleType) { // not visible problems hide unused -> remove both
                    int pos = curr.getSourceStart();
                    for (int k = 0; k < importsDecls.size(); k++) {
                        ImportDeclaration decl = importsDecls.get(k);
                        if (decl.getStartPosition() <= pos && pos < decl.getStartPosition() + decl.getLength()) {
                            if (existingImports.isEmpty() || !existingImports.contains(ASTNodes.asString(decl))) {
                                String name = decl.getName().getFullyQualifiedName();
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

        ImportsManager imports = new ImportsManager(root);

        int importsEnd = ASTNodes.getExclusiveEnd(importsDecls.get(importsDecls.size() - 1));
        IProblem[] problems = root.getProblems();
        for (int i = 0; i < problems.length; i++) {
            IProblem curr = problems[i];
            if (curr.getSourceEnd() < importsEnd) {
                int id = curr.getID();
                if (id == IProblem.UnusedImport || id == IProblem.NotVisibleType) { // not visible problems hide unused -> remove both
                    int pos = curr.getSourceStart();
                    for (int k = 0; k < importsDecls.size(); k++) {
                        ImportDeclaration decl = importsDecls.get(k);
                        if (decl.getStartPosition() <= pos && pos < decl.getStartPosition() + decl.getLength()) {
                            if (existingImports.isEmpty() || !existingImports.contains(ASTNodes.asString(decl))) {
                                String name = decl.getName().getFullyQualifiedName();
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

                public void acceptResult(CompilationResult result) {
                    try {
                        if (result.hasProblems()) {
                            IProblem[] problems = result.getProblems();
                            for (int i = 0; i < problems.length; i++) {
                                IProblem problem = problems[i];
                                String name =
                                    new String(problems[i].getOriginatingFileName());
                                try {
                                    problemList.add(ErrorDispatcher.createJavacError
                                        (name, pageNodes, new StringBuffer(problem.getMessage()),
                                                problem.getSourceLineNumber()));
                                } catch (JasperException e) {
                                    log.error("Error visiting node", e);
                                }
                            }
                        } else {
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

        final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
            public void acceptResult( final CompilationResult pResult ) {
                if (pResult.hasProblems()) {
                    final IProblem[] iproblems = pResult.getProblems();
                    for (int i = 0; i < iproblems.length; i++) {
                        final IProblem iproblem = iproblems[i];
                        final CompilationProblem problem = new EclipseCompilationProblem(iproblem);
                        if (problemHandler != null) {
                            problemHandler.handle(problem);
                        }
                        problems.add(problem);
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

        final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
            public void acceptResult( final CompilationResult pResult ) {
                if (pResult.hasProblems()) {
                    final IProblem[] iproblems = pResult.getProblems();
                    for (int i = 0; i < iproblems.length; i++) {
                        final IProblem iproblem = iproblems[i];
                        final CompilationProblem problem = new EclipseCompilationProblem(iproblem);
                        if (problemHandler != null) {
                            problemHandler.handle(problem);
                        }
                        problems.add(problem);
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

          String fn = String.valueOf(result.compilationUnit.getFileName());
          String msg = "Errors in '" + fn + "'";
          TreeLogger branch = logger.branch(TreeLogger.ERROR, msg, null);

          for (int i = 0; i < errors.length; i++) {
            IProblem error = errors[i];

            // Strip the initial code from each error.
            //
            msg = error.toString();
            msg = msg.substring(msg.indexOf(' '));

            // Append 'Line #: msg' to the error message.
            //
            StringBuffer msgBuf = new StringBuffer();
            int line = error.getSourceLineNumber();
            if (line > 0) {
              msgBuf.append("Line ");
              msgBuf.append(line);
              msgBuf.append(": ");
            }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IProblem

        final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
            public void acceptResult( final CompilationResult pResult ) {
                if (pResult.hasProblems()) {
                    final IProblem[] iproblems = pResult.getProblems();
                    for (int i = 0; i < iproblems.length; i++) {
                        final IProblem iproblem = iproblems[i];
                        final CompilationProblem problem = new EclipseCompilationProblem(iproblem);
                        if (problemHandler != null) {
                            problemHandler.handle(problem);
                        }
                        problems.add(problem);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.