简体   繁体   中英

Eclipse JFace how to dynamically add SWT view

My view (Show Result) is defined in plugin.xml. Which is working as expected when I run the plugin Show Result widget is getting displayed. Now I want to load the view dynamically based on results. Such as for each result it should load the new Show Result (eg Show Results1, Show Results2 etc) widget. Any suggestion on how it can be achieved?

<view
    allowMultiple="true"
    class="com.eclipse.plugin.MyResultView"
    icon="icons/res.png"
    id="view1"
    name="Show Results"
    restorable="true">
</view>

If you want to show multiple instances of the same view use the

IViewPart showView(String viewId, String secondaryId, int mode);

method of IWorkbenchPage . The view needs to be defined with allowMultiple="true" in the plugin.xml.

The secondaryId is a arbitrary string that distinguishes the views, it can have any value (except it should not contain a : ).

To set the name of the view call the ViewPart.setPartName(String name) method in the view part.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM