Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » CreateView question
CreateView question [message #628178] Thu, 23 September 2010 10:06 Go to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
Hi,

I'm trying to create the view of an existing semantic element created in program, already added to model; to do so I found this way:

private Command createViewCommand(EObject template) {
CreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor(new EObjectAdapter(
template), Node.class, ((IHintedType) XXXElementTypes
.getElementType(XXXEditPart.VISUAL_ID)).getSemanticHint(), true, CanvasEditPart
.getDiagramPreferencesHint());
viewDescriptor.setPersisted(true);
CreateViewRequest createViewRequest = new CreateViewRequest(viewDescriptor);
Command createViewCommand = CanvasEditPart.getCommand(createViewRequest);
return createViewCommand;
}

How can I translate the code
((IHintedType) XXXElementTypes
.getElementType(XXXEditPart.VISUAL_ID)).getSemanticHint()
for the type Port?

Thanks in advance, 123star
Re: CreateView question [message #630254 is a reply to message #628178] Fri, 01 October 2010 10:31 Go to previous messageGo to next message
Remi Schnekenburger is currently offline Remi SchnekenburgerFriend
Messages: 169
Registered: July 2009
Location: Palaiseau, France
Senior Member
Hi,

for the puzzle, i would answer:


  • VISUAL ID: org.eclipse.papyrus.diagram.composite.edit.parts.PortEditPar t.VISUAL_ID
  • Element types: org.eclipse.papyrus.diagram.composite.providers.UMLElementTy pes



Cheers
Rémi





Remi Schnekenburger

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: CreateView question [message #630452 is a reply to message #630254] Sat, 02 October 2010 16:54 Go to previous messageGo to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
Thank you Remi,

I've put in the code, but this exception occurs when I call the method for creating the view of the port:

Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument:failed to create a view
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
at org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.do ExecuteWithResult(CreateCommand.java:99)
at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doExecute(AbstractTransactionalCommand.ja va:247)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:150)
at org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy.ex ecute(ICommandProxy.java:68)
at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCom mand.java:111)


I tried different ways to do this, but I always get this exception.
I miss something, I looked through GMF forum, but I didn't find some working code.
For now I haven't managed to find a way to synchronize the view with the model...

Thanks in advance, 123star

Re: CreateView question [message #630621 is a reply to message #630452] Mon, 04 October 2010 12:15 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 341
Registered: July 2009
Location: Paris Saclay, France
Senior Member
It seems that the framework can not create the view.

Have you try to create the view element with the good parentview.

For exemple the parent view of the port can be a class view not a compartment.
What is your variable "template".

Patrick
Re: CreateView question [message #661226 is a reply to message #630452] Wed, 23 March 2011 15:55 Go to previous message
yangui  is currently offline yangui Friend
Messages: 2
Registered: January 2011
Junior Member
I have the same problem as you. Did you resolve this problem?
I wish to create a view of an existing semantic element created in program.
I used your code and I have the same exception.

Thank you in adavance!!
Rahma.
Previous Topic:How to programmatically interact with the model explorer
Next Topic:problem with org.eclipse.jface in papyrus
Goto Forum:
  


Current Time: Thu Mar 28 22:35:04 GMT 2024

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

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

Back to the top