Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » EditDomains and EAnnotation.getDetails() returns java.lang.ArrayStoreException?
EditDomains and EAnnotation.getDetails() returns java.lang.ArrayStoreException? [message #477565] Wed, 02 July 2008 17:50 Go to next message
Anders W. Tell is currently offline Anders W. TellFriend
Messages: 69
Registered: July 2009
Member
Hi,

Im trying to add annotation details to a UML2Model using commands and
editdomains. However I get the following exception.


> java.lang.ArrayStoreException
> at org.eclipse.emf.common.util.BasicEList.assign(BasicEList.jav a:191)
> at org.eclipse.emf.common.util.BasicEList.addAllUnique(BasicELi st.java:803)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddAl lUnique(NotifyingListImpl.java:506)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(NotifyingListImpl.java:446)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(NotifyingListImpl.java:406)
> at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:716)
> at org.eclipse.emf.common.util.BasicEMap.addAll(BasicEMap.java: 1644)
> at org.eclipse.emf.edit.command.AddCommand.doExecute(AddCommand .java:403)
> at org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:131)
> at org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:267)
> at org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:84)



Ive been trying different kinds of Map.Entry but they all return the
same error. Below is a code snippet.

final String locationKey = "location"; //FIXME
Map.Entry<String, String> entry= new Map.Entry<String, String>(){
String fKey = locationKey;
String fValue;

/**
* @return the key
*/
public String getKey() {
return fKey;
}

/**
* @return the value
*/
public String getValue() {
return fValue;
}
/**
* @param theArg0
* @return
*/
public String setValue(String theValue) {
fValue = theValue;
return fValue;
}
};
entry.setValue(ref.getLocation().toString());

AddCommand addCmd = new AddCommand(fEditor.getEditingDomain(),
found, EcorePackage.eINSTANCE.getEAnnotation_Details(), entry);
cmd.append(addCmd);


any hints?
thanks
/anders
Re: EditDomains and EAnnotation.getDetails() returns java.lang.ArrayStoreException? [message #477578 is a reply to message #477565] Tue, 08 July 2008 12:16 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Anders,

Comments below.

Anders W.Tell wrote:
> Hi,
>
> Im trying to add annotation details to a UML2Model using commands and
> editdomains. However I get the following exception.
>
>
>> java.lang.ArrayStoreException
>> at
>> org.eclipse.emf.common.util.BasicEList.assign(BasicEList.jav a:191)
>> at
>> org.eclipse.emf.common.util.BasicEList.addAllUnique(BasicELi st.java:803)
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddAl lUnique(NotifyingListImpl.java:506)
>>
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(NotifyingListImpl.java:446)
>>
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(NotifyingListImpl.java:406)
>>
>> at
>> org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:716)
>> at org.eclipse.emf.common.util.BasicEMap.addAll(BasicEMap.java: 1644)
>> at
>> org.eclipse.emf.edit.command.AddCommand.doExecute(AddCommand .java:403)
>> at
>> org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:131)
>>
>> at
>> org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:267)
>>
>> at
>> org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:84)
>>
>
>
>
> Ive been trying different kinds of Map.Entry but they all return the
> same error. Below is a code snippet.
>
> final String locationKey = "location"; //FIXME
> Map.Entry<String, String> entry= new Map.Entry<String, String>(){
> String fKey = locationKey;
> String fValue;
>
> /**
> * @return the key
> */
> public String getKey() {
> return fKey;
> }
>
> /**
> * @return the value
> */
> public String getValue() {
> return fValue;
> }
> /**
> * @param theArg0
> * @return
> */
> public String setValue(String theValue) {
> fValue = theValue;
> return fValue;
> }
> };
> entry.setValue(ref.getLocation().toString());
>
> AddCommand addCmd = new
> AddCommand(fEditor.getEditingDomain(), found,
> EcorePackage.eINSTANCE.getEAnnotation_Details(), entry);
> cmd.append(addCmd);
Use EcoreUtil.create(EcorePackage.Literals.ESTRING_TO_STRING_MAP _ENTRY)
to create an instance.
>
>
> any hints?
> thanks
> /anders


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EditDomains and EAnnotation.getDetails() returns java.lang.ArrayStoreException? [message #626771 is a reply to message #477565] Tue, 08 July 2008 12:16 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Anders,

Comments below.

Anders W.Tell wrote:
> Hi,
>
> Im trying to add annotation details to a UML2Model using commands and
> editdomains. However I get the following exception.
>
>
>> java.lang.ArrayStoreException
>> at
>> org.eclipse.emf.common.util.BasicEList.assign(BasicEList.jav a:191)
>> at
>> org.eclipse.emf.common.util.BasicEList.addAllUnique(BasicELi st.java:803)
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddAl lUnique(NotifyingListImpl.java:506)
>>
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(NotifyingListImpl.java:446)
>>
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(NotifyingListImpl.java:406)
>>
>> at
>> org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:716)
>> at org.eclipse.emf.common.util.BasicEMap.addAll(BasicEMap.java: 1644)
>> at
>> org.eclipse.emf.edit.command.AddCommand.doExecute(AddCommand .java:403)
>> at
>> org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:131)
>>
>> at
>> org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:267)
>>
>> at
>> org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:84)
>>
>
>
>
> Ive been trying different kinds of Map.Entry but they all return the
> same error. Below is a code snippet.
>
> final String locationKey = "location"; //FIXME
> Map.Entry<String, String> entry= new Map.Entry<String, String>(){
> String fKey = locationKey;
> String fValue;
>
> /**
> * @return the key
> */
> public String getKey() {
> return fKey;
> }
>
> /**
> * @return the value
> */
> public String getValue() {
> return fValue;
> }
> /**
> * @param theArg0
> * @return
> */
> public String setValue(String theValue) {
> fValue = theValue;
> return fValue;
> }
> };
> entry.setValue(ref.getLocation().toString());
>
> AddCommand addCmd = new
> AddCommand(fEditor.getEditingDomain(), found,
> EcorePackage.eINSTANCE.getEAnnotation_Details(), entry);
> cmd.append(addCmd);
Use EcoreUtil.create(EcorePackage.Literals.ESTRING_TO_STRING_MAP _ENTRY)
to create an instance.
>
>
> any hints?
> thanks
> /anders


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EAnnotation and Cross document reference
Next Topic:Unable to wrap long names... and other n00b questions :)
Goto Forum:
  


Current Time: Thu Apr 25 13:26:11 GMT 2024

Powered by FUDForum. Page generated in 0.02968 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top