[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [Dltk-dev] IProblemFactory and IProblemIdentifierFactory
|
As I understand you need basically 2 loops to skip leading and
terminating whitespaces.
And I don't think such utility already exists.
On Wed, Jun 6, 2012 at 10:43 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:
>
> 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 JavaScriptProblemFactory implements IProblemIdentifierFactory
>> {
>> public IProblemIdentifier valueOf(String localName) throws
>> IllegalArgumentException {
>> return JavaScriptProblems.valueOf(localName);
>> }
>> public IProblemIdentifier[] values() {
>> return JavaScriptProblems.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
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>