XWT.open string [message #581166] |
Mon, 23 August 2010 19:41 |
FD Messages: 15 Registered: August 2010 |
Junior Member |
|
|
Is there a function to open an 'xwt string'?
In the folowing example I've to create a temporary file to be able to open the 'xwt string'.
package test;
import java.io.*;
import java.net.URL;
import org.eclipse.e4.xwt.XWT;
public class Test {
public static void main(String[] args) throws IOException {
String xwtstr = "<Composite xmlns=\"http://www.eclipse.org/xwt/presentation\" xmlns:x=\"http://www.eclipse.org/xwt\"><Composite.layout> <GridLayout numColumns=\"1\"/> </Composite.layout> <Text text=\"test text\" x:style=\"SWT.NONE\"></Text></Composite>";
File xwtTemp = File.createTempFile("Test", ".xwt");
xwtTemp.deleteOnExit();
BufferedWriter out = new BufferedWriter(new FileWriter(xwtTemp));
out.write(xwtstr);
out.close();
@SuppressWarnings("deprecation")
URL url = xwtTemp.toURL();
try {
XWT.open(url);
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03794 seconds