Java Code Examples for org.eclipse.e4.ui.model.application.MApplication#getContext()
The following examples show how to use
org.eclipse.e4.ui.model.application.MApplication#getContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: E4PreferencesHandler.java From e4Preferences with Eclipse Public License 1.0 | 6 votes |
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Optional PreferenceManager pm, MApplication appli) { // Manage the possible null pm (case of pure E4 application. With E3 it // will be initialized by org.eclipse.ui.internal.WorkbenchPlugin // see line 1536 if (pm == null) { pm = new E4PrefManager(); E4PreferenceRegistry registry = new E4PreferenceRegistry(); IEclipseContext appliContext = appli.getContext(); registry.populatePrefManagerWithE4Extensions(pm, appliContext); appliContext.set(PreferenceManager.class, pm); } // Can display the standard dialog. PreferenceDialog dialog = new PreferenceDialog(shell, pm); dialog.create(); dialog.getTreeViewer().setComparator(new ViewerComparator()); dialog.getTreeViewer().expandAll(); dialog.open(); }
Example 2
Source File: CoreUiUtil.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override public void handleEvent(Event event){ synchronized (lock) { Object property = event.getProperty("org.eclipse.e4.data"); if (property instanceof MApplication) { MApplication application = (MApplication) property; CoreUiUtil.applicationContext = application.getContext(); if (!delayedInjection.isEmpty()) { for (Object object : delayedInjection) { Display.getDefault().asyncExec(() -> { injectServices(object); }); } delayedInjection.clear(); } } } }
Example 3
Source File: DemoGeometryPageFactoryContextFunction.java From ice with Eclipse Public License 1.0 | 5 votes |
@Override public Object compute(IEclipseContext context, String contextKey) { IPageFactory factory = ContextInjectionFactory .make(DemoGeometryPageFactory.class, context); // add the new object to the application context MApplication application = context.get(MApplication.class); IEclipseContext ctx = application.getContext(); ctx.set(IPageFactory.class, factory); return factory; }
Example 4
Source File: DemoGeometryPageContextFunction.java From ice with Eclipse Public License 1.0 | 5 votes |
@Override public Object compute(IEclipseContext context, String contextKey) { IPageProvider provider = ContextInjectionFactory .make(DemoGeometryPageProvider.class, context); // add the new object to the application context MApplication application = context.get(MApplication.class); IEclipseContext ctx = application.getContext(); ctx.set(IPageProvider.class, provider); return provider; }
Example 5
Source File: DemoEntryCompositeContextFunction.java From ice with Eclipse Public License 1.0 | 5 votes |
@Override public Object compute(IEclipseContext context, String contextKey) { IEntryCompositeProvider provider = ContextInjectionFactory .make(DemoEntryCompositeProvider.class, context); // add the new object to the application context MApplication application = context.get(MApplication.class); IEclipseContext ctx = application.getContext(); ctx.set(IEntryCompositeProvider.class, provider); return provider; }
Example 6
Source File: DefaultPageFactoryContextFunction.java From ice with Eclipse Public License 1.0 | 5 votes |
@Override public Object compute(IEclipseContext context, String contextKey) { IPageFactory factory = ContextInjectionFactory .make(DefaultPageFactory.class, context); // add the new object to the application context MApplication application = context.get(MApplication.class); IEclipseContext ctx = application.getContext(); ctx.set(IPageFactory.class, factory); return factory; }
Example 7
Source File: ContextService.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void handleEvent(Event event){ Object property = event.getProperty("org.eclipse.e4.data"); if (property instanceof MApplication) { MApplication application = (MApplication) property; applicationContext = application.getContext(); if (getRootContext() != null) { ((Context) getRootContext()).setEclipseContext(applicationContext); } } // set initial values for injection applicationContext.set(IUser.class, getRootContext().getTyped(IUser.class).orElse(null)); }