Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gmf-dev] How to create a IFigure from clipboard data

Hello,

I tried the news group and did not get a response - either because my mail is not clear or this request did not get the attention of someone who could answer. Hence, I am posting here.

I am playing around with a templates view for editors.

Have a look at the screenshot from here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=69581#c59

I was able to save the CustomData[] from the Transfer into the template and able to paste the data back to editor on Ctl-V. Similarly with a Ctl-V into the templatesview I was able to save the CustomData[] into the template. I am facing two problems:

1. When the paste happens into the editor indirectly through double-clicking a template, the pasted objects are not selected. I am constructing a PasteViewRequest and using getCommand() like follows:

    PasteViewRequest pvr = new PasteViewRequest(getData(template));
    Command command = fEditor.getDiagramEditPart().getCommand(pvr);
    command.execute();

2. I want to construct a thumbnail to display in the preview from the custom data. I need to write a function like:

       IFigure createFigure(DiagramEditor editor, CustomData[] data)

then whenever a template is selected in the view, I can just call the above function and do a setContents on the LWS. I am not finding it easy to follow the paste logic :(

Can someone please help me?

TIA.

-- KD


Back to the top