[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Problem using Swing from org.eclipse.core.runtime.applications extension

I have an existing Swing application to which I would like to add plug-in
support. I hope to use the Eclipse plug-in facility for this purpose. To
convince myself that this can work, I'm trying to write a small Eclipse
plug-in containing an org.eclipse.core.runtime.applications extension as
follows:

package clo.brp.rcp;

import javax.swing.JFrame;

import org.eclipse.core.runtime.IPlatformRunnable;

public class RcpApplication implements IPlatformRunnable {

    public Object run(Object args) {

    	JFrame frame = new JFrame("RcpApplication");
    	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	frame.setVisible(true);

    	System.out.println("back from setVisible");

    	return IPlatformRunnable.EXIT_OK;

    }
    
}

This almost works, except that the call to frame.setVisible returns
immediately instead of blocking until the user dismisses the JFrame, the
normal behavior for a Swing application. So the JFrame appears only
briefly and then the program exits. Does anybody know how I can fix this?