Edit policy [message #90058] |
Sun, 08 May 2005 06:11  |
Eclipse User |
|
|
|
Originally posted by: danijel_zecevic.hotmail.com
Hello,
where can I set my edit policy?
Thank you,
Danijel
|
|
|
Re: Edit policy [message #90179 is a reply to message #90058] |
Mon, 09 May 2005 04:59  |
Eclipse User |
|
|
|
Hi ddd,
> where can I set my edit policy?
A GEF EditPolicy is something that sits on an EditPart and is
responsible for creating a Command. In GEF you have either the tree
viewer or the graphical viewer and this is basically a set of edit part
nodes (that are either tree items or graphical boxes). Whenever a GEF
tool interacts with an edit part such as you move the mouse to drop
something, drag something, move something, etc... a command request is
created. The EditPart is asked getCommand(Request) and is responsible
for returing a command object that, when executed by the tooling
following something like a mouse up or key press action, runs and
updates the underlying model.
Instead of an EditPart creating the command the pattern of coding in GEF
is for this to be delegated to an EditPolicy object. This is sort of a
strategy pattern as the EditPolicy can evolve independent of the
EditPart. The method to set an EditPolicy on an EditPart is in
createEditPolicies() and something like
MyEditPart extends AbstractGraphicalEditPart(){
protected void createEditPolicies(){
installEditPolicy("UNIQUE_KEY",new MyEditPolicy());
}
}
In VE you can't add an edit policy on its own, you must create an
EditPart that overrides createEditPolicies() and installs it. The way
to do this is with a ClassDescriptorDecorator and if you look at the VE
tutorial on
http://dev.eclipse.org/viewcvs/indextools.cgi/%7Echeckout%7E /org.eclipse.ve.examples/org.eclipse.ve.example.customwidget /WebContent/index.html
this shows how to do this that involves creating a .override file for
your class.
Can you give me a bit more detail about exactly what you want your edit
policy to do ?
Best regards,
Joe
|
|
|
Re: Edit policy [message #607368 is a reply to message #90058] |
Mon, 09 May 2005 04:59  |
Eclipse User |
|
|
|
Hi ddd,
> where can I set my edit policy?
A GEF EditPolicy is something that sits on an EditPart and is
responsible for creating a Command. In GEF you have either the tree
viewer or the graphical viewer and this is basically a set of edit part
nodes (that are either tree items or graphical boxes). Whenever a GEF
tool interacts with an edit part such as you move the mouse to drop
something, drag something, move something, etc... a command request is
created. The EditPart is asked getCommand(Request) and is responsible
for returing a command object that, when executed by the tooling
following something like a mouse up or key press action, runs and
updates the underlying model.
Instead of an EditPart creating the command the pattern of coding in GEF
is for this to be delegated to an EditPolicy object. This is sort of a
strategy pattern as the EditPolicy can evolve independent of the
EditPart. The method to set an EditPolicy on an EditPart is in
createEditPolicies() and something like
MyEditPart extends AbstractGraphicalEditPart(){
protected void createEditPolicies(){
installEditPolicy("UNIQUE_KEY",new MyEditPolicy());
}
}
In VE you can't add an edit policy on its own, you must create an
EditPart that overrides createEditPolicies() and installs it. The way
to do this is with a ClassDescriptorDecorator and if you look at the VE
tutorial on
http://dev.eclipse.org/viewcvs/indextools.cgi/%7Echeckout%7E /org.eclipse.ve.examples/org.eclipse.ve.example.customwidget /WebContent/index.html
this shows how to do this that involves creating a .override file for
your class.
Can you give me a bit more detail about exactly what you want your edit
policy to do ?
Best regards,
Joe
|
|
|
Powered by
FUDForum. Page generated in 0.07225 seconds