Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create Request (CreationEditPolicy)
Create Request (CreationEditPolicy) [message #759102] Sat, 26 November 2011 11:31 Go to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 193
Registered: October 2010
Senior Member
Hi everyone.

I am working on an editor where CreationEditPolicy was extended in order to cover some specific behaviour when the element is created.

Now, I want that whenever I select the respective tool from palette, and click in diagram to create the element, the editor ask me (via popup), if the elemente should or not be created.

My first action was to change a bit the method
getCreateElementAndViewCommand(CreateViewAndElementRequest request) {
inside CreationEditPolicy extension, however I can't decide where the change should go since this method is called many times when we click in diagram to create the element.
Note that It is called with requests with the same data.


Anyone knows why is this method invoked several times, and if I have other options to put my code.??

Thanks in advance
Rui
Re: Create Request (CreationEditPolicy) [message #759293 is a reply to message #759102] Mon, 28 November 2011 09:49 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 769
Registered: July 2009
Location: Grenoble, France
Senior Member
Hi,

I think that the method is called quite often because it is used to
calculate the feedback of the mouse.
What happens is probably that whenever you move the mouse, the diagram
computes a new feedback for the cursor by verificating whether the host
EditPart understand the request (by checking the result of
getCreateElementAndViewCommand).

Place a breakpoint on this method to see the invocation stack.

HTH

On 26/11/2011 12:31, rui.domingues wrote:
> Hi everyone.
>
> I am working on an editor where CreationEditPolicy was extended in order
> to cover some specific behaviour when the element is created.
>
> Now, I want that whenever I select the respective tool from palette, and
> click in diagram to create the element, the editor ask me (via popup),
> if the elemente should or not be created.
>
> My first action was to change a bit the method
> getCreateElementAndViewCommand(CreateViewAndElementRequest request) {
> inside CreationEditPolicy extension, however I can't decide where the
> change should go since this method is called many times when we click in
> diagram to create the element.
> Note that It is called with requests with the same data.
>
>
> Anyone knows why is this method invoked several times, and if I have
> other options to put my code.??
>
> Thanks in advance
> Rui


--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
Re: Create Request (CreationEditPolicy) [message #759413 is a reply to message #759293] Mon, 28 November 2011 15:39 Go to previous messageGo to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 193
Registered: October 2010
Senior Member
Hi. Firstly thanks for your answer.

Actually it's that. Whenever I move the mouse, the method is invokated.

Do you know where I can put my code. Some place being invokated once. Or some workaround.

Thanks again.
Rui
Re: Create Request (CreationEditPolicy) [message #759433 is a reply to message #759413] Mon, 28 November 2011 16:19 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 769
Registered: July 2009
Location: Grenoble, France
Senior Member
The request will turn into a command (that's what you experiment), and
then the command will be executed.
I think you could override the getCreate...Command() to return a
customised command, with and override the execute() method. The
Command#execute method is the one that is called to actually perform the
action.

HTH

On 28/11/2011 16:39, rui.domingues wrote:
> Hi. Firstly thanks for your answer.
>
> Actually it's that. Whenever I move the mouse, the method is invokated.
>
> Do you know where I can put my code. Some place being invokated once. Or
> some workaround.
>
> Thanks again.
> Rui


--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
Re: Create Request (CreationEditPolicy) [message #759465 is a reply to message #759433] Mon, 28 November 2011 18:51 Go to previous message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 193
Registered: October 2010
Senior Member
Hi again. Actually the command is executed all the time. This is very strange.
The execute is performed every time a command is required..
Previous Topic:How to add xxx.xxx_diagram as navigator content in GMF plugin.xml
Next Topic:Retain diagram when double clicked on xxx.xxx_diagram on navigator windowvigator
Goto Forum:
  


Current Time: Thu Nov 27 00:34:00 GMT 2014

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

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