<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Developer Papercuts &#187; SWT</title>
	<atom:link href="http://www.vogella.de/blog/tag/swt/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vogella.de/blog</link>
	<description>Tips around Eclipse and Android programming</description>
	<lastBuildDate>Wed, 08 Feb 2012 17:31:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WindowBuilder with Eclipse 4.2 / 3.8 (Linux)</title>
		<link>http://www.vogella.de/blog/2012/01/14/windowbuilder-with-eclipse-4-2-3-8-linux/</link>
		<comments>http://www.vogella.de/blog/2012/01/14/windowbuilder-with-eclipse-4-2-3-8-linux/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 20:18:04 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Eclipse 4.2]]></category>
		<category><![CDATA[Eclipse e4]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=4785</guid>
		<description><![CDATA[Currently, if you trying to use WindowBuilder under Linux with Eclipse 3.8 / Eclipse 4.2, it renders incorrectly.

Add the following line to the end of your eclipse.ini file to fix this:

-Dorg.eclipse.swt.internal.gtk.useCairo=false

This is a small bug in SWT and properly will be fixed soon. See Bug Report for details.]]></description>
			<content:encoded><![CDATA[<p>Currently, if you trying to use WindowBuilder under Linux with Eclipse 3.8 / <a href="http://www.vogella.de/articles/EclipseE4/article.html">Eclipse 4.2</a>, it renders incorrectly.</p>
<p>Add the following line to the end of your eclipse.ini file to fix this:</p>
<p>-Dorg.eclipse.swt.internal.gtk.useCairo=false</p>
<p>This is a small bug in SWT and properly will be fixed soon. See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=368543">Bug Report</a> for details.</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.vogella.de/blog/?flattrss_redirect&amp;id=4785&amp;md5=c4bd40c94a71cd019f00665e1cf4ab60" title="Flattr" target="_blank"><img src="http://www.vogella.de/blog/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2012/01/14/windowbuilder-with-eclipse-4-2-3-8-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse SWT &#8211; Creating an email in the default email client</title>
		<link>http://www.vogella.de/blog/2011/08/30/eclipse-swt-creating-an-email-in-the-default-email-client/</link>
		<comments>http://www.vogella.de/blog/2011/08/30/eclipse-swt-creating-an-email-in-the-default-email-client/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 21:13:15 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=4272</guid>
		<description><![CDATA[As many of you properly know SWT has the nice Program.launch() method which allows to start programs associated with an URI.

Example:



Unfortunately this does not seem to be working on Linux. So if you are working under Linux you have to  use the Java runtime directly. Unfortunately this requires you in my humble opinion ...]]></description>
			<content:encoded><![CDATA[<p>As many of you properly know SWT has the nice Program.launch() method which allows to start programs associated with an URI.</p>
<p>Example:</p>
<pre class="brush: plain; title: ; notranslate">
// This works for Windows
	public void openMailWindows(String to, String subject,String body, List&lt;File&gt; attachments) {
		String mailto = &quot;mailto:&quot; + enc(to) + &quot;?subject=&quot; + enc(subject) + &quot;&amp;body=&quot; + enc(body);
		for (File f : attachments) {
			mailto += &quot;&amp;attach=&quot; + f.getAbsolutePath();
		}
		Program.launch(mailto);
	}

	private String enc(String p) {
		if (p == null)
			p = &quot;&quot;;
		try {
			return URLEncoder.encode(p, &quot;UTF-8&quot;).replace(&quot;+&quot;, &quot;%20&quot;);
		} catch (UnsupportedEncodingException e) {
			throw new RuntimeException();
		}
	}
</pre>
<p>Unfortunately this does not seem to be working on Linux. So if you are working under Linux you have to  use the Java runtime directly. Unfortunately this requires you in my humble opinion to code against a a specific application.</p>
<pre class="brush: plain; title: ; notranslate">
// This works for Linux with Thunderbird
	public void openMailLinux(String to, String subject,String body, List&lt;File&gt; attachments) {
		String mailto = &quot;mailto:&quot; + enc(to) + &quot;?subject=&quot; + enc(subject) + &quot;&amp;body=&quot; + enc(body);
		for (File f : attachments) {
			mailto += &quot;&amp;attach=&quot; + f.getAbsolutePath();
		}
		Program.launch(mailto);
		try {
			// For using the parameters check the following description
			// http://kb.mozillazine.org/Command_line_arguments_%28Thunderbird%29
			Runtime.getRuntime().exec(&quot;thunderbird -compose&quot;);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
</pre>
<p>I hope this helps. </p>
<p>You find me also on <a href="http://www.twitter.com/vogella" title="Twitter">Twitter</a> and <a rel="me" href="https://profiles.google.com/104044918586174763681" title="Google+">Google+</a>.</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.vogella.de/blog/?flattrss_redirect&amp;id=4272&amp;md5=2587bbafe83bb3b1e6742037b880e47a" title="Flattr" target="_blank"><img src="http://www.vogella.de/blog/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2011/08/30/eclipse-swt-creating-an-email-in-the-default-email-client/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SWT Style Bits &#8211; Bitwise Or and Bitwise And</title>
		<link>http://www.vogella.de/blog/2011/01/25/swt-style-bits/</link>
		<comments>http://www.vogella.de/blog/2011/01/25/swt-style-bits/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 21:58:30 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=3514</guid>
		<description><![CDATA[Ever wondered how SWT Style bits work? It is actually very simple. The style bits are a multitud of 2

SWT.NONE = 0,              // 00000000 binary
SWT.MULTI = 2,             // 00000010 ...]]></description>
			<content:encoded><![CDATA[<p>Ever wondered how SWT Style bits work? It is actually very simple. The style bits are a multitud of 2</p>
<p>SWT.NONE = 0,              // 00000000 binary<br />
SWT.MULTI = 2,             // 00000010 binary<br />
SWT.SINGLE = 4;           // 00000100 binary<br />
SWT.READ_ONLY = 8;    // 00001000 binary<br />
&#8230;</p>
<p>Via the bitwise OR operator | you combine the bits</p>
<p>SWT.NONE  | SWT.MULTI | SWT.READ_ONLY results in 00001010</p>
<p>To get later the information if a bit was set use the bitwise AND operation &amp;.</p>
<p>if (SWT.WRAP==(result &amp; SWT.WRAP)){<br />
      System.out.println(&#8220;SWT.WRAP available&#8221;);<br />
}</p>
<p>Here is a small code snippets to run a little test. </p>
<pre class="brush: plain; title: ; notranslate">

package de.vogella.swt.widgets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class SWTbitwiseOr {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		new Text(shell, SWT.NONE);
		System.out.println(SWT.NONE);
		System.out.println(SWT.MULTI);
		System.out.println(SWT.SINGLE);
		System.out.println(SWT.READ_ONLY);
		System.out.println(SWT.WRAP);
		System.out.println(SWT.SEARCH);
		System.out.println(SWT.ICON_CANCEL);
		System.out.println(SWT.ICON_SEARCH);
		System.out.println(SWT.LEFT);
		System.out.println(SWT.RIGHT);
		System.out.println(SWT.PASSWORD);
		System.out.println(SWT.CENTER);

		// Lets see what we have 

		int result = SWT.MULTI | SWT.WRAP;
		System.out.println(result);
		if (SWT.MULTI==(result &amp; SWT.MULTI)){
			System.out.println(&quot;SWT.MULI available&quot;);
		}
		if (SWT.WRAP==(result &amp; SWT.WRAP)){
			System.out.println(&quot;SWT.WRAP available&quot;);
		}
		if (SWT.SINGLE==(result &amp; SWT.SINGLE)){
			System.out.println(&quot;SWT.SINGLE available&quot;);
		} else {
			System.out.println(&quot;SWT.SINGLE available&quot;);
		}

	}
}
</pre>
<p>For more information please see <a href="http://leepoint.net/notes-java/data/expressions/bitops.html">Bitwise Operators</a>.</p>
<p>If you are located in Germany you may be interested in my <a href="http://www.vogella.de/training/eclipsercp.html">Eclipse RCP training</a> which I deliver together with <a href="http://www.ralfebert.de/">Ralf Ebert</a>. </p>
<p class="wp-flattr-button"></p> <p><a href="http://www.vogella.de/blog/?flattrss_redirect&amp;id=3514&amp;md5=5daa862fc8fc200d661f5f6e92214415" title="Flattr" target="_blank"><img src="http://www.vogella.de/blog/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2011/01/25/swt-style-bits/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Browser Tales &#8211; Java to JavaScript and vice versa with the SWT Browser Widget</title>
		<link>http://www.vogella.de/blog/2009/12/21/javascript-swt/</link>
		<comments>http://www.vogella.de/blog/2009/12/21/javascript-swt/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 16:54:21 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OpenSocial]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1675</guid>
		<description><![CDATA[The SWT Browser widget makes it very easy to run HTML and JavaScript within Eclipse. This widget encapsulates a browser (system dependent) into a SWT widget. 

The following screenshot is from the second example below. This example is based on a blog entry from Ian Bull and SWT Snippet 307.



The following coding will be ...]]></description>
			<content:encoded><![CDATA[<p>The SWT Browser widget makes it very easy to run HTML and JavaScript within Eclipse. This widget encapsulates a browser (system dependent) into a SWT widget. </p>
<p>The following screenshot is from the second example below. This example is based on a <a href="http://eclipsesource.com/blogs/2009/06/16/eclipse-galileo-feature-top-10-list-number-9/">blog entry from Ian Bull</a> and <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet307.java?view=co">SWT Snippet 307</a>.</p>
<p><a href="http://www.vogella.de/blog/wp-content/uploads/2009/12/swtexample.gif"><img src="http://www.vogella.de/blog/wp-content/uploads/2009/12/swtexample.gif" alt="swtexample" width="661" height="608" class="aligncenter size-full wp-image-1688" /></a></p>
<p>The following coding will be defining views for <a href="http://www.vogella.de/articles/RichClientPlatform/article.html">Eclipse RCP</a> or via <a href="http://www.vogella.de/articles/EclipsePlugIn/article.html">Eclipse plugins</a> so I assume you are familiar with these topics. </p>
<p>Lets start with a simple example. Via the following coding you can setup a View in your Eclipse RCP and inject some JavaScript from your Java Code.</p>
<pre class="brush: java; title: ; notranslate">
package de.vogella.javascript.simple;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

public class View extends ViewPart {
	public static final String ID = &quot;de.vogella.javascript.simple.view&quot;;

	public void createPartControl(Composite parent) {
		// You need XULRunner installed to use this line
//		final Browser b = new Browser(parent, SWT.MOZILLA);
		final Browser b = new Browser(parent, SWT.NONE); // Uses IE on MS Windows
		b.setUrl(&quot;http://www.vogella.de&quot;);
		b.addProgressListener(new ProgressListener() {
			@Override
			public void completed(ProgressEvent event) {
				System.out.println(&quot;Page loaded&quot;);
				try {
					Thread.sleep(2000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				// Execute JavaScript in the browser
				b.execute(&quot;alert(\&quot;JavaScript, called from Java\&quot;);&quot;);
			}
			@Override
			public void changed(ProgressEvent event) {
			}
		});
	}

	/**
	 * Passing the focus request to the viewer's control.
	 */
	public void setFocus() {
	}
}
</pre>
<p>The next example is a bit more complex (it is the example from the screenshot).  This demonstarte how JavaScript can also call back to your Java Code. </p>
<pre class="brush: java; title: ; notranslate">

package de.vogella.javascript.maps;

import java.io.File;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.BrowserFunction;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.List;
import org.eclipse.ui.part.ViewPart;

public class View extends ViewPart {

	public static final String ID = &quot;de.vogella.javascript.maps.view&quot;;
	private static List list;

	public void createPartControl(Composite parent) {
		SashForm sash = new SashForm(parent, SWT.HORIZONTAL);

		File f = new File(&quot;C:/temp/demofile/map.html&quot;);
		final Browser browser = new Browser(parent, SWT.NONE); // Uses IE on MS

		browser.addControlListener(new ControlListener() {
			public void controlResized(ControlEvent e) {
				// Use Javascript to set the browser width and height
				browser
						.execute(&quot;document.getElementById('map_canvas').style.width= &quot;
								+ (browser.getSize().x - 20) + &quot;;&quot;);
				browser
						.execute(&quot;document.getElementById('map_canvas').style.height= &quot;
								+ (browser.getSize().y - 20) + &quot;;&quot;);
			}

			public void controlMoved(ControlEvent e) {
			}
		});

		 new CustomFunction (browser, &quot;theJavaFunction&quot;);

		    Composite c = new Composite(sash, SWT.BORDER);
		    c.setLayout(new GridLayout(2, true));
		    Button b = new Button(c, SWT.PUSH);
		    b.setText(&quot;Where Am I ?&quot;);
		    b.addSelectionListener(new SelectionAdapter() {
		        public void widgetSelected(SelectionEvent e) {
		            double lat = ((Double) browser.evaluate(&quot;return map.getCenter().lat();&quot;)).doubleValue();
		            double lng = ((Double) browser.evaluate(&quot;return map.getCenter().lng();&quot;)).doubleValue();
		            list.add(lat + &quot; : &quot; + lng);
		        }
		    });

		    Button addMarker = new Button(c, SWT.PUSH);
		    addMarker.setText(&quot;Add Marker&quot;);
		    addMarker.addSelectionListener(new SelectionAdapter() {
		        public void widgetSelected(SelectionEvent e) {
		            browser.evaluate(&quot;createMarker();&quot;);

		        }
		    });
		    list = new List(c, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
		    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
		    gridData.horizontalSpan=2;
		    list.setLayoutData(gridData);

		    browser.setUrl(f.toURI().toString());
//		    sash.setWeights(new int[] {4,1});
	}

	/**
	 * Passing the focus request to the viewer's control.
	 */
	public void setFocus() {

	}

	 // Called by JavaScript
	 class CustomFunction extends BrowserFunction {
	    CustomFunctionData data = new CustomFunctionData(null);

		CustomFunction (Browser browser, String name) {
	        super (browser, name);
	        this.data.browser = browser;
	    }
	    public Object function (Object[] arguments) {
	        double lat = ((Double) arguments[0]).doubleValue();
	        double lng = ((Double) arguments[1]).doubleValue();
	        list.add(lat + &quot; : &quot; + lng);
	        data.browser.execute(&quot;document.getElementById('map_canvas').style.width= &quot;+ (data.browser.getSize().x - 20) + &quot;;&quot;);
	        data.browser.execute(&quot;document.getElementById('map_canvas').style.height= &quot;+ (data.browser.getSize().y - 20) + &quot;;&quot;);
	        return null;
	    }
	 }
}
</pre>
<p>The coding above reads a HTML (with some JavaScript code) file &#8220;C:/temp/demofile/map.html&#8221;. If you save it somewhere else you need to adjust line 28 in the coding above. </p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; 

 &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;

  &lt;head&gt;

    &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;/&gt;

    &lt;title&gt;Google Maps JavaScript API Example&lt;/title&gt;

    &lt;script src=&quot;http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=abcdefg&amp;sensor=false&quot;
            type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;

	var map;

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById(&quot;map_canvas&quot;));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.setUIToDefault();

		// Callback to Java from JavaScript
	    theJavaFunction(map.getCenter().lat(), map.getCenter().lng());

      }

    }

    function createMarker(){
		var lat = map.getCenter().lat();
		var lng = map.getCenter().lng();
        var point = new GLatLng(lat,lng);
		var d=new Date();

		var marker = new GMarker(point, {draggable: true});

		GEvent.addListener(marker, &quot;dragstart&quot;, function() {
			map.closeInfoWindow();
		});

		GEvent.addListener(marker, &quot;dragend&quot;, function() {
		});

		map.addOverlay(marker);
		addMassiveData();

    }

	function addMassiveData(){
	// Add 10 markers to the map at random locations
		var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() - southWest.lng();
        var latSpan = northEast.lat() - southWest.lat();
        for (var i = 0; i &lt; 100; i++) {
         var point = new GLatLng(southWest.lat() + latSpan * Math.random(),
               southWest.lng() + lngSpan * Math.random());
        map.addOverlay(new GMarker(point));
		}
	}

    &lt;/script&gt;

  &lt;/head&gt;

  &lt;body onload=&quot;initialize()&quot; &gt;

    &lt;div id=&quot;map_canvas&quot; style=&quot;width: 600px; height: 400px&quot;&gt;&lt;/div&gt;

  &lt;/body&gt;

&lt;/html&gt;
</pre>
<p>This should demonstrate how easy you can integrate HTML and JavaScript into Eclipse. This is something the <a href="http://wiki.eclipse.org/E4/OpenSocialGadgets">Eclipse E4 OpenSocial Gadget</a> project also targets. </p>
<p>Check it out! The <a href="http://www.vogella.de/articles/OpenSocialGadgets/article.html">Open Social Gadgets with Eclipse E4 &#8211; Tutorial</a> tries to give a little introduction. </p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/12/21/javascript-swt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaScript in the SWT Browser widget</title>
		<link>http://www.vogella.de/blog/2009/10/29/javascript-swt-browser-widget/</link>
		<comments>http://www.vogella.de/blog/2009/10/29/javascript-swt-browser-widget/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 13:14:49 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1252</guid>
		<description><![CDATA[At the Eclipse Summit Europe I listened to a talk of Boris Bokowski  about Eclipse and the Web.

Among other things I learned that you can execute JavaScript directly on the SWT Browser Widget and I wanted to give a tiny example for this.

This Eclipse view will for example load my webpage and then ...]]></description>
			<content:encoded><![CDATA[<p>At the Eclipse Summit Europe I listened to a <a href="http://www.eclipsecon.org/summiteurope2009/sessions?id=1035">talk of Boris Bokowski </a> about Eclipse and the Web.</p>
<p>Among other things I learned that you can execute JavaScript directly on the SWT Browser Widget and I wanted to give a tiny example for this.</p>
<p>This Eclipse view will for example load my webpage and then execute a tiny JavaScript (alert(&#8220;1&#8243;);) in the browser.</p>
<pre class="brush: java; title: ; notranslate">

package de.vogella.swtbrowser;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

public class View extends ViewPart {

	public static final String ID = &quot;de.vogella.swtbrowser.view&quot;;

	public void createPartControl(Composite parent) {
		final Browser b = new Browser(parent, SWT.NONE);
		b.setUrl(&quot;www.vogella.de&quot;);
		b.addProgressListener(new ProgressListener() {
			@Override
			public void completed(ProgressEvent event) {
				System.out.println(&quot;Page loaded&quot;);
				System.out.println(b.execute(&quot;alert(\&quot;1\&quot;);&quot;));
			}
			@Override
			public void changed(ProgressEvent event) {
			}
		});
	}

	/**
	 * Passing the focus request to the viewer's control.
	 */
	public void setFocus() {
	}
}
</pre>
<p>Thanks to Boris for the great talk. </p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/10/29/javascript-swt-browser-widget/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SWT &#8211; Putting a file into the clipboard</title>
		<link>http://www.vogella.de/blog/2009/09/04/swt-clipboard/</link>
		<comments>http://www.vogella.de/blog/2009/09/04/swt-clipboard/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 23:50:58 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1081</guid>
		<description><![CDATA[I recently got the question how you can put a file into the system clipboard.

SWT makes this trivial:



Afer calling the method with a correct filename you should be able to paste the file, e.g. Strg+V into your system file browser. ]]></description>
			<content:encoded><![CDATA[<p>I recently got the question how you can put a file into the system clipboard.</p>
<p>SWT makes this trivial:</p>
<pre class="brush: java; title: ; notranslate">

package de.vogella.desktop.clipboard;

import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Display;

/**
 * Utility class for putting files into the system clipboard
 *
 * @author Lars Vogel
 */

public final class CopyFileToClipboard {

	private CopyFileToClipboard() {
		// Utility class, prevent instantiation
	}

	/**
	 * Copy a file into the clipboard
	 * Assumes the file exists -&gt; no additional check
	 * @param fileName - includes the path
	 */

	public static void copytoClipboard(String fileName) {
		Display display = Display.getCurrent();
		Clipboard clipboard = new Clipboard(display);
		String[] data = { fileName };
		clipboard.setContents(new Object[] { data },
				new Transfer[] { FileTransfer.getInstance() });
		clipboard.dispose();
	}
}
</pre>
<p>Afer calling the method with a correct filename you should be able to paste the file, e.g. Strg+V into your system file browser. </p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/09/04/swt-clipboard/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

