<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;C0YER3o7eCp7ImA9WxNUFU4.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241</id><updated>2009-11-06T23:41:46.400+05:30</updated><title>Eclipse Tips</title><subtitle type="html">Tips and Tricks for Eclipse Plug-in Development</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.eclipse-tips.com/" /><link rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>96</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><thespringbox:skin xmlns:thespringbox="http://www.thespringbox.com/dtds/thespringbox-1.0.dtd">http://feeds.feedburner.com/cypal?format=skin</thespringbox:skin><link rel="self" href="http://feeds.feedburner.com/cypal" type="application/atom+xml" /><feedburner:emailServiceId>cypal</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry gd:etag="W/&quot;C08FR3Y4eip7ImA9WxNUEkk.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-1723605305934596489</id><published>2009-11-03T15:20:00.000+05:30</published><updated>2009-11-03T15:20:16.832+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-03T15:20:16.832+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><title>Eclipse Tips on Twitter !</title><content type="html">Get (a different set of) Eclipse&amp;nbsp; Tips in twitter: &lt;a href="http://twitter.com/Eclipse_Tips"&gt;@Eclipse_Tips&lt;/a&gt;. If you are still in the RSS reader era, get the feed &lt;a href="http://twitter.com/statuses/user_timeline/85313393.rss"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-1723605305934596489?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/Vtv-UixxecY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/1723605305934596489/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=1723605305934596489&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/1723605305934596489?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/1723605305934596489?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/Vtv-UixxecY/eclipse-tips-on-twitter.html" title="Eclipse Tips on Twitter !" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/11/eclipse-tips-on-twitter.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkENQHY5fyp7ImA9WxNVFko.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-6315123858544739069</id><published>2009-10-28T00:29:00.001+05:30</published><updated>2009-10-28T00:41:31.827+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-28T00:41:31.827+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Progress" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="3.6" /><category scheme="http://www.blogger.com/atom/ns#" term="Commands" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Associating a Command with a Job</title><content type="html">Earlier we saw how to &lt;a href="http://blog.eclipse-tips.com/2008/08/adding-iaction-to-job.html"&gt;associate an Action with a Job&lt;/a&gt;. Now you can associate a Command. Its very similar - use the constant to set a property on the job:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;ICommandService service = (ICommandService) serviceLocator.getService(ICommandService.class);
Command command = service.getCommand(commandId);
ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, null);
job.setProperty(IProgressConstants.COMMAND_PROPERTY, parameterizedCommand);
&lt;/pre&gt;&lt;br /&gt;
You have to specify either the ACTION_PROPERTY or COMMAND_PROPERTY, but not both. If you specify both, neither of them will get executed.&lt;br /&gt;
&lt;br /&gt;
Note: You need a 3.6 M3 or a latest I-Build for this to work.&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-6315123858544739069?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/jCdM0AuIGdk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/6315123858544739069/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=6315123858544739069&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/6315123858544739069?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/6315123858544739069?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/jCdM0AuIGdk/associating-command-with-job.html" title="Associating a Command with a Job" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/10/associating-command-with-job.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UMQH4-fyp7ImA9WxNQFkU.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-4184994961603957565</id><published>2009-09-23T11:24:00.000+05:30</published><updated>2009-09-23T11:24:41.057+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-23T11:24:41.057+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><title>Eclipse Demo Camp, Bangalore</title><content type="html">Its back :-)&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_hsp14iFkRLs/SrkAJp9i2wI/AAAAAAAAERo/9b-r6XppV5g/s1600-h/Eclipse-camp.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/SrkAJp9i2wI/AAAAAAAAERo/9b-r6XppV5g/s320/Eclipse-camp.gif" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;We are planning to organize a Demo Camp sometime in November. Date, time and venue to be decided. Since IBM's Eclipse team has grown since last Demo Camp, this time, you get a very good opportunity to learn right from the source, on whats coming up. From &lt;a href="http://wiki.eclipse.org/Equinox/p2"&gt;p2&lt;/a&gt; to &lt;a href="http://wiki.eclipse.org/PDE/Incubator/b3/Proposal"&gt;b3&lt;/a&gt; and &lt;a href="http://wiki.eclipse.org/E4"&gt;e4&lt;/a&gt; (Am I the only one who thinks that things can be named better?) we can give a good number of demos/presentations. But we don't want to make it as the Big Blue show, so we need few contributions from the community as well. We are glad that &lt;a href="http://eclipse-info.blogspot.com/"&gt;Madhu&lt;/a&gt; and &lt;a href="http://anilgudise.blogspot.com/"&gt;Anil&lt;/a&gt; have already signed up with some topics. I would encourage you to add a demo on what you are working on. Even if not sign up as an attendee, its a nice chance to meet other Eclipse plug-in developers and see what they are building with Eclipse.&lt;br /&gt;
&lt;a href="http://draft.blogger.com/goog_1253637096834"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://wiki.eclipse.org/Eclipse_DemoCamps_November_2009/Bangalore"&gt;http://wiki.eclipse.org/Eclipse_DemoCamps_November_2009/Bangalore&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-4184994961603957565?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/c7ALNokQH_M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/4184994961603957565/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=4184994961603957565&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4184994961603957565?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4184994961603957565?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/c7ALNokQH_M/eclipse-demo-camp-bangalore.html" title="Eclipse Demo Camp, Bangalore" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_hsp14iFkRLs/SrkAJp9i2wI/AAAAAAAAERo/9b-r6XppV5g/s72-c/Eclipse-camp.gif" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><georss:point>12.971606 77.594376</georss:point><feedburner:origLink>http://blog.eclipse-tips.com/2009/09/eclipse-demo-camp-bangalore.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cDQHY7fSp7ImA9WxNQFkw.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-4932218668846285347</id><published>2009-09-22T12:51:00.007+05:30</published><updated>2009-09-22T14:47:51.805+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-22T14:47:51.805+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="plugins" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="Downloads" /><category scheme="http://www.blogger.com/atom/ns#" term="3.6" /><category scheme="http://www.blogger.com/atom/ns#" term="Update" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Catching up with Milestones and I-Builds</title><content type="html">Helios M2 is released. Now the biggest problem for the early adopters would be how to catch up with these milestones. Every time, you have to download the milestone build, and then update it with all your required plugins (svn, mylyn, etc). If you are on the I builds, then you have to do this on every week. If you feel that its a painful process, here is a tip. &lt;br /&gt;
&lt;br /&gt;
The&amp;nbsp; p2 repos for Eclipse are not only for the stable releases, &lt;a href="http://wiki.eclipse.org/Eclipse_Project_Update_Sites"&gt;but also for the Milestones, I Builds and Nightly builds&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://download.eclipse.org/eclipse/updates/3.6milestones"&gt;Milestones: http://download.eclipse.org/eclipse/updates/3.6milestones&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://download.eclipse.org/eclipse/updates/3.6-I-builds"&gt;I-Builds: http://download.eclipse.org/eclipse/updates/3.6-I-builds&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://download.eclipse.org/eclipse/updates/3.6-N-builds"&gt;Nightly Builds: http://download.eclipse.org/eclipse/updates/3.6-N-builds&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The &lt;a href="http://www.eclipse.org/eclipse/platform-releng/buildSchedule.html"&gt;build schedule is available here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Go to your Preferences and add the required repo in your Available Software Site preferences (and disable all others, it will be slow to update).&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="351" src="http://1.bp.blogspot.com/_hsp14iFkRLs/Srh7vaSVXBI/AAAAAAAAERY/nb-axjlvPCQ/s800/Available_Software_Sites.png" width="662" /&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Also enable the automatic updates. You are done. Whenever there is a new Milestone (or an I-Build), then your Eclipse gets updated automatically to it and you don't have to worry about installing other required plug-ins.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="406" src="http://2.bp.blogspot.com/_hsp14iFkRLs/Srh8a0E0sAI/AAAAAAAAERg/n2tzeO6apIg/s800/Automatic_updates.png" width="492" /&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Enjoy with the latest and greatest without any pains :-)&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-4932218668846285347?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/G7bn4hQmpRA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/4932218668846285347/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=4932218668846285347&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4932218668846285347?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4932218668846285347?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/G7bn4hQmpRA/catching-up-with-milestones-and-i.html" title="Catching up with Milestones and I-Builds" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_hsp14iFkRLs/Srh7vaSVXBI/AAAAAAAAERY/nb-axjlvPCQ/s72-c/Available_Software_Sites.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/09/catching-up-with-milestones-and-i.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEBSX45fip7ImA9WxNQEE4.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-7610143536304099106</id><published>2009-09-15T22:39:00.002+05:30</published><updated>2009-09-15T22:40:58.026+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-15T22:40:58.026+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jface" /><category scheme="http://www.blogger.com/atom/ns#" term="RCP" /><category scheme="http://www.blogger.com/atom/ns#" term="dialogs" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><category scheme="http://www.blogger.com/atom/ns#" term="swt" /><title>Back to the basics: Display, Shell, Window ...</title><content type="html">Every Eclipse plugin developer has to deal with Shell and Window, but sometimes doesn't understand the difference between these two. In this tip, I'm trying to explain the basic things: Display, Shell, Window, Dialog, Workbench, WorkbenchPart, WorkbenchSite and WorkbenchPage. Yeah, I know, its probably the boring post you can read in this blog, if you are little bit experienced in these areas.&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html"&gt;Display&lt;/a&gt;:&lt;/h4&gt;This class is the link between SWT and the underlying OS. It manages the interaction between widgets and the OS. The primary task for this class is to maintain the event loop (&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html#readAndDispatch%28%29"&gt;readAndDispatch()&lt;/a&gt;). Unless you are writing a plain SWT app, you won't be using that. The most common methods you would be using in this class are &lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html#asyncExec%28java.lang.Runnable%29"&gt;asyncExec()&lt;/a&gt;, &lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html#syncExec%28java.lang.Runnable%29"&gt;syncExec()&lt;/a&gt; and &lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html#timerExec%28int,%20java.lang.Runnable%29"&gt;timerExec()&lt;/a&gt;, which allows you to run a piece of code in the UI thread. (aka user interface thread or display thread)&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Shell.html"&gt;Shell&lt;/a&gt;:&lt;/h4&gt;Shell is the "window" that you see in your desktop. The one that has a title, maximize, minimize, restore and close buttons. A shell can be either a top-level shell (no parent shell) or can be a secondary shell (will have a parent shell). The style that is passed in the constructor defines which of the above mentioned buttons are displayed and also whether the Shell is modal or not. If you are on a pure SWT app, then you should be create a Shell; create controls in it; open it; run the event loop; and dispose it. Speaking in code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;Shell shell = new Shell(display);
// set layout and create widgets 
 shell.open ();
 while (!shell.isDisposed ()) {
  if (!display.readAndDispatch ()) display.sleep ();
 }
 display.dispose ();
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/window/Window.html"&gt;Window&lt;/a&gt;:&lt;/h4&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; If you are developing plugins/JFace applications, its better to use Window rather than Shells directly, because it manages the above things for you. It is not, but think it of as a wrapper for Shell. When you use a Window, a Shell is not created until the open() method is called. Since the Shell is not created till the Window is open and windows can be reopened (yes, you can reopen it), configuration of the Shell should be done in the configureShell() method. Remember, this is an abstract class and so you cannot directly use it. You must either use Dialog or ApplicationWindow or your own concrete class.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/dialogs/Dialog.html"&gt;Dialog&lt;/a&gt;:&lt;/h4&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; When you need a specialized communication with the user, you should be using Dialogs. In all other cases, you will be using ApplicationWindow. Dialog are more of helper windows that are attached to another main window. PreferenceDialog, PropertyDialog, ErrorDialog, InputDialog &amp;amp; WizardDialog are some frequently used dialogs.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/window/ApplicationWindow.html"&gt;ApplicationWindow&lt;/a&gt;:&lt;/h4&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Window + menu support + toolbar support + coolbar support + status line support = ApplicationWindow :-) &lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchWindow.html"&gt;IWorkbenchWindow&lt;/a&gt;:&lt;/h4&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; WorkbenchWindow is Eclipse specific ApplicationWindow, which adds few services and a set of IWorkbenchPages to the ApplicationWindow. Although the javadoc says "Each workbench window has a collection of 0 or more pages", in reality it has only one page. I believe this is due to backward compatibility with Eclipse 1.0. &lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchPage.html"&gt;IWorkbenchPage&lt;/a&gt;:&lt;/h4&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; The area that lies between the toolbar and the status line of the WorkbenchWindow is known as WorkbenchPage. Simply put, this is the body of the WorkbenchWindow, where all the editors and views are showed. IWorkbenchPage contains IWorkbenchParts, which are the the visual representation of the Views and Editors. Both IViewPart and IEditorPart derive from &lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchPart.html"&gt;IWorkbenchPart&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;&lt;a href="http://help.eclipse.org/stable/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchSite.html"&gt;IWorkbenchSite&lt;/a&gt;:&lt;/h4&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWorkbenchPart resides inside the IWorkbenchPage. So it has no direct access to the workbench itself. So when it needs to interact with the workbench, then it needs the IWorkbenchSite. For example to get the shell inside a view, you call getSite().getShell().&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-7610143536304099106?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/OxMxxkHowOI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/7610143536304099106/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=7610143536304099106&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7610143536304099106?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7610143536304099106?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/OxMxxkHowOI/back-to-basics-display-shell-window.html" title="Back to the basics: Display, Shell, Window ..." /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/09/back-to-basics-display-shell-window.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMNSXc_cSp7ImA9WxNRFUo.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-2950286492438125393</id><published>2009-09-10T12:19:00.001+05:30</published><updated>2009-09-10T14:18:18.949+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-10T14:18:18.949+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RCP" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="3.6" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Excluding a view from Properties View</title><content type="html">In a previous tip, we saw how to make a &lt;a href="http://blog.eclipse-tips.com/2009/05/creating-custom-property-view.html"&gt;Properties View to respond only to a particular View&lt;/a&gt; or Editor. In this tip, we are going to see how to exclude a particular View or Editor from the Properties View. This will be very helpful in RCP apps, where they don't want the generic view like Outline view or an editor that contributes to the Properties View. Last time we extended the Properties View to create our own view and added some code. But this time its simple. You just have to use the org.eclipse.ui.propertiesView extension point.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;extension
         point="org.eclipse.ui.propertiesView"&amp;gt;
      &amp;lt;excludeSources
            id="org.eclipse.ui.views.ContentOutline"&amp;gt;
      &amp;lt;/excludeSources&amp;gt;
      &amp;lt;excludeSources
            id="com.eclipse_tips.editors.MyOwnEditor"&amp;gt;
      &amp;lt;/excludeSources&amp;gt;
&amp;lt;/extension&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
Yes, its that simple :-) Don't try with Galileo, you would need Helios (3.6) M2 to get this working.&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-2950286492438125393?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/okyfHv-oyNY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/2950286492438125393/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=2950286492438125393&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/2950286492438125393?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/2950286492438125393?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/okyfHv-oyNY/excluding-view-from-properties-view.html" title="Excluding a view from Properties View" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/09/excluding-view-from-properties-view.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcEQno9eCp7ImA9WxJaFUU.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-8412958758749086055</id><published>2009-08-06T23:31:00.001+05:30</published><updated>2009-08-06T23:36:43.460+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-06T23:36:43.460+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="plugins" /><category scheme="http://www.blogger.com/atom/ns#" term="jface" /><category scheme="http://www.blogger.com/atom/ns#" term="RCP" /><category scheme="http://www.blogger.com/atom/ns#" term="dialogs" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Remember the State</title><content type="html">As a rule of thumb, your application should try to remember the state across sessions. So when a user hits the close button and then opens it after few mins/days, it should present exactly in the same way where he left. In this tip, I'm going to explain few things of how this could be achieved.&lt;br /&gt;
&lt;br /&gt;
The first and foremost thing is the number of windows opened and current perspective and its state in each window. If you are writing a plugin for the IDE, you need not worry about this. Eclipse does that for you. If you are an RCP app, you have to do it yourself. You have to do it in the WorkbenchAdvisor.initialize() method:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
 
 @Override
 public void initialize(IWorkbenchConfigurer configurer) {

  super.initialize(configurer);
  configurer.setSaveAndRestore(true);
 }

 // other methods ...
}
&lt;/pre&gt;&lt;br /&gt;
Now this will take care of lot of things - the number of windows that are opened; location &amp;amp; size of those windows; perspective of each window; view &amp;amp; editors in each perspective; their locations,... All by setting that one boolean variable!&lt;br /&gt;
&lt;br /&gt;
Now that our views and editors are restored by Eclipse, we need to ensure the state of them. Most of the views will be tree/table based. In these cases, the current selection is an important one to restore. &lt;br /&gt;
&lt;br /&gt;
To store these items and anyother stuff you want to, Eclipse provides IMemento. An instance of this IMemento is passed to the view when its initialized and when workbench is closed. The information can be stored hierarchically with string keys and it will be persisted as an XML. If you are wondering why can't it be as simple as passing a Serializable Java object and the workbench persisting it, the answer is simple. The same class may not be there when Eclipse starts next time or even if the same class is available, it might have changed. IMemento avoids this problem by persisting the stae as an XML string.&lt;br /&gt;
&lt;br /&gt;
So how do we use it? In the view, you have to override the init() and saveState() methods:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
 this.memento = memento;
 super.init(site, memento);
}

public void createPartControl(Composite parent) {
        // create the viewer
 restoreSelection();
}

private void restoreSelection() {
 if (memento != null) {
  IMemento storedSelection = memento.getChild("StoredSelection");
  if (storedSelection != null) {
   // create a structured selection from it
   viewer.setSelection(selection);
  }
 }
}

@Override
public void saveState(IMemento memento) {
 IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
 if (!selection.isEmpty()) {
  IMemento storedSelection = memento.createChild("StoredSelection");
  // store the selection under storedSelection
 }
}
&lt;/pre&gt;&lt;br /&gt;
Not just the selection, we can store any other information (which of the tree nodes are expanded, sorter &amp;amp; filter settings etc) which will be useful to restore the state.&lt;br /&gt;
&lt;br /&gt;
Great. Now moving on from the views, the next item would be dialogs. Similar to the workbench windows, you can store the size, location and other elements of a dialog as well. The functionality for size and location is available by default, but you need to enable it by overriding the Dialog.getDialogBoundsSettings() method. The Dialog class stores &amp;amp; retrieves the size and location from IDialogSettings returned from that method. The original implementation returns null, so nothing is saved. We need to create an instanceof IDialogSettings and return it. Your plugin's Activator simplifies that. When required, it creates a dialog_settings.xml under your plugin's data area and store the dialog settings of all the dialogs. You have to create a separate section for each dialog.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;private static final String MY_DIALOG_SETTINGS = "MY_DIALOG_SETTINGS";

@Override
protected IDialogSettings getDialogBoundsSettings() {
 IDialogSettings settings = Activator.getDefault().getDialogSettings();
 IDialogSettings section = settings.getSection(MY_DIALOG_SETTINGS);
 if (section == null) {
  section = settings.addNewSection(MY_DIALOG_SETTINGS);
 }
 return section;
}&lt;/pre&gt;&lt;br /&gt;
In case you want to store only the location or size, you can specify it by overriding the getDialogBoundsStrategy() method.&lt;br /&gt;
&lt;br /&gt;
Much like the IMemento, the IDialogSettings basically organizes the key-value strings in an hierarchical way. So along with the size &amp;amp; location, you can store any other information in this IDialogSettings. Its a good practice to store the values of the widgets (which radion button is selecte, checked state of a check box, etc) in the dialog, so its faster for an user who frequently repeats an operation.&lt;br /&gt;
&lt;br /&gt;
Talking about the widgets, the trickier one is Combo. When the list of options are predefined and the user can't enter a new value, then its easy. But in places where the user can enter the values, (like File/Directory selection, search boxes), remembering them is not straight forward.&lt;br /&gt;
&lt;br /&gt;
We shouldn't be storing every single value the user enters, but only the recently used ones. Probably with a limit of 5 or 10 items only. This can be done with the help of LinkedHashSet. It guarantees the order of the element, so whenever the user enters a new values, put the current value first in the set then add the rest of the elements (even if the first element is repeated, it won't change the position). Then take the first N elements and store it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;private static final String COMBO_STATE="COMBO_STATE";

private static final int HISTORY_SIZE = 5;

private String []comboState;

private void restoreComboState(IDialogSettings settings) {
 comboState = settings.getArray(COMBO_STATE);
 if(comboState ==null)
  comboState = new String[0];
 for (String value : comboState) {
  myCombo.add(value);
 }
}

private void saveComboState(IDialogSettings settings) {

 // use LinkedHashSet to have the recently entered ones
 LinkedHashSet&amp;lt;String&amp;gt; newState = new LinkedHashSet&amp;lt;String&amp;gt;();
 newState.add(myCombo.getText());
 newState.addAll(Arrays.asList(comboState));

 // now convert it to the array of required size
 int size = Math.min(HISTORY_SIZE, newState.size());
 String[] newStateArray = new String[size];
 newState.toArray(newStateArray);

 // store
 settings.put(COMBO_STATE, newStateArray);
}
&lt;/pre&gt;&lt;br /&gt;
One last piece. Look at this dialog:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/SnsZ4H4Oh4I/AAAAAAAAEK4/RXXOGhZ6x_M/s800/Open_Perspective_Question.png" /&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Sometimes only for the first time you want to ask the question to the user. Thereafter if the user prefers, you can use the same answer. To simplify this, you can use the MessageDialogWithToggle. You need to pass the preference store and the key for the preference value. When the user selects the check box, the value will be stored. From the next time onwards, you can check the value from the preference and use it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;MessageDialogWithToggle.openYesNoQuestion(shell, "Remember me", "Is this tip useful?", 
  "Don't bug me with this question again", true, 
  Activator.getDefault().getPreferenceStore(), "BUG_USER_KEY");
&lt;/pre&gt;&lt;br /&gt;
There you go:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_hsp14iFkRLs/SnsaBbEuZlI/AAAAAAAAELA/swpaRewXzDI/s800/Tip_Useful_Question.png" /&gt;&lt;/div&gt;&lt;br /&gt;
:-)&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-8412958758749086055?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/weSokobWRhM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/8412958758749086055/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=8412958758749086055&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/8412958758749086055?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/8412958758749086055?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/weSokobWRhM/remember-state.html" title="Remember the State" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_hsp14iFkRLs/SnsZ4H4Oh4I/AAAAAAAAEK4/RXXOGhZ6x_M/s72-c/Open_Perspective_Question.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/08/remember-state.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4FSHczfSp7ImA9WxJUGU4.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-4303128513757494169</id><published>2009-07-18T22:37:00.001+05:30</published><updated>2009-07-18T22:38:39.985+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-18T22:38:39.985+05:30</app:edited><title>Eclipse Summit India - Day 2</title><content type="html">The second day, I was a little late and missed the Oracle's Plenary session. I was in time for IBM's session. Being an IBM-er nothing new for me there to see RAD or websphere. It was good.&lt;br /&gt;
&lt;br /&gt;
The first session I took was by Ilya Shinkarenko. More than half of the hall had repeated audience. It was nice, just as yesterday. This time, I was able to attend till the end. After a heavy lunch, I felt very sleepy in the afternoon session. The presenter was partly responsible for that ;-) Then I moved to Anshu Jain's session called 'Eclipse as framework of frameworks', which was simply awesome. To quote Ankur, "a lot of meat added with a perfect aroma, the presentation was a feast". Of the ones I've attended, that was the best. Next was networking in the corridor. After many questions on Eclipse startup to command invocation, that marked the end of the day for me.&lt;br /&gt;
&lt;br /&gt;
Some afterthoughts:&lt;br /&gt;
&lt;br /&gt;
(*) The good thing about this conference is the focus.  This is not an all-in-conference, which targets all the CEOs, CTOs, Managers, decision makers, IT guys and your office boys. This has complete focus on Eclipse plug-in developers and almost all of these sessions are well aligned towards this.&lt;br /&gt;
&lt;br /&gt;
(*) Parallel tracks are good, but they could have been specific tracks like OSGi, EMF etc. Also there were instances like both the OSGi sessions were held in parallel, so if someone is interested in OSGi, they have to choose between these two. Probably the next time, it gets better.&lt;br /&gt;
&lt;br /&gt;
(*) The venue was also much better, center of the city and well accessible. No need to talk about the food, it was great :-)&lt;br /&gt;
&lt;br /&gt;
I believe that the photos, videos and the slides will be uploaded online soon. I'll post a link once its done.&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-4303128513757494169?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/_JSKDGNd22Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/4303128513757494169/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=4303128513757494169&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4303128513757494169?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4303128513757494169?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/_JSKDGNd22Q/eclipse-summit-india-day-2.html" title="Eclipse Summit India - Day 2" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/07/eclipse-summit-india-day-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEENR3ozfip7ImA9WxJUGE8.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-7656574543405745755</id><published>2009-07-17T14:44:00.002+05:30</published><updated>2009-07-17T14:54:56.486+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-17T14:54:56.486+05:30</app:edited><title>Eclipse Summit India - Day 1</title><content type="html">Before I start, a question: How do you know you are in troubled economic times?&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://1.bp.blogspot.com/_hsp14iFkRLs/SmBAujwQobI/AAAAAAAAEJc/i1zg8F_18iY/s1600/EclipseSummitIndiaLogo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_hsp14iFkRLs/SmBAujwQobI/AAAAAAAAEJc/i1zg8F_18iY/s200/EclipseSummitIndiaLogo.png" /&gt;&lt;/a&gt;Today is the first day of Eclipse Summit India. Luckily, even after screwing up by taking a wrong road and going in a different direction, I did make it well before the keynote by Microsoft. Yes, Microsoft. They are one of the Platinum sponsors. Just like me, everyone was wondering what are they doing there, the answer told was "interoperability". I'm not going to summarize any of the topics presented, so I'll leave you to guess what how he positioned M$ in that.One thing that was interesting is they have PHP as a first class citizen in their IIS. That was surprising for me. Additionally they have some thing called a 'One Installer' which will download all that you want for a web site and install it on your server - not just PHP module for IIS or the latest .Net runtime, but Wordpress and Drupal as well! Wow!&lt;br /&gt;
&lt;br /&gt;
After that it was Ilya Shinkarenko's workshop. It was good. Started a little slow and the pace moved up during the session. I've to cut it in the middle and rush to the other room. Adobe guys were just finishing their presentation. Both of them had a black Mac book and even before I said another 'wow', I noticed it was a windows machine with an Apple sticker. Good idea, I should say. The presentation was mine, and I hope it went well. I did get some good feedback during the lunch. Its definitely troubled ecomony now, but the buffet was good :-)&lt;br /&gt;
&lt;br /&gt;
Post lunch, yeah, I'm in the EMF workshop and blogging this (yeah, we got free wi-fi). Got to run for Ankur's Presentation. Rest of the sessions in the evening/tomorrow.&lt;br /&gt;
&lt;br /&gt;
Before I sign out, the answer: In the free goodies for attendees, you get a pencil instead of a pen ;-)&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-7656574543405745755?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/8dydryT_8_4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/7656574543405745755/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=7656574543405745755&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7656574543405745755?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7656574543405745755?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/8dydryT_8_4/eclipse-summit-india-day-1.html" title="Eclipse Summit India - Day 1" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_hsp14iFkRLs/SmBAujwQobI/AAAAAAAAEJc/i1zg8F_18iY/s72-c/EclipseSummitIndiaLogo.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/07/eclipse-summit-india-day-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcAQH88cCp7ImA9WxJVEE0.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-7989849880617545097</id><published>2009-06-26T13:10:00.000+05:30</published><updated>2009-06-26T13:10:41.178+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-26T13:10:41.178+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RCP" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="Commands" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Keyboard accessibility thru Command Framework</title><content type="html">Keyboard shortcuts is usually much speedier than reaching out your mouse, moving it, pointing it to something and clicking. But there are some things which cannot be done that easily by keyboard shortcuts. For me, one of them is finding out a closed project and open it. Unfortunately, I've quite a large set of projects in my workspace and try to keep most them closed, when not used. In addition to that in the Package Explorer, I've the 'Closed Projects' filter on. So if I need to open a project, I've use the pull down menu, uncheck 'Closed Projects' navigate thru the working sets to find the right project and double click it. To enable keyboard access to this regular task, I decided to make use of &lt;a href="http://wiki.eclipse.org/Platform_Command_Framework"&gt;Commands Framework&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The solution is to add a &lt;a href="http://blog.eclipse-tips.com/2008/12/commands-part-3-parameters-for-commands.html"&gt;parameterized command&lt;/a&gt;, and in the values, I compute the projects which are closed. So when I press the awesome shortcut (Ctrl+3) it would display me the list of closed projects. With few keys, I can navigate to the project I want and open it. Lets see how to do it. First step is the command with the parameter:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: xml"&gt;&amp;lt;extension point="org.eclipse.ui.commands"&amp;gt;
   &amp;lt;command
            defaultHandler="com.eclipse_tips.handlers.OpenProjectHandler"
            id="com.eclipse-tips.openProject.command"
            name="Open Project"&amp;gt;
      &amp;lt;commandParameter
               id="com.eclipse-tips.openProject.projectNameParameter"
               name="Name"
               optional="false"
               values="com.eclipse_tips.handlers.ProjectNameParameterValues"&amp;gt;
      &amp;lt;/commandParameter&amp;gt;
   &amp;lt;/command&amp;gt;
&amp;lt;/extension&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
And the handler:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;public Object execute(ExecutionEvent event) throws ExecutionException {
 String projectName = event.getParameter("com.eclipse-tips.openProject.projectNameParameter");
 IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
 IProject project = root.getProject(projectName);
 try {
  project.open(null);
 } catch (CoreException e) {
  throw new ExecutionException("Error occured while open project", e);
 }
 return null;
}
&lt;/pre&gt;&lt;br /&gt;
For the parameter values, I look for closed projects and return them:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;public Map&amp;lt;String, String&amp;gt; getParameterValues() {

 IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
 IProject[] projects = root.getProjects();
 Map&amp;lt;String, String&amp;gt; paramValues = new HashMap&amp;lt;String, String&amp;gt;();
 for (IProject project : projects) {
  if (project.exists() &amp;amp;&amp;amp; !project.isOpen()) {
   paramValues.put(project.getName(), project.getName());
  }

 }
 return paramValues;
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
So finally, When I press Ctrl+3 and type OPN, I get the list:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_hsp14iFkRLs/SkR2yIhfxzI/AAAAAAAAECA/D0u-kCTiq-Q/s1600-h/KeyboardCommands.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_hsp14iFkRLs/SkR2yIhfxzI/AAAAAAAAECA/D0u-kCTiq-Q/s400/KeyboardCommands.png" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
This idea can be extended to provide keyboard accessibility to many functionalities. Say in an RCP mail application, you can add a command like 'Go To Mail' with parameter as the Subject/Sender:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_hsp14iFkRLs/SkR539zueKI/AAAAAAAAECI/REDeNO2mVnQ/s1600-h/KeyboardCommands1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/SkR539zueKI/AAAAAAAAECI/REDeNO2mVnQ/s400/KeyboardCommands1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Hmmm, if only the 'Built On Eclipse' mail app that I *have* to use, knows the existence of threads other than the UI thread :-(&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-7989849880617545097?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/jzeEc1ip9Z4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/7989849880617545097/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=7989849880617545097&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7989849880617545097?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7989849880617545097?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/jzeEc1ip9Z4/keyboard-accessibility-thru-command.html" title="Keyboard accessibility thru Command Framework" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_hsp14iFkRLs/SkR2yIhfxzI/AAAAAAAAECA/D0u-kCTiq-Q/s72-c/KeyboardCommands.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/06/keyboard-accessibility-thru-command.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMEQ3o7eyp7ImA9WxJXEEw.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-2386978422358746936</id><published>2009-06-03T13:51:00.003+05:30</published><updated>2009-06-03T13:53:22.403+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-03T13:53:22.403+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jface" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Subtask in ProgressMonitors</title><content type="html">Here is a trivial tip. When inspecting a bug, I found a interesting thing on Progress Monitors. We know monitor.worked() increments the progress bar, but how do we change the text to update the current subtask? The initial text is set by the beginTask() method and it should be called only once. I digged into the IProgressMonitor and found the subtask() method:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;IRunnableWithProgress operation = new IRunnableWithProgress() {

 public void run(IProgressMonitor monitor) {

  monitor.beginTask("Main task running ...", 5);
  for (int i = 0; i &amp;lt; 5; i++) {
   monitor.subTask("Subtask # " + i + " running.");
   runSubTask(new SubProgressMonitor(monitor, 1), i);
  }
 }

};
&lt;/pre&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_hsp14iFkRLs/SiYv6gq_xPI/AAAAAAAADpY/vDP9JM1hYzU/s1600-h/ProgressWithSubTask1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_hsp14iFkRLs/SiYv6gq_xPI/AAAAAAAADpY/vDP9JM1hYzU/s400/ProgressWithSubTask1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now the question is what happens when the runSubTask() method sets another subTask on the SubProgressMonitor?&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;private void runSubTask(IProgressMonitor monitor, int subTaskId) {

 monitor.beginTask("Sub task running", 10);
  for (int i = 0; i &amp;lt; 10; i++) {
   monitor.subTask("Inside subtask, " + i + " out of 10");
   // do something here ...
   monitor.worked(1);
   if (monitor.isCanceled())
    throw new OperationCanceledException();
 }
  monitor.done();
 }

}
&lt;/pre&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_hsp14iFkRLs/SiYwUsf-8SI/AAAAAAAADpg/9hmZYQi9ufY/s1600-h/ProgressWithSubTask2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_hsp14iFkRLs/SiYwUsf-8SI/AAAAAAAADpg/9hmZYQi9ufY/s400/ProgressWithSubTask2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Basically the SubProgressMonitor's subTask() overwrites the parent's subTask(). Thats the default behaviour. You can customize it with the style bits provided in the SubProgressMonitor:&lt;br /&gt;
&lt;br /&gt;
If you want to append the SubProgressMonitor's subTask info, use the style PREPEND_MAIN_LABEL_TO_SUBTASK:&lt;br /&gt;
&lt;pre class="brush: java;"&gt;new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK), i);&lt;/pre&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_hsp14iFkRLs/SiYxQ54EfzI/AAAAAAAADpo/TsxDbbnNb5M/s1600-h/ProgressWithSubTask3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/SiYxQ54EfzI/AAAAAAAADpo/TsxDbbnNb5M/s400/ProgressWithSubTask3.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Else if you want to ignore it altogher then use the SUPPRESS_SUBTASK_LABEL style:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL), i);&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-2386978422358746936?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/T2meNyoULUU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/2386978422358746936/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=2386978422358746936&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/2386978422358746936?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/2386978422358746936?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/T2meNyoULUU/subtask-in-progressmonitors.html" title="Subtask in ProgressMonitors" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_hsp14iFkRLs/SiYv6gq_xPI/AAAAAAAADpY/vDP9JM1hYzU/s72-c/ProgressWithSubTask1.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/06/subtask-in-progressmonitors.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4CRn85cSp7ImA9WxJQFUQ.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-838666877859722878</id><published>2009-05-29T15:10:00.004+05:30</published><updated>2009-05-29T17:06:07.129+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-29T17:06:07.129+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RCP" /><category scheme="http://www.blogger.com/atom/ns#" term="Mac" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><category scheme="http://www.blogger.com/atom/ns#" term="swt" /><title>Search menu in Mac - the implementation</title><content type="html">In the previous entry I mentioned about the &lt;a href="http://blog.eclipse-tips.com/2009/05/search-menu-in-mac.html" linkindex="207"&gt;Search Menu in Mac&lt;/a&gt;. Lets see what that search menu contains:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_hsp14iFkRLs/Sh-mTAhPuqI/AAAAAAAADoA/bFIxmmj8I2k/s1600-h/Tweetie_Mac_Search_Menu1.png" imageanchor="1" linkindex="208" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&amp;nbsp;&lt;a href="http://3.bp.blogspot.com/_hsp14iFkRLs/Sh-s6fxoaXI/AAAAAAAADoI/Q0n2b1lKuec/s1600-h/Tweetie_Mac_Search_Menu1.png" imageanchor="1" linkindex="209" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_hsp14iFkRLs/Sh-s6fxoaXI/AAAAAAAADoI/Q0n2b1lKuec/s400/Tweetie_Mac_Search_Menu1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The first item is the "Clear" menu. It clears the recent search history. Next comes the recent searches. If you want to call it as "Search History", you can do it in the title field menu item. The title field &amp;amp; clear menu item are visible only when there is at least one entry in the recent searches. The menu can also have custom items, where you can include you own action items. Lets see how to add all these in an SWT app:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;Text searchText = new Text(shell, SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
  SearchFieldSupport searchFieldSupport = new SearchFieldSupport(searchText);
  Menu menu = new Menu(searchText);
  
  MenuItem customItem = new MenuItem(menu, SWT.NONE);
  customItem.setText("Custom Action");
  customItem.addSelectionListener(new SelectionAdapter() {
   public void widgetSelected(SelectionEvent e) {
    MessageDialog.openInformation(shell, "Search Field", "Custom action is done here");
   };
  });
  
  MenuItem sep1 = new MenuItem(menu, SWT.SEPARATOR);
  
  MenuItem recentMenuItem = new MenuItem(menu, SWT.NONE);
  recentMenuItem.setText("Search History");
  SearchFieldSupport.setRecentSearchesTitle(recentMenuItem);
  
  // for the search history
  MenuItem recentsMenuItem = new MenuItem(menu, SWT.PUSH);
  SearchFieldSupport.setRecentSearches(recentsMenuItem);
  
  MenuItem sep2 = new MenuItem(menu, SWT.SEPARATOR);

  MenuItem clearMenuItem = new MenuItem(menu, SWT.PUSH);
  clearMenuItem.setText("Clear History");
  SearchFieldSupport.setClearRecents(clearMenuItem);

  searchFieldSupport.setMenu(menu);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the result:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_hsp14iFkRLs/Sh-s8Km0cBI/AAAAAAAADoQ/jyU6iBgQK7Q/s1600-h/Mac_SWT_Search.png" imageanchor="1" linkindex="210" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_hsp14iFkRLs/Sh-s8Km0cBI/AAAAAAAADoQ/jyU6iBgQK7Q/s320/Mac_SWT_Search.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Its almost perfect except that when we clear the search history and see the menu, it looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_hsp14iFkRLs/Sh-s_dGEh7I/AAAAAAAADoY/WyYEhsjoduA/s1600-h/Search_Separator.png" imageanchor="1" linkindex="211" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_hsp14iFkRLs/Sh-s_dGEh7I/AAAAAAAADoY/WyYEhsjoduA/s320/Search_Separator.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Its because the separators are still shown even when there is no recent menu items. The hack is to set the separator as a resentSearches menu item:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;MenuItem sep2 = new MenuItem(menu, SWT.SEPARATOR);
  SearchFieldSupport.setRecentSearchesTitle(sep2);
&lt;/pre&gt;&lt;br /&gt;
The Search Field also supports a custom menu item which tells that there is no recent search items. This menu item is automatically hidden when there search history is not empty. We can add that also before the second separator:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;MenuItem recentsMenuItem = new MenuItem(menu, SWT.PUSH);
  SearchFieldSupport.setRecentSearches(recentsMenuItem);
  
  MenuItem noRecentMenuItem = new MenuItem(menu, SWT.NONE);
  noRecentMenuItem.setText("No Search History");
  SearchFieldSupport.setNoRecentSearches(noRecentMenuItem);
  
  MenuItem sep2 = new MenuItem(menu, SWT.SEPARATOR);
  SearchFieldSupport.setRecentSearchesTitle(sep2);
&lt;/pre&gt;&lt;br /&gt;
Now we are all set:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_hsp14iFkRLs/Sh-tBBrSgUI/AAAAAAAADog/RASrf0OvunY/s1600-h/Search_Empty.png" imageanchor="1" linkindex="212" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/Sh-tBBrSgUI/AAAAAAAADog/RASrf0OvunY/s320/Search_Empty.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The last missing piece of the puzzle, the SearchFieldSupport class:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java; collapse: true"&gt;package org.eclipse.ui.cocoa.ext;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.cocoa.ext.internal.NSSearchField;

/**
 * 
 * @author Prakash G.R.
 * 
 */
public class SearchFieldSupport implements KeyListener, DisposeListener {
 
 private final NSSearchField nsSearchField;
 private final Text text;

 public SearchFieldSupport(Text text) {
  this.text = text;
  text.addKeyListener(this);
  text.addDisposeListener(this);
  nsSearchField = new NSSearchField(text);
 }

 public Text getText() {
  return text;
 }

 public String[] getRecentSearchStrings() {
  return nsSearchField.getRecentSearches();
 }
 
 public void setRecentSearchStrings(String[] recentSearches) {
  nsSearchField.setRecentSearches(recentSearches);
 }

 public void setMenu(Menu menu) {
  nsSearchField.setMenu(menu);
 }

 public static void setNoRecentSearches(MenuItem menuItem) {
  NSSearchField.setTag(menuItem, NSSearchField.NSSearchFieldNoRecentsMenuItemTag);
 }

 public static void setClearRecents(MenuItem menuItem) {
  NSSearchField.setTag(menuItem, NSSearchField.NSSearchFieldClearRecentsMenuItemTag);
 }

 public static void setRecentSearchesTitle(MenuItem menuItem) {
  NSSearchField.setTag(menuItem, NSSearchField.NSSearchFieldRecentsTitleMenuItemTag);
 }

 public static void setRecentSearches(MenuItem menuItem) {
  NSSearchField.setTag(menuItem, NSSearchField.NSSearchFieldRecentsMenuItemTag);
 }

 public void widgetDisposed(DisposeEvent e) {
  text.removeKeyListener(this);
 }

 public void keyPressed(KeyEvent e) {
  // do nothing
 }

 public void keyReleased(KeyEvent e) {
  if (e.keyCode == '\r') {
   String[] recentSearchStrings = getRecentSearchStrings();
   int oldSize = recentSearchStrings.length;
   String[] newSearchStrings = new String[recentSearchStrings.length + 1];
   System.arraycopy(recentSearchStrings, 0, newSearchStrings, 0, recentSearchStrings.length);
   newSearchStrings[oldSize] = text.getText();
   setRecentSearchStrings(newSearchStrings);
   text.setSelection(0, text.getText().length());
  }
 }

}
&lt;/pre&gt;&lt;br /&gt;
and the custom NSSearchField class:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java; collapse: true"&gt;package org.eclipse.ui.cocoa.ext.internal;

import java.lang.reflect.Field;

import org.eclipse.swt.internal.cocoa.NSArray;
import org.eclipse.swt.internal.cocoa.NSMenu;
import org.eclipse.swt.internal.cocoa.NSMenuItem;
import org.eclipse.swt.internal.cocoa.NSMutableArray;
import org.eclipse.swt.internal.cocoa.NSString;
import org.eclipse.swt.internal.cocoa.OS;
import org.eclipse.swt.internal.cocoa.id;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Text;

/**
 * @author Prakash G.R.
 * 
 */
@SuppressWarnings("restriction")
public class NSSearchField extends org.eclipse.swt.internal.cocoa.NSSearchField {

 public static final int NSSearchFieldRecentsTitleMenuItemTag = 1000;
 public static final int NSSearchFieldRecentsMenuItemTag = 1001;
 public static final int NSSearchFieldClearRecentsMenuItemTag = 1002;
 public static final int NSSearchFieldNoRecentsMenuItemTag = 1003;

 private static final int /* long */sel_setSearchMenuTemplate = OS.sel_registerName("setSearchMenuTemplate:");
 private static final int /* long */sel_setTag = OS.sel_registerName("setTag:");
 private static final int /* long */sel_setRecentSearches = OS.sel_registerName("setRecentSearches:");

 public NSSearchField(id id) {
  super(id);
 }

 public NSSearchField(Text text) {
  super(text.view);
 }

 public void setMenu(Menu menu) {
  try {
   Field field = Menu.class.getDeclaredField("nsMenu");
   field.setAccessible(true);

   NSMenu nsMenu = (NSMenu) field.get(menu);

   OS.objc_msgSend(this.id, sel_setSearchMenuTemplate, nsMenu.id);
  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 public static boolean setTag(MenuItem menuItem, int tag) {
  try {
   Field field = MenuItem.class.getDeclaredField("nsItem");
   field.setAccessible(true);

   NSMenuItem nsMenuItem = (NSMenuItem) field.get(menuItem);
   OS.objc_msgSend(nsMenuItem.id, sel_setTag, tag);

   // no action for titles
   if (tag == NSSearchFieldRecentsTitleMenuItemTag || tag == NSSearchFieldNoRecentsMenuItemTag) {
    nsMenuItem.setAction(0);
   }
   return true;
  } catch (Exception e) {
   return false;
  }
 }

 public String[] getRecentSearches() {
  NSArray recentSearches = super.recentSearches();
  String[] recentSearchStrings = new String[recentSearches.count()];
  for (int i = 0; i &amp;lt; recentSearchStrings.length; i++) {
   recentSearchStrings[i] = (new NSString(recentSearches.objectAtIndex(i))).getString();
  }
  return recentSearchStrings;
 }

 public void setRecentSearches(String[] recentSearchStrings) {
  
  NSMutableArray recentSearches = NSMutableArray.arrayWithCapacity(recentSearchStrings.length);
  for (String aRecentSearcb : recentSearchStrings) {
   NSString nsString = NSString.stringWith(aRecentSearcb);
   recentSearches.addObject(nsString);
  }
  OS.objc_msgSend(this.id, sel_setRecentSearches, recentSearches.id);
  
 }
}
&lt;/pre&gt;&lt;br /&gt;
Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-838666877859722878?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/_1WqCtWp3MY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/838666877859722878/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=838666877859722878&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/838666877859722878?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/838666877859722878?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/_1WqCtWp3MY/search-menu-in-mac-implementation.html" title="Search menu in Mac - the implementation" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_hsp14iFkRLs/Sh-s6fxoaXI/AAAAAAAADoI/Q0n2b1lKuec/s72-c/Tweetie_Mac_Search_Menu1.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/05/search-menu-in-mac-implementation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUESH4zeyp7ImA9WxJQFUQ.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-5683512156685396104</id><published>2009-05-26T17:24:00.001+05:30</published><updated>2009-05-29T15:13:29.083+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-29T15:13:29.083+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Mac" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><category scheme="http://www.blogger.com/atom/ns#" term="swt" /><title>Search menu in Mac</title><content type="html">In Mac applications, the little search box can have a pull down menu (similar to a View's pull down menu). It can have recent searches, user contributed menu entries, a menu item for clearing the recent searches etc. Here is the search box of Tweetie (the twitter app that I use):&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_hsp14iFkRLs/ShvX5ccsbkI/AAAAAAAADns/vuhs0Z4n25o/s1600-h/Tweetie_Mac_Search_Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_hsp14iFkRLs/ShvX5ccsbkI/AAAAAAAADns/vuhs0Z4n25o/s400/Tweetie_Mac_Search_Menu.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Eclipse by default offers the SWT.SEARCH style which will bring this search box instead of the default text box. But there is no option to add the menu. For today's SWT-Cocoa hack, I tried to enhance the Search box with the search menu and here is the result:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_hsp14iFkRLs/ShvX6NZwCPI/AAAAAAAADn0/o-4tfxj8BNw/s1600-h/SWT_Mac_Search.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_hsp14iFkRLs/ShvX6NZwCPI/AAAAAAAADn0/o-4tfxj8BNw/s400/SWT_Mac_Search.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The code is so ugly that I can't post it in public yet. Will post it with refinements tomorrow.&lt;br /&gt;
&lt;br /&gt;
Update: The implementation is &lt;a href="http://blog.eclipse-tips.com/2009/05/search-menu-in-mac-implementation.html"&gt;available here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-5683512156685396104?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/4NrSzbxY5QQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/5683512156685396104/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=5683512156685396104&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/5683512156685396104?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/5683512156685396104?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/4NrSzbxY5QQ/search-menu-in-mac.html" title="Search menu in Mac" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_hsp14iFkRLs/ShvX5ccsbkI/AAAAAAAADns/vuhs0Z4n25o/s72-c/Tweetie_Mac_Search_Menu.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/05/search-menu-in-mac.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04ESXs8fyp7ImA9WxJQEE8.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-4762226622898038483</id><published>2009-05-23T01:17:00.002+05:30</published><updated>2009-05-23T01:21:48.577+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-23T01:21:48.577+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jface" /><category scheme="http://www.blogger.com/atom/ns#" term="Mac" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><category scheme="http://www.blogger.com/atom/ns#" term="swt" /><title>Badge label on Mac Dock icon</title><content type="html">I'm passionate on both Mac and Eclipse. Although Eclipse runs well on a Mac, its not a marriage made in heaven. Its really hard to get the complete Mac experience with a portable UI tool kit. If you think of features like &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=246165" linkindex="68"&gt;this one&lt;/a&gt;, its actually endless list. One such thing is the badge on the Dock Icon. In Mac, the Dock icon can have a badge - like the number of unread mails in your inbox. How much effort does it takes to add a badge to our RCP mail sample? Not much. Since SWT doesn't have a NSDockTile, we need a NSDockTile class with two methods, one to get the DockTile for the application and the other to set the badge on it (there is an easier way by using the Mac Generator tool, but that will be a patch to SWT itself, which I wanted to avoid):&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java; collapse: true"&gt;/**
 * @author Prakash G.R. (grprakash@gmail.com) 
 * 
 */
@SuppressWarnings("restriction")
public class NSDockTile extends NSResponder {

 private static final int sel_setBadgeLabel_ = OS.sel_registerName("setBadgeLabel:");
 private static final int sel_dockTile_ = OS.sel_registerName("dockTile");
 private static final int sel_display_ = OS.sel_registerName("display");

 public NSDockTile(int id) {
  super(id);
 }

 public static NSDockTile getApplicationDockTile() {
  NSApplication sharedApplication = NSApplication.sharedApplication();
  int id = OS.objc_msgSend(sharedApplication.id, sel_dockTile_);
  NSDockTile dockTile = new NSDockTile(id);
  return dockTile;
 }

 public void setBadgeLabel(String badgeLabel) {
   NSString nsBadgeLabel = NSString.stringWith(badgeLabel);
   OS.objc_msgSend(this.id, sel_setBadgeLabel_, nsBadgeLabel.id);
   OS.objc_msgSend(this.id, sel_display_);
 }
}
&lt;/pre&gt;&lt;br /&gt;
And a two line code to set the badge:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;NSDockTile nsDockTile = NSDockTile.getApplicationDockTile();
nsDockTile.setBadgeLabel("6");
&lt;/pre&gt;&lt;br /&gt;
There you go in the dock icon and in the minimized window:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_hsp14iFkRLs/Shb96m7JMzI/AAAAAAAADnE/h7fEqJoOjTo/s1600-h/RCPMailDock.png" imageanchor="1" linkindex="69" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/Shb96m7JMzI/AAAAAAAADnE/h7fEqJoOjTo/s400/RCPMailDock.png" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/_hsp14iFkRLs/Shb97sot5fI/AAAAAAAADnM/h14qB8Ocvg8/s1600-h/RCPMailWindow.png" imageanchor="1" linkindex="70" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/Shb97sot5fI/AAAAAAAADnM/h14qB8Ocvg8/s400/RCPMailWindow.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
In case you were wondering how the GMail icon for the application is set, here is the code for that:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java;"&gt;ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(iconUrl);
Image image = imageDescriptor.createImage();
NSApplication app = NSApplication.sharedApplication();
app.setApplicationIconImage(image.handle);
&lt;/pre&gt;&lt;br /&gt;
Oh, BTW, I've just started learning Objective C, Cocoa &amp;amp; related things. So stay tuned, you will see more Mac related posts here. Also what is your favourite Mac feature that you are missing in Eclipse?&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-4762226622898038483?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/K3GxaV-btwU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/4762226622898038483/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=4762226622898038483&amp;isPopup=true" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4762226622898038483?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/4762226622898038483?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/K3GxaV-btwU/badge-label-on-mac-dock-icon.html" title="Badge label on Mac Dock icon" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_hsp14iFkRLs/Shb96m7JMzI/AAAAAAAADnE/h7fEqJoOjTo/s72-c/RCPMailDock.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">5</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/05/badge-label-on-mac-dock-icon.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkICRnk5eip7ImA9WxJRFEw.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-9040372474361125777</id><published>2009-05-16T00:37:00.001+05:30</published><updated>2009-05-16T00:39:27.722+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-16T00:39:27.722+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RCP" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Creating a custom Property View</title><content type="html">In an RCP application, you might need a Properties View, which shows only the properties of a specific view or a set of views. But the generic Properties View will show from all the other views that support it. Armed up with the knowledge of &lt;a href="http://blog.eclipse-tips.com/2009/05/how-to-create-pagebookview.html"&gt;how a PageBookView works&lt;/a&gt;, lets see how to hack the Properties View to listen only to a specific view.&lt;br /&gt;
&lt;br /&gt;
The isImportant() method is the one which decides whether to create an IPage for the specific IWorkbenchPart or not. The idea is to override that method and return false for all the workbenchPart that we are not interested in. Lets create the view first:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: xml"&gt;&amp;lt;view
            class="com.eclipse_tips.views.CustomPropertiesView"
            icon="icons/sample.gif"
            id="com.eclipse-tips.views.customePropertiesView"
            name="My Properties View"&amp;gt;
&amp;lt;/view&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
The CustomPropertiesView should extend PropertySheet and override the isImportant():&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;public class CustomPropertiesView extends PropertySheet {

 @Override
 protected boolean isImportant(IWorkbenchPart part) {
  if (part.getSite().getId().equals(IPageLayout.ID_PROJECT_EXPLORER))
   return true;
  return false;
 }
}&lt;/pre&gt;&lt;br /&gt;
In this case, I'm making the view only to respond to Project Explorer and ignore other views. Here is the CustomPropertyView in action:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_hsp14iFkRLs/Sg28Nwe3QSI/AAAAAAAADko/DqnVd7obB1Y/s1600-h/CustomPropertiesProjectExplore.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_hsp14iFkRLs/Sg28Nwe3QSI/AAAAAAAADko/DqnVd7obB1Y/s320/CustomPropertiesProjectExplore.png" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://4.bp.blogspot.com/_hsp14iFkRLs/Sg28VbUXjHI/AAAAAAAADkw/J6Bv2_uIkwU/s1600-h/CustomPropertiesNavigator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_hsp14iFkRLs/Sg28VbUXjHI/AAAAAAAADkw/J6Bv2_uIkwU/s320/CustomPropertiesNavigator.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
If you are on 3.5 or above, you would see the Pin Action in your Custom Properties View. If you don't want the Pin action in your properties view, there is no way to prevent the PropertySheet to adding the action. The action is added to both tool bar and menu in the createControl() method. Only way to get rid of the action is to remove it after the PropertySheet adds it:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;@Override
 public void createPartControl(Composite parent) {
  
  super.createPartControl(parent);
  IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
  IContributionItem[] items = menuManager.getItems();
  for (IContributionItem iContributionItem : items) {
   if(iContributionItem instanceof ActionContributionItem) {
    if(((ActionContributionItem) iContributionItem).getAction() instanceof PinPropertySheetAction) {
     menuManager.remove(iContributionItem);
     break;
    }
   }
  }

  IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
  items = toolBarManager.getItems();
  for (IContributionItem iContributionItem : items) {
   if(iContributionItem instanceof ActionContributionItem) {
    if(((ActionContributionItem) iContributionItem).getAction() instanceof PinPropertySheetAction)) {
     toolBarManager.remove(iContributionItem);
     break;
    }
   }
  }
 }
&lt;/pre&gt;&lt;br /&gt;
And don't forget to override the isPinned() method:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;@Override
 public boolean isPinned() {
  return false;
 }
&lt;/pre&gt;&lt;br /&gt;
There you go:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_hsp14iFkRLs/Sg28gW12WnI/AAAAAAAADk4/Y_bxy5lHIvI/s1600-h/PinActionRemoved.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_hsp14iFkRLs/Sg28gW12WnI/AAAAAAAADk4/Y_bxy5lHIvI/s320/PinActionRemoved.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-9040372474361125777?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/dWaTq8NDkaM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/9040372474361125777/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=9040372474361125777&amp;isPopup=true" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/9040372474361125777?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/9040372474361125777?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/dWaTq8NDkaM/creating-custom-property-view.html" title="Creating a custom Property View" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_hsp14iFkRLs/Sg28Nwe3QSI/AAAAAAAADko/DqnVd7obB1Y/s72-c/CustomPropertiesProjectExplore.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">10</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/05/creating-custom-property-view.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4GRnk5fyp7ImA9WxJRE08.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-5571902850791056235</id><published>2009-05-14T15:22:00.166+05:30</published><updated>2009-05-15T00:52:07.727+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-15T00:52:07.727+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>How to create a PageBookView</title><content type="html">Think of Properties View. It displays the properties of the selected element in the active part. Whenever the selection changes or the active part changes, it tracks them and displays the properties (unless you used the &lt;a href="http://blog.eclipse-tips.com/2008/10/multi-instance-property-view-first-look.html" linkindex="218"&gt;'Pin to selection' feature available from 3.5&lt;/a&gt;) There are many views like this, which update themselves when the active part changes. Outline view, Templates view, GEF Palette view, etc. If you want to create such view, its not a tough job - Eclipse provides you all the basic features in the class PageBookView. All you need is to extend this class and fill the void by implementing the abstract methods. Thats what we are going to see in this tip. The use case is to create a ActivePartTrackerView, which will display the name of the current active workbench part.&lt;br /&gt;
&lt;br /&gt;
First lets create a View:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: xml"&gt;&amp;lt;extension
         point="org.eclipse.ui.views"&amp;gt;
      &amp;lt;view
            class="com.eclipse_tips.views.SelectionView"
            icon="icons/sample.gif"
            id="com.eclipse-tips.views.pagebookview"
            name="Selection Provider View"&amp;gt;
      &amp;lt;/view&amp;gt;
   &amp;lt;/extension&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
The contents of the PageBookView is arranged in pages (IPage). There can be multiple pages, each of them is associated with a corresponding IWorkbenchPart. When the associated part becomes active, the PageBookView automatically switches to the respective page. When a PageBookView is created, it asks for a bootstrap part by calling getBootstrapPart() method. When no bootstrap part is found, it uses a default page. That default page is also shown when there are no pages for the currently active part. Lets start by creating this default page. To do that we need to implement the createDefaultPage() method, which returns the default page. Lets use the MessagePage which simply displays a string.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;@Override
 protected IPage createDefaultPage(PageBook book) {
  MessagePage messagePage = new MessagePage();
  initPage(messagePage);
  messagePage.setMessage("No interested in this part");
  messagePage.createControl(book);
  return messagePage;
 }&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_hsp14iFkRLs/Sgxt208UPZI/AAAAAAAADkE/SR-LI-i_N3Y/s1600-h/PageBookView-defaultPage.png" imageanchor="1" linkindex="219" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_hsp14iFkRLs/Sgxt208UPZI/AAAAAAAADkE/SR-LI-i_N3Y/s320/PageBookView-defaultPage.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now our SelectionView is up and running, except that its showing a static content not creating any IPages for the active parts. Before we create an IPage, how to determine whether to create an IPage for a given IWorkbenchPart or ignore it? Its by the isImportant() method. Lets say, we want to respond only to the parts that are contributed by the Platform UI.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;@Override
 protected boolean isImportant(IWorkbenchPart part) {
  return part.getSite().getPluginId().startsWith("org.eclipse.ui");
 }
&lt;/pre&gt;&lt;br /&gt;
So if a Package Explorer(contributed by JDT) or the Manifest Editor(contributed by PDE) is the active part, then our SelectionView will not create any page and use the default page. If its a TextEditor or Project Explorer, then it will create the page and show it.&lt;br /&gt;
&lt;br /&gt;
To create an IPage for a given part, we need to override the doCreatePage() method. Unlike the createDefaultPage() method this doesn't return a IPage, rather a PageRec. Why? This Page Record stores additional information - the associated workbench part and action bars:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;@Override
 protected PageRec doCreatePage(IWorkbenchPart part) {
  MessagePage messagePage = new MessagePage();
  initPage(messagePage);
  messagePage.setMessage("Page for "+part.getTitle());
  messagePage.createControl(getPageBook());
  return new PageRec(part, messagePage);
 }
&lt;/pre&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_hsp14iFkRLs/SgxuQqhOp7I/AAAAAAAADkM/JtgxVLQy4WI/s1600-h/PageBookView+ProjectExplorer.png" imageanchor="1" linkindex="220" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_hsp14iFkRLs/SgxuQqhOp7I/AAAAAAAADkM/JtgxVLQy4WI/s320/PageBookView+ProjectExplorer.png" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://2.bp.blogspot.com/_hsp14iFkRLs/Sgxuh324AYI/AAAAAAAADkc/j5LUqVwMlPM/s1600-h/PageBookView+TextEditor.png" imageanchor="1" linkindex="221" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_hsp14iFkRLs/Sgxuh324AYI/AAAAAAAADkc/j5LUqVwMlPM/s320/PageBookView+TextEditor.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
When you are switching between the TextEditor and the ProjectExplore view, the PageBookView will track and find the page for the active part and automatically show it. When the page is no longer needed (the associated part is closed), it would call the doDestroyPage(). This is where you would ideally remove any listeners and dispose of the resources.&lt;br /&gt;
&lt;br /&gt;
So the whole class goes here:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java; collapse: true"&gt;package com.eclipse_tips.views;

import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.IPage;
import org.eclipse.ui.part.MessagePage;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.PageBookView;

/**
 * @author Prakash G.R.
 *
 */
public class ActivePartTrackerView extends PageBookView {

 @Override
 protected IPage createDefaultPage(PageBook book) {
  MessagePage messagePage = new MessagePage();
  initPage(messagePage);
  messagePage.setMessage("No interested in this part");
  messagePage.createControl(book);
  return messagePage;
 }

 @Override
 protected PageRec doCreatePage(IWorkbenchPart part) {
  MessagePage messagePage = new MessagePage();
  initPage(messagePage);
  messagePage.setMessage("Page for "+part.getTitle());
  messagePage.createControl(getPageBook());
  return new PageRec(part, messagePage);
 }

 @Override
 protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
  pageRecord.page.dispose();
 }

 @Override
 protected IWorkbenchPart getBootstrapPart() {
  IWorkbenchPage page = getSite().getPage();
  if(page != null) {
   // check whether the active part is important to us
   IWorkbenchPart activePart = page.getActivePart();
   return isImportant(activePart)?activePart:null;
  }
  return null;
 }

 @Override
 protected boolean isImportant(IWorkbenchPart part) {
  return part.getSite().getPluginId().startsWith("org.eclipse.ui");
 }

}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-5571902850791056235?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/dXsIBkgNz3w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/5571902850791056235/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=5571902850791056235&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/5571902850791056235?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/5571902850791056235?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/dXsIBkgNz3w/how-to-create-pagebookview.html" title="How to create a PageBookView" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_hsp14iFkRLs/Sgxt208UPZI/AAAAAAAADkE/SR-LI-i_N3Y/s72-c/PageBookView-defaultPage.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/05/how-to-create-pagebookview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEHQH4-fyp7ImA9WxJREU8.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-3867721587101245330</id><published>2009-05-12T16:29:00.002+05:30</published><updated>2009-05-12T16:40:31.057+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-12T16:40:31.057+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="wizards" /><category scheme="http://www.blogger.com/atom/ns#" term="dialogs" /><category scheme="http://www.blogger.com/atom/ns#" term="Mac" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><category scheme="http://www.blogger.com/atom/ns#" term="swt" /><title>Sheet support in SWT</title><content type="html">For those who have downloaded 3.5 M7 would have seen Sheets support has been added to SWT and Platform UI has used the API wherever applicable. For those who are wondering what a Sheet means, its an eye-candy in Mac. Here is a sample of a MessageDialog shown with and without Sheet style:&lt;br /&gt;
&lt;br /&gt;
&lt;object height="395" width="714"&gt; &lt;param name="movie" value="http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/jingswfplayer.swf"&gt;&lt;/param&gt;&lt;param name="quality" value="high"&gt;&lt;/param&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;/param&gt;&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/FirstFrame.jpg&amp;containerwidth=714&amp;containerheight=395&amp;loaderstyle=jing&amp;content=http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/00000003.swf"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="scale" value="showall"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;param name="base" value="http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/"&gt;&lt;/param&gt;&lt;embed src="http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="714" height="395" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="thumb=http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/FirstFrame.jpg&amp;containerwidth=714&amp;containerheight=395&amp;loaderstyle=jing&amp;content=http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/00000003.swf" allowFullScreen="true" base="http://content.screencast.com/users/grprakash/folders/Jing/media/42a0726e-f51c-44d3-9237-95624768131d/" scale="showall"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;
&lt;br /&gt;
(in case you didn't notice the obvious, I'm back on a Mac :-P)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;So what is a Sheet?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A Sheet is essentially a Dialog, which is tied to a parent window. It acts as a Modal Dialog, so the user cannot perform any operations on a window until the Dialog is dismissed. (He is free to work on other windows) The dialog is&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;always attached with the window until dismissed&lt;/li&gt;
&lt;li&gt;placed in the center of the window&lt;/li&gt;
&lt;li&gt;moves along when the window is moved&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt; To Sheet or not to Sheet?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Use Sheets when the interaction is very short like the question "Is Eclipse a cool product?&amp;nbsp; &lt;yes&gt; &lt;no&gt;". Opening a 15 step Wizard to choose your life partner is not right place to use Sheet.&lt;/no&gt;&lt;/yes&gt;&lt;/li&gt;
&lt;li&gt;&lt;yes&gt;&lt;no&gt;Do not use Sheets where the user might still need to interact with the Window (like copy something from window and paste it in the Sheet). Since Sheets are Window Modal, it doesn't allow the user to interact with the associated Window &lt;br /&gt;
&lt;/no&gt;&lt;/yes&gt;&lt;/li&gt;
&lt;li&gt;Sheets are not Application Modal. So if you want a dialog to be Application Modal, don' use Sheets&lt;/li&gt;
&lt;li&gt;Unlike normal Dialogs, Sheets do not have title. Avoid Sheets where title provides valuable information.&lt;/li&gt;
&lt;li&gt; Do not use nested Sheets (says Apple's UI guidelines)&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;How do I use Sheet?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Simple. Set the SWT.Sheet style to the Shell of the dialog. In case you are using the MessageDialog, pass on the style bit as the last argument to the MessageDialog.open() method&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-3867721587101245330?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/HcKntuxxQKg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/3867721587101245330/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=3867721587101245330&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/3867721587101245330?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/3867721587101245330?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/HcKntuxxQKg/sheet-support-in-swt.html" title="Sheet support in SWT" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/05/sheet-support-in-swt.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkAEQnozfSp7ImA9WxJREU8.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-3809991569368288397</id><published>2009-05-12T14:57:00.002+05:30</published><updated>2009-05-12T15:01:43.485+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-12T15:01:43.485+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Commands" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Commands Part 7: Adding standard commands</title><content type="html">&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;In the earlier installments, we have seen adding our commands to menus and toolbars. But what about the standard menu items like Cut, Copy, Paste etc? We'll see how to add these to a context menu of the Sample View.&lt;br /&gt;
&lt;br /&gt;
Create the Sample View through the PDE's Extension Point Wizard. In the SampleView class, notice these lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #3333ff; font-family: monospace;"&gt;private void hookContextMenu() {&lt;br /&gt;
&lt;br /&gt;
// rest of the code...&lt;br /&gt;
getSite().registerContextMenu(menuMgr, viewer);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private void fillContextMenu(IMenuManager manager) {&lt;br /&gt;
&lt;br /&gt;
//rest of the code&lt;br /&gt;
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));&lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The first one registers this context menu, so that other plugins can contribute their commands to it. The second one adds a separator, which serves as a place holder/location where the contribution goes. So the SampleView is ready to accept the contributions, lets now contribute:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #3333ff; font-family: monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;extension&lt;br /&gt;
point="org.eclipse.ui.menus"&amp;gt;&lt;br /&gt;
&amp;lt;menuContribution&lt;br /&gt;
locationURI="popup:com.eclipse_tips.commands.part7.views.SampleView?after=additions"&amp;gt;&lt;br /&gt;
&amp;lt;command commandId="org.eclipse.ui.edit.cut"/&amp;gt;&lt;br /&gt;
&amp;lt;command commandId="org.eclipse.ui.edit.copy"/&amp;gt;&lt;br /&gt;
&amp;lt;command commandId="org.eclipse.ui.edit.paste"/&amp;gt;&lt;br /&gt;
&amp;lt;/menuContribution&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The id for the context menu, is by default the View's id, and we add our contribution after the separator. We can add any command, either the Platform defined or our own. Result:&lt;br /&gt;
&lt;br /&gt;
&lt;div align="center"&gt;&lt;img alt="" src="http://lh6.ggpht.com/_hsp14iFkRLs/SglA2CzYkuI/AAAAAAAADj8/lf20NWfFSvY/%5BUNSET%5D.png?imgmax=800" /&gt;&lt;/div&gt;&lt;br /&gt;
Now we have the menu items, images, shortcut keys everything in place (you ought to love the command framework :-)), except that the items are not enabled. Its because there is no handler for these commands for the given context. There are multiple ways to contribute the handler, since we are adding this to our view, lets use the activePartId variable:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #3333ff; font-family: monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;extension&lt;br /&gt;
point="org.eclipse.ui.handlers"&amp;gt;&lt;br /&gt;
&amp;lt;handler&lt;br /&gt;
class="com.eclipse_tips.commands.part7.handlers.CutHandler"&lt;br /&gt;
commandId="org.eclipse.ui.edit.cut"&amp;gt;&lt;br /&gt;
&amp;lt;activeWhen&amp;gt;&lt;br /&gt;
&amp;lt;with&lt;br /&gt;
variable="activePartId"&amp;gt;&lt;br /&gt;
&amp;lt;equals&lt;br /&gt;
value="com.eclipse_tips.commands.part7.views.SampleView"&amp;gt;&lt;br /&gt;
&amp;lt;/equals&amp;gt;&lt;br /&gt;
&amp;lt;/with&amp;gt;&lt;br /&gt;
&amp;lt;/activeWhen&amp;gt;&lt;br /&gt;
&amp;lt;/handler&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Other commands also have similar handlers. Now:&lt;br /&gt;
&lt;br /&gt;
&lt;div align="center"&gt;&lt;img alt="" src="http://lh4.ggpht.com/_hsp14iFkRLs/SglA3iQguMI/AAAAAAAADkA/qFQNOd4ytOI/%5BUNSET%5D.png?imgmax=800" /&gt;&lt;/div&gt;&lt;br /&gt;
There you go. In the similar way you can add all the standard commands to any menu/context menu you prefer. Just make sure that you have the handler for the commands with the right activeWhen &amp;amp; enabledWhen expression.&lt;br /&gt;
&lt;br /&gt;
The standard command Ids can be found in the IWorkbenchCommandConstants class (available in 3.5)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="zemanta-pixie"&gt;&lt;img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=eade1cdf-7873-8044-85b6-ccda04833046" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-3809991569368288397?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/9e9sY9JShLY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/3809991569368288397/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=3809991569368288397&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/3809991569368288397?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/3809991569368288397?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/9e9sY9JShLY/commands-part-7-adding-standard.html" title="Commands Part 7: Adding standard commands" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/05/commands-part-7-adding-standard.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4DSHkzeSp7ImA9WxVaEEU.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-648909486460899790</id><published>2009-04-07T11:20:00.001+05:30</published><updated>2009-04-07T11:29:39.781+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-07T11:29:39.781+05:30</app:edited><title>[Off Topic] Thank you!</title><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;When Google Web Tookit was released to the public, I played with it and realized that an Eclipse plug-in could simply few things. Since I didn't find any, I started learning Eclipse plug-in development to create &lt;a href="http://code.google.com/p/cypal-studio" target="_blank"&gt;one&lt;/a&gt;. I've fallen in love with Eclipse and its been a wonderful journey since then. I created this blog to publish the tips I've learnt. Shifted myself from server-side-runtime to IDE. I was the first guy to offer Eclipse Plug-in development training in India. With few like-minded-friends, we even started &lt;a href="http://www.cypal.in" target="_blank"&gt;a company&lt;/a&gt; to do this training. The clientele includes several small companies and big companies as well. When IBM extended the Eclipse team in Asia, I was the first hire and moved to Eclipse Platform UI team. Last week my &lt;a href="http://dev.eclipse.org/mhonarc/lists/platform-ui-dev/msg04150.html" target="_blank"&gt;committer election&lt;/a&gt; successfully concluded and I've become a &lt;a href="http://dev.eclipse.org/mhonarc/lists/platform-ui-dev/msg04168.html" target="_blank"&gt;committer now&lt;/a&gt;! Its one of my happiest moments and this blog has been partially responsible for all of this. I've learnt so many &lt;a href="http://blog.eclipse-tips.com/2008/08/adding-color-and-font-preferences.html" target="_blank"&gt;things&lt;/a&gt; &lt;a href="http://blog.eclipse-tips.com/2008/07/selection-dialogs-in-eclipse.html" target="_blank"&gt;just&lt;/a&gt; &lt;a href="http://blog.eclipse-tips.com/2008/05/single-column-tableviewer-and.html" target="_blank"&gt;for&lt;/a&gt; &lt;a href="http://blog.eclipse-tips.com/2008/01/how-to-add-trayitem-in-eclipse-rcp.html" target="_blank"&gt;the&lt;/a&gt; &lt;a href="http://blog.eclipse-tips.com/2008/10/extending-filtereditemsselectiondialog.html" target="_blank"&gt;sake&lt;/a&gt;&amp;#160;&lt;a href="http://blog.eclipse-tips.com/2008/05/how-to-add-new-resource-to-working-sets.html" target="_blank"&gt;of&lt;/a&gt; &lt;a href="http://blog.eclipse-tips.com/2008/10/multi-instance-property-view-first-look.html" target="_blank"&gt;publishing&lt;/a&gt; &lt;a href="http://blog.eclipse-tips.com/2008/11/creating-custom-marker-view.html" target="_blank"&gt;tips&lt;/a&gt;.&lt;/p&gt;    &lt;p&gt;I really thank all of the readers of this blog. Your comments, emails, queries kept me going. Thanks!&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-648909486460899790?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/4ET4MSHqJBI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/648909486460899790/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=648909486460899790&amp;isPopup=true" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/648909486460899790?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/648909486460899790?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/4ET4MSHqJBI/off-topic-thank-you.html" title="[Off Topic] Thank you!" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">10</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/04/off-topic-thank-you.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cCQXgyeSp7ImA9WxVUE0g.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-7478856046198898152</id><published>2009-03-18T12:21:00.001+05:30</published><updated>2009-03-18T12:21:00.691+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-18T12:21:00.691+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Reviews" /><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="search" /><category scheme="http://www.blogger.com/atom/ns#" term="Bugs" /><title>Searching Eclipse Bugzilla</title><content type="html">&lt;p&gt;There are many times you would want to search for a bug, say with a class name / stack trace. Using Bugzilla for this kind of searches is really painful. First the UI that it presents is not an elegant one (esp. if you are used to one single text box of Google) and then its very slow. It would have been much better if our Bugzilla allows Search Engines to index, but its still a &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=214067" target="_blank"&gt;work in progress&lt;/a&gt;. Meanwhile, &lt;a href="http://wagenknecht.org" target="_blank"&gt;Gunnar Wagenknecht&lt;/a&gt; has come up with &lt;a href="http://eclipsebugsearch.labs.ageto.net" target="_blank"&gt;an incubation project that allows searching the bugzilla&lt;/a&gt;. It just features one text box as opposed to the Bugzilla:&lt;/p&gt;  &lt;p&gt;&lt;img height="133" alt="Eclipse Bug Search" src="http://lh6.ggpht.com/_hsp14iFkRLs/ScCZlGaFxdI/AAAAAAAADf0/iMhX1CM4g6Y/image%5B12%5D.png?imgmax=800" width="721" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;and you can type in the Bug Number or key words (like 'About Dialog') or a class name and search. Results are usually within a second. Whats even more nice is the right side bar, which has a tag-clouds-style attributes of the bug:&lt;/p&gt;  &lt;p&gt;&lt;img height="484" alt="Eclipse Bug Search Tags" src="http://lh3.ggpht.com/_hsp14iFkRLs/ScCZr6J_R0I/AAAAAAAADf4/I9W-kDqPVuE/image%5B17%5D.png?imgmax=800" width="223" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Click on the items and it will filter your results accordingly:&lt;/p&gt;  &lt;p&gt;&lt;img height="375" alt="Eclipse Bug Search Filters" src="http://lh4.ggpht.com/_hsp14iFkRLs/ScCZzkHJFjI/AAAAAAAADf8/6enIBnjwxtE/image%5B27%5D.png?imgmax=800" width="723" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;If you use Bugzilla frequently, this is very effective tool and I strongly recommend you to try it. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-7478856046198898152?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/dEhmsgcfmrs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/7478856046198898152/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=7478856046198898152&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7478856046198898152?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7478856046198898152?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/dEhmsgcfmrs/searching-eclipse-bugzilla.html" title="Searching Eclipse Bugzilla" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/03/searching-eclipse-bugzilla.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MCQnYzeSp7ImA9WxVUEE4.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-6790319963395593191</id><published>2009-03-14T17:10:00.003+05:30</published><updated>2009-03-14T17:21:03.881+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-14T17:21:03.881+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PDE" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Do you need PDE custom attribute?</title><content type="html">&lt;p&gt;One of the features that I was very eagerly expecting in 3.5 M6 is PDE's Custom Attribute. As of now, the Manifest editor has very limited ways of editing an attribute in the plug-in. It could be either String/boolean/Java/Resource/Id. What if PDE provides an extension point and you could plug in your own controls in the editor? Well thats exactly the Custom Attribute feature that I'm talking about. I've been playing it with for a while, and its awesome. The possibilities are really endless and here are some samples:&lt;/p&gt;&lt;p&gt;Pick your favourite color:&lt;/p&gt;&lt;p&gt;&lt;img height="190" alt="Color Picker" src="http://lh4.ggpht.com/_hsp14iFkRLs/SbuW4Qw7cXI/AAAAAAAADfY/LCNlP2g5gFo/image47.png?imgmax=800" width="331" border="0" /&gt;&amp;#160; &lt;/p&gt;&lt;p&gt;Select the SWT Platforms you support:&lt;/p&gt;&lt;p&gt;&lt;img height="189" alt="SWT Platform" src="http://lh3.ggpht.com/_hsp14iFkRLs/SbuXFccyIXI/AAAAAAAADfc/Fx0fI7pztEw/image28.png?imgmax=800" width="390" border="0" /&gt; &lt;/p&gt;&lt;p&gt;Choose an icon from your plug-in or shared images:&lt;/p&gt;&lt;p&gt;&lt;img height="542" alt="Image Chooser" src="http://lh6.ggpht.com/_hsp14iFkRLs/SbuXQZcBNQI/AAAAAAAADfg/YPnuEzC6ZiU/image25.png?imgmax=800" width="536" border="0" /&gt; &lt;/p&gt;&lt;p&gt;Or the best I've seen - define the location URI for a menu/toolbar contribution:&lt;/p&gt;&lt;p&gt;&lt;img height="219" alt="Location URI" src="http://lh6.ggpht.com/_hsp14iFkRLs/SbuXcPuuB1I/AAAAAAAADfk/9a3Yj9pxS4w/image22.png?imgmax=800" width="538" border="0" /&gt; &lt;/p&gt;&lt;p&gt;You can even provide auto complete in the text editor tab:&lt;/p&gt;&lt;p&gt;&lt;img height="311" alt="" src="http://lh6.ggpht.com/_hsp14iFkRLs/SbuXm887wDI/AAAAAAAADfo/l_V7E2MIWns/image39.png?imgmax=800" width="556" border="0" /&gt; &lt;/p&gt;&lt;p&gt;This feature is not just cool one, but also a useful one and will boost productivity. Its very unfortunate that it slipped this milestone (M6) due to work load. Its even unfortunate that beyond M6 no API/extension point can be added. What this means, we have to wait till 3.6 (released in 2010) to get this feature. Or somehow convince *everyone* that its should be pushed into 3.5 itself. &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=227055#c44" target="_blank"&gt;Martin says&lt;/a&gt; &amp;quot;that is not impossible&amp;quot;,&amp;#160; and &lt;a href="http://wiki.eclipse.org/Eclipse/PMC" target="_blank"&gt;the way is&lt;/a&gt;: &amp;quot;to go through the process (e-mail and public discussion on eclipse-pmc list)&amp;quot;. As everyone is busy with EclipseCon, I think that this process would start after EclipseCon.&lt;/p&gt;&lt;p&gt;Meanwhile, if you like this feature and want it in 3.5 itself, why don't you &lt;a href="https://bugs.eclipse.org/bugs/votes.cgi?action=show_user&amp;bug_id=227055#vote_227055" target="_blank"&gt;vote for this bug&lt;/a&gt;? I'm sure community's voice will be heard. If this gets into next milestone, I'll promise that I'll write a tip on how to use this extension point :-)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-6790319963395593191?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/wUxUgE4jpKk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/6790319963395593191/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=6790319963395593191&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/6790319963395593191?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/6790319963395593191?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/wUxUgE4jpKk/do-you-need-pde-custom-attribute.html" title="Do you need PDE custom attribute?" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/03/do-you-need-pde-custom-attribute.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMBQn05eip7ImA9WxVVF0U.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-2799990864235728024</id><published>2009-03-11T20:27:00.001+05:30</published><updated>2009-03-11T20:27:33.322+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-11T20:27:33.322+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="search" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Eclipse Search - now with an Eclipse Plugin!</title><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Searching for Eclipse related material in Google is a painful task. It shows up lots of irrelevant results. With &lt;a href="http://blog.eclipse-tips.com/2008/02/eclipse-search.html" target="_blank"&gt;Eclipse Search&lt;/a&gt;, this was pretty much eliminated. It searches only our Eclipse related sites and provides relevant results. The results are even categorized into Blogs, Source, etc. To make things simple, I added a &lt;a href="http://blog.eclipse-tips.com/2008/07/eclipse-search-now-with-firefox-plugin.html" target="_blank"&gt;search plugin for the browsers&lt;/a&gt;. This helps to search help right from your search box of your browser. Still this has one problem - you need a browser to search. You need to copy &amp;amp; paste the class/method name from your Eclipse to Browser and start searching. Switch back to Eclipse and resume the work. Now this can be simplified by a search plugin for Eclipse.&lt;/p&gt;  &lt;p&gt;&lt;img height="454" alt="Eclipse Search" src="http://lh5.ggpht.com/_hsp14iFkRLs/SbfRA84aMCI/AAAAAAAADfE/_3iJ6Xt388U/image17.png?imgmax=800" width="527" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;When you open Search Page, you can see an Eclipse Search tab there. You don't even need to copy a text for searching - just a selection would do. The plug-in takes the current selection as the initial input. You can select the labels you want to search for and hit Enter. You get the results right there inside Eclipse itself:&lt;/p&gt;  &lt;p&gt;&lt;img height="521" alt="Eclipse Search - Results" src="http://lh6.ggpht.com/_hsp14iFkRLs/SbfRJArWVdI/AAAAAAAADfI/PPt3c2RfANs/image21.png?imgmax=800" width="835" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The recent searches are available in the History Menu:&lt;/p&gt;  &lt;p&gt;&lt;img height="160" alt="Eclipse Search - History" src="http://lh3.ggpht.com/_hsp14iFkRLs/SbfRPvHN20I/AAAAAAAADfM/9vAuUrnsqv0/image24.png?imgmax=800" width="272" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;And in case want to switch to a browser from the current results:&lt;/p&gt;  &lt;p&gt;&lt;img height="101" alt="Eclipse Search - New Browser" src="http://lh4.ggpht.com/_hsp14iFkRLs/SbfRWAP4WEI/AAAAAAAADfQ/vXTjutFnyaQ/image27.png?imgmax=800" width="288" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Me and few of my team mates are using it regularly and find it very handy. &lt;a href="http://cypal-eclipse-utils.googlecode.com/files/in.cypal.eclipse.tools.search_1.0.0.200902281330.jar" target="_blank"&gt;Download&lt;/a&gt; and try it yourself.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-2799990864235728024?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/GoGkTO27luk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/2799990864235728024/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=2799990864235728024&amp;isPopup=true" title="14 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/2799990864235728024?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/2799990864235728024?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/GoGkTO27luk/eclipse-search-now-with-eclipse-plugin.html" title="Eclipse Search - now with an Eclipse Plugin!" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">14</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/03/eclipse-search-now-with-eclipse-plugin.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4AQn09eyp7ImA9WxVVFUw.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-5440090601938186194</id><published>2009-03-08T18:56:00.001+05:30</published><updated>2009-03-08T18:59:03.363+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-08T18:59:03.363+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jface" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Commands" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Commands Part 6: Toggle &amp; Radio menu contributions</title><content type="html">&lt;p&gt;In the previous parts of the series, we saw how Commands contribute to push style menu items. But commands allow you to contribute menu items with 'toggle' and 'radio' style as well. Let us see how to contribute the familiar &amp;quot;Format&amp;quot; menu thru Commands:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_hsp14iFkRLs/SbPHVVU91pI/AAAAAAAADe8/6m6nEl85xV4/image5.png?imgmax=800"&gt;&lt;img height="149" alt="image" src="http://lh5.ggpht.com/_hsp14iFkRLs/SbPHgbSogyI/AAAAAAAADfA/aV1vuAGQOqg/image_thumb1.png?imgmax=800" width="137" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;First we will look at the toggle style menu contribution. Commands can have states associated with it. A state id known by its id and it can have any value, which is stored in a subclass of org.eclipse.core.commands.State. To know whether a command is checked or not, the Command Framework looks for a state with the id 'org.eclipse.ui.commands.toggleState'. Lets specify the default checked state of Bold to true and Italic to false:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;&amp;lt;command      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; defaultHandler=&amp;quot;com.eclipse_tips.commandstate.BoldHandler&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;com.eclipse-tips.commandState.boldCommand&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;Bold&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;state       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; class=&amp;quot;org.eclipse.ui.handlers.RegistryToggleState:true&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;org.eclipse.ui.commands.toggleState&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;/state&amp;gt;       &lt;br /&gt;&amp;lt;/command&amp;gt;       &lt;br /&gt;&amp;lt;command       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; defaultHandler=&amp;quot;com.eclipse_tips.commandstate.ItalicHandler&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;com.eclipse-tips.commandState.italicCommand&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;Italic&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;state       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; class=&amp;quot;org.eclipse.ui.handlers.RegistryToggleState:false&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;org.eclipse.ui.commands.toggleState&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;/state&amp;gt;       &lt;br /&gt;&amp;lt;/command&amp;gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The Framework expects a Boolean value from the state. It doesn't care about which class that holds the state. So why should we use the RegistryToggleState instead of our own state class? Two reasons:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;It implements IExecutableExtension. So you can specify the default values in the plugin.xml as I've done above. &lt;/li&gt;    &lt;li&gt;It extends PersistentState, so it can remember the value between Eclipse sessions. So if the user had checked/unchecked the menu, restarts Eclipse, he will get the same state as he left before - all this, you get without even your plugin being loaded. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;So how should the handler work for this command?&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;public Object execute(ExecutionEvent event) throws ExecutionException {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Command command = event.getCommand();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; boolean oldValue = HandlerUtil.toggleCommandState(command);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // use the old value and perform the operation &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;&amp;#160;&amp;#160;&amp;#160; return null;      &lt;br /&gt;}&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;Basically, its the Handler's responsibility to update the Command's state. The HandlerUtil has a convenient method which toggles the state and gives you the old value of the state. You can use the value to perform the operation.&lt;/p&gt;  &lt;p&gt;The radio state is also similar, which expects the state with a predefined id. Since the same command is contributed for various option, its should be a parameterized command. The id of the parameter which denotes the radio state is also predefined:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;&amp;lt;command      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; defaultHandler=&amp;quot;com.eclipse_tips.commandstate.AlignHandler&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;com.eclipse-tips.commandState.alignCommand&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;Align Command&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;commandParameter       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;org.eclipse.ui.commands.radioStateParameter&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;State&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; optional=&amp;quot;false&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;/commandParameter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;state       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; class=&amp;quot;org.eclipse.ui.handlers.RadioState:left&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;org.eclipse.ui.commands.radioState&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;/state&amp;gt;       &lt;br /&gt;&amp;lt;/command&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Just like toggle state, the state must have the id and the class could be anything that stores the value as String. The RadioState class provides initializing from plugin.xml and also persists the value across sessions.&lt;/p&gt;  &lt;p&gt;The menu contribution would specify the parameter value:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;&amp;lt;menuContribution      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; locationURI=&amp;quot;menu:org.eclipse.ui.main.menu?after=additions&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;menu       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; label=&amp;quot;Format&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ... other contributions here       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;command       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; commandId=&amp;quot;com.eclipse-tips.commandState.alignCommand&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; label=&amp;quot;Align Left&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; style=&amp;quot;radio&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;parameter       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;org.eclipse.ui.commands.radioStateParameter&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; value=&amp;quot;left&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/parameter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/command&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;command       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; commandId=&amp;quot;com.eclipse-tips.commandState.alignCommand&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; label=&amp;quot;Align Center&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; style=&amp;quot;radio&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;parameter       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;org.eclipse.ui.commands.radioStateParameter&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; value=&amp;quot;center&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/parameter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/command&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;command       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; commandId=&amp;quot;com.eclipse-tips.commandState.alignCommand&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; label=&amp;quot;Align Right&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; style=&amp;quot;radio&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;parameter       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;org.eclipse.ui.commands.radioStateParameter&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; value=&amp;quot;right&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/parameter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/command&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;/menu&amp;gt;       &lt;br /&gt;&amp;lt;/menuContribution&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The Command Framework understands this parameter and sets the UI contributions according to this value. Again its the handler's job to set the correct state from the command's parameter during execution. You have helper methods in the HandlerUtil to perform this:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;public Object execute(ExecutionEvent event) throws ExecutionException {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if(HandlerUtil.matchesRadioState(event))       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return null; // we are already in the updated state - do nothing       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; String currentState = event.getParameter(RadioState.PARAMETER_ID);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // perform task for current state       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if(currentState.equals(&amp;quot;left&amp;quot;))       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // perform left alignment       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; else if(currentState.equals(&amp;quot;center&amp;quot;))       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // perform center alignment       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // and so on ...       &lt;br /&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // and finally update the current state       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; HandlerUtil.updateRadioState(event.getCommand(), currentState);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;&amp;#160;&amp;#160;&amp;#160; return null;      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;strong&gt;Bonus:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Q: I want the initial value always loaded from the plugin.xml, the state should not be remembered between sessions. Should I write my own State class?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;A: Not necessary. You can specify both the default value of the state and whether to persist or not in the plugin.xml itself:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#000080" size="2"&gt;&amp;lt;command      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; defaultHandler=&amp;quot;com.eclipse_tips.commandstate.AlignHandler&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;com.eclipse-tips.commandState.alignCommand&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;Align Command&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;commandParameter       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;org.eclipse.ui.commands.radioStateParameter&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;State&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; optional=&amp;quot;false&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;/commandParameter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;state       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; id=&amp;quot;org.eclipse.ui.commands.radioState&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;class       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; class=&amp;quot;org.eclipse.ui.handlers.RadioState&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;parameter       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;default&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; value=&amp;quot;left&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/parameter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;parameter       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;persisted&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; value=&amp;quot;false&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/parameter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/class&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;/state&amp;gt;       &lt;br /&gt;&amp;lt;/command&amp;gt;&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;This applies for toggle state as well.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Q: I want to know the state of the command elsewhere in the code. How do I get it?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;A: Just use Command.getState(&amp;lt;state id&amp;gt;).getValue(). The state ids are available as constants at RegistryToggleState.STATE_ID and RadioState.STATE_ID&lt;/p&gt;  &lt;p&gt;My patch for this feature has just been checked in and should be available from 3.5 M6 onwards. If you are curious, pick up a recent Nightly build and play with this.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-5440090601938186194?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/yunJAX8qIFU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/5440090601938186194/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=5440090601938186194&amp;isPopup=true" title="25 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/5440090601938186194?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/5440090601938186194?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/yunJAX8qIFU/commands-part-6-toggle-radio-menu.html" title="Commands Part 6: Toggle &amp;amp; Radio menu contributions" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">25</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/03/commands-part-6-toggle-radio-menu.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MGR3s9eCp7ImA9WxVWFUs.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-7464270251242389085</id><published>2009-02-25T16:30:00.003+05:30</published><updated>2009-02-25T17:00:26.560+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-25T17:00:26.560+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Reviews" /><category scheme="http://www.blogger.com/atom/ns#" term="plugins" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><title>WireframeSketcher - Review and free licenses</title><content type="html">A picture is worth of 1000 words. That is why I have a habit of creating mockups/prototypes of UI before creating the real ones. There are umpteen number of tools available in the market, but I'm comfortable with plain old paper &amp;amp; pencil. Mostly because I don't need complex tools and partly because if I convert the price from Dollars to Rupees it would leave a bug hole in my wallet. Add to that I use Mac (my personal laptop), Windows (my official laptop) and Linux (my spare desktop). It is hard for me to find a simple tool that would work on all OS and still available for a cheaper price. To end my worries, here is &lt;a href="http://wireframesketcher.com/" target="_blank"&gt;WireframeSketcher&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Its an Eclipse plugin, so it works perfectly on all the platforms. Lets talk about simplicity.&lt;br /&gt;
The tool is as simple as it gets. The editor works on a .screen file, which can be kept under any project. In the editor, you have a drawing canvas and a palette with the most commonly used UI widgets. Drag and drop the elements you need from the palette to the canvas. You can group elements, adjust the Z-Order, move or resize them. Sounds like a perfect fit for me. Here is a screen shot of the product in action:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://lh4.ggpht.com/_hsp14iFkRLs/SaUkS8p76xI/AAAAAAAADd0/RG38h9FqfRw/image6.png?imgmax=800"&gt;&lt;img alt="WireframeSketcher" border="0" height="361" src="http://lh4.ggpht.com/_hsp14iFkRLs/SaUkaDtKhuI/AAAAAAAADd4/wRRgLVGqFlU/image_thumb6.png?imgmax=800" width="600" /&gt;&lt;/a&gt;&lt;br /&gt;
I usually create the mockup and then create the actual UI. For a change, I tried creating a mockup of the existing UI. The mimicked picture:&lt;br /&gt;
&lt;a href="http://lh4.ggpht.com/_hsp14iFkRLs/SaUkis-MVWI/AAAAAAAADd8/l8wL3JSgPm4/image33.png?imgmax=800"&gt;&lt;img alt="WireframeSketcher" border="0" height="347" src="http://lh5.ggpht.com/_hsp14iFkRLs/SaUktG63vZI/AAAAAAAADeA/A-pbvsteTrI/image3_thumb2.png?imgmax=800" width="600" /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Thats a pretty rough sketch. But creating the above took me less than 5 mins! I can spend a little more time and make it look more like the original picture, but I think this conveys the message. I wish it supports more options like generating SWT/Swing code from the mock up. How cool that would be? Awesome, but that would would deviate from its mail goal - creating mockups. I think it will compromise on the simplicity as well.&lt;br /&gt;
&lt;br /&gt;
I wish I could write more about this tool, but honestly there is nothing like you working on this. You don't have to go thru a a big manual. Just create a new .screen file and start using it. Period.&lt;br /&gt;
&lt;br /&gt;
Overall, its a neat and simple tool that helps you to create mockups. If you are looking for a such a tool to prototype the UI and explain it to the customer/boss and willing to live with minor nuances, then this tool is for you. If you are looking for more advanced one with complete control over the UI, you have to look elsewhere.&lt;br /&gt;
&lt;br /&gt;
Now lets come to the last part - cost of it. Right now there is no commercial version available. Evaluation licenses are available to play around with the tool. If you want a full free license, here is a chance exclusively for the readers of this blog.&lt;br /&gt;
&lt;br /&gt;
All you have to do is to post a comment answering this simple question: "What are the pros of UI prototyping?". Remember to enter your comment on or before March 3rd, 2009 and your comment should have your name and email id. &lt;a href="http://wireframesketcher.com/about.html" target="_blank"&gt;Peter&lt;/a&gt; will be selecting 5 random answers and will be giving out licenses to them.&lt;br /&gt;
&lt;br /&gt;
(In case you don't want to expose your email id in public, just leave the comment and send your name &amp;amp; email id to my email id: &lt;a href="mailto:grprakash@gmail.com"&gt;grprakash@gmail.com&lt;/a&gt;)&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-7464270251242389085?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/9FefdcUq8dE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/7464270251242389085/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=7464270251242389085&amp;isPopup=true" title="16 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7464270251242389085?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7464270251242389085?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/9FefdcUq8dE/wireframesketcher-review-and-free.html" title="WireframeSketcher - Review and free licenses" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">16</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/02/wireframesketcher-review-and-free.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8MQ3o6fCp7ImA9WxVVFUU.&quot;"><id>tag:blogger.com,1999:blog-1557780184357927241.post-7022191035441814296</id><published>2009-02-23T13:49:00.003+05:30</published><updated>2009-03-09T13:18:02.414+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-09T13:18:02.414+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RCP" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="guidelines" /><category scheme="http://www.blogger.com/atom/ns#" term="Commands" /><category scheme="http://www.blogger.com/atom/ns#" term="workbench" /><title>Commands Part 5: Authentication in RCP applications</title><content type="html">One of the frequently asked questions on Command Framework is 'how to dynamically update a command?' I thought I'll couple the answer with implementing ISourceProvider and explain it with a usecase: Authentication in RCP applications. Most of the RCP applications I've seen, needs authentication. Obviously it would need a Login/Logout menu items and other user related options. This can be accomplished in many ways, and I'm going to show you how to do it with Command Framework.&lt;br /&gt;
Lets do it in step by step.&lt;br /&gt;
&lt;h2&gt;Defining the session state thru ISourceProvider:&lt;/h2&gt;First, we need to store the session state in a variable. When we say variable in Command Framework, its not a public final static String. It is something that you can use it in the visibleWhen, activeWhen and enabledWhen expressions. The variable has to be provided thru a ISourceProvider:&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;lt;extension      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point="org.eclipse.ui.services"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;sourceProvider       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; provider="com.eclipse_tips.rcp.app.SessionSourceProvider"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;variable       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="com.eclipse-tips.rcp.app.sessionState"       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; priorityLevel="workbench"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/variable&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/sourceProvider&amp;gt;       &lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;/span&gt;&lt;br /&gt;
A ISourceProvider can provide the state of multiple variables. However, our source provider will give the value of only one variable - 'com.eclipse-tips.rcp.app.sessionState'. The values of this variable would be either 'loggedIn' or 'loggedOut'. The list of values cannot be defined thru the extension, so this is up to you to define it, publish it and use it.&lt;br /&gt;
In the extension, you can see the priorityLevel attribute. This is used by the IHandlerService to determine which handler is active for a given command and its defined in the org.eclipse.ui.ISources interface. See my earlier tip on Command Framework for more explanation on this priority attribute.&lt;br /&gt;
The class should either implement ISourceProvider or extend AbstractSourceProvider. The preferred way is extending, so we'll do it that way:&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;public class SessionSourceProvider extends AbstractSourceProvider { &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public final static String SESSION_STATE = "com.eclipse-tips.rcp.app.sessionState";      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; private final static String LOGGED_IN = "loggedIn";       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; private final static String LOGGED_OUT = "loggedOut";       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; boolean loggedIn;       &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String[] getProvidedSourceNames() {       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new String[] {SESSION_STATE};       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public Map&amp;lt;String, String&amp;gt; getCurrentState() {       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Map&amp;lt;String, String&amp;gt; currentState = new HashMap&amp;lt;String, String&amp;gt;(1);       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String currentState =&amp;nbsp; loggedIn?LOGGED_IN:LOGGED_OUT;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentState.put(SESSION_STATE, currentState);       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return currentState;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override    &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public void dispose() {} &lt;/span&gt;  &lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void setLoggedIn(boolean loggedIn) { &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(this.loggedIn == loggedIn)      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return; // no change &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.loggedIn = loggedIn;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String currentState =&amp;nbsp; loggedIn?LOGGED_IN:LOGGED_OUT;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fireSourceChanged(ISources.WORKBENCH, SESSION_STATE, currentState);       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }       &lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
The first method is simple. As I mentioned earlier, a source provider can provider the state of multiple variables. The list of the variables (source names) is returned in the call. The second method is called to get the current state. The variable:value pairs are put in a map and returned back to the caller. The third method dispose is a no-op method for us. These three methods completes the API contract, but we have added one more method, where the value is updated to the source provider itself. So whenever a Login/Logout happens we need to call this method. This method fires the sourceChanged event, so that all the listeners can update accordingly. &lt;br /&gt;
When the sourceChanged event is fired, the status of the Command Handlers which has activeWhen or enabledWhen expressions with this variable re-evaluated with the new value of the variable. This holds good for visibleWhen expressions of the Commands as well. So if you want to show/enable a contribution item only when the user has logged in, you can use this variable like:&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;lt;extension      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point="org.eclipse.ui.menus"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;menuContribution       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; locationURI="menu:file?after=additions"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;command       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; commandId="org.eclipse.ui.window.preferences"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;visibleWhen&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;with       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable="com.eclipse-tips.rcp.app.sessionState"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;equals       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value="loggedIn"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/equals&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/with&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/visibleWhen&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/command&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/menuContribution&amp;gt;       &lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;/span&gt; &lt;br /&gt;
Now the File-&amp;gt;Preferences will be visible only when the user has logged in. &lt;br /&gt;
&lt;h2&gt;Updating the state:&lt;/h2&gt;Now that we have the source provider and the menu items that are dynamically enabled/disabled or shown/hidden according to the sessionState, the problem is how to we update the state?&lt;br /&gt;
Elsewhere, when a command is executed for Login/Logout, we have to make a call to SessionSourceProvider.setLoggedIn() method. But how do we get hold of the instance of the SessionSourceProvider? This is where the ISourceProviderService comes into picture. This service has a getSourceProvider() method, where if you give the variable name, it will give the corresponding source provider. The next obvious question would be where to get the implementation of this service? Not this service, for any service, you can use IServiceLocator to get the implementation and fortunately the IWorkbenchWindow implements this service. So when we execute the Login/Logout command:&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;// get the window (which is a IServiceLocator)      &lt;br /&gt;
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);       &lt;br /&gt;
// get the service       &lt;br /&gt;
ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);       &lt;br /&gt;
// get our source provider by querying by the variable name       &lt;br /&gt;
SessionSourceProvider sessionSourceProvider = (SessionSourceProvider) service.getSourceProvider(SessionSourceProvider.SESSION_STATE);       &lt;br /&gt;
// set the value       &lt;br /&gt;
sessionSourceProvider.setLoggedIn(isSessionActive);&lt;/span&gt; &lt;br /&gt;
&lt;h2&gt;Dynamically updating the Login/Logout command:&lt;/h2&gt;The Login and Logout commands are mutually exclusive. When one appears the other won't. So you can have two different commands and use the visibleWhen with our sessionState variable to show/hide them. The other way is to have one command and update the text of the command according to the state. The first way is very similar to the Preference command that is explained above, so let me explain the second way here:&lt;br /&gt;
The idea is to define a single command and two handlers:&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;lt;extension      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point="org.eclipse.ui.commands"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;command       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id="com.eclipse-tips.rcp.app.sessionCommand"       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Session Command"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/command&amp;gt;       &lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;lt;extension      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point="org.eclipse.ui.handlers"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;handler       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class="com.eclipse_tips.rcp.app.handlers.LoginHandler"       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; commandId="com.eclipse-tips.rcp.app.sessionCommand"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activeWhen&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;with       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable="com.eclipse-tips.rcp.app.sessionState"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;equals       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value="loggedOut"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/equals&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/with&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/activeWhen&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/handler&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;handler       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class="com.eclipse_tips.rcp.app.handlers.LogoutHandler"       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; commandId="com.eclipse-tips.rcp.app.sessionCommand"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activeWhen&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;with       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable="com.eclipse-tips.rcp.app.sessionState"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;equals       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value="loggedIn"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/equals&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/with&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/activeWhen&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/handler&amp;gt;       &lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;lt;extension      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point="org.eclipse.ui.menus"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;menuContribution       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; locationURI="menu:file?before=quit"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;command       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; commandId="com.eclipse-tips.rcp.app.sessionCommand"       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style="push"&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/command&amp;gt;       &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/menuContribution&amp;gt;       &lt;br /&gt;
&amp;lt;/extension&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
So the first handler, LoginHandler will be active when the user is logged out and the LogoutHandler will be active when the user is logged in. Both the handlers after performing their respective actions will notify the SessionSourceProvider, but how do we change the menu text? This happens thru IElementUpdater. When a handler implements this interface, it can update the associated contributions. When I say update, it means the text, tooltip, image etc. So the LoginHandler would look like:&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;public class LoginHandler extends AbstractHandler implements IElementUpdater { &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public Object execute(ExecutionEvent event) throws ExecutionException {       &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // perform login here ...       &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SessionSourceProvider sessionSourceProvider = (SessionSourceProvider) service.getSourceProvider(SessionSourceProvider.SESSION_STATE);       &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // update the source provider       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sessionSourceProvider.setLoggedIn(true); &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return null;      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override      &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public void updateElement(UIElement element, Map parameters) {       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; element.setText("Login");       &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;}&lt;/span&gt;&lt;br /&gt;
The LogoutHandler also will have a similar code. Remember its not a mandatory thing to have multiple handlers to update the command dynamically. You can do it even with single handler as well.&lt;br /&gt;
One last piece, the Command Framework will call the updateElement() method only when the value of the variables in the *when expression is changed. So in other places where you want to update a command when no variable change has occurred, you need to use the ICommandService:&lt;br /&gt;
&lt;span style="color: navy; font-family: Courier New; font-size: small;"&gt;ICommandService commandService = (ICommandService.class)serviceLocator.getService(ICommandService.class);      &lt;br /&gt;
commandService.refreshElements(commandId, null);&lt;/span&gt;&lt;br /&gt;
&lt;p&gt;See also:&lt;/p&gt;&lt;p&gt;Part 1: &lt;a href="http://blog.eclipse-tips.com/2009/01/commands-part-1-actions-vs-commands.html" target="_blank"&gt;Actions Vs Commands&lt;/a&gt;     &lt;br /&gt;
Part 2: &lt;a href="http://blog.eclipse-tips.com/2009/01/commands-part-2-selection-and.html" target="_blank"&gt;Selection and Enablement of Handlers&lt;/a&gt;     &lt;br /&gt;
Part 3: &lt;a href="http://blog.eclipse-tips.com/2008/12/commands-part-3-parameters-for-commands.html" target="_blank"&gt;Parameters for Commands&lt;/a&gt;&lt;br /&gt;
Part 4: &lt;a href="http://blog.eclipse-tips.com/2009/01/commands-part-4-misc-items.html"&gt;Misc items ...&lt;/a&gt;&lt;br /&gt;
Part 6: &lt;a href="http://blog.eclipse-tips.com/2009/03/commands-part-6-toggle-radio-menu.html"&gt;'toggle' &amp; 'radio' style menu contribution&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;p style="border: 1px solid rgb(198, 198, 198); padding: 10px; color: rgb(51, 51, 51); font-family: 'Lucida Grande',sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 198); margin-bottom: 10px;"&gt; 
From &lt;a href="http://blog.eclipse-tips.com"&gt;Eclipse Tips&lt;/a&gt;
&lt;br/&gt;
Like the tip? Subscribe via &lt;a href="http://feeds.feedburner.com/cypal"&gt;RSS&lt;/a&gt; or &lt;a href="http://bit.ly/2mfGXa"&gt;Email&lt;/a&gt; or &lt;a href="https://twitter.com/Eclipse_Tips"&gt;Twitter&lt;/a&gt;
&lt;/p&gt;
&lt;br/&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1557780184357927241-7022191035441814296?l=blog.eclipse-tips.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cypal/~4/vzXy9vRa_-4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.eclipse-tips.com/feeds/7022191035441814296/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=1557780184357927241&amp;postID=7022191035441814296&amp;isPopup=true" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7022191035441814296?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1557780184357927241/posts/default/7022191035441814296?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cypal/~3/vzXy9vRa_-4/commands-part-5-authentication-in-rcp.html" title="Commands Part 5: Authentication in RCP applications" /><author><name>Prakash G.R.</name><uri>http://www.blogger.com/profile/13046268367318873066</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="08225524632456251201" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">10</thr:total><feedburner:origLink>http://blog.eclipse-tips.com/2009/02/commands-part-5-authentication-in-rcp.html</feedburner:origLink></entry></feed>
