Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Gettng the model service

I would try to play with IContextFunction. You get the IEclipseContext as the parameter of the compute method
,
Daniel




From: Wim Jongman <wim.jongman@xxxxxxxxx>
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>,
Date: 01/23/2014 11:13 AM
Subject: Re: [e4-dev] Gettng the model service
Sent by: e4-dev-bounces@xxxxxxxxxxx





Hi Daniel,

Thanks! This lead me to:

IEclipseContext serviceContext = (IEclipseContext) PlatformUI.getWorkbench().getService(IEclipseContext.class);
EModelService modelService = serviceContext.get(EModelService.class);
MApplication application = serviceContext.get(MApplication.class);

I think this suits my usecase. But how do I get the IEclipseContext if I am headless? 

Cheers,

Wim


On Thu, Jan 23, 2014 at 10:52 AM, Daniel Rolka <Daniel.Rolka@xxxxxxxxxx> wrote:
Hi,

You can use the
WorkbenchWindow.getService(Class) method.

For instance for the 3.x mail app:


public
class OpenViewAction extends Action {
...

public
void run() {
               
if(window != null) {        
                       
try {
                               
window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE);
                               
                                EModelService
service = (EModelService) window.getService(EModelService.class);
                                System.
err.println("Model service: " + service);
                               
                               
                        }
catch (PartInitException e) {
                                MessageDialog.openError(
window.getShell(), "Error", "Error opening view:" + e.getMessage());
                        }

                }

        }

}


Daniel


IBM SWG Lab, Cracow, Poland

IBM Polska Sp. z o.o. oddział w Krakowie
ul. Armii Krajowej 18
30 -150 Kraków
tel.
+48 12 628 9993

NIP: 526-030-07-24
Sąd Rejonowy dla
m.st. Warszawy, XIII Wydział Gospodarczy KRS
KRS 0000012941, Kapitał zakładowy: 34.650.000 PLN


From: Wim Jongman <wim.jongman@xxxxxxxxx>
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>,
Date: 01/23/2014 10:41 AM
Subject: Re: [e4-dev] Gettng the model service
Sent by: e4-dev-bounces@xxxxxxxxxxx







Is there a way to the context without a site?  


On Wed, Jan 22, 2014 at 7:45 PM, Paul Webster <
pwebster@xxxxxxxxxxxxxxxxxxx> wrote:
Hi


On Wed, Jan 22, 2014 at 11:26 AM, Lars Vogel <
lars.vogel@xxxxxxxxx> wrote:
Just get the local context via:

IEclipseContext parentContext = (IEclipseContext) site.getService(IEclipseContext.class);


 
This works as well with the E*services:

EModelService service = (EModelService) site.getService(EModelService.class);



--
Paul Webster
Hi floor.  Make me a sammich! - GIR


_______________________________________________
e4-dev mailing list

e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev

_______________________________________________
e4-dev mailing list

e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev



_______________________________________________
e4-dev mailing list

e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev

_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev



Back to the top