|
Re: EditDomains and EAnnotation.getDetails() returns java.lang.ArrayStoreException? [message #477578 is a reply to message #477565] |
Tue, 08 July 2008 12:16 |
Ed Merks 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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.03293 seconds