Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Set name of a created element
Set name of a created element [message #500931] Mon, 30 November 2009 11:02 Go to next message
Arian Storch is currently offline Arian StorchFriend
Messages: 6
Registered: July 2009
Junior Member
Hi!

I manually create an element and its view by invoking
CreateViewRequestFactory.getCreateShapeRequest()
and the associated command. This works fine.

After that I want to set the name of this element by this:

ElementNameEditPart elementNameEditPart = (ElementNameEditPart) createdEditPart;

elementNameEditPart.setLabelText("new one");


First, this works so that the created element gets the name but after saving and reloading the diagram the name disappears though the element is visible.

Has somebody a clue?

regards
Re: Set name of a created element [message #502149 is a reply to message #500931] Sun, 06 December 2009 15:59 Go to previous message
Arian Storch is currently offline Arian StorchFriend
Messages: 6
Registered: July 2009
Junior Member
Hi again.

I've worked out a solution. It looks like this:


EditPart createdEditPart = ... ; // previously created EditPart

ElementImpl el = (ElementImpl)createdEditPart.resolveSemanticElement();

editor.getDiagramEditDomain().getDiagramCommandStack().execute(
						new Command() {
							@Override
							public void execute() {
								super.execute();
                                                                el.setName("new name...");
							}
						}
				);


Maybe this helps anyone with similar problems.

regards
Previous Topic:Restrict the sharing of a Editingdomain to a Project
Next Topic:Garbled generated code
Goto Forum:
  


Current Time: Tue Apr 20 12:25:13 GMT 2021

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

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

Back to the top