<?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>treibsand.com &#187; RCP</title>
	<atom:link href="http://www.treibsand.com/tag/rcp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.treibsand.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Dec 2011 12:46:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Eclipse Anwendungen als Windows Service</title>
		<link>http://www.treibsand.com/2009/06/29/eclipse-anwendungen-als-windows-service/</link>
		<comments>http://www.treibsand.com/2009/06/29/eclipse-anwendungen-als-windows-service/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 10:43:09 +0000</pubDate>
		<dc:creator>Toast</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[RCP]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.treibsand.com/?p=349</guid>
		<description><![CDATA[RCP Anwendungen mit Eclipse bauen ist schön und gut. Manchmal braucht man aber wirklich einen Windows Service, da die Anwendung z.B. immer laufen muss und nur einen TrayIcon hat. Das ganze Unterfangen schien auf den ersten Blick gar nicht einfach. Zumal ich von Windows Interna, wie z.B. den Services keine Ahnung habe, da ich eigentlich [...]]]></description>
			<content:encoded><![CDATA[<p>RCP Anwendungen mit Eclipse bauen ist schön und gut. Manchmal braucht man aber wirklich einen Windows Service, da die Anwendung z.B. immer laufen muss und nur einen TrayIcon hat. Das ganze Unterfangen schien auf den ersten Blick gar nicht einfach. Zumal ich von Windows Interna, wie z.B. den Services keine Ahnung habe, da ich eigentlich aus der Unix Welt komme.<br />
<span id="more-349"></span><br />
Zum Glück habe ich ein Projekt, den <a href="http://wrapper.tanukisoftware.org/">Java Service Wrapper</a>, gefunden, mit welchem es trivial ist, eine vorhandene Java Anwendung als Service laufen zu lassen.</p>
<p>Die Konfiguration es relativ einfach, es muss nur eine Konfigurationsdatei angelegt werden und einige Bibliotheken bzw. Batch Dateien kopiert werden. Nach dem das ganze RCP Produkt exportiert wurde, müssen folgende Dateien aus der Wrapper Distribution kopiert werden.</p>
<p>* wrapper.dll und wrapper.jar, einfach in das Unterverzeichnis lib (muss neu angelegt werden) kopieren.</p>
<p>* wrapper.exe und die 2 Install- bzw. Uninstal Batch Skripte in den Hauptordner legen.</p>
<p>* wrapper.conf habe ich in den configuration Ordner gelegt.</p>
<p>Nachdem alle Dateien in dem entsprechendem Ort liegen, muss die Datei wrapper.conf angepasst werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">wrapper.java.command=java
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
&nbsp;
<span style="color: #666666; font-style: italic;"># Java Classpath (include wrapper.jar)  Add class path elements as</span>
<span style="color: #666666; font-style: italic;">#  needed starting from 1</span>
wrapper.java.classpath.1=lib<span style="color: #000000; font-weight: bold;">/</span>wrapper.jar
wrapper.java.classpath.2=plugins<span style="color: #000000; font-weight: bold;">/</span>org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar
<span style="color: #666666; font-style: italic;"># Java Library Path (location of Wrapper.DLL or libwrapper.so)</span>
wrapper.java.library.path.1=lib
&nbsp;
wrapper.java.additional.1=
wrapper.app.parameter.1=org.eclipse.equinox.launcher.Main
wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=wrapper.log
wrapper.logfile.format=LPTM
wrapper.logfile.loglevel=INFO
wrapper.logfile.maxsize=<span style="color: #000000;">0</span>
wrapper.logfile.maxfiles=<span style="color: #000000;">0</span>
wrapper.syslog.loglevel=NONE
&nbsp;
wrapper.console.title=Meine Eclipse Anwendungen
&nbsp;
wrapper.ntservice.name=EclipseAnwendung
wrapper.ntservice.displayname=EclipseAnwendung
wrapper.ntservice.description=Test Eclipse Anwendung
wrapper.ntservice.dependency.1=
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=<span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<p>In der Konfiguration wird angegeben, dass die DLL und JAR Dateien in dem Unterordner lib befinden. Da es sich hierbei im eine Eclipse Anwendung handelt muss im Classpath org.eclipse.equinox.launcher eingetragen sein. Der wrapper.app.parameter.1 muss für Eclipse 3.4 auf org.eclipse.equinox.launcher.Main gesetzt werden. Sobald die Anwendung auf den Desktop zugreifen muss, um z.B. Fenster darzustellen, muss die Option wrapper.ntservice.interactive auf true gesetzt werden.</p>
<p>Der Wrapper erwartet eigentlich, dass die Konfiguration an einem anderen Ort liegt, als im Ordner coniguration, aber warum sollte man dafür einen neuen Ordner anlegen? Damit da wieder alles passt, müssen noch kurz die 2 Batch Skripte angepasst werden. In beiden Dateien wird der Pfad zur wrapper.conf gesetzt, dies muss wie folgt abgeändert werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">_WRAPPER_CONF</span>=<span style="color: #ff0000;">&quot;%_REALPATH%/configuration/wrapper.conf&quot;</span></pre></div></div>

<p>Sobald das alles erlegt ist, reicht ein Doppelklick auf das Install Batch Skript, und der Service wird eingetragen <img src='http://www.treibsand.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.treibsand.com/2009/06/29/eclipse-anwendungen-als-windows-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RCP Anwendungen aktualisieren</title>
		<link>http://www.treibsand.com/2009/02/02/rcp-anwendungen-aktualisieren/</link>
		<comments>http://www.treibsand.com/2009/02/02/rcp-anwendungen-aktualisieren/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 10:50:57 +0000</pubDate>
		<dc:creator>Toast</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[RCP]]></category>

		<guid isPermaLink="false">http://www.treibsand.com/?p=243</guid>
		<description><![CDATA[Immer wieder ärger ich mich über Eclipse RCP, dass so wenig dokumentiert ist. Es ist wirklich schwer für dieses Thema vernünftige Dokumentationen zu bekommen. Auch die am Markt erhältlichen Bücher lassen zu Wünschen übrig. Ich hab vor kurzem sehr lange nach einer Dokumentation gesucht, um RCP Anwendungen über eine Update-Site zu aktualisieren. Vorab, das Buch [...]]]></description>
			<content:encoded><![CDATA[<p>Immer wieder ärger ich mich über Eclipse RCP, dass so wenig dokumentiert ist. Es ist<br />
wirklich schwer für dieses Thema vernünftige Dokumentationen zu bekommen. Auch die<br />
am Markt erhältlichen Bücher lassen zu Wünschen übrig. Ich hab vor kurzem sehr lange<br />
nach einer Dokumentation gesucht, um RCP Anwendungen über eine Update-Site<br />
zu aktualisieren. </p>
<p><span id="more-243"></span></p>
<p>Vorab, das Buch &#8220;Rich-Client Entwicklung mit Eclipse 3.3&#8243; von Berthold Daum ist riesiger<br />
Mist und keinen Cent Wert. Der dort beschrieben Weg, um Anwendungen zu aktualisieren<br />
funktioniert nicht und ist nur sehr oberflächlich beschrieben.</p>
<p>Nachdem ich gesehen habe, dass Eclipse 3.4 einen neuen Update Mechanismus verwendet, p2,<br />
dachte ich mir, dann bauen wir den gleich ein. Aber auch hier ist wieder kaum eine<br />
anständige Dokumentation zu finden. Ok, die Plug-Ins lassen sich ja problemlos einbinden,<br />
allerdings muss die Anwendung noch in einen p2-Anwendungen umgewandelt werden, was irgendwie<br />
nicht funktioniert hat und ich entnervt aufgegeben habe&#8230;ich hab ja auch nicht ewig Zeit<br />
forensisch herauszufinden wie etwas funktioniert. Wenn mir jemand evtl. einen Hinweis<br />
geben kann, wie dass alles stressfrei funktioniert bin ich dankbar <img src='http://www.treibsand.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Am Ende habe ich doch den &#8220;alten&#8221; Update-Manager verwendet. Herausgekommen ist folgende<br />
Klasse. Möge sie anderen genervten Entwicklern helfen&#8230;;-)</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">foo.bar</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.reflect.InvocationTargetException</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.MalformedURLException</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URL</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Iterator</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.CoreException</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.IProgressMonitor</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.NullProgressMonitor</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.action.IAction</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.viewers.ISelection</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.SWT</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.widgets.Display</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.widgets.Shell</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.ui.IWorkbenchWindow</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.ui.IWorkbenchWindowActionDelegate</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.configuration.IConfiguredSite</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.configuration.ILocalSite</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.core.IFeature</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.core.IFeatureReference</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.core.ISite</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.core.SiteManager</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.core.VersionedIdentifier</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.operations.IInstallFeatureOperation</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.operations.IUnconfigFeatureOperation</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.operations.IUninstallFeatureOperation</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.update.operations.OperationsManager</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UpdateAction <span style="color: #000000; font-weight: bold;">implements</span> IWorkbenchWindowActionDelegate <span style="color: #009900;">&#123;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> Shell shell<span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> Display display<span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> IWorkbenchWindow window<span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> restart<span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> dispose<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			shell.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			display.<span style="color: #006633;">dispose</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #009900;">&#125;</span> 
	<span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span>IWorkbenchWindow window<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">window</span> <span style="color: #339933;">=</span> window<span style="color: #339933;">;</span> 
		shell <span style="color: #339933;">=</span> window.<span style="color: #006633;">getShell</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		display <span style="color: #339933;">=</span> shell.<span style="color: #006633;">getDisplay</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span>IAction action<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>shell <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			display <span style="color: #339933;">=</span> Display.<span style="color: #006633;">getCurrent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			shell <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Shell<span style="color: #009900;">&#40;</span>display, SWT.<span style="color: #006633;">NONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #009900;">&#125;</span> 
&nbsp;
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span> 
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Update running...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			IProgressMonitor monitor <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NullProgressMonitor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
			ISite rs <span style="color: #339933;">=</span> SiteManager.<span style="color: #006633;">getSite</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span> 
				<span style="color: #0000ff;">&quot;http://localhost:8080/update&quot;</span><span style="color: #009900;">&#41;</span>, monitor<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			IFeatureReference<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> frs <span style="color: #339933;">=</span> rs.<span style="color: #006633;">getFeatureReferences</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			ILocalSite ls <span style="color: #339933;">=</span> SiteManager.<span style="color: #006633;">getLocalSite</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			IConfiguredSite ics <span style="color: #339933;">=</span> ls.<span style="color: #006633;">getCurrentConfiguration</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
				.<span style="color: #006633;">getConfiguredSites</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
			IFeatureReference<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> lfrs <span style="color: #339933;">=</span> ics.<span style="color: #006633;">getConfiguredFeatures</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			List<span style="color: #339933;">&lt;</span>IInstallFeatureOperation<span style="color: #339933;">&gt;</span> installOps <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>IInstallFeatureOperation<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Method initialized, ServerCount: &quot;</span> <span style="color: #339933;">+</span> frs.<span style="color: #006633;">length</span>
					<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; LocalCount: &quot;</span> <span style="color: #339933;">+</span> lfrs.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> frs.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
				<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Found Feature on Server: &quot;</span>
						<span style="color: #339933;">+</span> frs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getVersionedIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
				<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> j <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> lfrs.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
					VersionedIdentifier frsVi <span style="color: #339933;">=</span> frs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getVersionedIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
					VersionedIdentifier lfrsVi <span style="color: #339933;">=</span> lfrs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> .<span style="color: #006633;">getVersionedIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
					<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Local feature: &quot;</span> <span style="color: #339933;">+</span> lfrsVi.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>frsVi.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>lfrsVi.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
						<span style="color: #003399;">String</span> v <span style="color: #339933;">=</span> frsVi.<span style="color: #006633;">getVersion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
						<span style="color: #003399;">String</span> lv <span style="color: #339933;">=</span> lfrsVi.<span style="color: #006633;">getVersion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
						<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Checking feature: &quot;</span>
								<span style="color: #339933;">+</span> lfrsVi.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; Local: &quot;</span> <span style="color: #339933;">+</span> lv 
								<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; Server: &quot;</span> <span style="color: #339933;">+</span> v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
						<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>frsVi.<span style="color: #006633;">getVersion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isGreaterThan</span><span style="color: #009900;">&#40;</span>lfrsVi.<span style="color: #006633;">getVersion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
&nbsp;
							<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>lfrsVi.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
									<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; needs to be updated&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
							installOps.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>OperationsManager 
									.<span style="color: #006633;">getOperationFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
									.<span style="color: #006633;">createInstallOperation</span><span style="color: #009900;">&#40;</span>ics, 
											frs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getFeature</span><span style="color: #009900;">&#40;</span>monitor<span style="color: #009900;">&#41;</span>, <span style="color: #000066; font-weight: bold;">null</span>, 
											<span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
						<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span> 
							<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>lfrsVi.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
									<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; is up to date&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
						<span style="color: #009900;">&#125;</span> 
					<span style="color: #009900;">&#125;</span> 
				<span style="color: #009900;">&#125;</span> 
			<span style="color: #009900;">&#125;</span> 
&nbsp;
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Feature verification completed.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>installOps.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
				<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Iterator</span> iter <span style="color: #339933;">=</span> installOps.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> iter.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
					IInstallFeatureOperation op <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>IInstallFeatureOperation<span style="color: #009900;">&#41;</span> iter.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
					<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Updating: &quot;</span> <span style="color: #339933;">+</span> op.<span style="color: #006633;">getFeature</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getLabel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
						<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;, Size: &quot;</span> <span style="color: #339933;">+</span> op.<span style="color: #006633;">getFeature</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getDownloadSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
						<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;kb&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
					<span style="color: #000066; font-weight: bold;">boolean</span> succes <span style="color: #339933;">=</span> op.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span>monitor, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
					<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>succes<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
						restart<span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span> 
&nbsp;
						<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Update succesfull&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
						uninstallFeature<span style="color: #009900;">&#40;</span>ics,op.<span style="color: #006633;">getOldFeature</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,monitor<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
					<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span> 
						<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Update failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span> 
				<span style="color: #009900;">&#125;</span> 
				ls.<span style="color: #006633;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;There are no new updates.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InvocationTargetException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>CoreException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">MalformedURLException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 	
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> uninstallFeature<span style="color: #009900;">&#40;</span>IConfiguredSite ics, IFeature oldFeature, IProgressMonitor monitor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Uninstall Feature: &quot;</span> <span style="color: #339933;">+</span> oldFeature.<span style="color: #006633;">getLabel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span> 
			IUnconfigFeatureOperation uo <span style="color: #339933;">=</span> OperationsManager
				.<span style="color: #006633;">getOperationFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">createUnconfigOperation</span><span style="color: #009900;">&#40;</span>ics, oldFeature<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
			<span style="color: #000066; font-weight: bold;">boolean</span> isUnconfiged<span style="color: #339933;">=</span>uo.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span>monitor,<span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Unconfigured: &quot;</span> <span style="color: #339933;">+</span> isUnconfiged<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			IUninstallFeatureOperation uninsto<span style="color: #339933;">=</span>OperationsManager.<span style="color: #006633;">getOperationFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
				.<span style="color: #006633;">createUninstallOperation</span><span style="color: #009900;">&#40;</span>ics, oldFeature<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			<span style="color: #000066; font-weight: bold;">boolean</span> isUnstalled<span style="color: #339933;">=</span>uninsto.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span>monitor,<span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Uninstalled: &quot;</span> <span style="color: #339933;">+</span> isUnstalled<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #009900;">&#125;</span> 
	<span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> selectionChanged<span style="color: #009900;">&#40;</span>IAction action, ISelection selection<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isRestart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #000000; font-weight: bold;">return</span> restart<span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.treibsand.com/2009/02/02/rcp-anwendungen-aktualisieren/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RCP Anwendungen von CD starten</title>
		<link>http://www.treibsand.com/2008/06/06/rcp_readonly/</link>
		<comments>http://www.treibsand.com/2008/06/06/rcp_readonly/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 15:51:25 +0000</pubDate>
		<dc:creator>Toast</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[RCP]]></category>

		<guid isPermaLink="false">http://test.treibsand.com/?p=152</guid>
		<description><![CDATA[RCP Anwendungen müssen ja eigentlich auf einem Medium installiert werden, welches sich schreiben lässt. Da aber Eclipse Anwendungen immer ein Workspace Verzeichnis brauchen, wird es schwierig Anwendungen direkt von eine CD bzw. DVD zu starten. Warum sollte eine Anwendung immer installiert werden, wenn es sich z.B. nur um eine Marketing Anwendungen handelt? Die Lösung hierfuer [...]]]></description>
			<content:encoded><![CDATA[<p>RCP Anwendungen müssen ja eigentlich auf einem Medium installiert werden, welches sich schreiben lässt. Da aber Eclipse Anwendungen immer ein Workspace Verzeichnis brauchen, wird es schwierig Anwendungen direkt von eine CD bzw. DVD zu starten. </p>
<p><span id="more-152"></span><br />
Warum sollte eine Anwendung immer installiert werden, wenn es sich z.B. nur um eine Marketing Anwendungen handelt? Die Lösung hierfuer ist relativ trivial. Es müssen nur einige Parameter in der config.ini angepasst werden, so dass der Workspace z.B. in das Home Verzeichnis des Benutzers ausgelagert wird.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">osgi.<span style="color: #006633;">configuration</span>.<span style="color: #006633;">area</span><span style="color: #339933;">=</span>@user.<span style="color: #006633;">home</span><span style="color: #339933;">/</span>.<span style="color: #006633;">meinProduct</span>  
osgi.<span style="color: #006633;">instance</span>.<span style="color: #006633;">area</span>.<span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">=</span>@user.<span style="color: #006633;">home</span><span style="color: #339933;">/</span>.<span style="color: #006633;">meinProduct</span><span style="color: #339933;">/</span>workspace  
data<span style="color: #339933;">=</span>@user.<span style="color: #006633;">home</span><span style="color: #339933;">/</span>.<span style="color: #006633;">meinProduct</span><span style="color: #339933;">/</span>workspace</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.treibsand.com/2008/06/06/rcp_readonly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

