Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] IProblemFactory and IProblemIdentifierFactory


  ok - thanks for that explanation.

  another quick question (i hope) - i'm doing this when i go to create a problem marker:

        IProblemReporter reporter = context.getProblemReporter();
        ISourceLineTracker tracker = context.getLineTracker();
       
        ScriptResult result = executor.execute(args, context.getContentsAsCharArray());

        for (CompilerOutput output : parser.parse(result.stderrLines))
        {
            if (!output.isLocal() || output.isCompilationAborted())
            {
                continue;
            }
           
            ErrorsAndWarnings.ErrorOrWarning eom = output.getErrorOrWarning();           

            ProblemSeverity severity = getSeverity(eom);
            ISourceRange range = tracker.getLineInformation(output.lineNo - 1);
           
            int end = range.getOffset() + range.getLength();
            PerlBuildProblem problem = new PerlBuildProblem(output.message, severity, range.getOffset(), end, output.lineNo - 1);

            reporter.reportProblem(problem);
        }

  the issue i'm seeing is when the 'problem' is presented in the editor, the 'underline' includes leading and trailing white space, which i see is expected b/c the ISourceRange object includes it.

  i'm believe i can calculate the correct offsets b/c i have the contents array and i know the initial starting position, but wanted to see if there was any utility code already in existence to do this. i looked around but it's very possible i missed it.

On Wed, Jun 6, 2012 at 11:26 AM, Alexey Panchenko <alex.panchenko@xxxxxxxxx> wrote:
Hi Jae,

IProblemFactory is invoked when creating problem markers.

IProblemIdentifierFactory is used to decode problem id from string
into corresponding enum entry. It is invoked when problem markers are
read, e.g. into objects used to display problem annotations in the
editor (so quick fix processors deal with the enum entries as problem
ids, etc).

typical implementation is as follows:

public class _javascript_ProblemFactory implements IProblemIdentifierFactory {
       public IProblemIdentifier valueOf(String localName) throws
IllegalArgumentException {
               return _javascript_Problems.valueOf(localName);
       }
       public IProblemIdentifier[] values() {
               return _javascript_Problems.values();
       }
}

Regards,
Alex

On Wed, Jun 6, 2012 at 2:57 AM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:
> hello all -
>
>   could someone please explain how those two interfaces relate to each
> other?
>
>   thanks!!
>
> --
> -jae
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



--
-jae

Back to the top