views:

197

answers:

1

I am using the properties view in RCP, i.e org.eclipse.ui.views.properties.PropertySheet.

I want to be able to refresh the content of these properties programmatically. It seems RCP is geared towards the use case where this changes only when a selection changes.

Is there any way I can fire a dummy event to get this to refresh (without having ugly UI artifacts such as visibly switching between parts) ?

+1  A: 

The main problem is that the API hides all the pages (PropertySheetPage) and therefore viewers (PropertySheetViewer) within the properties view.

Good news is, you can tell the properties view to use a page of your desire. So I supply the page that it would normally use by default (PropertySheetPage), except when I supply it, I keep a reference to it (obviously), and then you can call propertySheetPageRef.refresh() to update the model (thankfully this method is public).

public Object getAdapter(Class adapter) {
        if (adapter == IPropertySource.class) {
            return resultProvider;
        } else if (adapter == IPropertySheetPage.class) {
            return propertySheetPage;
        }
        return null;
    }
geejay