Skip to content

How To Access Views

Jose Juan Tapia edited this page Mar 16, 2015 · 1 revision

Access the views

If a view needs to be updated from a different package then use the code below. This somewhat violates the separation of concerns and should not be used as a shortcut for a feature, but it does work and can be useful for testing.

IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();

for(IViewReference view : views)
{
	if(view.getView(true) instanceof ContactMapView)
	{
		// ((ContactMapView)view.getView(true)).<whatever>();
	}
	
	else if(view.getView(true) instanceof InfluenceGraphView)
	{
		// ((InfluenceGraphView) view.getView(true)).<whatever>();
	}
}