Update a reference when a new object will be created [message #480848] |
Tue, 18 August 2009 16:29 |
Eclipse User |
|
|
|
Originally posted by: dennis.freese.gmx.net
Hello all,
I tried to update a reference in the ...CreateCommand class like this:
doExecuteWithResult() {
Activity newElement = new ModelFactory.eINSTANCE.createActivity();
Model owner = (Model) getElementToEdit();
owner.getActivities().add(newElement);
owner.setStartActivity(newElement); // my additional code
...
}
If I create a new activity, I get the following exception
org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:519)
....
Caused by: org.eclipse.core.runtime.AssertionFailedException: null
argument:failed to create a view
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
The view cannot be created. I think the provider with the strategy
cannot be found.
If I remove my codeline everything works great. Is there a problem with
the command or the policy?
Thanks for comments
|
|
|
Re: Update a reference when a new object will be created [message #481071 is a reply to message #480848] |
Wed, 19 August 2009 14:00 |
Eclipse User |
|
|
|
Originally posted by: dennis.freese.gmx.net
Has nobody a suggestion? Maybe some further Information
or something else?
I read lots of entries in this newsgroup but I didn't found a
solution. I'm wondering, because it should be a very common task.
Is the way I changed the owners start activity wrong? Maybe a new
command needs to created?
If the new command is the correct way, why it's possible to add the new
created element to the owner but changing the start activity cause an
error?
I appreciate any suggestion.
Dennis F schrieb:
> Hello all,
>
> I tried to update a reference in the ...CreateCommand class like this:
>
> doExecuteWithResult() {
> Activity newElement = new ModelFactory.eINSTANCE.createActivity();
>
> Model owner = (Model) getElementToEdit();
> owner.getActivities().add(newElement);
>
> owner.setStartActivity(newElement); // my additional code
>
> ...
> }
>
> If I create a new activity, I get the following exception
>
> org.eclipse.core.commands.ExecutionException: While executing the
> operation, an exception occurred at
> org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:519)
> ....
> Caused by: org.eclipse.core.runtime.AssertionFailedException: null
> argument:failed to create a view
> at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
>
>
> The view cannot be created. I think the provider with the strategy
> cannot be found.
> If I remove my codeline everything works great. Is there a problem with
> the command or the policy?
>
> Thanks for comments
|
|
|
Powered by
FUDForum. Page generated in 0.03457 seconds