|
|
Re: Property sheet does not update [message #421523 is a reply to message #421521] |
Fri, 08 August 2008 12:40 |
Monica Messages: 4 Registered: July 2009 |
Junior Member |
|
|
Hi,
I don't really understand your answer. The code that you wrote is
already implemented, right? If not, where do I have to add that code?
Perhaps some more information for better understanding my problem:
I create a new Property Tab which has a Property Section. The Input of
the property section are EditParts. After I add this information in the
plugin.xml, I create a new section class and a new class which
implements IPropertySource. I register the propertyDescriptor of type
PropertyDescriptor (I didn't create my own PropertyDescriptor). To
change the value in the property view, I override the method
setPropertyValue. There is the only place where I set the value of the
property.
Do I need my own propertydescriptor or a celleditor or something else?
Thanks.
Ed Merks schrieb:
> Monica,
>
> Normally the properties view is updated by virtue of a command being
> executed and the command stack listener telling the properties view to
> update.
>
> // Add a listener to set the most recent command's affected objects
> to be the selection of the viewer with focus.
> //
> commandStack.addCommandStackListener
> (new CommandStackListener()
> {
> public void commandStackChanged(final EventObject event)
> {
> getContainer().getDisplay().asyncExec
> (new Runnable()
> {
> public void run()
> {
> firePropertyChange(IEditorPart.PROP_DIRTY);
>
> // Try to select the affected objects.
> //
> Command mostRecentCommand =
> ((CommandStack)event.getSource()).getMostRecentCommand();
> if (mostRecentCommand != null)
> {
>
> setSelectionToViewer(mostRecentCommand.getAffectedObjects()) ;
> }
> * if (propertySheetPage != null &&
> !propertySheetPage.getControl().isDisposed())
> {
> propertySheetPage.refresh();
> }*
> }
> });
> }
> });
>
>
> Monica wrote:
>> Hi,
>>
>> I have created a property section. Everything works fine. I can see my
>> properties which are independant from the model. BTW, I get the
>> properties from an xml file. When I changed a property value, the
>> value is changed in my xml file, but not in my eclipse view.
>>
>> For example I want to change my property value from "ValueA" to
>> "ValueB". My xml file updated the value to "ValueB", but in the
>> eclipse view there is still "ValueA". But when I select the value in
>> the property view, I can see the new property value "ValueB".
>>
>> How can I refresh the view?
|
|
|
Re: Property sheet does not update [message #421531 is a reply to message #421523] |
Fri, 08 August 2008 15:14 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Monica,
Comments below.
Monica wrote:
> Hi,
>
> I don't really understand your answer. The code that you wrote is
> already implemented, right? If not, where do I have to add that code?
Well yes, normally this all works because of this code.
>
> Perhaps some more information for better understanding my problem:
>
> I create a new Property Tab which has a Property Section.
So you have something different than just the normal generated
properties view, which was working.
> The Input of the property section are EditParts. After I add this
> information in the plugin.xml, I create a new section class and a new
> class which implements IPropertySource. I register the
> propertyDescriptor of type PropertyDescriptor (I didn't create my own
> PropertyDescriptor). To change the value in the property view, I
> override the method setPropertyValue. There is the only place where I
> set the value of the property.
It sounds like you aren't using commands to change the value and of
course the above refresh depends on using a command to change the value.
>
> Do I need my own propertydescriptor or a celleditor or something else?
I don't know what you did to override setPropertyValue. Again, normally
you'd not have to override anything and it would all just work because
you'd uses EMF's implementation to support IPropertySource...
>
> Thanks.
>
>
> Ed Merks schrieb:
>> Monica,
>>
>> Normally the properties view is updated by virtue of a command being
>> executed and the command stack listener telling the properties view
>> to update.
>>
>> // Add a listener to set the most recent command's affected
>> objects to be the selection of the viewer with focus.
>> //
>> commandStack.addCommandStackListener
>> (new CommandStackListener()
>> {
>> public void commandStackChanged(final EventObject event)
>> {
>> getContainer().getDisplay().asyncExec
>> (new Runnable()
>> {
>> public void run()
>> {
>> firePropertyChange(IEditorPart.PROP_DIRTY);
>>
>> // Try to select the affected objects.
>> //
>> Command mostRecentCommand =
>> ((CommandStack)event.getSource()).getMostRecentCommand();
>> if (mostRecentCommand != null)
>> {
>>
>> setSelectionToViewer(mostRecentCommand.getAffectedObjects()) ;
>> }
>> * if (propertySheetPage != null &&
>> !propertySheetPage.getControl().isDisposed())
>> {
>> propertySheetPage.refresh();
>> }*
>> }
>> });
>> }
>> });
>>
>>
>> Monica wrote:
>>> Hi,
>>>
>>> I have created a property section. Everything works fine. I can see
>>> my properties which are independant from the model. BTW, I get the
>>> properties from an xml file. When I changed a property value, the
>>> value is changed in my xml file, but not in my eclipse view.
>>>
>>> For example I want to change my property value from "ValueA" to
>>> "ValueB". My xml file updated the value to "ValueB", but in the
>>> eclipse view there is still "ValueA". But when I select the value in
>>> the property view, I can see the new property value "ValueB".
>>>
>>> How can I refresh the view?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03610 seconds