Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Refresh problem in broswer when I use swt applet (embedded GEF GraphicalViewer)
Refresh problem in broswer when I use swt applet (embedded GEF GraphicalViewer) [message #231158] Wed, 28 February 2007 05:33
Eclipse UserFriend
Originally posted by:

I make an applet within embedded GEF GraphicalViewer.
When I first open it, it works great.
But I push refresh button in browser, it doesn't work well. ( all labels are
not displayed and etc... )

I think SWT_AWT bridge has a problem.
Does anyone have a solution?

it is sourcecode...

public void run() {
* Create an SWT Composite from an AWT canvas to be the parent of the
* SWT widgets. The AWT Canvas will be layed out by the Applet layout
* manager. The layout of the SWT widgets is handled by the application
* (see below).
display = new Display();
cnvsAwtParent = new Canvas();

add(cnvsAwtParent, BorderLayout.CENTER);

swtParent = SWT_AWT.new_Shell(display, cnvsAwtParent);
swtParent.setLayout(new FillLayout());

/* Create SWT widget */
Composite cmpstParent = new Composite(swtParent, SWT.NONE);
cmpstParent.setLayout(new FillLayout());

ScrollingGraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.setEditDomain(new DefaultEditDomain(null));


viewer.setEditPartFactory(new GraphicalPartFactory());

try {
String fileName= "./example.logic";
File file = new File(fileName);
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
diagram = (LogicDiagram) in.readObject();
} catch (FileNotFoundException e) {
} catch (IOException e) {
} catch (ClassNotFoundException e) {

// LogicDiagramEditPart rootEditPart = new LogicDiagramEditPart();
// rootEditPart.setModel(diagram);

// viewer.getRootEditPart().setModel(diagram);

// Size AWT Panel so that it is big enough to hold the SWT widgets
Point size = swtParent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
cnvsAwtParent.setSize(size.x, size.y);

// Need to invoke the AWT layout manager or AWT and Swing
// widgets will not be visible

// The SWT widget(s) require an event loop
while (display != null && !display.isDisposed()) {
if (!display.readAndDispatch()) {

Previous Topic:How to put multiple editors in an editor
Next Topic:CheckboxTreeViwer in a GEF OutlineContentPage
Goto Forum:

Current Time: Mon Oct 25 16:47:31 GMT 2021

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

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

Back to the top