Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Copying GEF Diagram to Windows Applications
Copying GEF Diagram to Windows Applications [message #244926] Wed, 13 August 2008 06:08
Eclipse User
Originally posted by: sumit.mathur.amdocs.com

Hi,

I am working on a graphical editor using GEF and I want to provide the
support of copying my GEF diagram to the windows applications. By reading
to the existing posts on this newsgroup I came to know that I need to use
ImageTransfer.java and clipboard. I have implemented it in my code and I
am able to copy/paste my GEF image between eclipse applications, however,
in windows applications paste button does not get enabled.

I am using the ImageTransfer.java available at

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.exa mples/src/org/eclipse/swt/examples/dnd/ImageTransfer.java

My Code looks as follows

IFigure figure = getMyFigure();
int w = figure.getSize().width;
int h = figure.getSize().height;
Image image = new Image(Display.getDefault(), w, h);
GC gc = new GC(image);
SWTGraphics graphics = new SWTGraphics(gc);
figure.paint(graphics);
graphics.dispose();
gc.dispose();
ImageData data = image.getImageData();
Clipboard clipboard = new Clipboard(Display.getDefault());
try {
clipboard.setContents(new ImageData[] { data }, new Transfer[] {
ImageTransfer.getInstance() });
} finally {
clipboard.dispose();
}

Any help is greatly appreciated.


Regards,
Sumit.
Previous Topic:ZoomManager Looses Center
Next Topic:[Announce] GEF 3.5.0M1 is available
Goto Forum:
  


Current Time: Fri Apr 25 02:43:17 EDT 2014

Powered by FUDForum. Page generated in 0.03305 seconds