Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to redirect key presses to another shell?
How to redirect key presses to another shell? [message #673993] Wed, 25 May 2011 13:20 Go to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
I'm working on a way to maximise an EditorPart to be absolutely full-screen, no trim, no menu, and so on. Actually, it's a GEF Editor. It's a bit of a hack, but it kind of works:

        GraphicalViewer viewer = (GraphicalViewer)getWorkbenchPart().getAdapter(GraphicalViewer.class);
        Control control = viewer.getControl();
        Composite oldParent = control.getParent();
                
        Shell shell = new Shell(SWT.APPLICATION_MODAL);
        shell.setFullScreen(true);
        shell.setMaximized(true);
        
        // Some code here to listen to Esc key to dispose Shell and return...
        
        shell.setLayout(new FillLayout());
        control.setParent(shell);
        shell.open();


Basically it sets the parent of the GraphicalViewer control to the newly created, maximised Shell. Pressing escape will return the control to it's original parent (code not shown for brevity).

The only thing that doesn't work is receiving global key presses (Del, Ctrl-Z, Ctrl-A) the ones that are declared for the Workbench and forwarded to the EditorPart. Is there any way I can hook into these or redirect them from the EditorPart to forward them on to the GraphicalViewer?

Thanks in advance,

Phil
Re: How to redirect key presses to another shell? [message #674307 is a reply to message #673993] Thu, 26 May 2011 13:21 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The short answer is that you can't. See my response in http://stackoverflow.com/questions/6125164/how-to-redirect-key-presses-to-another-shell-in-an-eclipse-based-app/6138297#6138297

"The only supported way would be to open a new Workbench window with a perspective that only contained the editor area, and extending your org.eclipse.ui.application.WorkbenchWindowAdvisor.createWindowContents(Shell) method for that window+perspective combination to hide all of the trim you don't want, using org.eclipse.ui.application.IWorkbenchWindowConfigurer."

PW


Previous Topic:How to make sure that all workspace projects are loaded by workspacejob asynchronously
Next Topic:EFS Vs ResourceMapping
Goto Forum:
  


Current Time: Sat Sep 20 04:05:45 GMT 2014

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

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