Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to create a view at startup([NEWBIE])
How to create a view at startup [message #881253] Mon, 04 June 2012 08:22 Go to next message
Philippe Fry is currently offline Philippe Fry
Messages: 6
Registered: April 2012
Junior Member
Hello everyone,

I have a view which listen to the log service and for each events; add a new line in a TableViewer.

How can i create the view as soon as possible (not when i click on the tab of the view), in oder to see all logservice entries ?

I tried to create an Addon to the Application.e4xmi, and activate the view via the EPartService:

	
        @Inject
	EPartService partSrv;


	@PostConstruct
	void hookListeners() {
	  final MPart lFindPart = partSrv.findPart("logbook.view");
	  partSrv.activate(lFindPart);
	}


But i throws this exception :
org.eclipse.e4.core.di.InjectionException: java.lang.IllegalStateException: Application does not have an active window


Wo what is the best way to do taht ?

Thanks a lot.


Re: How to create a view at startup [message #886132 is a reply to message #881253] Thu, 14 June 2012 09:53 Go to previous message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

You get that exception because addons' PostConstract is called before the application's window is created and the activate doesn't make sense.

Use the lifecycle handlers to do stuff as early as possible. See: http://www.toedter.com/blog/?p=896
Previous Topic:Open Perspective Menu in RCP contains all installed perspectives
Next Topic:Eclipse plugins for Eclipse 4
Goto Forum:
  


Current Time: Thu Oct 02 06:40:23 GMT 2014

Powered by FUDForum. Page generated in 0.02119 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software