[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Getting the ChangeDescription of an AbstractEMFOperation

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

to complement my previous post, here is some more information on what I
am trying to do.

If I would be able to get the ChangeDescription, then I could hook an
IOperationApprover into the OperationHistory to check if there is a
dirty open editor for the affected classes of an AbstractEMFOperation
and can ask the user whether he/she really wants to procede and hence
undo the local changes of these editors.

In order to retrieve the ChangeDescription I tried the HelperClass
approach that sits in the same package and hence has acces to the
getChange method of an AbstractEMFOperation, but Eclipse seems to
disallow such an access.
The ugly second approach was via reflection. This way I got the
ChangeDescription, but when I try to iterate over the keyset of the
object changes (description.getObjectChanges().keyset()), I get the
following exception:
java.lang.ArrayStoreException:
org.eclipse.emf.ecore.change.impl.EObjectToChangesMapEntryImpl
	at org.eclipse.emf.common.util.BasicEList.assign(BasicEList.java:191)
	at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:645)
	at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
	at org.eclipse.emf.common.util.BasicEMap.doPut(BasicEMap.java:616)
	at
org.eclipse.emf.common.util.BasicEMap.ensureEntryDataExists(BasicEMap.java:247)
	at
org.eclipse.emf.common.util.BasicEMap$BasicEMapIterator.scan(BasicEMap.java:1215)
	at
org.eclipse.emf.common.util.BasicEMap$BasicEMapIterator.<init>(BasicEMap.java:1194)
	at
org.eclipse.emf.common.util.BasicEMap$BasicEMapKeyIterator.<init>(BasicEMap.java:1310)
	at org.eclipse.emf.common.util.BasicEMap$3.iterator(BasicEMap.java:880)

This only occurs on the first try, on the second try, the view is
already instantiated but empty.

To summarise, I think the access to the ChangeDescription of an
AbstractEMFOperation would be appreciative since it would open up the
possibility to scan the affected objects from a given operation.

Does anybody know how to get to the ChangeDescription from an Operation,
or maybe I missed the right way to use the API and am badly working
around it. (I hope not! :-))

All comments are appreciated!
 Marius H.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHpu2PuSHKxXSCvdcRAnFaAKC0e/dkNI52/HKZhaUGjTewMGSpEwCeIB5N
THxTdkRbokqDYwhshl+T+Uk=
=Ku7X
-----END PGP SIGNATURE-----