Enhancement: creating a bridge in the given composite (without creating an inner embedded composite)

This commit is contained in:
Matteo Miraz 2013-09-17 17:34:36 +02:00
parent 7b4e58b1bc
commit 8cdc378249
1 changed files with 19 additions and 0 deletions

View File

@ -78,4 +78,23 @@ public class Bridge {
}
});
}
public static void adaptIn(Composite embedder, final Component componentAWT) {
final Frame frame = SWT_AWT.new_Frame(embedder);
frame.add(componentAWT);
// disposing the frame cleanly
embedder.addDisposeListener(new DisposeListener(){
public void widgetDisposed(DisposeEvent arg0) {
EventQueue.invokeLater(new Runnable () {
public void run () {
//System.out.println("Bridge is disposing frame containing " + componentAWT.getName() + " - " + componentAWT.getClass());
frame.dispose();
// the awt component is supposed to be disposed by the user
}
});
}
});
}
}