<?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; progress bar</title>
	<atom:link href="http://urbas.tk/index.php/tag/progress-bar/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.3.1</generator>
		<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>3</slash:comments>
		</item>
	</channel>
</rss>

