Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Cut/Copy/Paste
Cut/Copy/Paste [message #524612] Thu, 01 April 2010 15:23 Go to next message
Andreas Schmid is currently offline Andreas SchmidFriend
Messages: 17
Registered: July 2009
Junior Member
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 #524660 is a reply to message #524612] Thu, 01 April 2010 17:34 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

WidgetMethodHandler will only work on the focus control.

To work in your scenario you have to work similar to the *Viewers, where
the copy handler is activated against the part itself and tends to copy
out the data object that underlies the *Viewer's presentation.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Cut/Copy/Paste [message #524823 is a reply to message #524660] Fri, 02 April 2010 18:41 Go to previous messageGo to next message
Andreas Schmid is currently offline Andreas SchmidFriend
Messages: 17
Registered: July 2009
Junior Member
Am 01.04.2010 19:34, schrieb Paul Webster:
> WidgetMethodHandler will only work on the focus control.
>
> To work in your scenario you have to work similar to the *Viewers, where
> the copy handler is activated against the part itself and tends to copy
> out the data object that underlies the *Viewer's presentation.
>
> PW
>
>
Can you give me some Links where I can find a sample for that ?

Thanks

Andreas
Re: Cut/Copy/Paste [message #525032 is a reply to message #524823] Mon, 05 April 2010 13:46 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Cut/Copy/Paste [message #525358 is a reply to message #525032] Tue, 06 April 2010 06:04 Go to previous message
Andreas Schmid is currently offline Andreas SchmidFriend
Messages: 17
Registered: July 2009
Junior Member
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
Previous Topic:Widget is disposed
Next Topic:Cannot get the updated content of Text.getText() value
Goto Forum:
  


Current Time: Sat Apr 27 04:15:17 GMT 2024

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

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

Back to the top