override copy action of editorpart (CopyCurrentLine) [message #54363] |
Fri, 10 April 2009 08:44  |
Eclipse User |
|
|
|
Hi,
I want to write a small plugin for eclipse. It is name is CopyCurrentLine.
As the name implies, When I press ctrl-c or call the copy action via context
menu, I want to copy the current line when nothing is selected by the user.
(like in visual studio)
How can I catch the copy action of an editorpart?
Thanks
Ken
|
|
|
|
|
|
Re: override copy action of editorpart (CopyCurrentLine) [message #60115 is a reply to message #54391] |
Thu, 07 May 2009 08:09  |
Eclipse User |
|
|
|
Thanks for your help.
I have implemented it on http://copycutcurrentline.googlecode.com/
Copy/Cut current line in Eclipse as in .NET
What is it?
Press Ctrl-C to copy the whole line in an editor when you select nothing.
It works as usual when you select something. And paste anywhere with Ctrl-V.
Works on Linux. Should work on Mac but not tested.
Download
- Eclipse Update Site
If you are already familiar with installing Eclipse plugins, you can just
use the update site URL below.
http://copycutcurrentline.googlecode.com/svn/trunk/
Tested for Java 6 and above. Tested for Eclipse 3.4 and above.
- Manual Download
Copy
http://copycutcurrentline.googlecode.com/svn/trunk/plugins/c om.lembas.CopyCutCurrentLine_1.0.0.jar
into your dropins folder and restart Eclipse.
"Ankur Sharma" <sharma.ankur@gmail.com> wrote in message
news:grng43$iph$1@build.eclipse.org...
> Kerem wrote:
>> Hi,
>>
>> I want to write a small plugin for eclipse. It is name is
>> CopyCurrentLine.
>>
>> As the name implies, When I press ctrl-c or call the copy action via
>> context menu, I want to copy the current line when nothing is selected by
>> the user. (like in visual studio)
>>
>> How can I catch the copy action of an editorpart?
>>
>> Thanks
>> Ken
>
>
> You've got 2 options
>
> 1. Go to Window -> Preferences -> General -> Keys
> Scroll down to find "Copy all from left to right".
> This, by default, has no key binding. Add one of your liking.
> Use it with Home (takes cursor to start of line).
> Save yourself from writing a plug-in.
>
> 2. If you want a shorted Key binding, you will have to write a plugin
> Need not catch the copy action. Just contribute to the extension
> "org.eclipse.ui.bindings"
> And have a key binding of you liking.
>
> --
> hth,
> Ankur..
|
|
|
Re: override copy action of editorpart (CopyCurrentLine) [message #594892 is a reply to message #54363] |
Fri, 10 April 2009 09:04  |
Eclipse User |
|
|
|
Kerem wrote:
> Hi,
>
> I want to write a small plugin for eclipse. It is name is CopyCurrentLine.
>
> As the name implies, When I press ctrl-c or call the copy action via context
> menu, I want to copy the current line when nothing is selected by the user.
> (like in visual studio)
>
> How can I catch the copy action of an editorpart?
>
> Thanks
> Ken
>
>
You've got 2 options
1. Go to Window -> Preferences -> General -> Keys
Scroll down to find "Copy all from left to right".
This, by default, has no key binding. Add one of your liking.
Use it with Home (takes cursor to start of line).
Save yourself from writing a plug-in.
2. If you want a shorted Key binding, you will have to write a plugin
Need not catch the copy action. Just contribute to the extension "org.eclipse.ui.bindings"
And have a key binding of you liking.
--
hth,
Ankur..
|
|
|
Re: override copy action of editorpart (CopyCurrentLine) [message #594900 is a reply to message #54391] |
Fri, 10 April 2009 09:32  |
Eclipse User |
|
|
|
Ankur thank you for your answer.
But in either case I cannot bind ctrl-c to that command. I have to bind
another key.
Isn't there a way to catch copy action?
Or can I change the handler of the copy command "org.eclipse.ui.edit.copy"?
"Ankur Sharma" <sharma.ankur@gmail.com> wrote in message
news:grng43$iph$1@build.eclipse.org...
> Kerem wrote:
>> Hi,
>>
>> I want to write a small plugin for eclipse. It is name is
>> CopyCurrentLine.
>>
>> As the name implies, When I press ctrl-c or call the copy action via
>> context menu, I want to copy the current line when nothing is selected by
>> the user. (like in visual studio)
>>
>> How can I catch the copy action of an editorpart?
>>
>> Thanks
>> Ken
>
>
> You've got 2 options
>
> 1. Go to Window -> Preferences -> General -> Keys
> Scroll down to find "Copy all from left to right".
> This, by default, has no key binding. Add one of your liking.
> Use it with Home (takes cursor to start of line).
> Save yourself from writing a plug-in.
>
> 2. If you want a shorted Key binding, you will have to write a plugin
> Need not catch the copy action. Just contribute to the extension
> "org.eclipse.ui.bindings"
> And have a key binding of you liking.
>
> --
> hth,
> Ankur..
|
|
|
Re: override copy action of editorpart (CopyCurrentLine) [message #594911 is a reply to message #54417] |
Fri, 10 April 2009 13:07  |
Eclipse User |
|
|
|
Kerem wrote:
> Ankur thank you for your answer.
> But in either case I cannot bind ctrl-c to that command. I have to bind
> another key.
> Isn't there a way to catch copy action?
> Or can I change the handler of the copy command "org.eclipse.ui.edit.copy"?
>
I am new to commands and really don't know how to hook or override and existing handler. Perhaps some SWT gurus at eclipse.platform.swt newsgroup can help you better than I can.
Sidenote: Why after Ctrl+C ? A similar one wont do? like Alt + C or Ctrl + Alt + C
--
hth,
Ankur..
|
|
|
Re: override copy action of editorpart (CopyCurrentLine) [message #596996 is a reply to message #54391] |
Thu, 07 May 2009 08:09  |
Eclipse User |
|
|
|
Thanks for your help.
I have implemented it on http://copycutcurrentline.googlecode.com/
Copy/Cut current line in Eclipse as in .NET
What is it?
Press Ctrl-C to copy the whole line in an editor when you select nothing.
It works as usual when you select something. And paste anywhere with Ctrl-V.
Works on Linux. Should work on Mac but not tested.
Download
- Eclipse Update Site
If you are already familiar with installing Eclipse plugins, you can just
use the update site URL below.
http://copycutcurrentline.googlecode.com/svn/trunk/
Tested for Java 6 and above. Tested for Eclipse 3.4 and above.
- Manual Download
Copy
http://copycutcurrentline.googlecode.com/svn/trunk/plugins/c om.lembas.CopyCutCurrentLine_1.0.0.jar
into your dropins folder and restart Eclipse.
"Ankur Sharma" <sharma.ankur@gmail.com> wrote in message
news:grng43$iph$1@build.eclipse.org...
> Kerem wrote:
>> Hi,
>>
>> I want to write a small plugin for eclipse. It is name is
>> CopyCurrentLine.
>>
>> As the name implies, When I press ctrl-c or call the copy action via
>> context menu, I want to copy the current line when nothing is selected by
>> the user. (like in visual studio)
>>
>> How can I catch the copy action of an editorpart?
>>
>> Thanks
>> Ken
>
>
> You've got 2 options
>
> 1. Go to Window -> Preferences -> General -> Keys
> Scroll down to find "Copy all from left to right".
> This, by default, has no key binding. Add one of your liking.
> Use it with Home (takes cursor to start of line).
> Save yourself from writing a plug-in.
>
> 2. If you want a shorted Key binding, you will have to write a plugin
> Need not catch the copy action. Just contribute to the extension
> "org.eclipse.ui.bindings"
> And have a key binding of you liking.
>
> --
> hth,
> Ankur..
|
|
|
Powered by
FUDForum. Page generated in 0.03242 seconds