UI Event Topics In Grits

Here is a list of event topics thath are posted to event bus in application context.


This topic is posted with the parent entry (entry which has changed by adding or removing its child entry) as its data. One can subscribe to this topic for listening to any change in the datamodel or for any change in a particular entry. Here is an example code for subscribing to this topic :

	public void refresh(@UIEventTopic
			(IGritsDataModelService.EVENT_DATA_MODEL_CHANGED) Entry entry)
		if(entry != null)
			&& !((ProjectProperty) entry.getProperty()).getOpen())
				treeViewer.collapseToLevel(entry, 1);


Grits broadcasts a change in preference using the event bus. Subscribe to this topic if you want to get notified when a preference is saved to a preference file. Here is an example code for subscribing to this topic.

	@Optional @Inject
	public void resetSomething(@UIEventTopic(
		IGritsPreferenceStore.EVENT_TOPIC_PREF_VALUE_CHANGED) String changedPreferenceId)
			// reset something


This is not a recommended topic to use but for now it is a fix for supporting EditorHandler.selectEntry(Entry entry). By using this topic one can make a selection in project explorer's treeViewer (by posting an entry with this topic on eventBroker.send(..)).

Earlier project explorer's treeViewer was visible to all the plugins but is no longer visible. If you are using eclipse 3.x then use EditorHandler.selectEntry(Entry entry). It internally will use this topic to make a selection. For e4 plugin, if you need to make a selection in project explorer's treeViewer programmatically you can use this topic but let us know of its usage so that we can make a decision on making treeViewer visible or finding a better solution.

Example send topic usage from EditorHandler class :

	public static void selectEntry(Entry a_entry)
		// some code
		// select entry 
		eventBroker.send(IGritsDataModelService.EVENT_SELECT_ENTRY, a_entry);
Last modified 6 years ago Last modified on 09/16/2016 10:04:49 PM