Friday, February 03, 2012

Closing the Eclipse Welcome screen programmatically

When writing Junit plugin tests in Eclipse I wanted to close the welcome page programmatically before starting the tests; looks like it's pretty easy :) Just use this @BeforeClass static method and you'll be fine!


@BeforeClass
public static void closeWelcome() {
final IIntroManager introManager =
PlatformUI.getWorkbench().getIntroManager();
IIntroPart part = introManager.getIntro();
introManager.closeIntro(part);
}

1 comment:

Emilio said...

Very interesting tip.

Could I suggest a little modification?

I suggest

if (part != null)
introManager.closeIntro(part);

instead of just

introManager.closeIntro(part);

Ciao,
Emilio