Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Clone a Application Window(How can we open a new Window with the same Menues and Perspective)
Clone a Application Window [message #834828] Mon, 02 April 2012 08:57 Go to next message
Tom K. is currently offline Tom K.
Messages: 22
Registered: July 2009
Junior Member
How is it possible to clone the first window of a pure e4 rcp application?

it is possible to open a new Window easily and define it in the model. But we would like to have a similar action like in Eclipse IDE open new Window. Where you have again all perspectives and Menues available.

MWindow newwindow = (MWindow) modelService.find(ContextConstants.NEW_WINDOW_ID, application);
        newwindow.setVisible(true);       
        newwindow.setOnTop(true);
        newwindow.setToBeRendered(true);
        modelService.bringToTop(newwindow);


We tried as well with the clone method but we get a NPE there.

 MWindow cloneswindow = (MWindow) modelService.cloneElement(window, application);
        modelService.bringToTop(cloneswindow);


Caused by: java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:383)
Re: Clone a Application Window [message #834866 is a reply to message #834828] Mon, 02 April 2012 09:52 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 589
Registered: December 2010
Senior Member

Try putting
application.getChildren().add(cloneswindow);


before
modelService.bringToTop(cloneswindow);
Re: Clone a Application Window [message #834907 is a reply to message #834866] Mon, 02 April 2012 10:40 Go to previous message
Tom K. is currently offline Tom K.
Messages: 22
Registered: July 2009
Junior Member
Cool ! It works...
Previous Topic:Having problems running 3.7 RCP app in e4
Next Topic:Prevent last Part to close
Goto Forum:
  


Current Time: Wed Apr 23 02:42:32 EDT 2014

Powered by FUDForum. Page generated in 0.02410 seconds