Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] intercept copy/paste in console

Hey Brian,

this is great, thanks a lot for your help, much appreciated. Works nicely!!! :-)

The only thing that bothers me is that this causes my action handler to be called for keystrokes and the global menu entries, but not for the context menu “copy” action. Any idea what I need to do additionally to hook into that as well?

Cheers,
-Martin



> Am 13.03.2016 um 05:10 schrieb Brian de Alwis <briandealwis@xxxxxxxxx>:
> 
> Hi Martin.
> 
> There are two approaches I can see, from quickly eyeballing the code.
> 
> ConsoleView is a PageBookView, which delegates action-registration for actions like COPY and PASTE to its particular IPageBookViewPage implementations (IOConsolePage/TextConsolePage in this case).  I’ve never tried this, but it’s possible your AnsiConsolePageParticipant’s init() might be able do something like:
> 
> 	public void init(IPageBookViewPage page, IConsole console) {
> 		// …
> 		page.getSite().getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(),
> 			new AnsiConsoleCopyIconAction());
> 	}
> 
> Or perhaps moved into the activate()  YMMW.
> 
> Since the copy/cut/paste actions are registered as view actions, you could try providing a handler on the org.eclipse.ui.edit.copy command with an <activeWhen> targeting the Console view.  Where there are multiple handlers for the same command, Eclipse ranks the available handlers by the complexity of their <activeWhen> expressions and chooses the more complex/specialized.  Your copy handler would behave similarly to the AnsiConsoleCopyIconAction.
> 
> Brian.
> 
>> On 8-Mar-2016, at 11:11 AM, Martin Lippert <mlippert@xxxxxxxxx> wrote:
>> 
>> Hey!
>> 
>> We are using a plugin to get ANSI coloring in the console (http://marketplace.eclipse.org/content/ansi-escape-console) and we would like to slightly improve it.
>> We would like to change the behavior of the copy shortcut in the console view in order to wipe out escape sequences from the copied text before it gets copied into the clipboard.
>> 
>> Is that somehow possible with the existing API? Any hint?
>> 
>> Thanks a lot for your help!
>> -Martin
>> _______________________________________________
>> platform-ui-dev mailing list
>> platform-ui-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
> 
> _______________________________________________
> platform-ui-dev mailing list
> platform-ui-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/platform-ui-dev



Back to the top