<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5062989492570016925</id><updated>2011-07-08T02:14:01.462-07:00</updated><title type='text'>Erdal Karaca</title><subtitle type='html'>1 + 1 = 10</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://erdalkaracade.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5062989492570016925/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://erdalkaracade.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>erdal</name><uri>http://www.blogger.com/profile/17223613322204864835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5062989492570016925.post-4644006971753026430</id><published>2010-05-28T13:39:00.001-07:00</published><updated>2010-05-28T13:39:30.736-07:00</updated><title type='text'>Chained Commands Execution</title><content type='html'>&lt;h1&gt;Chained Commands Execution&lt;/h1&gt;&lt;h3&gt;What are commands?&lt;/h3&gt;&lt;div style="text-align:left"&gt;The eclipse command API [1] allows for declaratively contributing UI parts (menu/toolbar items, window controls, ...) to the UI anywhere in your workbench window.&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;In general, this requires to&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;ol&gt;&lt;li&gt;create a command definition&lt;/li&gt;&lt;li&gt;create a handler or handlers (which are conditionally enabled upon a specific expression)&lt;/li&gt;&lt;li&gt;define a menu contribution to be shown in the UI which the user can use to trigger the execution of the command&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;As the command API does exist since eclipse 3.3, there are plenty of (re-)usable commands:&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;div id="mp1_" style="text-align:left"&gt;&lt;img src="http://docs.google.com/File?id=d84n757_142hgwghpcd_b" style="height:512px;width:351px"&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;h3&gt;What are chained commands?&lt;/h3&gt;&lt;div style="text-align:left"&gt;&lt;div style="text-align:left"&gt;As you might have noticed, the core API just allows to call one specific command per menu contribution (menu/toolbar item, ...).&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;Often, there is a need to execute several commands by just one UI button. To allow this, you have to define a composite command that is manually written to call command X, Y, and Z.&lt;/div&gt;&lt;div style="text-align:left"&gt;If you want to execute command A, B, and C in a sequence, you have to provide another composite command.&lt;/div&gt;&lt;div style="text-align:left"&gt;Things will become more complicated if those wrapped commands require parameters to be passed to them.&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;To fix this, we just define a chain of commands.&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;div id="flux" style="text-align:left"&gt;&lt;img src="http://docs.google.com/File?id=d84n757_143ccbwf6fq_b" style="height:19px;width:120px"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;A chain of commands consists of an arbitrary number of commands tied together to be executed (conditionally) in a sequence.&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;b&gt;Example&lt;/b&gt;: Imagine you have a web application based on RAP [2]. Once the user accesses the web application, he is given a login form where he has to provide his login data. Once he presses the login button, he is redirected to a home perspective. If the login fails, an error message will occur.&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;The plugin.xml may contain this extension:&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;p align="left" style="text-align:left"&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;extension&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;point=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;org.eclipse.ui.menus&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;menuContribution&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;allPopups=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;false&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;locationURI=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;chain:chains.demo.login&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;command&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;commandId=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;myapp.login&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;id=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;command.login&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;style=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;push&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/command&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;command&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;commandId=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;ui.showMessage&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;style=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;push&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;parameter&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;name=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;type&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;value=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;error&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/parameter&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;parameter&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;name=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;message&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;value=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;Login denied using: user={login.user}&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/parameter&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;visibleWhen&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;checkEnabled=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;false&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;with&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;variable=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;previous&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;equals&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;value=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;false&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/equals&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/with&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/visibleWhen&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/command&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;command&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;commandId=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;org.eclipse.ui.perspectives.showPerspective&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;style=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;push&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;parameter&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;name=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;org.eclipse.ui.perspectives.showPerspective.perspectiveId&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;value=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;myapp.myHomePerspective&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/parameter&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;visibleWhen&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;checkEnabled=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;false&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;with&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;variable=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;command.login&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;equals&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;value=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;true&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/equals&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/with&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/visibleWhen&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/command&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/menuContribution&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/extension&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;This is the menu contribution extension point.&lt;/div&gt;&lt;div style="text-align:left"&gt;Our contributions will not go into a menu/toolbar/..., instead they will be added to a chain (&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;locationURI=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;chain:chains.demo.login&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; where the chain&amp;#39;s id is chains.demo.login).&lt;/div&gt;&lt;div style="text-align:left"&gt;Next, we define three commands to be executed by the chain:&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;1. the myapp.login command will authenticate the user&lt;/div&gt;&lt;div&gt;2. the ui.showMessage will show an error message if the user could not be authenticated&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;- this will only happen if the previous command has been executed successfully, you can check this by comparing the &amp;quot;previous&amp;quot; variable&amp;#39;s boolean value&lt;/div&gt;&lt;div&gt;3. the last command will change the active perspective, if the first command succeeded&lt;/div&gt;&lt;br&gt;&lt;div&gt;Next, we have to define the chain execution menu item:&lt;/div&gt;&lt;p align="left" style="text-align:left"&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;extension&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;point=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;org.eclipse.ui.menus&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;menuContribution&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;allPopups=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;false&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;locationURI=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;toolbar:org.eclipse.ui.main.toolbar&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;command&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;commandId=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;platform.executeChain&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;style=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;push&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;parameter&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;name=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;chainID&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&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; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;value=&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;chains.demo.login&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#008000"&gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/parameter&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/command&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="left" style="text-align:left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/menuContribution&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;&lt;font face="&amp;quot;courier new&amp;quot;"&gt;&lt;font color="#000080"&gt;&amp;lt;/extension&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;br&gt;&lt;div&gt;This command menu item will execute the chain defined by the id &amp;quot;platform.executeChain&amp;quot;. That is our composite command that handles chain executions.&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;h3&gt;Source&lt;/h3&gt;&lt;div&gt;The source of the chain command is available on google code at&lt;/div&gt;&lt;br&gt;https://erdalkaraca.googlecode.com/svn/trunk/org.eclipselabs.chains&lt;br&gt;&lt;br&gt;&lt;div&gt;Use a subversion client to checkout.&lt;br&gt;&lt;/div&gt;&lt;h3&gt;Links&lt;/h3&gt;&lt;div style="text-align:left"&gt;[1] http://wiki.eclipse.org/index.php/Platform_Command_Framework&lt;/div&gt;&lt;div style="text-align:left"&gt;[2] http://eclipse.org/rap/&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;div style="text-align:left"&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5062989492570016925-4644006971753026430?l=erdalkaracade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erdalkaracade.blogspot.com/feeds/4644006971753026430/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://erdalkaracade.blogspot.com/2010/05/chained-commands-execution.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5062989492570016925/posts/default/4644006971753026430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5062989492570016925/posts/default/4644006971753026430'/><link rel='alternate' type='text/html' href='http://erdalkaracade.blogspot.com/2010/05/chained-commands-execution.html' title='Chained Commands Execution'/><author><name>erdal</name><uri>http://www.blogger.com/profile/17223613322204864835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5062989492570016925.post-970943214674943111</id><published>2010-01-12T06:06:00.000-08:00</published><updated>2010-01-15T11:54:34.356-08:00</updated><title type='text'>Single Sourcing RAP/RCP apps</title><content type='html'>&lt;h2&gt;Scenario&lt;/h2&gt;You read about RAP [1] to be able to do pretty much that is possible with RCP, and thus, decided to provide a web version of your eclipse plugin.&lt;br /&gt;So, you install and setup the RAP tooling [2]. You change your target platform to compile against the RAP runtime. Several compile errors arise. After some research you read about RAP not being fully compatible with its RCP counterpart and that you will have to apply single sourcing techniques to get your plugin work on RAP.&lt;br /&gt;A bit more of your research reveals the following approaches used for single sourcing:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;use reflection to determine whether a specific functionality is available&lt;/li&gt;&lt;li&gt;swap non-working code into a bundle fragment&lt;/li&gt;&lt;li&gt;use osgi services for each functionality to be single sourced&lt;/li&gt;&lt;li&gt;use byte code weaving to patch non-working code at runtime&lt;/li&gt;&lt;li&gt;etc. (Are there any more to be listed here?)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h2&gt;This approach&lt;/h2&gt;This approach is based on a central single sourcing service (think OSGi). It provides an interface for registering and executing wrapped code by a user defined id:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_og3GOTsAJFE/S0yCcfWlr-I/AAAAAAAAAA4/4Z5F5639mfc/s320/single-sourcing-service.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" src="http://1.bp.blogspot.com/_og3GOTsAJFE/S0yCcfWlr-I/AAAAAAAAAA4/4Z5F5639mfc/s320/single-sourcing-service.png" style="cursor: hand; cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 278px;" /&gt;&lt;/a&gt;&lt;br /&gt;Let us explain this by a simple example: In your RCP you are adding a mouse move listener to a control:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Composite comp = new Composite( parent, SWT.None );&lt;br /&gt;comp.addMouseMoveListener( new MouseMoveListener() {&lt;br /&gt; public void mouseMove( MouseEvent e ) {&lt;br /&gt;  System.out.println( "mouse location: "&lt;br /&gt;   + e.x + ", " + e.y );&lt;br /&gt; }&lt;br /&gt;} );&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As you might know, RAP does not support mouse move events, and thus, this has to be single sourced.&lt;br /&gt;We, first, have to register the wrapped code, i.e. the part that is not runnable on RAP:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ISingleSourcingService service = ISingleSourcingService.INSTANCE.get();&lt;br /&gt;service.registerExec( "my.execs.addMouseMoveListenerToComposite",&lt;br /&gt; new IExec() {&lt;br /&gt;  public Object run( Object... params ) {&lt;br /&gt;   Composite comp = (Composite) params[ 0 ];&lt;br /&gt;   comp.addMouseMoveListener( new MouseMoveListener() {&lt;br /&gt;    public void mouseMove( MouseEvent e ) {&lt;br /&gt;     System.out.println( "mouse location: "&lt;br /&gt;      + e.x + ", " + e.y );&lt;br /&gt;    }&lt;br /&gt;   } );&lt;br /&gt;   return null;&lt;br /&gt;  }&lt;br /&gt; } );&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then, we can call the single sourcing service to execute the wrapped code:&lt;br /&gt;&lt;pre&gt;Composite comp = new Composite( parent, SWT.None );&lt;br /&gt;service.execute( "my.execs.addMouseMoveListenerToComposite", null, comp );&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This code can be used on both of the platforms, since it does not cause any errors anymore.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Missing clues&lt;/h2&gt;&lt;b&gt;Where to register wrapped code?&lt;br /&gt;&lt;/b&gt;The preferred way is a separate plugin to host the code. When running on RCP, you will have to make sure that this plugin has been started. On RAP, you would just exclude that plugin from deployment. The other way around is valid as well.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Where to find the sources?&lt;br /&gt;&lt;/b&gt;You can checkout the sources from &lt;a href="http://erdalkaraca.googlecode.com/svn/trunk/org.eclipse.labs.singlesrc"&gt;http://erdalkaraca.googlecode.com/svn/trunk/org.eclipse.labs.singlesrc&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://eclipse.org/rap/introduction.php"&gt;[1] http://eclipse.org/rap/introduction.php&lt;/a&gt;&lt;br /&gt;&lt;a href="http://eclipse.org/rap/gettingstarted.php"&gt;[2] http://eclipse.org/rap/gettingstarted.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5062989492570016925-970943214674943111?l=erdalkaracade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erdalkaracade.blogspot.com/feeds/970943214674943111/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://erdalkaracade.blogspot.com/2010/01/single-sourcing-raprcp-apps.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5062989492570016925/posts/default/970943214674943111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5062989492570016925/posts/default/970943214674943111'/><link rel='alternate' type='text/html' href='http://erdalkaracade.blogspot.com/2010/01/single-sourcing-raprcp-apps.html' title='Single Sourcing RAP/RCP apps'/><author><name>erdal</name><uri>http://www.blogger.com/profile/17223613322204864835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_og3GOTsAJFE/S0yCcfWlr-I/AAAAAAAAAA4/4Z5F5639mfc/s72-c/single-sourcing-service.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
