Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Creating a fixed node on new diagram start up
Creating a fixed node on new diagram start up [message #114184] Sun, 25 March 2007 18:49 Go to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

Hi,
I'd like to create a node in the top left corner when a diagram is created.
Its a singleton (no creating more than one) and has to exists so no deleting
either.

Any clues on where to start to do this.

Thanks,
Stu
Re: Creating a fixed node on new diagram start up [message #114198 is a reply to message #114184] Mon, 26 March 2007 03:20 Go to previous message
Eclipse UserFriend
Stu schrieb:
> Hi,
> I'd like to create a node in the top left corner when a diagram is created.
> Its a singleton (no creating more than one) and has to exists so no deleting
> either.
>
> Any clues on where to start to do this.
>
> Thanks,
> Stu
>
>
Hi,

my solution for your problem in creating a new node:
search in the XXX.diagram.part package for the class XXXDiagramEditorUtil,
there you can find a method createInitialModel(). In this method you can
add the node to your Root of the diagram. This works fine for me.

Second problem with deleting: In your xxx.diagram.edit.parts search for
the editpart of your node. In method createDefaultEditPolicies() you
have to change editpolicy of CREATION_ROLE, if the command for delete is
requested you return UnexecutableCommand. Like this:

installEditPolicy(EditPolicyRoles.CREATION_ROLE,
new CreationEditPolicy() {
public Command getCommand(Request request) {
here---> if ((request instanceof GroupRequest)
&& (request.getType().equals("delete")))
---> return UnexecutableCommand.INSTANCE;
if (understandsRequest(request))
return super.getCommand(request);
return null;}
});

I think this will help you!

Bye,

Jens
Previous Topic:Feature-independent initializer
Next Topic:copy/past on compartments
Goto Forum:
  


Current Time: Tue Jul 22 03:27:45 EDT 2025

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

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

Back to the top