Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Copy and Paste Facility!!!
Copy and Paste Facility!!! [message #186238] Mon, 04 July 2005 07:08 Go to next message
Eclipse UserFriend
Originally posted by: gautamn.iitk.ac.in

I want to provide Cut/Copy and Paste facility in my editor. How can i do
that???
Regards,
Nitin.
Re: Copy and Paste Facility!!! [message #186277 is a reply to message #186238] Mon, 04 July 2005 17:27 Go to previous message
Eclipse UserFriend
Originally posted by: raswinkumar.datamirror.com

Create
copyAction extending selectionAction
in the init method,
setId(ActionFactory.PASTE.getId());

then in the run method
GroupRequest copyReq = new GroupRequest(Messages.REQ_COPY);

getSelectedObjects() will return editparts as one the elements.
using the editpart(s), call
editpart.getCommand(copyReq);

this will go to the ComponentPolicy and request the command,
there, return a copyCommand extends command

example,

public class CopyCommand extends Command
{
public void execute()
{
// copy here
// u can call the editor and getSelectedObjects() or something
}
}

once the copy action gets the required command, execute the command by
calling

execute(getCommand(copyReq));

for the action to appear in the menu,
in the ActionBarAdvisor,

....
menu.add(ActionFactory.COPY.getID());

this should work... but u may have to use
protected boolean calculateEnabled()
{
}
in the CopyCommand to choose when it is enabled and when its not...

tell me once you get it running

"Nitin Gautam" <gautamn@iitk.ac.in> wrote in message
news:eec9ebda7f4f744c2bcb8be56172395f$1@www.eclipse.org...
>
> I want to provide Cut/Copy and Paste facility in my editor. How can i do
> that???
> Regards,
> Nitin.
>
Previous Topic:[OT] viewing examples for expanding collocated nodes
Next Topic:TextFlow fragments and segments
Goto Forum:
  


Current Time: Tue Dec 03 05:43:11 GMT 2024

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

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

Back to the top