<?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; bundle</title>
	<atom:link href="http://www.vogella.de/blog/tag/bundle/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>Re-using the Eclipse proxy preference settings in your Eclipse RCP application</title>
		<link>http://www.vogella.de/blog/2009/12/08/eclipse-rcp-proxy-preference/</link>
		<comments>http://www.vogella.de/blog/2009/12/08/eclipse-rcp-proxy-preference/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 01:30:22 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[How-to]]></category>
		<category><![CDATA[Planet]]></category>
		<category><![CDATA[RCP]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1442</guid>
		<description><![CDATA[The following demonstrates how to re-use the Eclipse proxy preferences in an Eclipse RCP application.

Create a project "de.vogella.rcp.net.proxy" and select the "RCP application with a view" as template. 

Add the preferences command to your application. See Eclipse Preferences Tutorial for details.

Add the plugin "org.eclipse.ui.net" and "org.eclipse.core.net" as dependency to your plugin. 

Run your plugin ...]]></description>
			<content:encoded><![CDATA[<p>The following demonstrates how to re-use the Eclipse proxy preferences in an <a href="http://www.vogella.de/articles/RichClientPlatform/article.html">Eclipse RCP</a> application.</p>
<p>Create a project &#8220;de.vogella.rcp.net.proxy&#8221; and select the &#8220;RCP application with a view&#8221; as template. </p>
<p>Add the preferences command to your application. See <a href="http://www.vogella.de/articles/EclipsePreferences/article.html">Eclipse Preferences Tutorial</a> for details.</p>
<p>Add the plugin &#8220;org.eclipse.ui.net&#8221; and &#8220;org.eclipse.core.net&#8221; as dependency to your plugin. </p>
<p>Run your plugin and open preferences. </p>
<p><a href="http://www.vogella.de/blog/wp-content/uploads/2009/11/proxy_settings.gif"><img src="http://www.vogella.de/blog/wp-content/uploads/2009/11/proxy_settings.gif" alt="proxy_settings" width="624" height="541" class="aligncenter size-full wp-image-1446" /></a></p>
<p>Fantastic! You already have the preference dialog. </p>
<p>Now change your view to the following. </p>
<pre class="brush: java; title: ; notranslate">

package de.vogella.rcp.net.proxy;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
import org.osgi.framework.FrameworkUtil;
import org.osgi.util.tracker.ServiceTracker;

public class View extends ViewPart {
	public static final String ID = &quot;de.vogella.rcp.net.proxy.view&quot;;
	private final ServiceTracker proxyTracker;

	public View() {
		proxyTracker = new ServiceTracker(FrameworkUtil.getBundle(
				this.getClass()).getBundleContext(), IProxyService.class
				.getName(), null);
		proxyTracker.open();
	}

	/**
	 * This is a callback that will allow us to create the viewer and initialize
	 * it.
	 */
	public void createPartControl(Composite parent) {
		StyledText text = new StyledText(parent, SWT.NONE);
		text.setText(readWebpage());
	}

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

	private String readWebpage() {
		BufferedReader in = null;
		StringBuffer sb = new StringBuffer();

		try {
			URI uri = new URI(&quot;http://www.vogella.de&quot;);
			IProxyService proxyService = getProxyService();
			IProxyData[] proxyDataForHost = proxyService.select(uri);

			for (IProxyData data : proxyDataForHost) {
				if (data.getHost() != null) {
					System.setProperty(&quot;http.proxySet&quot;, &quot;true&quot;);
					System.setProperty(&quot;http.proxyHost&quot;, data.getHost());
				}
				if (data.getHost() != null) {
					System.setProperty(&quot;http.proxyPort&quot;, String.valueOf(data
							.getPort()));
				}
			}
			// Close the service and close the service tracker
			proxyService = null;

			URL url;

			url = uri.toURL();

			in = new BufferedReader(new InputStreamReader(url.openStream()));
			String inputLine;

			while ((inputLine = in.readLine()) != null) {
				// Process each line.
				sb.append(inputLine + &quot;\n&quot;);
			}

		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (URISyntaxException e) {
			e.printStackTrace();
		} finally {
			if (in != null) {
				try {
					in.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}

		}
		return sb.toString();

	}

	public IProxyService getProxyService() {
		return (IProxyService) proxyTracker.getService();
	}

	@Override
	public void dispose() {
		proxyTracker.close();
		super.dispose();
	}

}
</pre>
<p>If you run your application behind a firewall and if you have maintained the proxy correctly then the View should display the HTML code. </p>
<p>Hope this helps!</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/12/08/eclipse-rcp-proxy-preference/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>API for reading Eclipse plugin dependencies</title>
		<link>http://www.vogella.de/blog/2009/10/19/eclipse-plugin-dependencies/</link>
		<comments>http://www.vogella.de/blog/2009/10/19/eclipse-plugin-dependencies/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 05:04:02 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[Commands]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1241</guid>
		<description><![CDATA[The Eclipse platform provides an API to allows that you can access in information of the MANIFEST.MF. For example you could read the dependencies of your plugin. 

For this example create a plugin "de.vogella.pde.dependencies". See Eclipse Plugin development for examples on how to develop plugins. Use the "Hello, World Command" template.

Define dependendies to the ...]]></description>
			<content:encoded><![CDATA[<p>The Eclipse platform provides an API to allows that you can access in information of the MANIFEST.MF. For example you could read the dependencies of your plugin. </p>
<p>For this example create a plugin &#8220;de.vogella.pde.dependencies&#8221;. See <a href="http://www.vogella.de/articles/EclipsePlugIn/article.html">Eclipse Plugin development</a> for examples on how to develop plugins. Use the &#8220;Hello, World Command&#8221; template.</p>
<p>Define dependendies to the following plugins:<br />
 &#8211; org.eclipse.ui<br />
 &#8211;  org.eclipse.core.runtime</p>
<p>Change the command to the following. </p>
<pre class="brush: java; title: ; notranslate">

package de.vogella.pde.dependencies.handlers;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;

public class PrintDependencies extends AbstractHandler {
	public Object execute(ExecutionEvent event) throws ExecutionException {
		String requireBundle = (String)Platform.getBundle(&quot;de.vogella.pde.dependencies&quot;).getHeaders().get(
				Constants.REQUIRE_BUNDLE);
				try {
					ManifestElement[] elements = ManifestElement.parseHeader(
					Constants.BUNDLE_CLASSPATH, requireBundle);
					for (ManifestElement manifestElement : elements) {
						System.out.println( manifestElement.getValue());
					}
				} catch (BundleException e) {
					e.printStackTrace();
				}
		return null;
	}
}
</pre>
<p>If you now run your new plugin it and select your command it will print out the dependencies of your plugin. </p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/10/19/eclipse-plugin-dependencies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse Papercut #5 &#8211; Getting external libraries as bundles</title>
		<link>http://www.vogella.de/blog/2009/09/21/eclipse-plugin-libraries/</link>
		<comments>http://www.vogella.de/blog/2009/09/21/eclipse-plugin-libraries/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 05:45:11 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Papercut]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=548</guid>
		<description><![CDATA[Explains why Eclipse Plugins are improving the definition of the external API and how to get prepared Eclipse plugins via the Springsource bundle repository. ]]></description>
			<content:encoded><![CDATA[<p>In this episode of <a href="http://www.vogella.de/blog/?p=385">Eclipse Papercuts</a> I explain how you get bundles for popolar Java libraries for your  <a href="http://www.vogella.de/articles/EclipsePlugIn/article.html">Eclipse plugin</a> development. </p>
<p>I believe it has advantages to work with plugin projects instead of pure Java projects even if the plan is not to create <a href="http://www.vogella.de/articles/EclipsePlugIn/article.html">Eclipse plugins</a> / <a href="http://www.vogella.de/articles/RichClientPlatform/article.html">RCP applications</a>.  </p>
<p>The core strength of OSGi for this scenario is in my opinion the encapsalation and protection of your inner classes. With <a href="http://www.vogella.de/articles/OSGi/article.html">OSGi bundles </a>  you decide which packages of your project are exported and therefore visible to other projects (via the tab Runtime in the editor for the file plugin.xml).</p>
<p>This leaves only one problem: If you are using externally libraries you <a href="http://www.vogella.de/articles/EclipseJarToPlugin/article.html">have to convert them into bundles / plugins</a>.</p>
<p>I would be nicer to consume pre-packages bundles. As I created a bug <a href="http://sourceforge.net/tracker/?func=detail&amp;aid=2860779&amp;group_id=15255&amp;atid=365255">iText should be OSGi</a> and <a href="http://twitter.com/vogella">tweeted </a>about it <a href="http://aniszczyk.org/">Chris Aniszczyk</a> pointed me to <a href="http://www.eclipse.org/orbit/">Eclipse Orbit</a>.</p>
<p>Eclipse Orbit provides lots of standard libraries already pre-packaged as bundles / plugins. </p>
<p>Lets see how you could get the iText version from Orbit. Check the <a href="http://wiki.eclipse.org/index.php/Orbit_Faq">Orbit FAQ </a>to find out more.</p>
<p>You need to <a href="http://www.vogella.de/articles/EclipseCodeAccess/article.html#versioncontrol_cvs">connect via cvs </a> to the Eclipse cvs repository. CVS URL is :pserver:anonymous@dev.eclipse.org/cvsroot/tools</p>
<p>Navigate to &#8220;org.eclipse.orbit&#8221;. Select &#8220;com.lowagie.text&#8221; and check it out.</p>
<p><a href="http://www.vogella.de/blog/wp-content/uploads/2009/09/orbit10.gif"><img src="http://www.vogella.de/blog/wp-content/uploads/2009/09/orbit10.gif" alt="orbit10" width="388" height="138" class="aligncenter size-full wp-image-1125" /></a></p>
<p>Orbit keeps the different version of the library as cvs branches. Select your project and select Replace With -&gt; Another Branch or Version&#8230;<br />
<a href="http://www.vogella.de/blog/wp-content/uploads/2009/09/orbit20.gif"><img src="http://www.vogella.de/blog/wp-content/uploads/2009/09/orbit20.gif" alt="orbit20" width="586" height="560" class="aligncenter size-full wp-image-1126" /></a></p>
<p><a href="http://www.vogella.de/blog/wp-content/uploads/2009/09/orbit30.gif"><img src="http://www.vogella.de/blog/wp-content/uploads/2009/09/orbit30.gif" alt="orbit30" width="447" height="321" class="aligncenter size-full wp-image-1142" /></a></p>
<p>After selecting the branch and pressing ok the system will download the library and you can start using the library.</p>
<p>In addition to Orbit you can also use the <a href="http://www.springsource.com/repository/app/">Springsource bundle repository</a>. On this website you can search for bundles and download then directly. You can then import them as plugin projects into your workspace. </p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/09/21/eclipse-plugin-libraries/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

