Bug 247168 - [api] Properties not yet computed should indicate that state
Summary: [api] Properties not yet computed should indicate that state
Status: ASSIGNED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Linux
: P4 minor (vote)
Target Milestone: Future   Edit
Assignee: Anna Dushistova CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
: 233525 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-09-12 10:37 EDT by Anna Dushistova CLA
Modified: 2009-03-17 04:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anna Dushistova CLA 2008-09-12 10:37:02 EDT
Tested on 3.0.1-RC3a.
If folder was not expanded, properties show 0 as number of children.
After expanding the folder properties show correct number of children.

The same can be seen on processes tree for TCF connection.
Comment 1 Anna Dushistova CLA 2008-09-12 10:38:32 EDT
Might be similar to 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=160763
Comment 2 Martin Oberhuber CLA 2008-09-12 14:49:14 EDT
I guess this is kind of expected behavior. In order to know the number of children, we'd have to list contents of each folder. But we try to avoid that in order to reduce remote communications.

Imagine you open a folder which has 1000 subfolders. Getting the number of children of each of these 1000 subfolders would need significant amount of time, even if you are typically not interested in the number of children.

I agree, that a better solution than showing "0" children for not-yet-expanded folders would be showing "(not yet retrieved)" or a similar text.

I personally find this a minor to trivial issue, reducing severity and priority -- feel free to up again if you disagree.
Comment 3 Anna Dushistova CLA 2008-09-12 15:04:25 EDT
That's fine for me but "0" is really very confusing. Especially when it is changed to some other number after you expand. 
Comment 4 Martin Oberhuber CLA 2008-09-12 15:20:35 EDT
Hm, I see... in fact other properties may have similar issues. What about changing the bug summary into

"Properties not yet computed should indicate that state (rather than reading invalid values)"
Comment 5 Anna Dushistova CLA 2008-09-12 15:29:04 EDT
Agreed. 
Comment 6 Kevin Doyle CLA 2008-09-12 15:43:03 EDT
*** Bug 233525 has been marked as a duplicate of this bug. ***
Comment 7 Martin Oberhuber CLA 2008-11-12 08:54:00 EST
We should have a "pending" state for Properties. I believe that this should be API, so I'm planning M5 for it.
Comment 8 Anna Dushistova CLA 2008-12-02 08:12:02 EST
Is it enough to change return value of getPropertyValue to "(not yet retrieved)" instead of "0"? 
Comment 9 Martin Oberhuber CLA 2008-12-02 11:11:28 EST
I think one problem here is that we'll want the "(not yet retrieved)" String to be NLS translated, but also be available as a constant for Programs to check. 

Another problem is, that some programs may expect an "int" value on some Properties, and be confused (down to throwing an exception) when they see a String.

In terms of backward compatibility, I think I'd prefer a solution that only changes appearance in the Viewer, but keeps the actual data as it is today ("0"). Internally, Properties could have an additional boolean flag ("not yet retrieved)" to trigger display of the special "not yet retrieved" status. In terms of API, we could have

   String[] ISystemViewElementAdapter#getPropertyNamesPending(Object element)

to return the Property Keys of those Properties that are still "pending". Since we expect that in most cases the Properties will be available, the String would typically return an Empty String array (String[0]), which could be provided in the AbstractSystemViewElementAdapter for backward compatibility. In other words, without special handling the "old" subsystems would work as they do today, and "new" subsystems could return proper pending state through this API.
Comment 10 Anna Dushistova CLA 2009-03-17 04:05:25 EDT
Don't have time for it for M6.