Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » refresh properties view
refresh properties view [message #404503] Thu, 13 January 2005 11:01 Go to next message
Phil Williams is currently offline Phil WilliamsFriend
Messages: 22
Registered: July 2009
Junior Member
I have a RCP app that uses the properties view. The properties that
are shown can be modified within editors. What event should be fired to
let the PropertySheet know that it has to update or do I have to get a
handle to it and do it myself?

Thanks,
Phil
Re: refresh properties view [message #404511 is a reply to message #404503] Thu, 13 January 2005 17:45 Go to previous messageGo to next message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
The properties view listens for selection changed events from the
workbench page's selection service, and notifies the current property
page of the change. The default property page updates in response (as
should other implementations).

The view or editor needs to publish its selection provider via
getSite().setSelectionProvider(ISelectionProvider), and issue events to
selection listeners appropriately.

If the view or editor is implemented using a viewer, you can just set
that as the selection provider.

If properties of the selected element are changing without the selection
changing, you may need to issue a fake selection event to get the
properties view to update.

Nick


From within the

Phil Williams wrote:
> I have a RCP app that uses the properties view. The properties that
> are shown can be modified within editors. What event should be fired to
> let the PropertySheet know that it has to update or do I have to get a
> handle to it and do it myself?
>
> Thanks,
> Phil
>
Re: refresh properties view [message #1033432 is a reply to message #404503] Thu, 04 April 2013 08:13 Go to previous messageGo to next message
Joris Lückenga is currently offline Joris LückengaFriend
Messages: 7
Registered: March 2013
Junior Member
Hey everyone,

i know that this thread is about 3 years old, but I have trouble implementing a
"fake selection event" as Nick mentioned:

I have a generated EMF plugin project and created several Sections/Tabs (extended from AbstractPropertySections) for the Properties View. I´m using two different tabs, a "Basic" tab, and an "Advanced" tab.

Now, i want to have a workflow like this: In my custom Editor View (TreeViewer), i want to select an object and edit its Index in the properties view. If the typed value matches a specific Index, the "Advanced" tab should appear immediatly after the "Index-changed" event.

I created an adapter, listening for a index change. It correctly fires every time the index is changed in the properties view. What i wanted to do is to fire the fake selection event so that the classes with implemented IFilter interface run over the currently edited object and create the "Advanced" tab (if the Filter returns true). This works already when selecting an object with mouse/keyboard when a matching index is found.
I want to avoid that the user has to deselect and reselect the object after editing the index in the "Basic" tab, to be able to see the "Advanced" tab.

The following ideas did not resolve my problem:
- Selecting an empty ISelection in TabbedPropertiesSheetPage-Class and reselecting the ISelection of the editor (This causes a loop!)
- Selecting Objects in the Editor TreeViewer (apperently the PropertiesSheetPage is not affected by the changes when firing these events programmatically)
- Selecting the same Selection twice (if-statement in TabbedPropertiesSheetPage with "currentselection.equals(newSelection)" avoids this...
- Refreshing TabbedPropertiesSheetPage (in the spec, it says that only the current Tab is refreshed. Another problem is, that the "Index-changed" event is fired and this results in a loop again)

I also want to avoid overriding TabbePropertiesSheetPage to get arround the if-statement or to affect the currentSelection-object.

Another idea would be to get a valid selection (like the Resource or something) and change it back? I´m really having trouble finding an ISelection or IStructuredSelection element (except the selected object itself) to switch to and back. If you have an idea or other solutions I would be very happy to get some help Smile

[Updated on: Thu, 04 April 2013 12:09]

Report message to a moderator

Re: refresh properties view [message #1034294 is a reply to message #1033432] Fri, 05 April 2013 08:58 Go to previous message
Joris Lückenga is currently offline Joris LückengaFriend
Messages: 7
Registered: March 2013
Junior Member
I found a solution to my problem. I know it´s dirty, but it works Wink
I used StructuredSelection.EMPTY to get a "valid" selection. Apperently it works just fine when setting the selection to the editor and then setting it to the propertysheetpage. Its also only works when i use the editor-getter in my case. When you have a listener on the property you have to make sure to test / allow the cases: if the object is the same and just the property was changed, or the object is not the same. Otherwise this kind of "refreshing" could trigger the notifier everytime the page refreshes and as you could guess, this results in a loop (if you want to solve this by using an adapter).
//save old selection
ISelection oldSelection = myeditor.getSelection();
//Set the empty selection to the editor
myeditor.setSelection(StructuredSelection.EMPTY);
//set the empty selection to the propertypage the editor contributes to
propertypage.selectionChanged(workbenchpart, editor.getSelection());
//Change back to the old selection to refresh the view
myeditor.setSelection(oldSelection);
propertypage.selectionChanged(workbenchpart, editor.getSelection());


I´m still interested in better workarounds if you know any Wink

Cheers,
Joris

[Updated on: Fri, 05 April 2013 09:00]

Report message to a moderator

Previous Topic:Empty Selection after opened an editor
Next Topic:load Icons from other Bundle via plugin.xml
Goto Forum:
  


Current Time: Fri Apr 26 17:44:56 GMT 2024

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

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

Back to the top