Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Collecting Error/Warning messages produced by a Node Factory
icon1.gif  Collecting Error/Warning messages produced by a Node Factory [message #956175] Wed, 24 October 2012 09:46 Go to next message
Hazem ELRAFFIEE is currently offline Hazem ELRAFFIEE
Messages: 61
Registered: September 2012
Member
Sapphire is driving me crazy Very Happy It's very powerful, and that's keeping me digging deep everyday more and more to see what else can it do for me Smile

Let's say I have a Node Factory for a Property List "Variables" in the class "IData.java". Noting that "IData" contains many other Node Factories beside "Variables".

Many Validation Services have been made to many properties in the "IVariable.java"

Then I made a button that exports data in the list "Variables" into some file format. How can I check in the button action, about how many Errors/Warnings produced by properties in the Node Factory "Variables" ?

Is it also possible to get the Errors/Warning messages in order to display them to my user as a warning before exporting the data?

Thanks everyone Smile
Re: Collecting Error/Warning messages produced by a Node Factory [message #956511 is a reply to message #956175] Wed, 24 October 2012 15:17 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
This snippet should get you started...

Status validation = data.getVariables().validation();

if( ! validation.ok() )
{
    if( validation.children().isEmpty() )
    {
        System.err.println( "Problem Count: 1" );
        System.err.println( validation.toString() );
    }
    else
    {
        System.err.println( "Problem Count: " + validation.children().size()  );

        for( Status child : validation.children() )
        {
            System.err.println( child.toString() );
        }
    }
}


- Konstantin

[Updated on: Wed, 24 October 2012 15:21]

Report message to a moderator

Re: Collecting Error/Warning messages produced by a Node Factory [message #956521 is a reply to message #956511] Wed, 24 October 2012 15:29 Go to previous messageGo to next message
Hazem ELRAFFIEE is currently offline Hazem ELRAFFIEE
Messages: 61
Registered: September 2012
Member
Always simple and neat Smile Thanks Konstantin Smile
Re: Collecting Error/Warning messages produced by a Node Factory [message #956678 is a reply to message #956521] Wed, 24 October 2012 18:14 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
Thanks, but it could be simpler. I don't like the current Status class API. In particular the rift between handling of a single problem vs. multiple problems. The current class borrows too heavily from Eclipse's IStatus API. The "if( validation.children().isEmpty() )" block should not be necessary. Will need to get around to cleaning this up at some point.

Have you considered blogging about your experience with Sapphire? Planet Eclipse aggregator is always looking for new feeds. The adopter experience angle is particularly under-represented.

- Konstantin
Re: Collecting Error/Warning messages produced by a Node Factory [message #987552 is a reply to message #956678] Tue, 27 November 2012 06:44 Go to previous messageGo to next message
Hazem ELRAFFIEE is currently offline Hazem ELRAFFIEE
Messages: 61
Registered: September 2012
Member
I see a strange attitude by sapphire now !! I don't know if I am the reason behind it, or it's a limitation in sapphire.

In the example mentioned above, for small number of "Variable" Nodes, I faced no problem at all. But when I had a file with about 50 "Variable" Nodes, I noticed that validating a Property in a "Variable" takes very long time. Let's say I have a property "Value" in the "Variable" Node with a Validation Service, I did some investigation and found out that when an edit happens in the "Value" of 1 "Variable", all Variables' Values are re-checked (their Validation Services are recalled).

So, for a file with 5 or 6 "Variables", Nothing to notice. But for a bigger file (not so big, 50 or 60 Variables), the problem appears. Do you have any idea what is the reason behind that?

** UPDATE **

I removed the listeners from the "init" and "dispose" functions, and that made the Validation Service not to be recalled for all "Variables", but it's called for a single edit (1 key clicked) from 4 to 5 times !! Is that normal?

[Updated on: Tue, 27 November 2012 08:52]

Report message to a moderator

Re: Collecting Error/Warning messages produced by a Node Factory [message #987712 is a reply to message #987552] Tue, 27 November 2012 17:06 Go to previous message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
Quote:
I removed the listeners from the "init" and "dispose" functions, and that made the Validation Service not to be recalled for all "Variables", but it's called for a single edit (1 key clicked) from 4 to 5 times !! Is that normal?


Doesn't sound right, but it is hard to comment further without digging into the particulars of your scenario. Could you put together a repro project based on the pattern exhibited in the model that shows this issue and create a bug report?

Thanks,

- Konstantin
Previous Topic:Announcing Sapphire 0.6 Release
Next Topic:Problems migrating to 0.6
Goto Forum:
  


Current Time: Thu Oct 30 12:26:42 GMT 2014

Powered by FUDForum. Page generated in 0.01997 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software