Cut/Copy/Paste [message #524612] |
Thu, 01 April 2010 11:23  |
Eclipse User |
|
|
|
Hello,
I am using WidgetMethodHandler to invoke cut/copy/paste action in my RCP
app. Also I use the IFocusService to enable/disable this handler.
My Problem now is, that there is no cut/copy/paste method in lists. I
tried to create my own listWidget creating a Composite with a list on it.
WidgetMethodHandler is looking for the focused Control, and therefor it
is getting the list on my listWidget, not my listWidget. How can i tell
the WidgetMethodHandler to use my cut/copy/paste methods in my widget
instead of looking (and NOT finding) these methods in the list control ?
Thanks
Andreas
|
|
|
|
|
|
Re: Cut/Copy/Paste [message #525358 is a reply to message #525032] |
Tue, 06 April 2010 02:04  |
Eclipse User |
|
|
|
Am 05.04.2010 15:46, schrieb Paul Webster:
> Andreas Schmid wrote:
>> Can you give me some Links where I can find a sample for that ?
>>
> Have a look at what the error log view does. For example,
> org.eclipse.ui.internal.views.log.LogView.createActions().
>
> PW
>
Hello,
I tryed to do it like it is done in the LogView, but I failed....
If I click on the Action in the Views Menu, it works.
But neither the Binding to the Application's menu nor the keyboard
shortcuts are working.
I am using Handlers "org.eclipse.ui.edit.copy" to perform copy actions
(see plugin.xml).
What am I missing ?
Thanks
Andreas
View.java ==>
public void createPartControl(Composite parent) {
...
createActions();
...
}
private void createActions(){
...
System.out.println("Creating Action...");
IActionBars bars = getViewSite().getActionBars();
copyAction = createCopyAction();
bars.setGlobalActionHandler(
ActionFactory.COPY.getId(),copyAction);
bars.getMenuManager().add(copyAction);
bars.getMenuManager().update(true);
...
}
private Action createCopyAction() {
Action action = new Action("&Copy") {
public void run() {
System.out.println("Hola Chico");
};
return action;
}
<== EOF View.java
plugin.xml ==>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="foo.bar.menu.edit"
label="Edit">
<command
commandId="org.eclipse.ui.edit.copy"
style="push">
</command>
</menu>
</menuContribution>
</extension>
<== EOF plugin.xml
|
|
|
Powered by
FUDForum. Page generated in 0.08311 seconds