Sunday, October 10, 2010

multiple instances of the same view be made to appear at the same time

Can multiple instances of the same view be made to appear at the same time?

Yes. See IWorkbenchPage.showView(String primaryId, String secondaryId, int mode).
The <view> element in the plugin.xml must also specify allowMultiple="true".
Be sure to use a different secondaryId for each instance, otherwise showView will find any existing view with the same primaryId and secondaryId rather than showing a new one.
To pass instance-specific data to the view, you will need to cast the resulting IViewPart down to the concrete view class and call your own setData method.
Note that views with a secondaryId will not match placeholders specifying just the primaryId. In a perspective factory, placeholders can be added for multi-instance views using the format primaryId + ':' + secondaryId, where '*' wildcards are supported.

No comments:

Post a Comment