我想知道,是否可以在某个地方找到创建 Eclipse“欢迎”页面上显示的按钮的代码。
当您在 Eclipse 中创建新工作区时,一开始会显示“欢迎”页面。该页面显示不同类型的按钮,例如“新增内容”、“教程”...
我想使用这些类型的按钮,但无法在 Eclipse 中找到源代码。
有人知道如何创建这样一个带有隐藏复合 Material 和动态组件的按钮吗?
最佳答案
您可以尝试探索org.eclipse.ui.internal.WorkbenchIntroManager
类,负责构建一个ViewIntroAdapterPart
,基于 ViewIntroAdapterSite
中找到的信息
* @return the <code>ViewIntroAdapterPart</code> for this workbench, <code>null</code> if it
* cannot be found.
*/
/*package*/ViewIntroAdapterPart getViewIntroAdapterPart() {
IWorkbenchWindow[] windows = this.workbench.getWorkbenchWindows();
for (int i = 0; i < windows.length; i++) {
IWorkbenchWindow window = windows[i];
WorkbenchPage page = (WorkbenchPage) window.getActivePage();
if (page == null) {
continue;
}
IPerspectiveDescriptor[] perspDescs = page.getOpenPerspectives();
for (int j = 0; j < perspDescs.length; j++) {
IPerspectiveDescriptor descriptor = perspDescs[j];
IViewReference reference = page.findPerspective(descriptor)
.findView(IIntroConstants.INTRO_VIEW_ID);
if (reference != null) {
IViewPart part = reference.getView(false);
if (part != null && part instanceof ViewIntroAdapterPart) {
return (ViewIntroAdapterPart) part;
}
}
}
}
return null;
}
如果每个透视图包含 ViewIntroAdapterPart
,则基于其 IPerspectiveDescriptor
对 IntroPart 做出贡献。
ViewPart 将创建 IIntroPart
,其中包含图形可见元素。
关于java - 创建动态eclipse "Welcome"页面按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2341884/