What is the use of ContainerEditPolicy [message #213257] |
Tue, 04 April 2006 13:22 |
Eclipse User |
|
|
|
Originally posted by: shruthi.cn.in.bosch.com
Hello everybody,
I am quite new to editpolicies.
Could anyone give me a brief description of the kind of editing possible
with ContainerEditPolicy.
Also some links which have code for the ContainerEditPolicy would be
helpful to me.
I have a doubt.
Say a model object m1 has children c1, c2.
Initially i display only m1. When i double click on the figure of m1 in
the view, i want to display in the editor only the children c1, c2.
Can i achieve this with ContainerEditPolicy. If not how do i achieve this?
Thank you very much
Best Regards
Shruthi
|
|
|
|
Re: What is the use of ContainerEditPolicy [message #213496 is a reply to message #213390] |
Thu, 06 April 2006 10:46 |
Eclipse User |
|
|
|
Originally posted by: shruthi.cn.in.bosch.com
Hello Steven Shaw,
Thanks a lot for your reply.
I tried to implement as you had said. I am little new to Editpolicies.
Actually HierarchyDisplay edit policy will handle the
RequestConstants.REQ_OPEN request as shown below.
When i debugged it, the following is happening:-
When i single click on the figure, control is going to the getCommand
method in HierarchyDisplay. The request.getType() value is "delete".
Control is also not entering the if loop present in getCommand method.
If i double click twice on the figure, then control is entering twice in
to the getCommand method. Is there anything else that i have to do? Thanks
a lot. Waiting for your reply.
Best Regards
Shruthi
protected void createEditPolicies() {
installEditPolicy(HIERARCHY_ROLE, new HierarchyDisplay());
}
private static class HierarchyDisplay extends GraphicalEditPolicy {
public Command getCommand(Request request)
{
if(request.getType().equals(RequestConstants.REQ_OPEN ))
{
System.out.println("diagram double clicked");
return new HierarchyViewCommand((Shape)
this.getTargetEditPart(request).getModel(),
request);
}
else
return null;
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03502 seconds