|
Re: SubClassing TransactionalEditingDomain [message #222811 is a reply to message #222519] |
Thu, 26 March 2009 08:40 |
Christophe Bouhier Messages: 937 Registered: July 2009 |
Senior Member |
|
|
Hi Daniel,
I subclass TransactionalEditingDomain to solve the problem with
"read-only" if the resource is a hibernate resource. Perhaps to some use
for you.
Here is my example:
// INITIALIZE
editingDomain = new HibernateAdapterFactoryEditingDomain(
adapterFactory, commandStack,
new HashMap<Resource, Boolean>());
// The EDITINGDOMAIN
public class HibernateTransactionalEditingDomain extends
TransactionalEditingDomainImpl {
public HibernateTransactionalEditingDomain() {
super(new ComposedAdapterFactory(
ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
((TransactionalEditingDomainImpl.FactoryImpl)
TransactionalEditingDomain.Factory.INSTANCE)
.mapResourceSet(this);
}
protected boolean isReadOnlyURI(URI uri) {
boolean defaultReadOnly = super.isReadOnlyURI(uri);
if (defaultReadOnly == true) {
// if (defaultReadOnly == true
// && uri.fileExtension().compareTo("ndiag") == 0) {
return false;
} else {
return defaultReadOnly;
}
}
}
Daniel OKOUYA wrote:
> Hi All,
>
> Because I need to customize the behavior of the
> AdapterFactoryEditingDomain to manage an EMF Problem of deletion, and
> because I already Made the EMF GMF integration, I need to subclass /
> customize TransactionalEditingDomain Class to override method coming
> from AdapterFactoryEditingDomain.
>
> Because, it is also a GMF issue I post it here as well. If you want to
> understand the EMF issue, you can see the thread on the EMF forum about
> Locally managing global shared object as non-contain-child.
>
> But mainly, my concern here is that once I have done the subclassing
> which I hope I did correctly, then when I change the famous line of the
> initialization of the TransactionalEditingDomain from:
> TransactionalEditingDomain domain =
> TransactionalEditingDomain.Factory.INSTANCE.createEditingDom ain();
> To
> TransactionalEditingDomain domain =
> OperaTransactionalEditingDomain.Factory.INSTANCE.createEditi ngDomain();
>
> It just doesn’t work anymore. I mean, my TreeEditor works but not the
> Diagram my which is weird because I don’t change anything. Therefore I
> indentify the problem as being possibly caused by:
>
> 1-/ I’m not subclassing correctely the Class/Interface couple
> TransactionalEditingDomain
> I have attached the two files (impl with its interface) to let you see
> how I did the subclassing.
>
> 2-/ I’m missing something about GMF:
> Does it check the instance class which is used as
> TransacationalEditingDomain, even if we don’t use the Registry approach
> ? Otherwise I don’t understand why the same class cause two different
> behavior. Indeed, with this couple of class, my Diagram doesn’t open
> anymore.
>
>
>
> Please, if anyone has an idea or suggestion that may help me to further
> understand, do not hesitate.
>
>
> Kind regards,
> Daniel
|
|
|
Powered by
FUDForum. Page generated in 0.03209 seconds