|
Re: TreeViewer is not updating as exected [message #1449248 is a reply to message #1448871] |
Tue, 21 October 2014 04:47 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Phil,
Comments below.
On 20/10/2014 5:01 PM, Phil Wim wrote:
> My Treeviewer shows a hierarchy of non-containment references of
> eobjects. The actual eobject is saved to rootContent. The eobject has
> multiple references which are shown in the treeviewer. So the eobject
> can appear more than one time.
Did you achieve this by modifying the GenFeatures of that object to set
Children and Notify to true?
> If I change the content of the eobject which affects the label to
> change I expect the label to change in all references. In my
> environment (RAP, CDO) only the last attached or opened reference will
> be updated. All others stay as they were. But If I reload, they all
> have the new label.
Check what's happening in
org.eclipse.emf.edit.provider.ItemProviderAdapter.createWrapper(EObject,
EStructuralFeature, Object, int) for the object with those
non-containment "children" references. It should be creating wrappers
for this to work properly. Most likely you just need to specialize
org.eclipse.emf.edit.provider.ItemProviderAdapter.isWrappingNeeded(Object)
to return true.
>
> Is that the expected behavior?
>
> This is my code:
> FilteredTree filteredTree = new FilteredTree(parent, SWT.BORDER, new
> PatternFilter(), false);
> viewer = filteredTree.getViewer(); AdapterFactoryLabelProvider
> labelProvider = new
> AdapterFactoryLabelProvider(this.adapterFactory);
>
> AdapterFactoryContentProvider contentProvider =
> new AdapterFactoryContentProvider(this.adapterFactory);
> viewer.setContentProvider(contentProvider);
> viewer.setLabelProvider(labelProvider);
> viewer.setInput(CDOProvider.getInstance().getContainer ());
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: TreeViewer is not updating as exected [message #1449377 is a reply to message #1448871] |
Tue, 21 October 2014 09:04 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
You will find that the Sample Ecore Model Editor can display stale
labels, most commonly after changing an inheritance.
This seems inevitable, unless the Tree Editor is able to analyze all the
code that contributes to the displayed labels.
In the past, when I have cared, I have set up my own Notifier listeners
so that the refreshes occur automatically. Perhaps Ed M can identify
tooling or hooks that facilitate this.
[This automated analysis is much easier when the code to be analyzed is
written in OCL, and while there is an OCL Impact Analyzer, we have yet
to produce a cookbook example of how this use case could be handled.]
Regards
Ed Willink
On 20/10/2014 16:01, Phil Wim wrote:
> My Treeviewer shows a hierarchy of non-containment references of
> eobjects. The actual eobject is saved to rootContent. The eobject has
> multiple references which are shown in the treeviewer. So the eobject
> can appear more than one time.
> If I change the content of the eobject which affects the label to change
> I expect the label to change in all references. In my environment (RAP,
> CDO) only the last attached or opened reference will be updated. All
> others stay as they were. But If I reload, they all have the new label.
>
> Is that the expected behavior?
>
> This is my code:
> FilteredTree filteredTree = new FilteredTree(parent, SWT.BORDER, new
> PatternFilter(), false);
> viewer = filteredTree.getViewer();
> AdapterFactoryLabelProvider labelProvider = new
> AdapterFactoryLabelProvider(this.adapterFactory);
>
> AdapterFactoryContentProvider contentProvider =
> new AdapterFactoryContentProvider(this.adapterFactory);
> viewer.setContentProvider(contentProvider);
> viewer.setLabelProvider(labelProvider);
> viewer.setInput(CDOProvider.getInstance().getContainer ());
>
|
|
|
Re: TreeViewer is not updating as exected [message #1449404 is a reply to message #1449377] |
Tue, 21 October 2014 09:57 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Ed,
Comments below.
On 21/10/2014 11:04 AM, Ed Willink wrote:
> Hi
>
> You will find that the Sample Ecore Model Editor can display stale
> labels, most commonly after changing an inheritance.
That's a different problem as far as I can tell. The problem you
describe is related to the fact that the label of a node is computed
from information that involves following references. In Phil's case,
it's apparently a problem that he's showing the same object more the
once in the tree without wrappers. The wrappers would take care of
updating all occurrences.
>
> This seems inevitable, unless the Tree Editor is able to analyze all
> the code that contributes to the displayed labels.
Yes, if the label is derived from information other than direct features
of the object (which properly notify), it won't know about changes that
happen to other objects.
>
> In the past, when I have cared, I have set up my own Notifier
> listeners so that the refreshes occur automatically. Perhaps Ed M can
> identify tooling or hooks that facilitate this.
If I were made of spare time. :-P
>
> [This automated analysis is much easier when the code to be analyzed
> is written in OCL, and while there is an OCL Impact Analyzer, we have
> yet to produce a cookbook example of how this use case could be handled.]
Yes, or if one defined the model with IncQuery and defined derived
features for the labels; such query-defined features will produce
notifications just like non-derived features.
>
> Regards
>
> Ed Willink
>
>
> On 20/10/2014 16:01, Phil Wim wrote:
>> My Treeviewer shows a hierarchy of non-containment references of
>> eobjects. The actual eobject is saved to rootContent. The eobject has
>> multiple references which are shown in the treeviewer. So the eobject
>> can appear more than one time.
>> If I change the content of the eobject which affects the label to change
>> I expect the label to change in all references. In my environment (RAP,
>> CDO) only the last attached or opened reference will be updated. All
>> others stay as they were. But If I reload, they all have the new label.
>>
>> Is that the expected behavior?
>>
>> This is my code:
>> FilteredTree filteredTree = new FilteredTree(parent, SWT.BORDER, new
>> PatternFilter(), false);
>> viewer = filteredTree.getViewer();
>> AdapterFactoryLabelProvider labelProvider = new
>> AdapterFactoryLabelProvider(this.adapterFactory);
>>
>> AdapterFactoryContentProvider contentProvider =
>> new AdapterFactoryContentProvider(this.adapterFactory);
>> viewer.setContentProvider(contentProvider);
>> viewer.setLabelProvider(labelProvider);
>> viewer.setInput(CDOProvider.getInstance().getContainer ());
>>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03508 seconds