Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Update a reference when a new object will be created
Update a reference when a new object will be created [message #480848] Tue, 18 August 2009 16:29 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Drawing on the diagram surface
Next Topic:model content navigator
Goto Forum:
  


Current Time: Thu Apr 25 05:42:24 GMT 2024

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

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

Back to the top