Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How can I register a paste command handler in PageDesignerEditor?(How can I register a paste command handler in PageDesignerEditor?)
How can I register a paste command handler in PageDesignerEditor? [message #847244] Tue, 17 April 2012 06:02 Go to next message
Wang Zhaoliang is currently offline Wang ZhaoliangFriend
Messages: 9
Registered: April 2012
Junior Member
How can I register a paste command handler in PageDesignerEditor ?

I have successed to do this in ProjectExplorer, but with the same way I can't do this with PageDesignerEditor ?

Is there something wrong ?


Thanks !

<extension point="org.eclipse.ui.handlers">
<handler class="com.my.handlers.PasteHandler"
commandId="org.eclipse.ui.edit.paste">
<activeWhen>
<with
variable="activePartId">
<equals value="org.eclipse.jst.pagedesigner.PageDesignerEditor">
</equals>
</with>
</activeWhen>
</handler>
</extension>
Re: How can I register a paste command handler in PageDesignerEditor? [message #855062 is a reply to message #847244] Tue, 24 April 2012 13:45 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

What's the PageDesignEditor? Is it a multi-page editor part?

PW


Re: How can I register a paste command handler in PageDesignerEditor? [message #856976 is a reply to message #855062] Thu, 26 April 2012 06:14 Go to previous messageGo to next message
Wang Zhaoliang is currently offline Wang ZhaoliangFriend
Messages: 9
Registered: April 2012
Junior Member
Paul Webster wrote on Tue, 24 April 2012 09:45
What's the PageDesignEditor? Is it a multi-page editor part?

PW


Thanks for help.
PageDesignEditor is a multi-page editor part, it is the HTMLEditor that defined in WPT, and the part id is "org.eclipse.jst.pagedesigner.PageDesignerEditor".

I just want to register a paste command handler in HTMLEditor's GraphicViewer part, not the StyledText part.

If I use the configuration below it works, but it works in other editor too, I don't want to handle ervery editor.

<activeWhen>
<with
variable="selection">
<count value="*" />
</with>
</activeWhen>


Is there any better solution ?
Thanks ~
Re: How can I register a paste command handler in PageDesignerEditor? [message #857355 is a reply to message #856976] Thu, 26 April 2012 13:27 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There's no easy way to declaratively add activate a handler for a page in an MPEP.

You'd either have to write a source provider that looked at the active editor to see if it was an MultiPageEditorPart, find the active inner IEditorPart if available, and post that in a user variable (which could then be used declaratively) *or* programmatically activate/deactivate a handler when the active editor was an MPEP and the inner page is the editor you want.

PW


Previous Topic:How to define a org.eclipse.ui.menus contribution for sub-context-menus
Next Topic:SaveAll Command
Goto Forum:
  


Current Time: Sat Nov 29 10:06:35 GMT 2014

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

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