Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Property sheet does not update
Property sheet does not update [message #421513] Fri, 08 August 2008 10:11 Go to next message
Monica is currently offline MonicaFriend
Messages: 4
Registered: July 2009
Junior Member
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 #421521 is a reply to message #421513] Fri, 08 August 2008 12:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080904030202020606020703
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

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?

--------------080904030202020606020703
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Monica,<br>
<br>
Normally the properties view is updated by virtue of a command being
executed and the command stack listener telling the properties view to
update.<br>
<small><br>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Property sheet does not update [message #421523 is a reply to message #421521] Fri, 08 August 2008 12:40 Go to previous messageGo to next message
Monica is currently offline MonicaFriend
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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:Direct Reference CrossReferencer?
Next Topic:What is need to automatically identify an XML-file's content?
Goto Forum:
  


Current Time: Fri Apr 26 15:36:14 GMT 2024

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

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

Back to the top