[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: TrackResources and Batch vs Live Validator

Hi, John,

What I suggest for your case, then, is to use the Batch Validator.  Presumably there will be some heuristic to determine when (when does the Java editor do its syntax validation, for example?).  At the very least your project builder would be driven by workspace resource changes.

If you're concerned about batch validation running a potentially unbounded set of constraints and thereby reducing the responsiveness of your editor, then you can look into using the IValidator constraint-filter API to check some subset.  One useful trick is to include all of the constraints that you want to enable in the editor in a particular categary for that purpose, and implement a filter to check for that category (constraints can be members of multiple categories).

The problem with the Live Validator example is that it really wasn't clear how it could demonstrate the notion of a "transaction" in a useful way. One option would have been adding "Start" and "End" buttons to the editor that would manually delineate the transaction boundaries.  Another option would have been to use the menu action invocation as the transaction context, but all of the standard actions are pretty much atomic changes anyway. Either approach would have been clunky, so we left it very simple.  Besides, the EMF Transaction component provides a more complete example of live validation, so it didn't seem particularly important ...

HTH,

Christian


On Mon, 2009-09-14 at 18:24 +0000, John J. Franey wrote:
Christian W. Damus wrote:

> Hi, John,
>
> The intention of the "live" validation was always to enable a
> "transactional" editing system, by which I mean simply some kind of
> automatic roll-back of changes performed during some interval.  It is
> not intended that problems caught by live validation should be persisted
> in problem markers or by any other means.  After all, once the offending
> changes have been rolled back, there's no problem about which to persist
> such information.
>

Thank you.  I understand enough here that LiveValidation is not what I
want.  I know that I am not building a 'transactional' editing system
because I don't even know what that is.   I got down this path by
following the validation example for ext library model. From that
example, I could not tell that LiveValidation purpose is to enable a
transactional library editor.  I guessed wrong.


> I wouldn't go so far as to say that tracking resources in the live
> validator is "silly" but it does seem to indicate an unintended usage of
> the API  :-)  I suppose there might be considerations such as efficiency
> of UI refresh, etc. that could be accommodated by tracking resources ...
> What are you trying to accomplish with this mechanism?  Perhaps there's
> an even better way.

I now know there is a better way, thanks. 

I'm looking for a poor man's builder for validation (or I want
to be convinced that I have to bite the bullet and write a builder).
I'm looking for the ability to validate and report errors as the user
enters content. This is a behavior that JDT gives: as the user enters
java code, the compiler runs (and gives error/problem messages). So,
I'm looking for that kind of interactive behavior.

I'm still new to plugin development and am reading code to discover the
right thing.  Thanks for responding here to help me stay on track.

>
> You can, of course, always write your own validator if you need to, but
> the intent is that you should never need to.  That's why there isn't any
> place to "register" them  ;-)
>
> HTH,
>
> Christian
>

Thanks,
John

>
> On Mon, 2009-09-14 at 16:01 +0000, John J. Franey wrote:
>
>> In EMF validation framework 1.3.0, BatchValidator observes the 
>> IBatchValidator.OPTION_TRACK_RESOURCES option that would generate 'marker 
>> statuses for the resources covered by the validation operation'.  These 
>> are necessary to 'update problem markers'.  Neat.
>> 
>> This option is not available on LiveValidator.  Bummer.
>> 
>> Is it silly for me to expect LiveValidator to track resources?  Is this a 
>> reasonable enhancement request?
>> 
>> Do I need to write and register my own LiveValidator?
>> 
>> Regards,
>> Thanks,
>> John