Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » checkbox tree viewer in emf editor
checkbox tree viewer in emf editor [message #405724] Tue, 05 December 2006 15:03 Go to next message
Eclipse UserFriend
Originally posted by: cswaroop.in.ibm.com

Hi,

I am customizing the EMF editor by replacing TreeViewer with
CheckboxTreeViewer.

As model mandates I need to disable the check boxes for certain nodes
preventing user selection. How can I do that?

As its more of an UI question its cross posted to RCP group as well, but
anybody throwing some pointer, greately appreciated.

- Thanks
Re: checkbox tree viewer in emf editor [message #405725 is a reply to message #405724] Tue, 05 December 2006 15:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Swaroop,

There doesn't appear to be any way to control this via a label provider
the same way the font, color, image, and text can be controlled. In
that case it would seem you'd have to call setGrayed directly...


swaroop chalasani wrote:
> Hi,
>
> I am customizing the EMF editor by replacing TreeViewer with
> CheckboxTreeViewer.
>
> As model mandates I need to disable the check boxes for certain nodes
> preventing user selection. How can I do that?
>
> As its more of an UI question its cross posted to RCP group as well,
> but anybody throwing some pointer, greately appreciated.
>
> - Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: checkbox tree viewer in emf editor [message #405727 is a reply to message #405725] Tue, 05 December 2006 16:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cswaroop.in.ibm.com

Ed Merks wrote:
> Swaroop,
>
> There doesn't appear to be any way to control this via a label provider
> the same way the font, color, image, and text can be controlled. In
> that case it would seem you'd have to call setGrayed directly...
>

Ed,

I need to disable the checkbox. ( after doing setGreyed() or
setChecked()) preventing user do any select.

Thanks for the help!




>
> swaroop chalasani wrote:
>> Hi,
>>
>> I am customizing the EMF editor by replacing TreeViewer with
>> CheckboxTreeViewer.
>>
>> As model mandates I need to disable the check boxes for certain nodes
>> preventing user selection. How can I do that?
>>
>> As its more of an UI question its cross posted to RCP group as well,
>> but anybody throwing some pointer, greately appreciated.
>>
>> - Thanks
Re: checkbox tree viewer in emf editor [message #405729 is a reply to message #405727] Tue, 05 December 2006 16:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Swaroop,

I don't see any way to disable the ability to check or uncheck things.
Perhaps asking in the SWT newsgroup or the platform newsgroup would work
best since these are basic questions about how to use the controls and
the viewers...


swaroop chalasani wrote:
> Ed Merks wrote:
>> Swaroop,
>>
>> There doesn't appear to be any way to control this via a label
>> provider the same way the font, color, image, and text can be
>> controlled. In that case it would seem you'd have to call setGrayed
>> directly...
>>
>
> Ed,
>
> I need to disable the checkbox. ( after doing setGreyed() or
> setChecked()) preventing user do any select.
>
> Thanks for the help!
>
>
>
>
>>
>> swaroop chalasani wrote:
>>> Hi,
>>>
>>> I am customizing the EMF editor by replacing TreeViewer with
>>> CheckboxTreeViewer.
>>>
>>> As model mandates I need to disable the check boxes for certain
>>> nodes preventing user selection. How can I do that?
>>>
>>> As its more of an UI question its cross posted to RCP group as well,
>>> but anybody throwing some pointer, greately appreciated.
>>>
>>> - Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: checkbox tree viewer in emf editor [message #405730 is a reply to message #405729] Tue, 05 December 2006 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cswaroop.in.ibm.com

Ed Merks wrote:
> Swaroop,
>
> I don't see any way to disable the ability to check or uncheck things.
> Perhaps asking in the SWT newsgroup or the platform newsgroup would work
> best since these are basic questions about how to use the controls and
> the viewers...
>

Thanks Ed.

>
> swaroop chalasani wrote:
>> Ed Merks wrote:
>>> Swaroop,
>>>
>>> There doesn't appear to be any way to control this via a label
>>> provider the same way the font, color, image, and text can be
>>> controlled. In that case it would seem you'd have to call setGrayed
>>> directly...
>>>
>>
>> Ed,
>>
>> I need to disable the checkbox. ( after doing setGreyed() or
>> setChecked()) preventing user do any select.
>>
>> Thanks for the help!
>>
>>
>>
>>
>>>
>>> swaroop chalasani wrote:
>>>> Hi,
>>>>
>>>> I am customizing the EMF editor by replacing TreeViewer with
>>>> CheckboxTreeViewer.
>>>>
>>>> As model mandates I need to disable the check boxes for certain
>>>> nodes preventing user selection. How can I do that?
>>>>
>>>> As its more of an UI question its cross posted to RCP group as well,
>>>> but anybody throwing some pointer, greately appreciated.
>>>>
>>>> - Thanks
Re: checkbox tree viewer in emf editor [message #726894 is a reply to message #405730] Mon, 19 September 2011 20:11 Go to previous message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
I've been experimenting with use of the CheckboxTreeViewer as a substitute for the TreeViewer in the emf generated views in order to permit checking to enable some properties, and want to post what I've learned here:

1. On Windows the grayed state can be achieved reliably by setting both checked and greyed. On linux this results in a check over the grayed box, but at least the Windows grayed box is shown correctly.

2. I update the model's boolean properties with the ICheckStateListener that is added to the CheckboxTreeViewer on creation.

3. Model update is through the editingDomain call

editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, eob,checkBoxObject, boolOb));

4. Stay away from the CheckboxTreeViewer setParentsGrayed and setSubtreeChecked calls.

5. Instead, provide overrides for isChecked(Object) and isGrayed(Object) to implement ICheckStateProvider in your Editor. In your checkedStateListener, after you update your model, just call the treeViewer's refresh(). This will result in the viewer calling your isChecked() and isGrayed() to update the tree state with no side-effects.

6. The CheckboxTreeViewer calls isChecked() first, then isGrayed(), but due to 1 above, when it calls isChecked(), you should immediately check if you want grayed state displayed, and if so return true for isChecked() and true for the subsequent call to isGrayed().

7. Stay away from the ContainerCheckedTreeViewer class, which seems to want to force the updateChildrenItems and updateParentItems on you, which will try to change the check state of your model rather than doing the simple update of the tree display from the model. You would need to override their setChecked() to avoid this, so it isn't clear to me what extra value is left with that viewer.
Previous Topic:Working with generated code
Next Topic:[emf] String#intern() call in URI(...)
Goto Forum:
  


Current Time: Fri Apr 26 19:31:27 GMT 2024

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

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

Back to the top