<?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>Radek's Tech Blog &#187; jobs api</title>
	<atom:link href="http://urbas.tk/index.php/tag/jobs-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://urbas.tk</link>
	<description>Radoslaw H. Urbas homepage / blog</description>
	<lastBuildDate>Tue, 01 Jun 2010 20:31:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Eclipse Jobs API &#8211; Errata</title>
		<link>http://urbas.tk/index.php/2009/02/04/eclipse-jobs-api-errata/</link>
		<comments>http://urbas.tk/index.php/2009/02/04/eclipse-jobs-api-errata/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:19:54 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[jobs api]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=48</guid>
		<description><![CDATA[My colleague Lukasz Milewski has just spotted a missing piece in a code sample for creating icons presented in previous post. In the screenshot you can see nice icons for currently running Jobs as well as for scheduled Jobs. You need to set two properties in your Job implementation to associate an icon with it. [...]]]></description>
			<content:encoded><![CDATA[<p>My colleague <a href="http://milewski.ws/" target="_blank">Lukasz Milewski</a> has just spotted a missing piece in a code sample for creating icons presented in previous post. In the screenshot you can see nice icons for currently running Jobs as well as for scheduled Jobs. You need to set two properties in your Job implementation to associate an icon with it.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">	setProperty<span style="color: #009900;">&#40;</span>IProgressConstants.<span style="color: #006633;">KEEP_PROPERTY</span>, <span style="color: #003399;">Boolean</span>.<span style="color: #000066; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	setProperty<span style="color: #009900;">&#40;</span>IProgressConstants.<span style="color: #006633;">ICON_PROPERTY</span>, ImageDescriptorFactory
		.<span style="color: #006633;">createImageDescriptor</span><span style="color: #009900;">&#40;</span>ICON_NAME<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/02/04/eclipse-jobs-api-errata/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Eclipse Jobs API</title>
		<link>http://urbas.tk/index.php/2009/01/14/using-eclipse-jobs-api/</link>
		<comments>http://urbas.tk/index.php/2009/01/14/using-eclipse-jobs-api/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 02:30:50 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[jobs api]]></category>
		<category><![CDATA[progress bar]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=41</guid>
		<description><![CDATA[Eclipse platform offers great API for managing long running operations in the background. Besides the API for starting, stopping and monitoring progress of the Job &#8211; there is also standard UI for managing all those operations. I&#8217;m going to present sample usage of Jobs API in you own plug-in/application. Creating and scheduling Job may look [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse platform offers great API for managing long running operations in the background. Besides the API for starting, stopping and monitoring progress of the Job &#8211; there is also standard UI for managing all those operations. I&#8217;m going to present sample usage of Jobs API in you own plug-in/application.</p>
<p>Creating and scheduling Job may look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"> TrainJob job <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TrainJob<span style="color: #009900;">&#40;</span>TRAIN_JOB_NAME <span style="color: #339933;">+</span> file.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, classifier<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">setRule</span><span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">setUser</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">setPriority</span><span style="color: #009900;">&#40;</span>Job.<span style="color: #006633;">SHORT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">schedule</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// start as soon as possible</span></pre></div></div>

<p>Sample of custom Job:</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;">pl.edu.agh.caracal.classifier.popup.jobs</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> org.<span style="color: #006633;">eclipse</span>.<span style="color: #006633;">core</span>.<span style="color: #006633;">runtime</span>.<span style="color: #006633;">Status</span>.<span style="color: #006633;">OK_STATUS</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.IStatus</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.jobs.Job</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">pl.edu.agh.caracal.classifier.ext.classifiers.AbstractClassifier</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Class for execution of training of a classifier
 *
 * @since 1.0
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TrainJob <span style="color: #000000; font-weight: bold;">extends</span> Job <span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">private</span> AbstractClassifier classifier<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
  * Public constructor TrainJob
  *
  * @param name Train job name
  * @param classifier Classifier to be trained
  */</span>
 <span style="color: #000000; font-weight: bold;">public</span> TrainJob<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name, AbstractClassifier classifier<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 	<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 	<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">classifier</span> <span style="color: #339933;">=</span> classifier<span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
 @Override
 <span style="color: #000000; font-weight: bold;">protected</span> IStatus run<span style="color: #009900;">&#40;</span>IProgressMonitor monitor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 	<span style="color: #666666; font-style: italic;">// Long running operation - in this case classifier training</span>
       <span style="color: #666666; font-style: italic;">// ...</span>
       <span style="color: #000000; font-weight: bold;">return</span> OK_STATUS<span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Standard GUI for presenting Job progress:</p>
<p><img src="http://urbas.tk/wp-content/jobsapi_view.PNG" alt="Jobs API View" /></p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/01/14/using-eclipse-jobs-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
