Package org.eclim.util.file

Examples of org.eclim.util.file.FileOffsets


   */
  protected List<Error> setClasspath(
      IJavaProject javaProject, IClasspathEntry[] entries, String classpath)
    throws Exception
  {
    FileOffsets offsets = FileOffsets.compile(classpath);
    String classpathValue = IOUtils.toString(new FileInputStream(classpath));
    ArrayList<Error> errors = new ArrayList<Error>();
    for(IClasspathEntry entry : entries){
      IJavaModelStatus status = JavaConventions
        .validateClasspathEntry(javaProject, entry, true);
View Full Code Here


    model.reconcile();

    String filepath = ProjectUtils.getFilePath(project, file);

    List<IProblem> problems = requestor.getProblems();
    FileOffsets offsets = FileOffsets.compile(filepath);
    for (IProblem problem : problems){
      int[] lineColumn = offsets.offsetToLineColumn(problem.getOffset());
      Error error = new Error(
        problem.getUnmodifiedMessage(), filepath,
        lineColumn[0], lineColumn[1],
        problem.isWarning());
      if(!errors.contains(error)){
View Full Code Here

      }
      List<IProblem> problems = requestor.getProblems();

      ArrayList<Error> errors = new ArrayList<Error>();
      String filename = src.getResource().getLocation().toOSString();
      FileOffsets offsets = FileOffsets.compile(filename);
      for(IProblem problem : problems){
        int[] lineColumn =
          offsets.offsetToLineColumn(problem.getSourceStart());

        // one day vim might support ability to mark the offending text.
        /*int[] endLineColumn =
          offsets.offsetToLineColumn(problem.getSourceEnd());*/

 
View Full Code Here

        JavaCore.createCompilationUnitFrom(ifile);
      IProblem[] problems = JavaUtils.getProblems(src);
      List<Error> errors = new ArrayList<Error>();
      String filename = src.getResource().getLocation()
          .toOSString().replace('\\', '/');
      FileOffsets offsets = FileOffsets.compile(filename);

      for(IProblem problem : problems){
        // exclude TODO, etc
        if (problem.getID() == IProblem.Task){
          continue;
        }

        int[] lineColumn = offsets.offsetToLineColumn(problem.getSourceStart());
        errors.add(new Error(
            problem.getMessage(),
            filename,
            lineColumn[0],
            lineColumn[1],
View Full Code Here

      if(commandLine.hasOption(Options.VALIDATE_OPTION)){
        List<IProblem> problems = getProblems(src);
        ArrayList<Error> errors = new ArrayList<Error>();
        String filename = src.getResource()
          .getLocation().toOSString().replace('\\', '/');
        FileOffsets offsets = FileOffsets.compile(filename);
        for(IProblem problem : problems){
          int[] lineColumn = offsets.offsetToLineColumn(problem.getSourceStart());
          errors.add(new Error(
              problem.getMessage(),
              filename,
              lineColumn[0],
              lineColumn[1],
              problem.isWarning()));
        }

        IMarker[] markers = getMarkers(src);
        for(IMarker marker : markers){
          // skip task markers (FIXME, etc)
          if (marker.isSubtypeOf(IMarker.TASK)){
            continue;
          }

          int[] lineColumn = null;

          Integer start = (Integer)marker.getAttribute(IMarker.CHAR_START);
          if (start != null && start.intValue() > 0){
            lineColumn = offsets.offsetToLineColumn(start.intValue());
          }else{
            Integer line = (Integer)marker.getAttribute(IMarker.LINE_NUMBER);
            if (line != null && line.intValue() > 0){
              lineColumn = new int[]{line.intValue(), 1};
            }
View Full Code Here

    // call refresh to ensure the project interpreter is validated properly
    refresh(project, commandLine);

    String dotPydevProject = project.getFile(PYDEVPROJECT)
      .getRawLocation().toOSString();
    FileOffsets offsets = FileOffsets.compile(dotPydevProject);
    String contents = IOUtils.toString(new FileInputStream(dotPydevProject));

    Tuple<List<ProjectConfigError>, IInterpreterInfo> configErrorsAndInfo =
      nature.getConfigErrorsAndInfo(project);
    ArrayList<Error> errors = new ArrayList<Error>();
    for (ProjectConfigError e : configErrorsAndInfo.o1){
      String message = e.getLabel();
      int line = 1;
      int col = 1;
      // attempt to locate the line the error occurs on.
      for (Pattern pattern : new Pattern[]{NOT_FOUND, INVALID}){
        Matcher matcher = pattern.matcher(message);
        // extract the value that is triggering the error (path, interpreter
        // name, etc.).
        String value = null;
        if (matcher.find()){
          value = matcher.group(1).trim();
          matcher = Pattern
            .compile(">\\s*(\\Q" + value + "\\E)\\b", Pattern.MULTILINE)
            .matcher(contents);
          if(matcher.find()){
            int[] position = offsets.offsetToLineColumn(matcher.start(1));
            line = position[0];
            col = position[1];
          }
          break;
        }
View Full Code Here

          filename.indexOf("__eclim_temp_") != -1)
      {
        return;
      }

      FileOffsets offsets = FileOffsets.compile(filename);
      int[] lineColumn = offsets.offsetToLineColumn(problem.getSourceStart());

      error = new Error(
          problem.getMessage(),
          filename.replace("__eclim_temp_", ""),
          lineColumn[0],
View Full Code Here

      IProblem[] problems = JavaUtils.getProblems(src);

      ArrayList<Error> errors = new ArrayList<Error>();
      String filename = src.getResource()
        .getLocation().toOSString().replace('\\', '/');
      FileOffsets offsets = FileOffsets.compile(filename);
      for(IProblem problem : problems){
        // exclude TODO, etc
        if (problem.getID() == IProblem.Task){
          continue;
        }

        int[] lineColumn =
          offsets.offsetToLineColumn(problem.getSourceStart());

        // one day vim might support ability to mark the offending text.
        /*int[] endLineColumn =
          offsets.offsetToLineColumn(problem.getSourceEnd());*/

 
View Full Code Here

    String dotbuildpath = scriptProject.getProject().getFile(BUILDPATH)
      .getRawLocation().toOSString();

    IBuildpathEntry[] entries = scriptProject.readRawBuildpath();
    FileOffsets offsets = FileOffsets.compile(dotbuildpath);
    String buildpath = IOUtils.toString(new FileInputStream(dotbuildpath));
    errors = new ArrayList<Error>();
    for(IBuildpathEntry entry : entries){
      IModelStatus status = BuildpathEntry.validateBuildpathEntry(
          scriptProject, entry, true);
View Full Code Here

      Reporter reporter = new Reporter();
      parse(project, ifile, reporter);

      String filepath = ProjectUtils.getFilePath(project, file);
      FileOffsets offsets = FileOffsets.compile(filepath);
      ArrayList<Error> errors = new ArrayList<Error>();
      for(IProblem problem : reporter.getProblems()){
        int[] lineColumn = offsets.offsetToLineColumn(problem.getSourceStart());
        errors.add(new Error(
            problem.getMessage(),
            filepath,
            lineColumn[0],
            lineColumn[1],
View Full Code Here

TOP

Related Classes of org.eclim.util.file.FileOffsets

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.