views:

46

answers:

1

Hi

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 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.

+1  A: 

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.

VonC
see also http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/ua_intro_hello_world.htm (for a introduction, but not directly for the button)
VonC
Nice link, thanks. But i do not want to contribute a button to the welcone page. I want to use the button, shown in the welcome page, in my own view. i want the button code ;)
Markus Lausberg
@Markus: ... I thought you would say that ;) I am still looking myself for the exact code. I meant only to give some starting point.
VonC