﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-日出而作兮勤于外，日落而归兮忙于内-随笔分类-eclipse rcp</title><link>http://www.blogjava.net/cherishchen/category/23925.html</link><description>The art of living is to know when to hold fast and when to let go</description><language>zh-cn</language><lastBuildDate>Wed, 18 Jul 2007 02:31:07 GMT</lastBuildDate><pubDate>Wed, 18 Jul 2007 02:31:07 GMT</pubDate><ttl>60</ttl><item><title>Top 10 Eclipse Hotkeys</title><link>http://www.blogjava.net/cherishchen/archive/2007/07/15/130403.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Sun, 15 Jul 2007 09:46:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/07/15/130403.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/130403.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/07/15/130403.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/130403.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/130403.html</trackback:ping><description><![CDATA[<h4><a href="http://www.eclipse.org/">Eclipse</a> has lots and lots of hotkeys, but for daily work you need only a small subset. This are the hotkeys I consider to be the most important time savers:</h4>
<h3>Moving around</h3>
<ul>
    <li><strong>Ctrl+J</strong> — Incremental Search  </li>
    <li><strong>Ctrl+Shift+T</strong> — Search a type, with search on typing. You can use only the upcase letters (e.g. type &#8220;MIL&#8221; to find MouseInputListener)  </li>
    <li><strong>Ctrl+F6</strong> — Switch between last used files  </li>
    <li><strong>F3</strong> — Open declaration</li>
    <li>F4-- 查看类体系<br></li>
    <li><strong>Ctrl+Alt+H</strong> — Open Call Hierarchy </li>
</ul>
<h3>Editing</h3>
<ul>
    <li><strong>Ctrl+1</strong> — Quick Fix: press while cursor is positioned at member variable, parameter, selection, warnings, errors, &#8230;  </li>
    <li><strong>Ctrl+Space</strong> — Context Assist: press after a <tt>.</tt>, or to use macros (<tt>for</tt>, <tt>while</tt>, <tt>sysout</tt>, &#8230;). Press in class-scope to automatically create method declarations.  </li>
    <li><strong>Ctrl+Shift+O</strong> — Organize Imports  </li>
    <li><strong>Ctrl+Shift+F</strong> — Reformat source  </li>
    <li><strong>Alt+Shift+T</strong> — Show Refactor Quick Menu </li>
</ul>
<p>In case these hotkeys are not enough or you have forgotten which hotkey does what, you can always press <strong>Ctrl+Shift+L</strong> to get a nice list of all the hotkeys.</p><img src ="http://www.blogjava.net/cherishchen/aggbug/130403.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-07-15 17:46 <a href="http://www.blogjava.net/cherishchen/archive/2007/07/15/130403.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Polish up your JFace-Viewer! Sorting a table by Tom Seidel  表格排序</title><link>http://www.blogjava.net/cherishchen/archive/2007/07/05/128296.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Thu, 05 Jul 2007 03:48:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/07/05/128296.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/128296.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/07/05/128296.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/128296.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/128296.html</trackback:ping><description><![CDATA[<a title="http://www.javawiki.org/2006_01_18/tidy-up-your-jface-viewer-sorting-a-table/" href="http://www.javawiki.org/2006_01_18/tidy-up-your-jface-viewer-sorting-a-table/http://www.javawiki.org/2006_01_18/tidy-up-your-jface-viewer-sorting-a-table/">http://www.javawiki.org/2006_01_18/tidy-up-your-jface-viewer-sorting-a-table/</a><br>
<p>Today I want to show how to add a sorter to your JFace-Table. The
requirement is to sort descending und ascending by clicking on the
TableColumn-Header.</p>
<p><img src="http://www.javawiki.org/wp-content/table_sorter_initalize.png" alt="The Viewer with an inital Sorting (Column ID)"><br>
The inital view with sorting</p>
<p><img src="http://www.javawiki.org/wp-content/table_sorter_reverse.png" alt="The ascending sorting after a click on the ID-Column header"><br>
The ascending sorting after a click on the ID-Column header.</p>
<p>JFace already provides sorting-functionality. We just have to
provide something like an alogrithm to arrange the items. For that we
implemented the <code>CollectionSorter</code> that uses the default Collator from <code>ViewerSorter</code>. Now look at the Sorter:</p>
<p>Initializing the Sorter with a default column</p>
<div class="igBar"><a href="javascript:showCodeTxt('java-1');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color: #000000; font-weight: bold;">JAVA:</span><br>
<div id="java-1">
<div class="java">
<ol>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CollationSorter <span style="color: #000000; font-weight: bold;">extends</span> ViewerSorter <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AMap+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Map</span></a> sortMap = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AHashMap+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">HashMap</span></a><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* Creates an instance of the sorter</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* @param tc0 the default sorter-column.</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">*/</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> CollationSorter<span style="color: #006600; font-weight: bold;">(</span><a href="http://www.google.com/search?q=allinurl%3ATableColumn+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">TableColumn</span></a> defaultColumn<span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">setCurrentColumn<span style="color: #006600; font-weight: bold;">(</span>defaultColumn<span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* Pushs the current sortorder in a map which key is the</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* table-column.</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* @param column</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">*/</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> pushSortCriteria<span style="color: #006600; font-weight: bold;">(</span><a href="http://www.google.com/search?q=allinurl%3ATableColumn+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">TableColumn</span></a> column<span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">sortMap</span>.<span style="color: #006600;">get</span><span style="color: #006600; font-weight: bold;">(</span>column<span style="color: #006600; font-weight: bold;">)</span> == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">sortMap</span>.<span style="color: #006600;">put</span><span style="color: #006600; font-weight: bold;">(</span>column,<span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3ABoolean+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Boolean</span></a><span style="color: #006600; font-weight: bold;">(</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">else</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #993333;">boolean</span> newSort = !<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">(</span><a href="http://www.google.com/search?q=allinurl%3ABoolean+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Boolean</span></a><span style="color: #006600; font-weight: bold;">)</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">sortMap</span>.<span style="color: #006600;">get</span><span style="color: #006600; font-weight: bold;">(</span>column<span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">booleanValue</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">sortMap</span>.<span style="color: #006600;">put</span><span style="color: #006600; font-weight: bold;">(</span>column,<span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3ABoolean+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Boolean</span></a><span style="color: #006600; font-weight: bold;">(</span>newSort<span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* Asks for the current sort-order and inverts the sort-order</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* @param column the requested column</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* @return true if the sortIndex is descending, else false.</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">*/</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">boolean</span> isDescending<span style="color: #006600; font-weight: bold;">(</span><a href="http://www.google.com/search?q=allinurl%3ATableColumn+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">TableColumn</span></a> column<span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #993333;">boolean</span> returnValue = <span style="color: #000000; font-weight: bold;">true</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">sortMap</span>.<span style="color: #006600;">get</span><span style="color: #006600; font-weight: bold;">(</span>column<span style="color: #006600; font-weight: bold;">)</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">returnValue = <span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">(</span><a href="http://www.google.com/search?q=allinurl%3ABoolean+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Boolean</span></a><span style="color: #006600; font-weight: bold;">)</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">sortMap</span>.<span style="color: #006600;">get</span><span style="color: #006600; font-weight: bold;">(</span>column<span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">booleanValue</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">pushSortCriteria<span style="color: #006600; font-weight: bold;">(</span>column<span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">return</span> returnValue;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3ATableColumn+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">TableColumn</span></a> currentColumn = <span style="color: #000000; font-weight: bold;">null</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* (non-Javadoc)</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* @see org.eclipse.jface.viewers.ViewerSorter#getCollator()</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">*/</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">int</span> compare<span style="color: #006600; font-weight: bold;">(</span>Viewer viewer, <a href="http://www.google.com/search?q=allinurl%3AObject+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Object</span></a> obj1, <a href="http://www.google.com/search?q=allinurl%3AObject+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Object</span></a> obj2<span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #993333;">int</span> rc = -<span style="color: #800000;">1</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// get the data</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">AbstractBaseElement data1 = <span style="color: #006600; font-weight: bold;">(</span>AbstractBaseElement<span style="color: #006600; font-weight: bold;">)</span> obj1;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">AbstractBaseElement data2 = <span style="color: #006600; font-weight: bold;">(</span>AbstractBaseElement<span style="color: #006600; font-weight: bold;">)</span> obj2;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><a href="http://www.google.com/search?q=allinurl%3ACollationKey+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">CollationKey</span></a> key1 = <span style="color: #000000; font-weight: bold;">null</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><a href="http://www.google.com/search?q=allinurl%3ACollationKey+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">CollationKey</span></a> key2 = <span style="color: #000000; font-weight: bold;">null</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">currentColumn</span> == <span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">(</span>TableViewer<span style="color: #006600; font-weight: bold;">)</span>viewer<span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getTable</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getColumn</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">0</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key1 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span>data1.<span style="color: #006600;">getId</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key2 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span>data2.<span style="color: #006600;">getId</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">currentColumn</span> == <span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">(</span>TableViewer<span style="color: #006600; font-weight: bold;">)</span>viewer<span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getTable</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getColumn</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">1</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key1 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span>data1.<span style="color: #006600;">getName</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key2 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span>data2.<span style="color: #006600;">getName</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">currentColumn</span> == <span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">(</span>TableViewer<span style="color: #006600; font-weight: bold;">)</span>viewer<span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getTable</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getColumn</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">2</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key1 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span>data1.<span style="color: #006600;">getDescription</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key2 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span>data2.<span style="color: #006600;">getDescription</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// replace null-strings with empty-strings</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span>key1 == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #006600; font-weight: bold;">)</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key1 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #ff0000;">""</span><span style="color: #006600; font-weight: bold;">)</span>; <span style="color: #808080; font-style: italic;">//$NON-NLS-1$</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span>key2 == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #006600; font-weight: bold;">)</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">key2 = getCollator<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span>.<span style="color: #006600;">getCollationKey</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #ff0000;">""</span><span style="color: #006600; font-weight: bold;">)</span>; <span style="color: #808080; font-style: italic;">//$NON-NLS-1$</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #006600; font-weight: bold;">(</span>isDescending<span style="color: #006600; font-weight: bold;">(</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">currentColumn</span><span style="color: #006600; font-weight: bold;">)</span><span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">rc = key1.<span style="color: #006600;">compareTo</span><span style="color: #006600; font-weight: bold;">(</span>key2<span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">else</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">rc = key2.<span style="color: #006600;">compareTo</span><span style="color: #006600; font-weight: bold;">(</span>key1<span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">return</span> rc;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* Sets the sort column.</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">* @param currentColumn The currentColumn to set.</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">*/</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setCurrentColumn<span style="color: #006600; font-weight: bold;">(</span><a href="http://www.google.com/search?q=allinurl%3ATableColumn+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">TableColumn</span></a> currentColumn<span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">currentColumn</span>&nbsp; = currentColumn;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">pushSortCriteria<span style="color: #006600; font-weight: bold;">(</span>currentColumn<span style="color: #006600; font-weight: bold;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="color: #000000; font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
    </li>
</ol>
</div>
</div>
</div>
<p>This sorter you can use everywhere, you just have to modify the Creation of the Collator-Keys.</p>
<p><strong>Direction Indicator</strong><br>
This feature will be aviable in <a href="http://download.eclipse.org/eclipse/downloads/drops/S-3.2M1-200508111530/eclipse-news-M1.html">Eclipse 3.2 </a></p>
<p><img src="http://www.javawiki.org/wp-content/importjar_wiz.png"> <a href="http://www.javawiki.org/wp-content/org.javawiki.tablesort.zip" title="JFace TableSorter Plugin">Download the JFace TableSorter Plugin</a> (Requires <a href="http://www.javawiki.org/?p=5">Model-Plugin</a>)<br>
<img src="http://www.javawiki.org/wp-content/importjar_wiz.png"> <a href="http://www.javawiki.org/wp-content/org.javawiki.tablesort_rcp.zip" title="JFace TableSorter RCP (source included)">Download the JFace TableSorter RCP (source included)</a>
</p>
<br>  <img src ="http://www.blogjava.net/cherishchen/aggbug/128296.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-07-05 11:48 <a href="http://www.blogjava.net/cherishchen/archive/2007/07/05/128296.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Creating your own Perspective-Switcher - A first try by Tom Seidel</title><link>http://www.blogjava.net/cherishchen/archive/2007/07/05/128283.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Thu, 05 Jul 2007 03:10:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/07/05/128283.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/128283.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/07/05/128283.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/128283.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/128283.html</trackback:ping><description><![CDATA[<span style="font-weight: bold;"><a title="http://www.richclient2.eu/2006_08_29/creating-your-own-perspective-switcher-a-first-try/" href="http://www.richclient2.eu/2006_08_29/creating-your-own-perspective-switcher-a-first-try/">http://www.richclient2.eu/2006_08_29/creating-your-own-perspective-switcher-a-first-try/</a><br><br></span>Do you know the Perspective-Bar? - And have you ever tried to integrate the perspecitve-bar in your RCP? If yes, did you suceed?
<p>From my experience, perspectives are really useful for representing
blocks of funtionality, something like a workflow or a set of
requirements that are bundled. The perspective-bar is a very nice
feature, necessary in the JDT but has a great disadvantage: The lack of
integrity.</p>
<p>In my opinion perspectives have different goals: On the one hand
they have to provide different user-roles different presentations of an
application and on the other hand they have to bundle different views
that are responsible for a special set of functionality.</p>
<p>Unfortunately the Eclipse-Framework doesn&#8217;t provide the approach to
use this nice bar for different user-roles. Neither it&#8217;s possible to
contribute to this bar nor to filter or hide perspectives. This is
confusing, because everywhere you contribute your items, action, views,
etc. to the workbench, but not in this special case. You have to
reimplement the perspective-bar if you want to provide special behavior.</p>
<h3>The art or reimplementing</h3>
<p>The easiest way is to declare some actions, registering a
perspective-listener and contributing the actions, depending from your
business logic to a coolbar of the workbench-window. But that&#8217;s ugly,
isn&#8217;t it?</p>
<p>I want to have a big and colored perspective-switcher (like in Lotus
Notes) without implementing a new Presentation using the
org.eclipse.ui.themes Extension-Point. But that&#8217;s not so easy, because
Eclipse doesn&#8217;t have a special &#8220;Area&#8221;, something like a Composite where
I can provide something, that&#8217;s always present.</p>
<h3>A first try</h3>
<p>I just had an idea. Using a standalone-View that is in all
perspectives on the same place could simulate a fully customizable
perspective-bar. Although it&#8217;s not a satisfying solution it&#8217;s the first
step of a better fully controllable perspective-switcher.</p>
<p><img src="http://www.richclient2.eu/wp-content/uploads/2006/08/persp_header.png" id="image65" alt="persp_header.png"></p>
<p>(The Example RCP with two Perspectives)</p>
<h3>Download</h3>
<p><img src="http://www.richclient2.eu/wp-content/uploads/2006/07/importjar_wiz.png"> <a href="http://www.richclient2.eu/wp-content/uploads/2006/08/de.spiritlink.perspective_rcp.zip" id="p19">Download the Perspective-Switcher Example as RCP (Source included - 9,3 Mbyte)<br>
</a><img src="http://www.richclient2.eu/wp-content/uploads/2006/08/cvs_persp.gif" alt="cvs_persp.gif" id="image74"> CVS-Checkout <a href="http://www.richclient2.eu/cvs/">(more info)</a>
</p>
<div class="feedback">
</div>
<h2 id="comments">2 Comments
<a href="http://www.richclient2.eu/2006_08_29/creating-your-own-perspective-switcher-a-first-try/#postcomment" title="Leave a comment">&#187;</a>
</h2>
<ol id="commentlist">
    <li id="comment-304">
    <p>Well this could be
    achieved if you create your own ApplicationWorkbenchWindowAdvisor like
    I did it to create logo for my RCP application, but you can use it for
    this task too. You can find what I mean if you look at <a href="http://birosoft.zexxo.net/demo/UpdateDemo.htm" rel="nofollow">http://birosoft.zexxo.net/demo/UpdateDemo.htm</a><br>
    . ApplicationLogo class in my case is a simple composite.</p>
    <p>Source example:</p>
    <p>package com.birosoft.workday.platform.intro;</p>
    <p>import org.eclipse.core.runtime.Preferences;<br>
    import org.eclipse.swt.SWT;<br>
    import org.eclipse.swt.graphics.Point;<br>
    import org.eclipse.swt.layout.FormAttachment;<br>
    import org.eclipse.swt.layout.FormData;<br>
    import org.eclipse.swt.layout.FormLayout;<br>
    import org.eclipse.swt.widgets.Composite;<br>
    import org.eclipse.swt.widgets.Control;<br>
    import org.eclipse.swt.widgets.CoolBar;<br>
    import org.eclipse.swt.widgets.Menu;<br>
    import org.eclipse.swt.widgets.Shell;<br>
    import org.eclipse.ui.PlatformUI;<br>
    import org.eclipse.ui.application.ActionBarAdvisor;<br>
    import org.eclipse.ui.application.IActionBarConfigurer;<br>
    import org.eclipse.ui.application.IWorkbenchWindowConfigurer;<br>
    import org.eclipse.ui.application.WorkbenchWindowAdvisor;<br>
    import org.eclipse.ui.internal.WorkbenchWindow;<br>
    import org.eclipse.ui.internal.progress.ProgressRegion;</p>
    <p>import com.birosoft.workday.platform.Activator;</p>
    <p>public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {<br>
    private Control logo;</p>
    <p>	private Control toolbar;</p>
    <p>	private Control page;</p>
    <p>	private Control statusline;</p>
    <p>	private ProgressRegion progressRegion;</p>
    <p>	public ApplicationWorkbenchWindowAdvisor(<br>
    IWorkbenchWindowConfigurer configurer) {<br>
    super(configurer);<br>
    }</p>
    <p>	public ActionBarAdvisor createActionBarAdvisor(<br>
    IActionBarConfigurer configurer) {<br>
    return new ApplicationActionBarAdvisor(configurer);<br>
    }</p>
    <p>	public void preWindowOpen() {<br>
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();<br>
    Preferences prefs = Activator.getDefault().getPluginPreferences();<br>
    if (prefs.getInt(Application.APP_WIN_WIDTH) == 0<br>
    || prefs.getInt(Application.APP_WIN_HEIGHT) == 0) {<br>
    configurer.setInitialSize(new Point(800, 600));<br>
    } else {<br>
    int width = prefs.getInt(Application.APP_WIN_WIDTH);<br>
    int height = prefs.getInt(Application.APP_WIN_HEIGHT);<br>
    configurer.setInitialSize(new Point(width, height));<br>
    }<br>
    configurer.setShowCoolBar(true);<br>
    configurer.setShowStatusLine(true);<br>
    configurer.setShowProgressIndicator(true);<br>
    configurer.setTitle(&#8221;Birosoft Workday Client - &#8221;<br>
    + Application.getCurrentClient().toString() + &#8221; (&#8221;<br>
    + Application.getUsername() + &#8220;)&#8221;);<br>
    }</p>
    <p>	public void postWindowOpen() {<br>
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();<br>
    Preferences prefs = Activator.getDefault().getPluginPreferences();<br>
    if (prefs.getInt(Application.APP_WIN_POS_X) == 0<br>
    || prefs.getInt(Application.APP_WIN_POS_Y) == 0) {<br>
    configurer.getWindow().getShell().setLocation(0, 0);<br>
    } else {<br>
    int x = prefs.getInt(Application.APP_WIN_POS_X);<br>
    int y = prefs.getInt(Application.APP_WIN_POS_Y);<br>
    configurer.getWindow().getShell().setLocation(x, y);<br>
    }<br>
    }</p>
    <p>	@Override<br>
    public void postWindowClose() {<br>
    Preferences prefs = Activator.getDefault().getPluginPreferences();<br>
    Point size = PlatformUI.getWorkbench().getActiveWorkbenchWindow()<br>
    .getShell().getSize();<br>
    prefs.setValue(Application.APP_WIN_WIDTH, size.x);<br>
    prefs.setValue(Application.APP_WIN_HEIGHT, size.y);<br>
    Point position = PlatformUI.getWorkbench().getActiveWorkbenchWindow()<br>
    .getShell().getLocation();<br>
    prefs.setValue(Application.APP_WIN_POS_X, position.x);<br>
    prefs.setValue(Application.APP_WIN_POS_Y, position.y);<br>
    super.postWindowClose();<br>
    }</p>
    <p>	public void createWindowContents(Shell shell) {<br>
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();<br>
    Menu menu = configurer.createMenuBar();<br>
    shell.setMenuBar(menu);<br>
    FormLayout layout = new FormLayout();<br>
    layout.marginWidth = 0;<br>
    layout.marginHeight = 0;<br>
    shell.setLayout(layout);<br>
    logo = new ApplicationLogo(<br>
    getWindowConfigurer().getWindow().getShell(), SWT.NONE);<br>
    Application.setApplicationLogo(((ApplicationLogo) logo));<br>
    toolbar = configurer.createCoolBarControl(shell);<br>
    ((CoolBar) toolbar).setLocked(true);<br>
    page = configurer.createPageComposite(shell);<br>
    statusline = configurer.createStatusLineControl(shell);<br>
    createProgressIndicator(shell);</p>
    <p>		// The layout method does the work of connecting the<br>
    // controls together.<br>
    layoutNormal();<br>
    }</p>
    <p>	private void layoutNormal() {<br>
    // APPLOGO<br>
    FormData data = new FormData();<br>
    data.top = new FormAttachment(0, 0);<br>
    data.left = new FormAttachment(0, 0);<br>
    data.right = new FormAttachment(100, 0);<br>
    logo.setLayoutData(data);<br>
    // TOOLBAR<br>
    data = new FormData();<br>
    data.top = new FormAttachment(logo, 5, SWT.BOTTOM);<br>
    data.left = new FormAttachment(0, 0);<br>
    data.right = new FormAttachment(page, 0, SWT.LEFT);<br>
    toolbar.setLayoutData(data);<br>
    // STATUS LINE<br>
    data = new FormData();<br>
    data.bottom = new FormAttachment(100, 0);<br>
    data.left = new FormAttachment(0, 0);<br>
    data.right = new FormAttachment(100, 0);<br>
    statusline.setLayoutData(data);<br>
    // PAGE CONTENTS<br>
    data = new FormData();<br>
    data.top = new FormAttachment(logo, 5, SWT.BOTTOM);<br>
    // data.left = new FormAttachment(toolbar, 0, SWT.RIGHT);<br>
    data.left = new FormAttachment(0, 5);<br>
    data.right = new FormAttachment(100, -5);<br>
    data.bottom = new FormAttachment(statusline);<br>
    page.setLayoutData(data);<br>
    layout();<br>
    }</p>
    <p>	private void layout() {<br>
    getWindowConfigurer().getWindow().getShell().layout(true);<br>
    if (page != null) {<br>
    ((Composite) page).layout(true);<br>
    }<br>
    }</p>
    <p>	/**<br>
    * Create the progress indicator for the receiver.<br>
    * @param shell	the parent shell<br>
    */<br>
    private void createProgressIndicator(Shell shell) {<br>
    if (getWindowConfigurer().getShowProgressIndicator()) {<br>
    WorkbenchWindow window = (WorkbenchWindow) getWindowConfigurer()<br>
    .getWindow();<br>
    progressRegion = new ProgressRegion();<br>
    progressRegion.createContents(shell, window);<br>
    }<br>
    }</p>
    <p>}
    </p>
    <p><cite>Comment by Mickey — 13. March 2007 @ <a href="http://www.richclient2.eu/2006_08_29/creating-your-own-perspective-switcher-a-first-try/#comment-304">19:41</a></cite> </p>
    </li>
    <li id="comment-305">
    <p>Yes, you&#8217;re right.<br>
    Thanks for your addition
    </p>
    <p><cite>Comment by Tom Seidel — 13. March 2007 @ <a href="http://www.richclient2.eu/2006_08_29/creating-your-own-perspective-switcher-a-first-try/#comment-305">19:58</a></cite> </p>
    </li>
</ol>
<br>   <img src ="http://www.blogjava.net/cherishchen/aggbug/128283.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-07-05 11:10 <a href="http://www.blogjava.net/cherishchen/archive/2007/07/05/128283.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Printing with SWT - An Eclipse Editor Example by Tom Seidel</title><link>http://www.blogjava.net/cherishchen/archive/2007/07/05/128277.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Thu, 05 Jul 2007 02:55:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/07/05/128277.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/128277.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/07/05/128277.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/128277.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/128277.html</trackback:ping><description><![CDATA[<a title="http://www.richclient2.eu/2006_11_22/printing-with-swt-an-eclipse-editor-example/" href="http://www.richclient2.eu/2006_11_22/printing-with-swt-an-eclipse-editor-example/">http://www.richclient2.eu/2006_11_22/printing-with-swt-an-eclipse-editor-example/</a><br>
<div style="text-align: center;">Printing with SWT - An Eclipse Editor Example<br></div>
22. November 2006
<div class="meta"><a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#116;&#111;&#109;&#46;&#115;&#101;&#105;&#100;&#101;&#108;&#64;&#115;&#112;&#105;&#114;&#105;&#116;&#108;&#105;&#110;&#107;&#46;&#100;&#101;">Tom Seidel</a> @ 21:14 </div>
<div class="storycontent">
<p><img src="http://www.richclient2.eu/wp-content/uploads/2006/11/print.png" alt="print.png" id="image103" align="right">If
you build your own editor in the most cases you have to provide the
capability to print its content. In addition you probably also have to
print different business-logic that is not presented by an editor or
viewpart. SWT gives you the possibility to generate printing jobs, what
is a bit complex. With the Open-Source API <a href="http://paperclips.sourceforge.net/" title="PaperClipse Website">PaperClips</a>
there is a possibility to generate data that can be sent to a printer
in a very easy way. In addition it provides cool UI-Elments, e.g. a
Print Preview. In this article is explained how to register a
Print-Action as GlobalAction Handler, with formatting the data you want
to print and a Print-Preview.</p>
<h3>Global ActionHandler</h3>
<p>At first you have to implement your custom editor. After your editor
can be opened you have to set up a GlobalActionHandler and assign this
handler with an Action. In the example there is an Action that justs
open a wizard.</p>
<div class="igBar"><span id="ljava-1"><a href="http://www.richclient2.eu/2006_11_22/printing-with-swt-an-eclipse-editor-example/#" onclick="javascript:showPlainTxt('java-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVA:</span><br>
<div id="java-1">
<div class="java">
<ol>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">PrintAction printAction = <span style="color: #000000; font-weight: bold;">new</span> PrintAction<span style="color: #66cc66;">(</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">model</span><span style="color: #66cc66;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">site.<span style="color: #006600;">getActionBars</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>.<span style="color: #006600;">setGlobalActionHandler</span><span style="color: #66cc66;">(</span>ActionFactory.<span style="color: #006600;">PRINT</span>.<span style="color: #006600;">getId</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>,printAction<span style="color: #66cc66;">)</span>; </div>
    </li>
</ol>
</div>
</div>
</div>
<p>
</p>
<p align="center"><img src="http://www.richclient2.eu/wp-content/uploads/2006/11/print_bar.png" alt="print_bar.png" id="image107"><br>
If the editor is activated the Print-button is enabled.</p>
<h3>Integrating PaperClips</h3>
<p align="left">After you have added the paperclips libraries you can
build printer-data with special formatting possibilites that are
shipped with the API. In this example a simple list with a header and
footer is generated. A big benefit is the runtime-generation of the
data you want to print. If you see the Wizard you have the possibility
to select special properties of your business-data. The preview will be
actualized every time your selection changes.</p>
<p align="left">
</p>
<div style="text-align: center;"><img src="http://www.richclient2.eu/wp-content/uploads/2006/11/print_wizard.png" id="image108" alt="print_wizard.png"></div>
<p>If you click on the "Finish" Button the system-specific print dialog will be opened and a print-job is queued.</p>
<div class="igBar"><span id="ljava-2"><a href="http://www.richclient2.eu/2006_11_22/printing-with-swt-an-eclipse-editor-example/#" onclick="javascript:showPlainTxt('java-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVA:</span><br>
<div id="java-2">
<div class="java">
<ol>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">PrintDialog dialog = <span style="color: #000000; font-weight: bold;">new</span> PrintDialog<span style="color: #66cc66;">(</span>Display.<span style="color: #006600;">getDefault</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>.<span style="color: #006600;">getActiveShell</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>, SWT.<span style="color: #006600;">NONE</span><span style="color: #66cc66;">)</span>;</div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">PrinterData printerData = dialog.<span style="color: #006600;">open</span> <span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">(</span>printerData != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; PaperClips.<span style="color: #006600;">print</span><span style="color: #66cc66;">(</span>PrintingJob.<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">jobDelegate</span>, printerData<span style="color: #66cc66;">)</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #66cc66;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">{</span></div>
    </li>
    <li style="font-weight: bold; color: #26536a;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">canceled = <span style="color: #000000; font-weight: bold;">true</span>;</div>
    </li>
    <li style="font-family: 'Courier New',Courier,monospace; font-weight: normal; font-style: normal; color: #3a6a8b;">
    <div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #66cc66;">}</span> </div>
    </li>
</ol>
</div>
</div>
</div>
<p>
</p>
<h3>Download</h3>
<p><img src="http://www.richclient2.eu/wp-content/uploads/2006/07/importjar_wiz.png"> <a href="http://www.richclient2.eu/wp-content/uploads/2006/11/de.spiritlink.editor.printing_rcp.zip" id="p19">Download the Print Example as RCP (Source included - 10 Mbyte)</a><a href="http://www.richclient2.eu/wp-content/uploads/2006/08/de.spiritlink.perspective_rcp.zip" id="p19"><br>
</a><img src="http://www.richclient2.eu/wp-content/uploads/2006/08/cvs_persp.gif" id="image74" alt="cvs_persp.gif"> CVS-Checkout <a href="http://www.richclient2.eu/cvs/">(more info)</a>
</p>
</div><img src ="http://www.blogjava.net/cherishchen/aggbug/128277.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-07-05 10:55 <a href="http://www.blogjava.net/cherishchen/archive/2007/07/05/128277.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Customizing the UI in small RCP Projects by Tom Seidel</title><link>http://www.blogjava.net/cherishchen/archive/2007/07/05/128275.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Thu, 05 Jul 2007 02:52:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/07/05/128275.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/128275.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/07/05/128275.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/128275.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/128275.html</trackback:ping><description><![CDATA[<a title="http://www.richclient2.eu/2007_04_16/customizing-the-ui-in-small-rcp-projects/" href="http://www.richclient2.eu/2007_04_16/customizing-the-ui-in-small-rcp-projects/">http://www.richclient2.eu/2007_04_16/customizing-the-ui-in-small-rcp-projects/</a><br><br>The <a href="http://help.eclipse.org/help32/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_presentationFactories.html" title="Eclipse Help - Presentation Factory Extension Point">presentation framework</a>
provided by Eclipse gives you the possibility to customize the UI and
the behavior of graphical elements. A good example for UI-customization
is the Lotus Nodes Client &#8220;Hannover&#8221;. But what do you do If you don&#8217;t
have the budget, time or the skill set to implement such an excessive
UI-customization like the guys from &#8220;Hannover&#8221;? Especially for small
RCP applications with a handful views and the wish that your product
should not look like a &#8220;typical Eclipse Client&#8221; it is probably better
to use alternative possibilities to create an individual looking RCP.
The following article will give an example how to customize your UI
easily without using any special framework or extension-point.
<h3>Product branding with Eclipse RCP</h3>
<p>Since it is possible to build RCP applications with Eclipse, the
possibilities to give your application a more personal touch through
the PDE have also increased. Typical elements are for example
splash-screens, program-icons or welcome-screens. But in the most cases
that is not enough. The customer often has a corporate identity with
logos, special colors, fonts,etc. which must be also integrated within
the application.</p>
<h3>Step 1: Implementing a banner with integrated Toolbar</h3>
<p>An often required UI-element is a banner on top of your views with a
company logo or the name of your product and a toolbar where the key
features of the application are accessible. This is possible if your
overwrite the method WorkbenchWindowAdvisor#createWindowContents(Shell
shell). Eclipse layouts and creates typical elements of your workbench
like the Coolbar, MenuBar and the Statusline. If you overwrite this
method you have the freedom to arrange the content of your window but
you also have to care for the correct initialization of all UI-elements
needed. This step is very effective and your application looks much
more personalized (see picture).</p>
<p align="center"><img src="http://www.richclient2.eu/wp-content/uploads/2007/04/toolbar_banner.png" alt="A part of the banner with integrated toolbar" id="image158"><br>
Part of the banner with a two-buttons toolbar</p>
<h3>Step 2: Implement your own Viewpart-Title Area</h3>
<p align="left">The most characteristic element to indicate a &#8220;typical
Eclipse application&#8221; is the look of a viewpart with the curved title
and the appended action bar.<br>
With the <a href="http://www.eclipse.org/eclipse/platform-ua/proposals/forms/enhancements-3.3/index.html">form enhancements</a>
in Eclipse 3.3M5 and the features with custom titles a new and
interesting possibility is provided to use this feature also as title
in your viewparts. You just have to add the views as standalone views
to your perspective layout and implement the title in your viewpart.
With the ability to customize the colors (see
org.eclipse.ui.forms.FormColors) you can show up views that nobody
would associate with a &#8220;typical Eclipse application&#8221; (see Image).</p>
<p align="center"><img src="http://www.richclient2.eu/wp-content/uploads/2007/04/form_heading.png" alt="A customized form title as viewpart-title" id="image159"><br>
Viewparts with Form-Headings and Actionbar (on the right: with Subheader)</p>
<h3>Step 3: Move your Progress Indicator</h3>
<p align="left">This is an optional step, depending on your
requirements. In nearly every application you have jobs for
background-processes where you need a progress indicator to give the
user a feedback about the job-status. The default-location of the
progress indicator is on the bottom of your application window outside
the page contents. It doesn&#8217;t make sense in small applications, that
this little, but important widget needs the whole bottom of your
workbench-window, especially if you don&#8217;t have a status-bar. So why not
place the progress-bar somewhere else, e.g. in a viewpart?- In spite of
the <a href="http://www.eclipsezone.com/eclipse/forums/t87066.html">&#8220;Discouraged Access Warning&#8221;</a> you can implement the org.eclipse.ui.internal.progress.ProgressRegion wherever you want (see picture).</p>
<p align="center"><img src="http://www.richclient2.eu/wp-content/uploads/2007/04/progress_region.png" alt="Progress region in a viewpart" id="image160"><br>
Progress Region in a viewpart</p>
<h3>Example</h3>
<p align="left">I have implemented a small RCP application, which uses
the mentioned UI-customizations (see picture). Check it out (or
download) to see, how easyily an individual UI can be implemented. But
remember: The discussed issues can be realized only for a special type
of RCPs. If you have to customize your &#8220;Next generation IDE&#8221; with 100
views and editors, please use the presentation framework.</p>
<p align="center"><a href="http://www.richclient2.eu/wp-content/uploads/2007/04/example_complete.png" class="imagelink" title="The Example Application"><img src="http://www.richclient2.eu/wp-content/uploads/2007/04/example_complete.thumbnail.png" id="image161" alt="The Example Application"><br>
</a><span class="imagelink">The example application</span></p>
<h3>Conclusion</h3>
<p align="left">There are many ways to customize your Eclipse RCP Application. Based on the special requirements of <strong>your</strong> personal application you have to choose the best toolkit to reach your goal.<br>
Maybe you also have a simple way to customize your RCP product. Let me know.</p>
<h3>Downloads</h3>
<p><img src="http://www.richclient2.eu/wp-content/uploads/2006/07/importjar_wiz.png"> <a href="http://www.richclient2.eu/wp-content/uploads/2007/04/de.spiritlink.custom.ui.zip" id="p19">Download the UI Customization Example as RCP (Source included - 11 Mbyte)</a><a href="http://www.richclient2.eu/wp-content/uploads/2006/08/de.spiritlink.perspective_rcp.zip" id="p19"><br>
</a><img src="http://www.richclient2.eu/wp-content/uploads/2006/08/cvs_persp.gif" alt="cvs_persp.gif" id="image74"> CVS-Checkout <a href="http://www.richclient2.eu/cvs/">(more info)</a>
</p>
<div class="feedback">
</div>
<h2 id="comments">2 Comments
<a href="http://www.richclient2.eu/2007_04_16/customizing-the-ui-in-small-rcp-projects/#postcomment" title="Leave a comment">&#187;</a>
</h2>
<ol id="commentlist">
    <li id="comment-1677">
    <p>Note that
    overriding the WorkbenchWindowAdvisor#createWindowContents(Shell shell)
    method has some disadvantages, as discussed in this bug[1].</p>
    <p>[1] <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=73821" rel="nofollow">https://bugs.eclipse.org/bugs/show_bug.cgi?id=73821</a>
    </p>
    <p><cite>Comment by Kris — 16. April 2007 @ <a href="http://www.richclient2.eu/2007_04_16/customizing-the-ui-in-small-rcp-projects/#comment-1677">17:13</a></cite> </p>
    </li>
    <li id="comment-1685">
    <p>And
    overriding the WorkbenchWindowAdvisor#createWindowContents(Shell shell)
    does not allow to use &#8220;Welcome&#8221; view because your banner will be always
    on top. In this case you should to hide banner manually because eclipse
    api hides only coolbar.
    </p>
    <p><cite>Comment by MByte — 17. April 2007 @ <a href="http://www.richclient2.eu/2007_04_16/customizing-the-ui-in-small-rcp-projects/#comment-1685">08:37</a></cite> </p>
    </li>
</ol>
<br>   <img src ="http://www.blogjava.net/cherishchen/aggbug/128275.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-07-05 10:52 <a href="http://www.blogjava.net/cherishchen/archive/2007/07/05/128275.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Swt jface 提供了virtual table 和 virtual tree</title><link>http://www.blogjava.net/cherishchen/archive/2007/06/26/126271.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Tue, 26 Jun 2007 02:13:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/06/26/126271.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/126271.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/06/26/126271.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/126271.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/126271.html</trackback:ping><description><![CDATA[<div style="text-align: center;">TableViewer使用virtual table<br></div>
<br>使用虚拟表和虚拟树的确可以很大程度地提供UI界面的性能,尤其是在大数据量的情况下，对于TableViewer使用虚拟表很简单，只要在创建TableViewer的时候指定SWT.VIRTUAL即可<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: #eeeeee;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">tableViewer</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">TableViewer(container, SWT.FULL_SELECTION<br></span><span style="color: #000000;">|</span> <span style="color: #000000;">SWT.BORDER</span> <span style="color: #000000;">|</span> <span style="color: #000000;">SWT.HIDE_SELECTION</span><span style="color: #000000;">|</span><span style="color: #000000;">SWT.VIRTUAL);</span></div>
<br>在以前的版本，<span style="color: #000000;">TableViewer要使用</span>virtual table的时候，需要实现ILazyContentProvider接口，但是目前好像是不用了，下面附上两个eclipse社区提供的例子<br><br><span style="color: #000000;">Snippet030VirtualLazyTableViewer.java,使用的是实现</span><span style="color: #000000;">ILazyContentProvider接口<br></span>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: #eeeeee;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.ILazyContentProvider;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.IStructuredContentProvider;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.LabelProvider;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.TableViewer;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.Viewer;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.SWT;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.layout.FillLayout;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.widgets.Display;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.widgets.Shell;<br><br></span><span style="color: #008000;">/**</span><span style="color: #008000;"><br>* A simple TableViewer to demonstrate usage of an ILazyContentProvider. You can compare this snippet to the Snippet029VirtualTableViewer<br>* to see the small but needed difference.<br>*<br>*</span> <span style="color: #808080;">@author</span> <span style="color: #008000;">Tom Schindl &lt;tom.schindl@bestsolution.at&gt;<br>*<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #000000;">Snippet030VirtualLazyTableViewer {<br></span><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">class</span> <span style="color: #000000;">MyContentProvider</span> <span style="color: #0000ff;">implements</span> <span style="color: #000000;">IStructuredContentProvider, ILazyContentProvider {<br></span><span style="color: #0000ff;">private</span> <span style="color: #000000;">TableViewer viewer;<br></span><span style="color: #0000ff;">private</span> <span style="color: #000000;">MyModel[] elements;<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">MyContentProvider(TableViewer viewer) {<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">.viewer</span> <span style="color: #000000;">=</span> <span style="color: #000000;">viewer;<br>}<br><br></span><span style="color: #008000;">/*</span> <span style="color: #008000;">(non-Javadoc)<br>* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">Object[] getElements(Object inputElement) {<br></span><span style="color: #0000ff;">return</span> <span style="color: #000000;">elements;<br>}<br><br></span><span style="color: #008000;">/*</span> <span style="color: #008000;">(non-Javadoc)<br>* @see org.eclipse.jface.viewers.IContentProvider#dispose()<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> <span style="color: #000000;">dispose() {<br><br>}<br><br></span><span style="color: #008000;">/*</span> <span style="color: #008000;">(non-Javadoc)<br>* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> <span style="color: #000000;">inputChanged(Viewer viewer, Object oldInput, Object newInput) {<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">.elements</span> <span style="color: #000000;">=</span> <span style="color: #000000;">(MyModel[])newInput;<br>}<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> <span style="color: #000000;">updateElement(</span><span style="color: #0000ff;">int</span> <span style="color: #000000;">index) {<br>viewer.replace(elements[index], index);<br>}<br><br>}<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #000000;">MyModel {<br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> <span style="color: #000000;">counter;<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">MyModel(</span><span style="color: #0000ff;">int</span> <span style="color: #000000;">counter) {<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">.counter</span> <span style="color: #000000;">=</span> <span style="color: #000000;">counter;<br>}<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">String toString() {<br></span><span style="color: #0000ff;">return</span> <span style="color: #000000;">"</span><span style="color: #000000;">Item</span> <span style="color: #000000;">"</span> <span style="color: #000000;">+</span> <span style="color: #0000ff;">this</span><span style="color: #000000;">.counter;<br>}<br>}<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">Snippet030VirtualLazyTableViewer(Shell shell) {<br></span><span style="color: #0000ff;">final</span> <span style="color: #000000;">TableViewer v</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">TableViewer(shell,SWT.VIRTUAL);<br>v.setLabelProvider(</span><span style="color: #0000ff;">new</span> <span style="color: #000000;">LabelProvider());<br>v.setContentProvider(</span><span style="color: #0000ff;">new</span> <span style="color: #000000;">MyContentProvider(v));<br>v.setUseHashlookup(</span><span style="color: #0000ff;">true</span><span style="color: #000000;">);<br>MyModel[] model</span> <span style="color: #000000;">=</span> <span style="color: #000000;">createModel();<br>v.setInput(model);<br>v.setItemCount(model.length);</span> <span style="color: #008000;">//</span> <span style="color: #008000;">This is the difference when using a ILazyContentProvider</span><span style="color: #008000;"><br></span><span style="color: #000000;"><br>v.getTable().setLinesVisible(</span><span style="color: #0000ff;">true</span><span style="color: #000000;">);<br>}<br><br></span><span style="color: #0000ff;">private</span> <span style="color: #000000;">MyModel[] createModel() {<br>MyModel[] elements</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">MyModel[</span><span style="color: #000000;">10000</span><span style="color: #000000;">];<br><br></span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span> <span style="color: #0000ff;">int</span> <span style="color: #000000;">i</span> <span style="color: #000000;">=</span> <span style="color: #000000;">0</span><span style="color: #000000;">; i</span> <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10000</span><span style="color: #000000;">; i</span><span style="color: #000000;">++</span> <span style="color: #000000;">) {<br>elements[i]</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">MyModel(i);<br>}<br><br></span><span style="color: #0000ff;">return</span> <span style="color: #000000;">elements;<br>}<br><br></span><span style="color: #008000;">/**</span><span style="color: #008000;"><br>*</span> <span style="color: #808080;">@param</span> <span style="color: #008000;">args<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> <span style="color: #000000;">main(String[] args) {<br>Display display</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">Display ();<br>Shell shell</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">Shell(display);<br>shell.setLayout(</span><span style="color: #0000ff;">new</span> <span style="color: #000000;">FillLayout());<br></span><span style="color: #0000ff;">new</span> <span style="color: #000000;">Snippet030VirtualLazyTableViewer(shell);<br>shell.open ();<br><br></span><span style="color: #0000ff;">while</span> <span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">shell.isDisposed ()) {<br></span><span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">display.readAndDispatch ()) display.sleep ();<br>}<br><br>display.dispose ();<br><br>}<br><br>}</span></div>
<br><span style="color: #000000;">Snippet029VirtualTableViewer.java 更加方便，直接指定SWT.VIRTUAL即可</span><br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: #eeeeee;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.IStructuredContentProvider;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.LabelProvider;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.TableViewer;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.jface.viewers.Viewer;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.SWT;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.layout.FillLayout;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.widgets.Display;<br></span><span style="color: #0000ff;">import</span> <span style="color: #000000;">org.eclipse.swt.widgets.Shell;<br><br></span><span style="color: #008000;">/**</span><span style="color: #008000;"><br>* A simple TableViewer to demonstrate the usage of a standard content provider<br>* with a virtual table<br>*<br>*</span> <span style="color: #808080;">@author</span> <span style="color: #008000;">Tom Schindl &lt;tom.schindl@bestsolution.at&gt;<br>*<br></span> <span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #000000;">Snippet029VirtualTableViewer {<br></span><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">class</span> <span style="color: #000000;">MyContentProvider</span> <span style="color: #0000ff;">implements</span> <span style="color: #000000;">IStructuredContentProvider {<br></span><span style="color: #0000ff;">private</span> <span style="color: #000000;">MyModel[] elements;<br><br></span><span style="color: #008000;">/*</span><span style="color: #008000;"><br>* (non-Javadoc)<br>*<br>* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">Object[] getElements(Object inputElement) {<br></span><span style="color: #0000ff;">return</span> <span style="color: #000000;">elements;<br>}<br><br></span><span style="color: #008000;">/*</span><span style="color: #008000;"><br>* (non-Javadoc)<br>*<br>* @see org.eclipse.jface.viewers.IContentProvider#dispose()<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> <span style="color: #000000;">dispose() {<br><br>}<br><br></span><span style="color: #008000;">/*</span><span style="color: #008000;"><br>* (non-Javadoc)<br>*<br>* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,<br>* java.lang.Object, java.lang.Object)<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> <span style="color: #000000;">inputChanged(Viewer viewer, Object oldInput, Object newInput) {<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">.elements</span> <span style="color: #000000;">=</span> <span style="color: #000000;">(MyModel[]) newInput;<br>}<br>}<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #000000;">MyModel {<br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> <span style="color: #000000;">counter;<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">MyModel(</span><span style="color: #0000ff;">int</span> <span style="color: #000000;">counter) {<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">.counter</span> <span style="color: #000000;">=</span> <span style="color: #000000;">counter;<br>}<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">String toString() {<br></span><span style="color: #0000ff;">return</span> <span style="color: #000000;">"</span><span style="color: #000000;">Item</span> <span style="color: #000000;">"</span> <span style="color: #000000;">+</span> <span style="color: #0000ff;">this</span><span style="color: #000000;">.counter;<br>}<br>}<br><br></span><span style="color: #0000ff;">public</span> <span style="color: #000000;">Snippet029VirtualTableViewer(Shell shell) {<br></span><span style="color: #0000ff;">long</span> <span style="color: #000000;">time1</span><span style="color: #000000;">=</span><span style="color: #000000;">System.currentTimeMillis();<br></span><span style="color: #0000ff;">final</span> <span style="color: #000000;">TableViewer v</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">TableViewer(shell,SWT.VIRTUAL);<br>v.setLabelProvider(</span><span style="color: #0000ff;">new</span> <span style="color: #000000;">LabelProvider());<br>v.setContentProvider(</span><span style="color: #0000ff;">new</span> <span style="color: #000000;">MyContentProvider());<br>v.setUseHashlookup(</span><span style="color: #0000ff;">true</span><span style="color: #000000;">);<br>MyModel[] model</span> <span style="color: #000000;">=</span> <span style="color: #000000;">createModel();<br>v.setInput(model);<br><br>v.getTable().setLinesVisible(</span><span style="color: #0000ff;">true</span><span style="color: #000000;">);<br>System.out.println(System.currentTimeMillis()</span><span style="color: #000000;">-</span><span style="color: #000000;">time1);<br>}<br><br></span><span style="color: #0000ff;">private</span> <span style="color: #000000;">MyModel[] createModel() {<br>MyModel[] elements</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">MyModel[</span><span style="color: #000000;">10000</span><span style="color: #000000;">];<br><br></span><span style="color: #0000ff;">for</span> <span style="color: #000000;">(</span><span style="color: #0000ff;">int</span> <span style="color: #000000;">i</span> <span style="color: #000000;">=</span> <span style="color: #000000;">0</span><span style="color: #000000;">; i</span> <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10000</span><span style="color: #000000;">; i</span><span style="color: #000000;">++</span><span style="color: #000000;">) {<br>elements[i]</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">MyModel(i);<br>}<br><br></span><span style="color: #0000ff;">return</span> <span style="color: #000000;">elements;<br>}<br><br></span><span style="color: #008000;">/**</span><span style="color: #008000;"><br>*</span> <span style="color: #808080;">@param</span> <span style="color: #008000;">args<br></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> <span style="color: #000000;">main(String[] args) {<br>Display display</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">Display();<br>Shell shell</span> <span style="color: #000000;">=</span> <span style="color: #0000ff;">new</span> <span style="color: #000000;">Shell(display);<br>shell.setLayout(</span><span style="color: #0000ff;">new</span> <span style="color: #000000;">FillLayout());<br></span><span style="color: #0000ff;">new</span> <span style="color: #000000;">Snippet029VirtualTableViewer(shell);<br>shell.open();<br><br></span><span style="color: #0000ff;">while</span> <span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">shell.isDisposed()) {<br></span><span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">display.readAndDispatch())<br>display.sleep();<br>}<br><br>display.dispose();<br><br>}<br><br>}</span></div>
<br><br>  <img src ="http://www.blogjava.net/cherishchen/aggbug/126271.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-06-26 10:13 <a href="http://www.blogjava.net/cherishchen/archive/2007/06/26/126271.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> eclipse rcp 相关的资料</title><link>http://www.blogjava.net/cherishchen/archive/2007/06/25/126149.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Mon, 25 Jun 2007 08:41:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/06/25/126149.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/126149.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/06/25/126149.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/126149.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/126149.html</trackback:ping><description><![CDATA[<div style="margin-left: 15px; margin-top: 1px;">
<h2><a href="http://cherishchen.javaeye.com/blog/89466" title="永久链接：eclipse rcp 相关的资料">
eclipse rcp 相关的资料</a>
</h2>
</div>
权威介绍RCP体系结构的文章<br>
<span> <a href="http://www.eclipse.org/articles/article-plug-in-architecture/plugin_architecture.html">http://www.eclipse.org/articles/Article-Plug-in-architecture/plugin_architecture.html</a></span><br>
<br>
关于eclipse插件开发类装载的解决方法，一定要好好理解的<br>
<span> <a href="http://wiki.eclipse.org/index.php/context_class_loader_enhancements">http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements</a></span><br>
<br>
关于Progress Monitors和job的文章
<p>FAQ Can I make a job run in the UI thread?<br>
</p>
<span> <a href="http://wiki.eclipse.org/index.php/faq_can_i_make_a_job_run_in_the_ui_thread%3f">http://wiki.eclipse.org/index.php/FAQ_Can_I_make_a_job_run_in_the_UI_thread%3F</a></span><br>
<br>
<br>
<p>How to Correctly and Uniformly Use Progress Monitors<br>
</p>
<span> <a href="http://www.eclipse.org/articles/article-progress-monitors/article.html">http://www.eclipse.org/articles/Article-Progress-Monitors/article.html</a></span><br>
<br>
<p>FAQ Why do I get an invalid thread access exception?</p>
<span> <a href="http://wiki.eclipse.org/index.php/faq_why_do_i_get_an_invalid_thread_access_exception%3f">http://wiki.eclipse.org/index.php/FAQ_Why_do_I_get_an_invalid_thread_access_exception%3F</a></span><br>
<br>
<br>
<br>
<p>FAQ Why should I use the new progress service?</p>
<span> <a href="http://wiki.eclipse.org/index.php/faq_why_should_i_use_the_new_progress_service%3f">http://wiki.eclipse.org/index.php/FAQ_Why_should_I_use_the_new_progress_service%3F</a><br>
<br>
<br>
</span>
<p>FAQ How do I switch from using a Progress dialog to the Progress view?</p>
<br>
<span><span><a href="http://wiki.eclipse.org/index.php/faq_how_do_i_switch_from_using_a_progress_dialog_to_the_progress_view%3f">http://wiki.eclipse.org/index.php/FAQ_How_do_I_switch_from_using_a_Progress_dialog_to_the_Progress_view%3F</a></span></span> <img src ="http://www.blogjava.net/cherishchen/aggbug/126149.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-06-25 16:41 <a href="http://www.blogjava.net/cherishchen/archive/2007/06/25/126149.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>eclipse 的buddy-register</title><link>http://www.blogjava.net/cherishchen/archive/2007/06/25/126138.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Mon, 25 Jun 2007 08:29:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/06/25/126138.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/126138.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/06/25/126138.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/126138.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/126138.html</trackback:ping><description><![CDATA[如果一个插件A需要访问插件B内文件，需要进行下面两个步骤：<br>（1）在插件A的MANIFEST.MF文件内添加<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">Eclipse</span><span style="color: #000000;">-</span><span style="color: #000000;">BuddyPolicy:&nbsp;registered</span></div>
<br>（2）在插件B的MANIFEST.MF文件内添加<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">Eclipse</span><span style="color: #000000;">-</span><span style="color: #000000;">RegisterBuddy: A</span></div>
<br> <img src ="http://www.blogjava.net/cherishchen/aggbug/126138.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-06-25 16:29 <a href="http://www.blogjava.net/cherishchen/archive/2007/06/25/126138.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>得到eclipse rcp plugin 内目录文件绝对路径的方法</title><link>http://www.blogjava.net/cherishchen/archive/2007/06/25/126129.html</link><dc:creator>凭栏观海</dc:creator><author>凭栏观海</author><pubDate>Mon, 25 Jun 2007 07:54:00 GMT</pubDate><guid>http://www.blogjava.net/cherishchen/archive/2007/06/25/126129.html</guid><wfw:comment>http://www.blogjava.net/cherishchen/comments/126129.html</wfw:comment><comments>http://www.blogjava.net/cherishchen/archive/2007/06/25/126129.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cherishchen/comments/commentRss/126129.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cherishchen/services/trackbacks/126129.html</trackback:ping><description><![CDATA[<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">import</span><span style="color: #000000;">&nbsp;java.io.IOException;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;">&nbsp;java.net.URL;<br><br></span><span style="color: #0000ff;">import</span><span style="color: #000000;">&nbsp;org.eclipse.core.runtime.FileLocator;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;">&nbsp;org.eclipse.core.runtime.Platform;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;">&nbsp;org.osgi.framework.Bundle;<br><br></span><span style="color: #0000ff;">import</span><span style="color: #000000;">&nbsp;com.work.base.exception.DataException;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;">&nbsp;com.work.view.Activator;<br><br></span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">class</span><span style="color: #000000;">&nbsp;BundlePathUtil&nbsp;{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;String&nbsp;getRealPath(String&nbsp;bundleID,&nbsp;String&nbsp;entry)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">throws</span><span style="color: #000000;">&nbsp;DataException&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;URL&nbsp;urlentry;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;strEntry;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">try</span><span style="color: #000000;">&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bundle&nbsp;bundle&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;Platform.getBundle(bundleID);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(bundle</span><span style="color: #000000;">==</span><span style="color: #0000ff;">null</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">throw</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;DataException(</span><span style="color: #000000;">"</span><span style="color: #000000;">请检查文件的路径</span><span style="color: #000000;">"</span><span style="color: #000000;">,</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;NullPointerException());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000;">//</span><span style="color: #008000;">&nbsp;get&nbsp;path&nbsp;URL</span><span style="color: #008000;"><br></span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;urlentry&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;bundle.getEntry(entry);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(urlentry</span><span style="color: #000000;">==</span><span style="color: #0000ff;">null</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">throw</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;DataException(</span><span style="color: #000000;">"</span><span style="color: #000000;">请检查文件的路径</span><span style="color: #000000;">"</span><span style="color: #000000;">,</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;NullPointerException());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strEntry&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;FileLocator.toFileURL(urlentry).getPath();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span><span style="color: #0000ff;">catch</span><span style="color: #000000;">&nbsp;(IOException&nbsp;e1)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">throw</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;DataException(</span><span style="color: #000000;">"</span><span style="color: #000000;">请检查文件的路径</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;e1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;strEntry;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;String&nbsp;getPluginPath(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;Activator.getDefault().getStateLocation().makeAbsolute().toFile().getAbsolutePath();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>}<br></span></div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 宋体;">另外，获取插件/rcp 的</span><span style="font-size: 10pt; font-family: &quot;courier new&quot;; color: black;" lang="EN-US">workspace</span><span style="font-size: 10pt; font-family: 宋体; color: black;">的路径：</span></p>
<p class="MsoNormal">
</p>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">Platform.getInstanceLocation().getURL().getPath()</span></div>
<br><span style="font-size: 10pt; font-family: 宋体;"></span><span style="font-size: 10pt; font-family: &quot;courier new&quot;;" lang="EN-US"><o:p></o:p></span>
<p>&nbsp;</p><img src ="http://www.blogjava.net/cherishchen/aggbug/126129.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cherishchen/" target="_blank">凭栏观海</a> 2007-06-25 15:54 <a href="http://www.blogjava.net/cherishchen/archive/2007/06/25/126129.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>