Java 我可以在CTabFolder SWT中放置视图吗?

Java 我可以在CTabFolder SWT中放置视图吗?,java,swt,Java,Swt,作为标题,我想知道有没有办法将视图扩展到CtabFolder中 我做了一些谷歌搜索,但没有什么可以帮助。所以我决定把我的问题带到这里 谢谢。在尝试了更多的研究之后,我发现了如何将CTabFolder中的ViewPart显示为CTabItem。这是: // create a container for the View part with tabFolder as a parent CTabFolder Composite composite = n

作为标题,我想知道有没有办法将视图扩展到CtabFolder中

我做了一些谷歌搜索,但没有什么可以帮助。所以我决定把我的问题带到这里


谢谢。

在尝试了更多的研究之后,我发现了如何将CTabFolder中的ViewPart显示为CTabItem。这是:

            // create a container for the View part with tabFolder as a parent CTabFolder
            Composite composite = new Composite(tabFolder, SWT.NONE);
            composite.setLayout(new FillLayout());

            CTabItem item = null;

            item = new CTabItem(tabFolder, SWT.NONE);

            // Create the one of the ViewPart I want to show in my CTabFolder
            ProjectVersionDriversView myTestViewer = new ProjectVersionDriversView();

            // call the init method on the ViewPart with the current ViewSite
            try {
                myTestViewer.init(this.getViewSite());
            } catch (PartInitException e) {
                e.printStackTrace();
            }

            // Build the ViewPart within our composite container.
            myTestViewer.createPartControl(composite);
            item.setText("Your Title");
            // set the composite containing the view part as the control for tabItem2.
            item.setControl(composite);

它来自。

您不能这样做。您实际想要实现的是什么?只需在CTabFolder中将ViewPart显示为CTabItem。这是无法实现的,但如果您解释您想要实现的目标,可能还有另一种方法。您只将其标记为SWT—ViewPart不是SWT,它是Eclipse插件体系结构的一部分—那么您真的在编写Eclipse插件吗?