Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT.open string
XWT.open string [message #581166] Mon, 23 August 2010 19:41
FD  is currently offline FD Friend
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();
}
}
}
Previous Topic:data binding
Next Topic:Can't make Eclipse e4 product (Standalong application))
Goto Forum:
  


Current Time: Sun Nov 23 02:34:59 GMT 2014

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

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