i am wondering, whether the code to create the buttons shown at the eclipse "Welcome" page can be found somewhere.
When you create a new workspace in eclipse, a "Welcome" page is shown at 开发者_Python百科the very beginning. The page shows different type of buttons like, "What is new", "Tutorials", ...
I want to use these type of buttons, but was not able to find the source code inside eclipse.
Does somebody know how to create such a button, with hide composites and dynimic components.
You can try and explore the org.eclipse.ui.internal.WorkbenchIntroManager
class, in charge of building a ViewIntroAdapterPart
, based on informations found in the ViewIntroAdapterSite
From getViewIntroAdapterPart():
* @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;
}
Each perspective contributes to the IntroPart, based on its IPerspectiveDescriptor
, if it includes a ViewIntroAdapterPart
.
The ViewPart will create IIntroPart
, which contains the graphical visible elements.
精彩评论