Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » E4 + SWT renderer in FullScreen mode?
E4 + SWT renderer in FullScreen mode? [message #695976] Wed, 13 July 2011 00:43 Go to next message
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
Hi,

I would like to know where is the best place to call the SWT shell.setFullScreen(true) method to able my E4 RCP to start in fullScreen mode ?

I have tried to use lifeCycleURI, but I've discovered that it is processed before UI is get started...

I've start to investigate a solution with addOn (using the MinMaxAddOn as example) but I couldn't find out how could I have the main shell injected...

I would appreciate any help.

cheers

Cristiano
Re: E4 + SWT renderer in FullScreen mode? [message #696096 is a reply to message #695976] Wed, 13 July 2011 09:07 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 354
Registered: December 2010
Location: Germany
Senior Member
Hi,

I haven't tried it myself, but you could try to register a processor via the extension point org.eclipse.e4.workbench.model. Inside of the class you should be able to get the Shell by Injection:

@Inject @Named(IServiceConstants.ACTIVE_SHELL) Shell shell;

@Execute
public void execute() {
	shell.setFullScreen(true);
}


Let me know if it works ...

christoph
Re: E4 + SWT renderer in FullScreen mode? [message #696382 is a reply to message #696096] Wed, 13 July 2011 20:31 Go to previous message
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
Hi I could make it work using AddOns.
I've subscribed on UIEvents.UIElement.WIDGET and get the shell from it.

		ev5 = new EventHandler() {

			@Override
			public void handleEvent(Event event) {
				Object objElement = event
						.getProperty(UIEvents.EventTags.ELEMENT);
				Object objType = event.getProperty(UIEvents.EventTags.TYPE);
				Object objWidget = event.getProperty(UIEvents.EventTags.WIDGET);
				Object objNew = event.getProperty(UIEvents.EventTags.NEW_VALUE);
				Object objOld = event.getProperty(UIEvents.EventTags.OLD_VALUE);
				Object objAtt = event.getProperty(UIEvents.EventTags.ATTNAME);

				if (!(event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MWindow))
					return;

				String attName = (String) event
						.getProperty(UIEvents.EventTags.ATTNAME);
				// Is this listener interested ?
				MWindow windowModel = (MWindow) objElement;
				// if (windowModel.getRenderer() != WBWRenderer.this)
				// return;

				// No widget == nothing to update
				Shell theShell = (Shell) windowModel.getWidget();
				if (theShell == null)
					return;
				
				theShell.pack(true);
				theShell.setMaximized(true);
//				theShell.setFullScreen(true);
			}
		};
		eventBroker.subscribe(UIEvents.buildTopic(UIEvents.UIElement.TOPIC,
				UIEvents.UIElement.WIDGET), ev5);
	}


It is entering on fullScreen properly, but the screen is not ok on my Mac.
The main toolbar is shorter (height) that the normal and my icons was trimmed. I think it is related to the top bar that is removed when it enter in fullscreen mode... (see attached picture)

any tip to help me to investigate this?

thanks

Cristiano
Previous Topic:Dependency Injection - JSR-299?
Next Topic:XWT - ATL
Goto Forum:
  


Current Time: Mon Sep 22 10:19:06 GMT 2014

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

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