Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » getting editing domain from resource set
getting editing domain from resource set [message #400882] Fri, 05 May 2006 11:57 Go to next message
Marc Moser is currently offline Marc Moser
Messages: 10
Registered: July 2009
Junior Member
On Mon, 20 Jun 2005 11:55:07 -0400,
Ed wrote:
Jaap,

In the generated editors, the resource set knows the editing domain so
typically this should work well.

We naively looked for a getEditingDomain() in ResourceSet, but obviously
its not there.

Does anyone know how to get the editing domain from a resource set
in the generated EMF editor?

Thanks in advance,
Marc
Re: getting editing domain from resource set [message #400886 is a reply to message #400882] Fri, 05 May 2006 12:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26014
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050203010407090005020500
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Marc,

You'll probably just want to reuse this method from
AdapterFactoryEditingDomain:

static public EditingDomain getEditingDomainFor(EObject object)
{
Resource resource = object.eResource();
if (resource != null)
{
IEditingDomainProvider editingDomainProvider =

(IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc e,
IEditingDomainProvider.class);
if (editingDomainProvider != null)
{
return editingDomainProvider.getEditingDomain();
}
else
{
ResourceSet resourceSet = resource.getResourceSet();
if (*resourceSet instanceof IEditingDomainProvider*)
{
EditingDomain editingDomain =
((IEditingDomainProvider)resourceSet).getEditingDomain();
return editingDomain;
}
else if (resourceSet != null)
{
editingDomainProvider =
(IEditingDomainProvider)*EcoreUtil.getExistingAdapter(resour ceSet,
IEditingDomainProvider.class)*;
if (editingDomainProvider != null)
{
return editingDomainProvider.getEditingDomain();
}
}
}
}

return null;
}


Marc Moser wrote:
>
> On Mon, 20 Jun 2005 11:55:07 -0400,
> Ed wrote: Jaap,
>
> In the generated editors, the resource set knows the editing domain so
> typically this should work well.
>
> We naively looked for a getEditingDomain() in ResourceSet, but obviously
> its not there.
>
> Does anyone know how to get the editing domain from a resource set
> in the generated EMF editor?
>
> Thanks in advance,
> Marc
>


--------------050203010407090005020500
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Marc,<br>
<br>
You'll probably just want to reuse this method from
AdapterFactoryEditingDomain:<br>
<blockquote><small>
Re: getting editing domain from resource set [message #987191 is a reply to message #400886] Sat, 24 November 2012 05:30 Go to previous message
Victor Zalevski is currently offline Victor Zalevski
Messages: 1
Registered: November 2012
Junior Member
Thank you, Ed!
This post helped me a lot
Previous Topic:Customizing saving Model to XMI via XMISaveImpl options
Next Topic:[EMF Compare] UML: Added Element with Stereotyp
Goto Forum:
  


Current Time: Tue Sep 02 05:13:53 EDT 2014

Powered by FUDForum. Page generated in 0.02791 seconds