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 FryFriend
Messages: 8
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 CelaFriend
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:Add menu item to menu at runtime
Next Topic:Adding 3.x ViewParts to E4XMI
Goto Forum:
  


Current Time: Wed May 24 18:01:04 GMT 2017

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

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