Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » 3x e4 Bridge, View, and getting the Shell
3x e4 Bridge, View, and getting the Shell [message #1029536] Fri, 29 March 2013 20:52 Go to next message
Eclipse UserFriend
Incrementally trying to migrate 3.x RCP views over to e4 by
incorporating the 3x e4bridge in new plugin development.

One of the 3.x views dynamically builds a popup menu on the selected
items in a TreeView with new MenuManager("#PopupMenu"), using the
IWorkbenchPartSite to register selection providers and context menu. It
also uses the Active Shell when calling dialogs.

I have tried various ways to inject the ActiveShell, like:

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

or

@Inject
private IShellProvider shellProvider;

but these do not work for me.

What is the proper way to do this? Any suggestions?

thanks,
John
Re: 3x e4 Bridge, View, and getting the Shell [message #1029658 is a reply to message #1029536] Sat, 30 March 2013 01:00 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6264
Registered: July 2009
Senior Member
I think we are simply not pushing this one into the context. Just to
make sure you run the e4 bridge in 3.x env or 4.x? File a bugzilla and
we'll try to hook it up.

Tom

On 29.03.13 16:52, John E. Conlon wrote:
> Incrementally trying to migrate 3.x RCP views over to e4 by
> incorporating the 3x e4bridge in new plugin development.
>
> One of the 3.x views dynamically builds a popup menu on the selected
> items in a TreeView with new MenuManager("#PopupMenu"), using the
> IWorkbenchPartSite to register selection providers and context menu. It
> also uses the Active Shell when calling dialogs.
>
> I have tried various ways to inject the ActiveShell, like:
>
> @Inject @Named(IServiceConstants.ACTIVE_SHELL)
> private Shell shell;
>
> or
>
> @Inject
> private IShellProvider shellProvider;
>
> but these do not work for me.
>
> What is the proper way to do this? Any suggestions?
>
> thanks,
> John
Re: 3x e4 Bridge, View, and getting the Shell [message #1742870 is a reply to message #1029658] Thu, 08 September 2016 10:38 Go to previous message
Alexander Kerner is currently offline Alexander KernerFriend
Messages: 11
Registered: January 2015
Junior Member
Hi,

is there any news on this one?

Its always like gambling when trying to get the active shell to show some info window.

How to get the active shell properly?

As mentioned above, the following does not seem to work:

@Inject
	private IShellProvider shellProvider;
	@Inject
	@Named(IServiceConstants.ACTIVE_SHELL)
	private Shell shell;


I have also tried this one, but it is also not very reliable and I dont understand in which cases it works and when not.

public static Shell getShell() {

		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		if(window == null) {
			IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
			if(windows.length > 0) {
				return windows[0].getShell();
			}
		} else {
			return window.getShell();
		}
		return null;
	}
Previous Topic:How to consume KeyEvent in E4
Next Topic:Getting Toolbar for a programmatically created MPart
Goto Forum:
  


Current Time: Thu Dec 08 08:05:01 GMT 2016

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

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