[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.gmf] Re: Double click event

There are many messages regarding this already but here's a summary:

In the particular EditPart that you want to handle double-click install
an EditPolicy for the OPEN_ROLE like so:

protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();

    [snip...]

    installEditPolicy(EditPolicyRoles.OPEN_ROLE, createOpenEditPolicy());

}

Then add the createOpenEditPolicy() method like so (in the same EditPart):

private OpenEditPolicy createOpenEditPolicy() {
    OpenEditPolicy policy = new OpenEditPolicy() {
        protected Command getOpenCommand(Request request) {

        /*
         * You can create whatever command you need here
         *
         */

	return [your command];	

        };
    return policy;
}


That's the main idea of it.

Alternatively you can implement the EditPolicyProvider extension if you
have to install custom EditPolicies on many EditParts.

-- Khai --


Stu wrote:
Ok I've been looking around extension points all day and trying to find how I can tap into the double click event for a Node or Node Element.

I know GMF has the Open Digram - behaviour that can be added that uses double click so I guess it can be done.

Maybe on another note - if it is an extension point - How do you find them ? I have farmed through in eclipse and get the descriptions but no joy.