tag:blogger.com,1999:blog-71703900063159165052024-03-21T22:20:59.014-06:00Eclipse RCPDavid Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-7170390006315916505.post-54406639405110390422009-04-04T05:18:00.025-06:002009-04-04T10:40:29.547-06:00Got a bug? Who ya gonna call?<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg_JcavxjwVltGQXL9FruaRGtVLQYKABIVF4cvzV-RfntZMtB9JssBN8Na3XXmcC5UE70kvq6d97UQWYIw_uXhaLzEy66TSK6w5IW4YwOkJypJLb_jahV3sUdK9tH-Wmzj2EbzO5j-Ark/s1600-h/software_bug.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 166px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg_JcavxjwVltGQXL9FruaRGtVLQYKABIVF4cvzV-RfntZMtB9JssBN8Na3XXmcC5UE70kvq6d97UQWYIw_uXhaLzEy66TSK6w5IW4YwOkJypJLb_jahV3sUdK9tH-Wmzj2EbzO5j-Ark/s200/software_bug.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5320828643486931138" /></a>
<p>No one!</p>
<p>Seriously, this is the problem we face all the time when users run into a problem with our software. They don't call, they figure out an inefficient work around, they get frustrated, or stop using the software. It's counter intuitive but I've seen it over and over again. The reasons and excuses are endless but it all boils down to the fact that few problems are ever going to make it back to you.</p>
<p>Have you read Joel Spolsky's <a href="http://www.joelonsoftware.com/articles/fog0000000043.html">The Joel Test: 12 Steps to Better Code</a>? You should. I like it enough to add a thirteenth step, <b>log all error messages</b>. Logging errors to a file that no one reads doesn't count. You need to track the errors so that you can be proactive in finding solutions.</p>
<p>We took Manoel Marques's <a href="http://www.ibm.com/developerworks/library/os-eclog/">Plugging in a logging framework for Eclipse plug-ins</a> and extended it so all errors are logged in a database, emailed to our user support group and appropriate software developers. We've even gone as far as having <a href="http://www.mediawiki.org/wiki/MediaWiki">wiki</a> pages that shows the latest trends in real time.</p>
<p>This doesn't mean we're being constantly interrupted during our work day. But it does give us the flexibility to monitor users and jump in to solve either a usability, training, or software bug issue.</p>
<p>Eclipse is robust. I've been amazed at how well it handles nasty NullPointerExceptions without crashing. Don't get me wrong, it is a good thing but it can hide problems from the user. In alot of cases our users don't know they are in trouble until we burst into their office like <a href="http://dailyblabber.ivillage.com/entertainment/Ghostbusters-Photograph-C12119601.jpg">Murray, Aykroyd, and Ramis</a> looking to bust up a few ghosts.</p>
<p>We found it a great help to extend Marques's code to allow us to customize the logging properties. We allow log properties in the following order.</p>
<dl>
<dt>Load from the users home account</dt>
<dd>We can drop a custom logging properties file in the users account, restart our application and we can monitor whats happening in greater detail.</dd>
<dt>Load from command line</dt>
<dd>Customize logging from the run configuration dialog. Developers use this to avoid inundating the group with errors.</dd>
<dt>Load from bundle</dt>
<dd>This is what is shipped to our clients. Thanks to Eclipse plugin fragments each client gets to setup their own settings.</dd>
<dt>Load from default</dt>
<dd>In case the log properties file is broken, we have a default setup. Paranoid you say. Yep!</dd>
</dl>
<p>We have a set of standard logging tags. When you playback the log file, think airplane black boxes, it makes it easier to figure out what the user was doing leading up to their problem.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
public interface ILoggingTag {
public static final String DELIMITER = ":";
public static final String SPACE = " ";
public static final String CREATE = "CREATE";
public static final String OPEN = "OPEN";
public static final String CLOSE = "CLOSE";
public static final String START = "START";
public static final String STOP = "STOP";
public static final String FINISH = "FINISH";
public static final String DELETE = "DELETE";
public static final String CANCEL = "CANCEL";
//......
public static final String PLUGIN_START = PLUGIN + DELIMITER + START + SPACE;
public static final String PLUGIN_STOP = PLUGIN + DELIMITER + STOP + SPACE;
public static final String RESOURCE_OPEN = RESOURCE + DELIMITER + OPEN + SPACE;
public static final String RESOURCE_CLOSE = RESOURCE + DELIMITER + CLOSE + SPACE;
}
</pre></span>
<p>Our code looks like this.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
@Override
public void init(IEditorSite site, IEditorInput input) {
//...
logger.info(ILoggingTag.EDITOR_CREATE + input.getName());
}
@Override
public void dispose() {
log.debug(ILoggingTag.RESOURCE_CLOSE + getEditorInput().getName());
//...
}
</pre></span>
<p>We log messages to the users log file, to a <a href="http://www.postgresql.org/">PostgreSQL</a> database, and send emails. Having errors stored in a database allows use to generate wiki reports showing the latest trends in usage, bugs, etc.</p>
<p>The payback; obviously fewer bugs but what was really important was a more relaxed user community willing to help use improve the software. In many cases we're not tracking down software bugs but working to improve software usability. Users want to use our software, I have more time to spend writing new code, and tracking down bugs takes less time.</p>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com2tag:blogger.com,1999:blog-7170390006315916505.post-64799369776133265472008-04-05T12:11:00.007-06:002008-04-05T12:23:58.279-06:00Dynamic Context Help<p>I admit that I've passed over this user assistance feature for the last few years. My reasons: it's fluff, the documentation is vague, and no one will use it. I couldn't have been more wrong.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKJ1Z5cwUkcvv5NdLuny6IjOH3cSthi2CXLMk46xrbCdOQnHYSLPF48toEdXXLAyhwDNr-8jlB1ZsFBwwo-7KTkzRpghyKM60LekxYJJX8-lIN6-pGlJd9-nblw1povET9tgUyKbwJB9c/s1600-h/jobdeckeditordynamichelp.png"><img style="margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKJ1Z5cwUkcvv5NdLuny6IjOH3cSthi2CXLMk46xrbCdOQnHYSLPF48toEdXXLAyhwDNr-8jlB1ZsFBwwo-7KTkzRpghyKM60LekxYJJX8-lIN6-pGlJd9-nblw1povET9tgUyKbwJB9c/s200/jobdeckeditordynamichelp.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5174355941522771666" /></a>
<p>We first wired up dynamic help to our <a href="http://richclientplatform.blogspot.com/2007/12/oil-and-gas-industry-using-eclipse.html">job deck editor</a> in January. Looking at the above image you will see that the *TFSUPPRESS tag NOISEDIP has been selected with the help view offered a link for more details. It is simple, it works, and it is not <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipgSZtymBk_AjPRmKR52GUjXKhVSsbCgJsH39mnFnsDW-jXgiZPjediV_tJGjmsM5M-GJgZsJ_UBBW2v43KoUZYZLv-2S00kV64MjX8pOZyt4u2E_Rs__dhKO6l33g_Qow_j4zYdk0ZFY/s1600-h/annoying_paperclip.jpg">annoying</a>.</p>
<p>The idea is to offer the user help on what has been selected in the active view or editor. The help appears in the Eclipse help view. I've put together an example plugin that shows how it works. It is a view listing three characters from the classic movie "The Good, the Bad and the Ugly". The view class is called DynamicHelpView.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8qphhcmo0ySf18swQJ7hZVuWrBRzHrqhFMd-iis5hejvLffBGbLgGB-nxYVtnzEKNVNadgLoztvFCjG4_8VFE3pcof-LkZPl8n5TNs0XjxjvOVC2inKqYGaoW6pYw_WYk4sPrpAdnYlI/s1600-h/DynamicHelpViewHiLite.png"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8qphhcmo0ySf18swQJ7hZVuWrBRzHrqhFMd-iis5hejvLffBGbLgGB-nxYVtnzEKNVNadgLoztvFCjG4_8VFE3pcof-LkZPl8n5TNs0XjxjvOVC2inKqYGaoW6pYw_WYk4sPrpAdnYlI/s400/DynamicHelpViewHiLite.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5174358668827004674" /></a>
<p>Download the plugin source <a href="http://sourceforge.net/project/showfiles.php?group_id=220401">here</a> from SourceForge.net. The code assumes you are using Eclipse 3.3 and at least Java 5.0. I'm assuming you have some experience in adding help to your plugin. If not, spend a few minutes looking at the plugin.xml, context.xml and reference/*.* files.</p>
<p>The Eclipse help view, if visible, will listen for view or editor activation and selection events. In our example, when it sees one of these events it calls DynamicHelpView.getAdapter(Class) with a request for an IContextProvider.</p>
<p>To get this to work, make a selection and request dynamic help by pressing the F1 key.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
public Object getAdapter(Class adapter) {
if (IContextProvider.class.equals(adapter)) {
return new ContextProvider(Activator.PLUGIN_ID + ".context_dynamichelpview",
(IStructuredSelection) viewer.getSelection());
}
return super.getAdapter(adapter);
}
</pre></span>
<p>The ContextProvider retrieves the current table selection and returns a SelectionContext which provides the help view with help context resources to display. The help context resources can be related topics links or external links.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
public class ContextProvider implements IContextProvider {
public IContext getContext(Object target) {
IContext context = HelpSystem.getContext(fContextId);
if (!fSelected.isEmpty()) {
context = new SelectionContext(context, fSelected);
}
return context;
}
public int getContextChangeMask() {
return SELECTION;
}
}
</pre></span>
<p>The SelectionContext creates a list of IHelpResources. The first is a a single external link to <a href="http://www.wikipedia.org/">Wikipedia</a> followed by some internal links to related static help. The static help was registered in plugin.xml.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
public class SelectionContext implements IContext2 {
private IHelpResource[] fHelpResources;
private String fText;
private String fTitle;
public SelectionContext(IContext context, IStructuredSelection selection) {
Assert.isNotNull(selection);
if (context instanceof IContext2) {
fTitle = ((IContext2) context).getTitle();
}
List<IHelpResource> helpResources = new ArrayList<IHelpResource>();
String label = null;
StringBuffer location = new StringBuffer("http://en.wikipedia.org/wiki/");
if (selection.getFirstElement().equals("The Good")) {
label = "Clint Eastwood " + selection.toString();
location.append("Man_with_No_Name");
} else if (selection.getFirstElement().equals("The Bad")) {
label = "Lee Van Cleef " + selection.toString();
location.append("Angel_Eyes_%28The_Good%2C_the_Bad_and_the_Ugly%29");
} else if (selection.getFirstElement().equals("The Ugly")) {
label = "Eli Wallach " + selection.toString();
location.append("Tuco_%28The_Ugly%29");
}
helpResources.add(new SelectionHelpResource(label, location.toString()));
// Add static help topics
if (context != null) {
IHelpResource[] resources = context.getRelatedTopics();
if (resources != null) {
for (int j = 0; j < resources.length; j++) {
helpResources.add(resources[j]);
}
}
}
fHelpResources = helpResources.toArray(new IHelpResource[helpResources.size()]);
if (context != null) {
fText = context.getText();
}
if (fText == null) {
fText = "";
}
}
}
</pre></span>
<p>Set a few break points in the plugin to learn how dynamic help works.</p>
<p>There is a small bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=173073">173073</a> which requires you to hit a few <F1> keys to have the help view update its list of links. It has been fixed in Eclipse 3.4 (to be released in June 2008). Don't let this bug stop you from using the dynamic help.</p>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com4tag:blogger.com,1999:blog-7170390006315916505.post-8350669177122971932008-02-15T12:53:00.009-07:002008-02-17T18:48:09.001-07:00My Favorite Breakpoints<a href="http://youtube.com/watch?v=styYbRWQYP8"><img id="BLOGGER_PHOTO_ID_5167298449984268178" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf1YSsjYwKvwb0Su86pktSLJSXT4wcnAk1lTK6I_U2lPaeSjH0CTfVkbZ4mw8aG-rGTVRU0elYz_8XBWBaEvn1AD5SkUgZxnJD05czFkJ3Ae3ztigK2nkU9MYMg0VIjNLV5DrhcwJFwmI/s200/breakpoint.png" border="0" /></a><p>I have been meaning to start listing the breakpoints I use to track down issues with Eclipse since the beginning of the year. Even when you know the problem is with your own code diving into the Eclipse code can greatly reduce your debug time. This is specific to the Eclipse 3.3 release. Please send me your favorite break points and I'll add them to the list.</p>
<strong>User assistance</strong>
<dl>
<dt>WorkbenchHelpListener.helpRequested(HelpEvent)</dt>
<dd>Prease F1 (or CTRL + F1 for GNOME) and you will end up here. A quick
way to figure out which help context id is being requested.</dd>
<dt>WorkbenchHelpSystem.displayContext(IContext, int, int)</dt>
<dd>Most requests for help end up here.</dd>
<dt>StandaloneInfocenter.executeCommand(List)</dt>
<dd>Stand alone infocenter entry point.</dd>
</dl>
<strong>Menu contribution (org.eclipse.ui.menus)</strong>
<p>If you use commands and handlers with the new Eclipse 3.3 org.eclipse.ui.menus then these breakpoints are for you.</p>
<dl>
<dt>MenuPersistence.readAdditions()</dt>
<dd>See org.eclipse.ui.menus contributions being read
from a plugin.xml file.</dd>
<dt>MenuAdditionCacheEntry.createContributionItems()</dt>
<dd>Most requests for help end up here.</dd>
<dt>PopupMenuExtender.menuAboutToShow(IMenuManager)</dt>
<dd>Called when MenuManager fires an about to show event</dd>
</dl>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com0tag:blogger.com,1999:blog-7170390006315916505.post-50709329616177934002007-12-21T10:49:00.000-07:002007-12-21T21:52:57.632-07:00The Oil and Gas Industry using Eclipse<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyTK7IE6HvNf5d-Rh4O2c9CLepmmB7KFpelt1lzzPI-jWCsUqi-FjVXSnCYJRtSjeOfebEKH8gS5KO_WP80PzVcJevRxOdotoXfFcmSzPKQwegtufCL3d9jbD__AtZWn7LoiGOrUne4Qw/s1600-h/01-intro.png"><img style="float:left; margin:0 10px 0px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyTK7IE6HvNf5d-Rh4O2c9CLepmmB7KFpelt1lzzPI-jWCsUqi-FjVXSnCYJRtSjeOfebEKH8gS5KO_WP80PzVcJevRxOdotoXfFcmSzPKQwegtufCL3d9jbD__AtZWn7LoiGOrUne4Qw/s200/01-intro.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146485279035763794" /></a><p>It has been too long since I last posted so I decided to show off some of what we've been working on at <a href="http://www.kelman.com/">Kelman Technologies</a>.</p>
<p>The screen shots show off the IPE (Interactive Processing Environment). It is our latest generation of seismic processing tools based on <a href="http://www.eclipse.org/home/categories/rcp.php">Eclipse RCP</a> and other Eclipse projects. Before you get your mouse in a knot this isn't a sales pitch. The IPE is not for sale. We use open source tools to turn our <a href="http://en.wikipedia.org/wiki/Intellectual_property">intellectual property</a> into tools for "in house" use.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXI8fayZU9YA8UTEWYV29t3XliGCYAL1HUyi9bEshydFz6bvMViNhhvjIHf8zvQSaxcnELnr9pfx7TosAmkdMxNYa34W080HXs8-OONCP-Lmbmg-1CLufsZ5SoYJcWGG99XUsy87LF0XI/s1600-h/02-crossplot.png"><img style="float:left; margin:0 10px 0px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXI8fayZU9YA8UTEWYV29t3XliGCYAL1HUyi9bEshydFz6bvMViNhhvjIHf8zvQSaxcnELnr9pfx7TosAmkdMxNYa34W080HXs8-OONCP-Lmbmg-1CLufsZ5SoYJcWGG99XUsy87LF0XI/s200/02-crossplot.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146485485194194018" /></a>
<p>The IPE is the front end to our <a href="http://en.wikipedia.org/wiki/Exploration_geophysics">geophysical</a> processing system. We use it to help our clients find and enhance oil and gas reserves around the world. Developing software for this industry is a challenge because of the immense amount of data that needs to be managed and processed. We deal with extremely large computer clusters, <a href="http://en.wikipedia.org/wiki/Tera-">terabyte</a> sized disk farms, <a href="http://en.wikipedia.org/wiki/Exa-">exabyte</a> sized tape systems and insane visualization requirements. There are very few industries in the world that have the same high performance computing needs as the oil and gas industry.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKL1Of848X2u91SFCMfw9SrZSC5K3I6EZra9FG3CsPhXwb3t70j0J9XNklS_wPOrz2rP3B0zBXYZTVFhh9VjGSedGcyU6yUJaGzFRK2ovWd5BQkn570P_I4_0LtX9TgrrVPapdI_-zNx8/s1600-h/03-2d-crossplot.png"><img style="float:left; margin:0 10 0px 0px;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKL1Of848X2u91SFCMfw9SrZSC5K3I6EZra9FG3CsPhXwb3t70j0J9XNklS_wPOrz2rP3B0zBXYZTVFhh9VjGSedGcyU6yUJaGzFRK2ovWd5BQkn570P_I4_0LtX9TgrrVPapdI_-zNx8/s200/03-2d-crossplot.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146485807316741234" /></a>
<p><a href="http://en.wikipedia.org/wiki/Cross-plot">Cross plots</a> have been a big challenge. How do you visualize 20 million or more data points? We have tried a number of different scientific plotting libraries that have all failed to handle the large amount of data points. Early 2008 we are starting work on our own plotting library to replace <a href="http://www.epic.noaa.gov/java/sgt/">SGT</a> which replaced <a href="http://java.freehep.org/">FreeHEP</a>.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqe4IYNlHuN-UQSmCsD04CKL4xkx4nzStd4gfj5qZ3H4toiCc3xUjz5uk2spLgHSNmE4pfUPARexlpztFsHoy0bCADC20orpZbqutJBLrGVzq4pEJR0Wt29xDvBHsFVmnmZ3slW9i52WM/s1600-h/04-seismic.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqe4IYNlHuN-UQSmCsD04CKL4xkx4nzStd4gfj5qZ3H4toiCc3xUjz5uk2spLgHSNmE4pfUPARexlpztFsHoy0bCADC20orpZbqutJBLrGVzq4pEJR0Wt29xDvBHsFVmnmZ3slW9i52WM/s200/04-seismic.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146485923280858242" /></a>
<p>This is what the earth looks like to a geophysicist. A seismic plot can easily be 3 feet by 20 feet long on paper. Convert that to a usable image on the screen and you have a 12,000 by 23,000 pixel image. That is 276,000,000 pixels or about 828 megabytes of memory. Our users expect to have dozens of these images open at one time. Libraries like <a hef="http://java.sun.com/javase/technologies/desktop/media/jai/">Java Advanced Imaging</a> were never designed for this sort of work load.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4eHekvaGY4QbhO1x75LkcvZSxT46MRsdeRZ74nBOf3EgKbEQMa-RzmNpRkt1LCBxQeVyxOA7LMKiCiMTcqmIdFIMsWRNW_FA3Ujen4qM1bqRGq9z8sK6lT_Righq9fWnRAlAfo7dZNzE/s1600-h/04-variable-density-seismic.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4eHekvaGY4QbhO1x75LkcvZSxT46MRsdeRZ74nBOf3EgKbEQMa-RzmNpRkt1LCBxQeVyxOA7LMKiCiMTcqmIdFIMsWRNW_FA3Ujen4qM1bqRGq9z8sK6lT_Righq9fWnRAlAfo7dZNzE/s200/04-variable-density-seismic.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146486155209092242" /></a>
<p>You are seeing seismic data plotted as wiggles and as a variable density plot. Seismic data files can be as large at 350 gigabytes with the requirement that any <a href="http://www.kgs.ku.edu/PRS/publication/2002/ofr49/gifs/fig1.gif">seismic trace</a> be retrieved for immediate viewing. SWT has been surprising good at keeping up with the performance demands.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv8gA-mRsCIZ7EQvl6bP9OxW4zRO1TI-PpviYIlCKznJ81nVS_4iEA_cV9iudTUVjzC6BDdMG0tAu-19KvlO7A07vN_hzUyqIRQ2gdqE5gT7OqqQIZS6VNT3q2DXldCjqetkkyIk5OwIk/s1600-h/05-spectral-analysis.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv8gA-mRsCIZ7EQvl6bP9OxW4zRO1TI-PpviYIlCKznJ81nVS_4iEA_cV9iudTUVjzC6BDdMG0tAu-19KvlO7A07vN_hzUyqIRQ2gdqE5gT7OqqQIZS6VNT3q2DXldCjqetkkyIk5OwIk/s200/05-spectral-analysis.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146486498806475938" /></a>
<p>We used <a href="http://www.eclipse.org/birt/phoenix/">BIRT</a> for our spectral analysis editor. It made for a fast development cycle but the business oriented charting isn't up to plotting thousands of data points. The guys working on BIRT have been very responsive to our requests but it's not a high performance scientific charting API. Work on a replacement starts in 2008. We'll still use BIRT for our management related reports.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjvmMKwfnUl5AcvrR-iE1MpQdWGE9dCBP9tHLGgM-gs5MMD5yIRCCP2mZgV092QSydQdk3wq-IyMDFrDmdhvhkrTvcX6j9becs87XQPWoHU5KQ3E5XJSlfoXDR097fvQ63M1ZmeTH8bQk/s1600-h/06-history-seismic.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjvmMKwfnUl5AcvrR-iE1MpQdWGE9dCBP9tHLGgM-gs5MMD5yIRCCP2mZgV092QSydQdk3wq-IyMDFrDmdhvhkrTvcX6j9becs87XQPWoHU5KQ3E5XJSlfoXDR097fvQ63M1ZmeTH8bQk/s200/06-history-seismic.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146486584705821874" /></a>
<p>The seismic data keeps its own processing history. It's an audit trail of how the raw seismic field data was processed into a final client ready dataset. It can take hundreds of processing steps and months of CPU time to generate one seismic dataset. The history alone for a single file can reach 100 gigabytes. Being able to create our own custom IDocument saves us from loading the whole file into memory.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj19EPl2VK-Ov5oJXQaKaT7UqSIC-bDcKoznqPffdAYGElqUyGJNSwZtMHRTNLZoIbDWVvVk7dOzondeNYvWxO5n-MewRZLvpCtm5e01hN9yNFoW3v2PW_r86BGhFMkhtLvbdRK9oU22E/s1600-h/07-trace-header-dump-seismic.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj19EPl2VK-Ov5oJXQaKaT7UqSIC-bDcKoznqPffdAYGElqUyGJNSwZtMHRTNLZoIbDWVvVk7dOzondeNYvWxO5n-MewRZLvpCtm5e01hN9yNFoW3v2PW_r86BGhFMkhtLvbdRK9oU22E/s200/07-trace-header-dump-seismic.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146486799454186690" /></a>
<p>Quality control of the seismic data is another big challenge. The volume of data makes it impossible for a human to inspect all of the project data.</p>
<p>Managing the volume of files has been in nightmare in the past. I've been impressed with how well the <a href="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/resources/package-summary.html">resources plugin</a> combined with the <a href="http://richclientplatform.blogspot.com/2007/06/common-navigator-framework.html">Common Navigator Framework</a> has been able to keep up with our demands.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj125-CgBTrDhyphenhyphen0NtKBKmo9_s-kG7Ja05gXg2IC5tukQ9NvTsGC89gIIJCuwkR4DyvrQj5XDIfWudsh1NzxGU2rrRuQ5nGd4R9Tc_ERDSiRrky2lI0COcmyozuTjhxpdmS5iE5rRJEvAL8/s1600-h/08-dynamic-help.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj125-CgBTrDhyphenhyphen0NtKBKmo9_s-kG7Ja05gXg2IC5tukQ9NvTsGC89gIIJCuwkR4DyvrQj5XDIfWudsh1NzxGU2rrRuQ5nGd4R9Tc_ERDSiRrky2lI0COcmyozuTjhxpdmS5iE5rRJEvAL8/s200/08-dynamic-help.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146486876763598034" /></a>
<p>The Eclipse User Assistance API has been used heavily. We have offices all around the world so we have to provide easy access to good quality help documents. We are using Camtasia to create built in videos. I don't want to get a call from our users in Libya at two in the morning.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjta3tGcCEepo0waX8uRCEwUkNzrqp0ACjFKbWNdq8S8w4tW5gYgezAUxAW_LOOGgrZ5zMXO6K7rSI9kWrKO5IPc1K-GBUBCQRAKQAabE7kK0IZ3Mnwv-epvw67xmjw5v1I2TK5sKHoSCI/s1600-h/09-job-editor.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjta3tGcCEepo0waX8uRCEwUkNzrqp0ACjFKbWNdq8S8w4tW5gYgezAUxAW_LOOGgrZ5zMXO6K7rSI9kWrKO5IPc1K-GBUBCQRAKQAabE7kK0IZ3Mnwv-epvw67xmjw5v1I2TK5sKHoSCI/s200/09-job-editor.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146486975547845858" /></a>
<p>We've written a smart job deck editor that has all of the features of the Java editor but it works with our proprietary processing language called kismet. Our seismic processors are a bit like software programmers. They write job decks that tell our seismic processing system how to manipulate the seismic data.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzXSen06H03UIfWjz90nl7laQ1BkPbY-ZypLXp4iX82cmFiHis8KMbEKjxgE5HAHKxenYsAQ9j21b8lUDxKSUCR-CuGYDdVvKMlP6VkQ_wQKCWYYvJmvSM5GPlHzRzA-SRRox9x93LIGk/s1600-h/10-database.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzXSen06H03UIfWjz90nl7laQ1BkPbY-ZypLXp4iX82cmFiHis8KMbEKjxgE5HAHKxenYsAQ9j21b8lUDxKSUCR-CuGYDdVvKMlP6VkQ_wQKCWYYvJmvSM5GPlHzRzA-SRRox9x93LIGk/s200/10-database.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487031382420722" /></a>
<p>Our clients send data in a bewildering array of data formats. Using our standard database editor has reduced the confusion experienced by our users. As new formats appear we create a new translator and plug it into the IPE. All of our plotting plugins can then take advantage of the new data.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgosMoDUGVsHG6jqYpBtESQihjMjWWNZrvzrtB9lfwezDpIeth9R3t8FLJn_5w8SyrxTNLJhSjEqewM2m_XpfSExgQqctc-jO_KOlRHGf80JJv6S0iYkHcDEgkeMEMZrDsjYdoRtsByyfA/s1600-h/11-problem-view.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgosMoDUGVsHG6jqYpBtESQihjMjWWNZrvzrtB9lfwezDpIeth9R3t8FLJn_5w8SyrxTNLJhSjEqewM2m_XpfSExgQqctc-jO_KOlRHGf80JJv6S0iYkHcDEgkeMEMZrDsjYdoRtsByyfA/s200/11-problem-view.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487091511962882" /></a>
<p>Kismet jobs can report errors and warning. We have our own kismet builder/nature. We get the best of the Eclipse IDE for our users who have no programming experience. Editor user assistance, hover help, and other great built in features makes it the editor of choice.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJQGOdhrEiok0rghw5gRDfKGzY00XY1lPE8XuSSQYsB7fKZD7-xF4OVvjQMxzBzaAAJE1hVZSPlDFhFSPYN1YVEfnjEEawdIAgxs_UKSn9mo42if-1G6SjxCs_7qWiS4A4WZ6AILjmRFU/s1600-h/12-job-tracker-view.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJQGOdhrEiok0rghw5gRDfKGzY00XY1lPE8XuSSQYsB7fKZD7-xF4OVvjQMxzBzaAAJE1hVZSPlDFhFSPYN1YVEfnjEEawdIAgxs_UKSn9mo42if-1G6SjxCs_7qWiS4A4WZ6AILjmRFU/s200/12-job-tracker-view.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487151641505042" /></a>
<p>We used <a href="http://ibatis.apache.org/">iBatis</a> to access our <a href="http://www.postgresql.org/">PostgreSQL</a> job tracker server. It's an unorthodox use of iBatis (the IPE is not web based) but it makes for a fast development cycle and easy maintenance. Our users can monitor a job on any cluster computer from the comfort of their desk.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBZxK1L9KWrw3FvOBUTq0PKm9yAwnnvlQrjmCcXq8pPkOUsgcfnfu8fhnFJ-whxUWVKKt_9KogAeAbsRR8YG0_Ctzo0t2Lt-R_0G4lbvqg8_hEUBUIPEerbWKsV7Uss7HvyE1rsiZwFIA/s1600-h/13-binary-editor.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBZxK1L9KWrw3FvOBUTq0PKm9yAwnnvlQrjmCcXq8pPkOUsgcfnfu8fhnFJ-whxUWVKKt_9KogAeAbsRR8YG0_Ctzo0t2Lt-R_0G4lbvqg8_hEUBUIPEerbWKsV7Uss7HvyE1rsiZwFIA/s200/13-binary-editor.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487297670393122" /></a>
<p>For those times when our client sends us data in a mystery format with no file extension. We can load any binary file into our binary editor. We even have an ascii table view to help with conversions from hex to octal to decimal to ascii. I wonder if we'll need a slider ruler view?</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5mjt8GBDEQJZsaYBRoSE-Q8TqzGBypleH0Vcj2iaGAO4cLsGxlTXctKTPmWE75uRBNkty2x35cPeYrQCNtY5YMUW8CCJCfGIZz7ykS-edsNl1MT-9MvvmAnCLcQJ8gv5E5DgCM232OF8/s1600-h/14-image-editor.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5mjt8GBDEQJZsaYBRoSE-Q8TqzGBypleH0Vcj2iaGAO4cLsGxlTXctKTPmWE75uRBNkty2x35cPeYrQCNtY5YMUW8CCJCfGIZz7ykS-edsNl1MT-9MvvmAnCLcQJ8gv5E5DgCM232OF8/s200/14-image-editor.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487370684837170" /></a>
<p>Another sore point I have with the available image libraries. The seismic industry image standard is <a href="http://en.wikipedia.org/wiki/TIFF">TIFF</a> on steroids. We can't load a typical TIFF image into an SWT <a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Image.html">Image</a> object because it will use over 2 gigabytes of memory. We're still working out performance kinks on this one. I'll be looking at Batik and libTiff in 2008. The SWT TIFF support wasn't designed with us in mind.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_WzsKwDP17CxtD1Cc0MqJwRY1otu82yhzZoc0DfMKHJkFN4XCzek_dzm1_s66gL23u6QI7kfLLY1g9_NcnLzeoJzHigSU-19gwoAdRT00r90KBjUlojX_CC9RTHLjaSXOhbh2h1IxnBU/s1600-h/15-pbs-hosts.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_WzsKwDP17CxtD1Cc0MqJwRY1otu82yhzZoc0DfMKHJkFN4XCzek_dzm1_s66gL23u6QI7kfLLY1g9_NcnLzeoJzHigSU-19gwoAdRT00r90KBjUlojX_CC9RTHLjaSXOhbh2h1IxnBU/s200/15-pbs-hosts.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487555368430914" /></a>
<p>Our front end to the <a href="http://www.openpbs.org/">Portable Batch System</a> (PBS) developed by <a href="http://www.nasa.gov/">NASA</a> back in the early 1990s.</p>
<p>We use PBS to manage our computer clusters. Users can submit hundreds or thousands of processing jobs with a simple click of a button. It's grid computing on steroids.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXe9QJYXB2zVc7wRtwopFrWKfwst1sDSqurHTHTTcsAjRMqDQSyVc7S2XRhwjhmcuFwFUZTiEcU7xxwCSx9xI9wjSmZzoZTiI2wu9vX_Ll3BJwYlhkgvLF3pbnltmf2kslOWztEiffZUI/s1600-h/16-pbs-queue.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXe9QJYXB2zVc7wRtwopFrWKfwst1sDSqurHTHTTcsAjRMqDQSyVc7S2XRhwjhmcuFwFUZTiEcU7xxwCSx9xI9wjSmZzoZTiI2wu9vX_Ll3BJwYlhkgvLF3pbnltmf2kslOWztEiffZUI/s200/16-pbs-queue.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487624087907666" /></a>
<p>The processing requirements vary depending on the state of the seismic data. We still have to manually configure our computers for peek performance. That is why we have so many different processing queues. I know it sounds like we're in the age of <a href="http://en.wikipedia.org/wiki/ENIAC">ENIAC</a> but we still haven't found computer hardware that is flexible enough to handle all our high performance processing needs. Heck, we're looking at moving our processing system onto GeForce graphics cards to squeeze out every last <a href="http://en.wikipedia.org/wiki/FLOPS">FLOP</a>.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPaIQIu4dAmGZ0o1jXeuBbCIiGA_55MT_P0REdAgAciRmVz7zTrB0ljlnnxca5u4zsqzVPoPoJKxCPMm9fIV8jLWl3EcdEjOjFooqH_hZpL-AqaWcuzdQDQOlAA68-d9AJHtvOjJ-baiw/s1600-h/17-pbs-jobs.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPaIQIu4dAmGZ0o1jXeuBbCIiGA_55MT_P0REdAgAciRmVz7zTrB0ljlnnxca5u4zsqzVPoPoJKxCPMm9fIV8jLWl3EcdEjOjFooqH_hZpL-AqaWcuzdQDQOlAA68-d9AJHtvOjJ-baiw/s200/17-pbs-jobs.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487688512417122" /></a>
<p>Job, jobs and more jobs. Managing thousands of jobs that could run for weeks is getting easier. Using an Eclipse view to filter and sort jobs has made life a little less stressful for our users. More advanced tools are in the works for 2008 and 2009 as we try to figure out better ways for our cluster computers to manage themselves.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj1-ZL-2zCMwdw337xcDJSqYZ0ZI0o7zafNPDqwSE0fWXJ1_4bOD5PrugZEz_NDmW-IaJs9aH9k2sT0x9hU1LS8Ym8IGYXZSw0BvWjeDXxH0HUALtvTIRedCA76e8wtFKeENcUNSKPkxE/s1600-h/18-wiki.png"><img style="float:left; margin:0 10px 0 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj1-ZL-2zCMwdw337xcDJSqYZ0ZI0o7zafNPDqwSE0fWXJ1_4bOD5PrugZEz_NDmW-IaJs9aH9k2sT0x9hU1LS8Ym8IGYXZSw0BvWjeDXxH0HUALtvTIRedCA76e8wtFKeENcUNSKPkxE/s200/18-wiki.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5146487744346991986" /></a>
<p>Bless the wiki. We use it more and more to keep our internal users informed. The Eclipse platform allows us to search our internal doc, our wiki, and our Eclipse based <a href="http://www.eclipse.org/eclipse/platform-ua/proposals/help/help_enhancements/index.htm">info center</a> with the click of one button. It's great.</p>
<p>We are pushing the Eclipse RCP to extremes that I know were never envisioned by the Eclipse team back in the 2001. Although we've found a few performance weaknesses we've never regretted our decision to adopt Eclipse RCP.</p>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com1tag:blogger.com,1999:blog-7170390006315916505.post-71670026473050718162007-09-20T07:38:00.000-06:002007-09-20T08:58:49.328-06:00IBM Lotus Expeditor and Symphony<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7JuXOzlupeY1AqYaawQ1Xu1lOxSOq9jZ90zOtxxVHTfbQGLRUQYijUX2H11F4jfOWoofNtQTJg7due2SdGVszNhbixf7YX57VdWyiaHOnghnQWvsrboS46AuKTKGLJr5yUENfHjGbUJU/s1600-h/IBMSymphony1985.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7JuXOzlupeY1AqYaawQ1Xu1lOxSOq9jZ90zOtxxVHTfbQGLRUQYijUX2H11F4jfOWoofNtQTJg7due2SdGVszNhbixf7YX57VdWyiaHOnghnQWvsrboS46AuKTKGLJr5yUENfHjGbUJU/s200/IBMSymphony1985.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5112280515752543842" /></a>
<p>Dreams of <a href="http://symphony.lotus.com/software/lotus/symphony/home.jspa">IBM Lotus Symphony</a> components appearing inside our Eclipse RCP application have quickly faded when reality tapped me on the side of the head with a large <a href="http://en.wikipedia.org/wiki/Service-oriented_architecture">SOA</a> middleware wiffle bat.</p>
<p>IBM Lotus Symphony is built on top of <a href="http://www.eclipse.org/home/categories/rcp.php">Eclipse RCP</a> and <a href="http://www.ibm.com/developerworks/lotus/library/expeditor-intro/index.html?S_TACT=105AGX13&S_CMP=EDU">IBM Lotus Expeditor</a>. That is a key point. Your existing Eclipse RCP applications need to be ported to the IBM Lotus Expeditor environment. For example, the three IBM Lotus Symphony applications run inside the Expeditor.</p>
<p>For those who are interested, start with the following articles. I'm assuming you are comfortable developing Eclipse RCP applications. In fact, only Eclipse 3.2 RCP applications. If you have made the jump to Eclipse 3.3 you will have to wait. Also, you don't need to download IBM Lotus Symphony.</p>
<ul>
<li><a href="http://www.ibm.com/developerworks/lotus/library/expeditor-intro/index.html?S_TACT=105AGX13&S_CMP=EDU">Introducing IBM Lotus Expeditor V6.1.1</a></li>
<li><a href="http://www.ibm.com/developerworks/lotus/library/expeditor-toolkit/?S_TACT=105AGX01&S_CMP=LP">Getting started with the IBM Lotus Expeditor Toolkit V6.1.1</a></li>
<li><a href="http://www.ibm.com/developerworks/lotus/library/expeditor-eclipse/">Migrating Eclipse RCP applications to IBM Lotus Expeditor</a></li>
</ul>
<p>The last article shows how to port our favorite <a href="http://www.eclipse.org/articles/Article-RCP-3/tutorial3.html">Eclipse RCP Mail Application</a> into the IBM Lotus Expeditor SOA Middleware universe.</p>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com0tag:blogger.com,1999:blog-7170390006315916505.post-44933334754675443222007-09-12T07:03:00.001-06:002007-09-12T07:47:26.436-06:00Sigue Sigue SIGTERM<a href="http://youtube.com/watch?v=pk30a0qsVIk"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT86VlYr2RMU2quOkCnP7ygD4HEbWQrYwJRpeYC6nuHeuAiXiaUeh1EYdlSmn-enqnqsYSth0hsKPszvfuCBDg91YmtSatFRjhWuebklgMS0DRj4BgEUMV-ZCE9MTe2fmM_-k18-XaT48/s200/sigueX2sputnik.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5108258211975454034" /></a>
<p>Our IT group wondered if our Eclipse RCP based application could handle a linux system shutdown. They kept catching hell for rebooting computers at night to keep the batch processing system running. Our users would lose unsaved work and get grumpy. Grumpy seismic processors are not a pretty sight.</p>
<p>The trick is to teach the Eclipse RCP application to listen for a <a href="http://en.wikipedia.org/wiki/SIGTERM">SIGTERM</a> by adding a shutdown hook.</p>
<p>Please note that this does not work on Windows. More about this in a future blog.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
public class IPEApplication implements IApplication {
public Object start(IApplicationContext context) throws Exception {
final Display display = PlatformUI.createDisplay();
Runtime.getRuntime().addShutdownHook(new ShutdownHook()); }
// start workbench...
}
}
</pre></span>
<p>The shutdown code must be run in the UI thread and should not be
run if the workbench is being closed by other means. All dirty editors
are automatically saved. This avoids prompting the user who is probably at home sleeping when their computer is shutdown. Finally the workbench is closed.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
private class ShutdownHook extends Thread {
@Override
public void run() {
try {
final IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = PlatformUI.getWorkbench()
.getDisplay();
if (workbench != null && !workbench.isClosing()) {
display.syncExec(new Runnable() {
public void run() {
IWorkbenchWindow [] workbenchWindows =
workbench.getWorkbenchWindows();
for(int i = 0;i < workbenchWindows.length;i++) {
IWorkbenchWindow workbenchWindow =
workbenchWindows[i];
if (workbenchWindow == null) {
// SIGTERM shutdown code must access
// workbench using UI thread!!
} else {
IWorkbenchPage[] pages = workbenchWindow
.getPages();
for (int j = 0; j < pages.length; j++) {
IEditorPart[] dirtyEditors = pages[j]
.getDirtyEditors();
for (int k = 0; k < dirtyEditors.length; k++) {
dirtyEditors[k]
.doSave(new NullProgressMonitor());
}
}
}
}
}
});
display.syncExec(new Runnable() {
public void run() {
workbench.close();
}
});
}
} catch (IllegalStateException e) {
// ignore
}
}
}
</pre></span>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com2tag:blogger.com,1999:blog-7170390006315916505.post-67694808776818929982007-09-03T14:32:00.000-06:002007-09-03T15:10:51.457-06:00Cheat Sheet Editor<p>Eclipse Europa (3.3) has a new Cheat Sheet Editor which is a vast improvement over the XML editor used in the Calipso (3.2) release.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVYChXc-LpudLIx760puTcWyMgVxGZ_amZnYWfwnVM2pYgpv-MvJGb4_BORXXhZvxfaSgwOEOdhyphenhyphenyxwAVksKdqpHXzFHKnCMprcqmI0vSP4PEznext8SB3UaRh6K2lRBmKfi8Pey3ChwQ/s1600-h/cheatsheeteditor.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVYChXc-LpudLIx760puTcWyMgVxGZ_amZnYWfwnVM2pYgpv-MvJGb4_BORXXhZvxfaSgwOEOdhyphenhyphenyxwAVksKdqpHXzFHKnCMprcqmI0vSP4PEznext8SB3UaRh6K2lRBmKfi8Pey3ChwQ/s200/cheatsheeteditor.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5106088257058561346" /></a>
<ol>
<li>Create a cheat sheet, <strong>File->New->Other...->User Assistance->Cheat Sheets</strong>.</li>
<li>Enter a filename and click Finish.</li>
</ol>
<p>The new Cheat Sheet Editor will appear. Select the <strong>Item</strong> and you will see the definition and command sections appear to the right. Click the <strong>Browse...</strong> button to see the new Command Composer.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8jUw5sJOCtNz6xr3dcTvZFBbBKFIkxmUpzyOHemZnGH9MDh3Q9Yv114CDU2Pht-yQi4FYNpIvL-z1TMK7FeFupMMOsVKeVH1DIklfO2-pMlLfXl5INXFnxYyfR7oyJp2744WSfbyOa6o/s1600-h/command-composer.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8jUw5sJOCtNz6xr3dcTvZFBbBKFIkxmUpzyOHemZnGH9MDh3Q9Yv114CDU2Pht-yQi4FYNpIvL-z1TMK7FeFupMMOsVKeVH1DIklfO2-pMlLfXl5INXFnxYyfR7oyJp2744WSfbyOa6o/s200/command-composer.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5106087329345625394" /></a>
<p>The Command Composer shows a list of available commands and their parameters. Gone are the days of hunting through eclipse plugin.xml files looking for command ids.</p>
<ol>
<li>In the Command Composer, select <strong>Window->Preferences</strong>.</li>
<li>Use the Preference Page combo box to select <strong>General->Editors->File Associations</strong>.</li>
<li>Click OK.</li>
</ol>
<p>You now have a cheat sheet item which will display the File Association preference page.</p>
<p>If you want to see what happens inside Eclipse, display the <code>ParameterizedCommand</code> class and set a break point at <code>executeWithChecks(Object, Object)</code>. Now run your application in debug mode, display your cheat sheet and press "Click to perform".</p>
<p>The command <code>org.eclipse.ui.window.preferences</code> is defined in <code>org.eclipse.ui/plugin.xml</code>. Its default handler is <code>ShowPreferencePageHandler</code> which is found in the <code>org.eclipse.ui.workbench</code> plugin.</p>
<p>Read up on the following extension points and use the <code>ShowPreferencePageHandler</code> as an template to build your own commands that can be accessed from a cheat sheet. See <a href="http://richclientplatform.blogspot.com/2007/07/new-menu-contribution-extension.html">New menu contribution extension</a> for readings on how to use a command in a menu, toolbar, or popup menu.</p>
<dl>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_commands.html">
<code>org.eclipse.ui.commands</code></a></dt>
<dd>A logical representation of a task. A handler does the work. See <a href="http://wiki.eclipse.org/Platform_Command_Framework#Commands">wiki</a> and <a href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd_commands.htm">help guide</a>.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_handlers.html">
<code>org.eclipse.ui.handlers</code></a></dt>
<dd>A handler does what the command represents. See <a href="http://wiki.eclipse.org/Platform_Command_Framework#Handlers">wiki</a> and <a href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd_handlers.htm">help guide</a>.</dd>
</dl>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com2tag:blogger.com,1999:blog-7170390006315916505.post-31930345406750009802007-08-30T13:13:00.000-06:002007-09-05T09:01:46.712-06:00New Europa default presentation<blockquote><i>An internal note in the WorkbenchPage code lead me to think that our legacy code was broken due to a valid API change. <a href="http://www.blogger.com/profile/06344587055927544695">Boris Bokowski</a> has correctly pointed out that it is a bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=202280">202280</a>.</i></blockquote>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGLUyR0H0OuGiNGJ2i46edov9ooIftRZvxCh4iQUdysMKPf7Zktv_CUNr06zO-XO8VHNpk3uzcZKUHBYkNf9eaQ9mrcSfqlpZou9M0lSpxJf0egM60zcBWW5djuttFVMXfQWBRfdFL0Ng/s1600-h/europaNewTrim.png"><img style="float:right; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGLUyR0H0OuGiNGJ2i46edov9ooIftRZvxCh4iQUdysMKPf7Zktv_CUNr06zO-XO8VHNpk3uzcZKUHBYkNf9eaQ9mrcSfqlpZou9M0lSpxJf0egM60zcBWW5djuttFVMXfQWBRfdFL0Ng/s200/europaNewTrim.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5104574470065282338" /></a>
<p>Eclipse Europa has a new default presentation that includes a new minimize/maximize behavior and new tab treatments.</p>
<p>I like the new feature but was a bit puzzled at the API changes made to IWorkbenchPage. Calls to <a href="http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchPage.html#isPageZoomed()">IWorkbenchPage.html#isPageZoomed()</a> always return false. Our application would never call <a href="http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchPage.html#toggleZoom(org.eclipse.ui.IWorkbenchPartReference)">IWorkbenchPage.html#toggleZoom(IWorkbenchPartReference)</a> and our users became a bit bewildered by a view taking up the whole view stack.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().
getActivePage();
if (page.isPageZoomed()) {
page.toggleZoom(workbenchPartReference);
}</pre></span>
<p>Instead you need to call <a href="http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchPage.html#getPartState(org.eclipse.ui.IWorkbenchPartReference)">IWorkbenchPage.html#getPartState(IWorkbenchPartReference)</a>. It returns one of the following states.</p>
<dl>
<dt>IWorkbenchPage.STATE_MINIMIZED</dt>
<dd>State of a view in a given page when the page is zoomed in on the view stack. (int)0</dd>
<dt>IWorkbenchPage.STATE_MAXIMIZED</dt>
<dd>State of a view in a given page when the view stack is minimized. (int)1</dd>
<dt>IWorkbenchPage.STATE_RESTORED</dt>
<dd>State of a view in a given page when the view stack is in it's normal state. (int 2)</dd>
</dl>
<p>In our case a simple call to restore the view to its original state is all thats needed.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().
getActivePage();
page.setPartState(workbenchPartReference,
IWorkbenchPage.STATE_RESTORED);
</pre></span>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com2tag:blogger.com,1999:blog-7170390006315916505.post-81372487671294542332007-08-15T09:26:00.000-06:002007-08-15T10:05:27.203-06:00High performance graphics with SWT<p>When dealing with high performance graphics using a <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html">Graphics Context</a> is not always the fastest way to render images.</p>
<p>We discovered this when trying to render a seismic variable density plot. On a typical two monitor system we were rendering an partial image of 2,000x800 pixels. Repeated calls to GC.drawPoint() or GC.fillRectangle() returned extremely slow rendering times. A whole seismic panel could be 10,000x4000 pixels. A large dataset could have 15,000 panels (about 500 Gigabytes) so you see we have to do things quickly.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi76rn6LH6pw0KBO1FQ0ofM0WRgMx1_LODS1OdtvPwb5oyzPvJnfLqhe39_vXq-aVAjC0JteAcraTF5sDRo1ipRAxzpEnTLrZt_xg7okpYzeoVantJDD5JtE9PmwFMdWGZaZFs310APpiM/s1600-h/VariableDensityPlot.png"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi76rn6LH6pw0KBO1FQ0ofM0WRgMx1_LODS1OdtvPwb5oyzPvJnfLqhe39_vXq-aVAjC0JteAcraTF5sDRo1ipRAxzpEnTLrZt_xg7okpYzeoVantJDD5JtE9PmwFMdWGZaZFs310APpiM/s320/VariableDensityPlot.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5098950402496582146" /></a>
<p>The answer was to draw directly into an <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/ImageData.html">ImageData</a> by setting each pixel using an <a href="http://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html#PaletteData">indexed palette</a>. In the image above text and grid lines are drawn using the <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html">Graphics Context</a> while the colour pixels are set using <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/ImageData.html#setPixel(int,%20int,%20int)">ImageData.setPixel()</a>. It sounds slow but ends up being extremely fast. </p>
<span style="font-family:courier new;font-size:85%;">
<pre>
PaletteData paletteData = new PaletteData(new RGB[]
{new RGB(255,0,0), new RGB(0,255,0)});
ImageData imageData = new ImageData(48,48,1,paletteData);
for(int x=11;x<35;x++){
for(int y=11;y<35;y++){
imageData.setPixel(x,y,1);
}
}
Image image = new Image(display,imageData);
</pre>
</span>
<p>There is a great article on using SWT <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Image.html">Image</a> called <a href="http://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html">Taking a look at SWT Images Summary</a> which the code example above was taken from.David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com1tag:blogger.com,1999:blog-7170390006315916505.post-65573945237289984222007-08-15T08:54:00.000-06:002007-08-15T10:01:58.133-06:00SWT Canvas default behaviour<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgccmAKITp2wG644mgbcpbN7fiOqTciQDkIOBaptqgTwug-wUhC0pIdrdXLAv5NBq3qFCI7gjEE8KVeYnXLFEDzQ2zKNagLzWY_Y0oGcsCP6uaxIAtrhfJjHbRSuTC_Ww0Qkp3b1pe374g/s1600-h/AnimalHouseBigPic.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgccmAKITp2wG644mgbcpbN7fiOqTciQDkIOBaptqgTwug-wUhC0pIdrdXLAv5NBq3qFCI7gjEE8KVeYnXLFEDzQ2zKNagLzWY_Y0oGcsCP6uaxIAtrhfJjHbRSuTC_Ww0Qkp3b1pe374g/s200/AnimalHouseBigPic.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5098957089760662034" /></a>
<p>This <a href="http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg36213.html">eclipse.platform.swt</a> news group posting started me thinking again about platform differences in Eclipse RCP and Java. Without a bit of care you could end up having DOUBLE SECRET SWT.DOUBLE_BUFFERED! <i>My apologies to Harold Ramis</i>.</p>
<p>The default behaviour of <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Canvas.html">org.eclipse.swt.widgets.Canvas</a> does support SWT.DOUBLE_BUFFERED on Linux GTK but not on Windows.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class CanvasTest {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Canvas canvas = new Canvas(shell, SWT.NONE);
System.out.println("SWT.NO_REDRAW_RESIZE: "
+ stateToString(canvas.getStyle(), SWT.NO_REDRAW_RESIZE));
System.out.println("SWT.DOUBLE_BUFFERED: "
+ stateToString(canvas.getStyle(), SWT.DOUBLE_BUFFERED));
System.out.println("SWT.NO_BACKGROUND: "
+ stateToString(canvas.getStyle(), SWT.NO_BACKGROUND));
System.out.println("SWT.NO_MERGE_PAINTS: "
+ stateToString(canvas.getStyle(), SWT.NO_MERGE_PAINTS));
}
private static String stateToString(int style, int styleFlag) {
return (style & styleFlag) != 0 ? "on" : "off";
}
}</pre>
</span>
<p>Run on a Windows platform has the <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Canvas.html">org.eclipse.swt.widgets.Canvas</a> set as:</p>
<pre>
SWT.NO_REDRAW_RESIZE: off
SWT.DOUBLE_BUFFERED: off
SWT.NO_BACKGROUND: off
SWT.NO_MERGE_PAINTS: off
</pre>
<p>Run on a Linux GTK platform has the <a href="http://help.eclipse.org/help33/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Canvas.html">org.eclipse.swt.widgets.Canvas</a> set as:</p>
<pre>
SWT.NO_REDRAW_RESIZE: off
SWT.DOUBLE_BUFFERED: on
SWT.NO_BACKGROUND: off
SWT.NO_MERGE_PAINTS: off
</pre>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com1tag:blogger.com,1999:blog-7170390006315916505.post-20858649596445894002007-07-26T07:08:00.000-06:002007-10-04T06:51:15.968-06:00New menu contribution extension<p><b>Background</b></p>
<p>I started this post to help me and hopefully you understand what is involved in using <code>org.eclipse.ui.menus</code>. I'm assuming you have a good understanding of Eclipse RCP and you would use this as a reference guide. It stems from my fustration in using the <a href="http://wiki.eclipse.org">Eclipse wiki</a> and finding help with the new features of Eclipse Europa.</p>
<p>The Eclipse Europa (3.3) release has changed the <code>org.eclipse.ui.menus</code> extension to improve menu, toolbar, and popup placement and visibility. The idea is to move away from the old extensions.</p>
<ul>
<li><code>org.eclipse.ui.actionSets</code></li>
<li><code>org.eclipse.ui.editorActions</code></li>
<li><code>org.eclipse.ui.popupMenus</code></li>
<li><code>org.eclipse.ui.viewActions</code></li>
</ul>
<p><b>Where to start</b></p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjovYY4I1hEUbDvcC46ZER-Wo7dF7q5lZkz2l7uKi4dZCkwkFZicuV5S6IgyHR9DnjETN4par0J0BKbRo7Wk_bKA_XHFPpFiR91nwDmJmQcXG_msMwtYJ9L6Tcf5bkbNFQ2RkbHTKC8iWE/s1600-h/diagram.png"><img style="float:right; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjovYY4I1hEUbDvcC46ZER-Wo7dF7q5lZkz2l7uKi4dZCkwkFZicuV5S6IgyHR9DnjETN4par0J0BKbRo7Wk_bKA_XHFPpFiR91nwDmJmQcXG_msMwtYJ9L6Tcf5bkbNFQ2RkbHTKC8iWE/s200/diagram.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5091493720795435506" /></a>
<p>I've listed the extensions with links to appropriate Eclipse help page and wiki page.</p>
<p>Scared yet? It is well worth the effort to learn and thus avoid, as much as possible, the legacy action extensions listed above.</p>
<p>What do you get? A very flexible and powerful way of creating menus, toolbars, and popup menus. I found the legacy action extensions to be difficult to implement complex menu and toolbar interactions and I ended up writing less java code.</p>
<dl>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_commands.html">
<code>org.eclipse.ui.commands</code></a></dt>
<dd>A logical representation of a task. A handler does the work. See <a href="http://wiki.eclipse.org/Platform_Command_Framework#Commands">wiki</a> and <a href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd_commands.htm">help guide</a>.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_handlers.html">
<code>org.eclipse.ui.handlers</code></a></dt>
<dd>A handler does what the command represents. See <a href="http://wiki.eclipse.org/Platform_Command_Framework#Handlers">wiki</a> and <a href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd_handlers.htm">help guide</a>.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_bindings.html">
<code>org.eclipse.ui.bindings</code></a></dt>
<dd>Bind a command to a key. See <a href="http://wiki.eclipse.org/Platform_Command_Framework#KeyBindings">wiki</a> and <a href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd_bindings.htm">help guide</a>.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_contexts.html">
<code>org.eclipse.ui.contexts</code></a></dt>
<dd>Bindings can be organized into a context. See <a href="http://wiki.eclipse.org/Platform_Command_Framework#Contexts">wiki</a>.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_commandImages.html">
<code>org.eclipse.ui.commandImages</code></a></dt>
<dd>Give a command an image.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_editors.html">
<code>org.eclipse.ui.editor</code></a></dt>
<dd>See <a href="http://wiki.eclipse.org/RCP_Text_Editor_Example">RCP Text Editor Example</a>.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_views.html">
<code>org.eclipse.ui.view</code></a></dt>
<dd>See <a href="http://www.eclipse.org/articles/viewArticle/ViewArticle2.html">Creating an Eclipse View</a>.</dd>
<dt><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_menus.html">
<code>org.eclipse.ui.menus</code></a></dt>
<dd>Add custom additions to the main menu, main toolbars, and view/editor context menus, toolbars, popup menu, and trim.
See <a href="http://wiki.eclipse.org/index.php/Menu_Contributions">wiki</a> and <a href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd_menus.htm">help guide</a>.</dd>
</dl>
<p><b>Important to understand</b></p>
<p><a href="http://wiki.eclipse.org/Command_Core_Expressions#Variables_and_the_Command_Framework">Command Core Expressions</a> needs to be understood to make your commands visible and handlers enabled.</p>
<p>Read up on <a href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd.htm">Basic workbench extension points using commands</a>.</p>
<p>How the <a href="http://wiki.eclipse.org/Menus_Extension_Mapping">old maps to the new</a>.</p>
<p><b>Examples</b></p>
<p>Example code can be found in <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ui.examples.contributions/">org.eclipse.ui.examples.contributions</a>.</p>
<p><b>Development strategies</b></p>
<p>Keep notes of the commands you are creating and how they can be reused.</p>
<ol>
<li>Create or reuse a <code>org.eclipse.ui.contexts</code>.</li>
<li>Create a command category.</li>
<li>Create a command.</li>
<li>Create a command image (optional).</li>
<li>Create a binding schema.</li>
<li>Create a binding for a command.</li>
<li>Create a handler.</li>
<li>Create a menu contribution.</li>
</ol>
<p><b>Debugging and tracing</b></p>
<p>Check out this <a href="http://wiki.eclipse.org/Platform_Command_Framework#Tracing_Option">wiki page</a> for details on a few debugging strategies.</p>
<p><b>Common mistakes</b></p>
<ul>
<li>Commands added to a view toolbar must have either a label or icon defined in the menuContribution or icons defined in the org.eclipse.ui.commandImages.</li>
<li>Forget to look at org.eclipse.ui.menus.MenuUtil for correct spelling of menu constants.</p>
</ul>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com2tag:blogger.com,1999:blog-7170390006315916505.post-52662243399969918972007-07-20T14:22:00.000-06:002007-07-20T14:35:39.383-06:00Europa help, gone without a trace<p>The org.eclipse.help* plugins have had all of the tracing features removed for the Europa release. Why? Only this <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=197335">bug 197335</a> report will possibly tell.</p>
<p>They did leave the <code>.options</code> file in the plugins so that your run configuration appears to support help tracing. It doesn't so don't waste your time trying.</p>
<p>What you can do is set a break point in <code>org.eclipse.help.HelpSystem.getContext(String)</code>. It will show you the help context id being used. Most problems are due to simple typos in your help *.xml file or in your view/editor/dialog call to <code>PlatformUI.getWorkbench().getHelpSystem().setHelp(Control, String)</code>.</p>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com0tag:blogger.com,1999:blog-7170390006315916505.post-52137962491884258202007-07-11T08:53:00.001-06:002007-07-12T12:27:58.509-06:00I come to praise TPTP and bury it<p>I tried out the new TPTP (Test & Performance Tools Platform) tool yesterday. In the end I was able to get it to work but there are a number of very annoying problems.</p>
<p>The first issue is the new monitor page in the run configuration will randomly forget its settings. If Memory Analysis is selected make sure you edit its options to track object allocation sites. Otherwise you'll have a hard time tracing object allocation back to your source code.</p>
<p>The big issue is with the Java Profiling options. Manually setting a content filter set does not work as expected. The Default filter set does not work as expected (already reported to Eclipse). The filter below hides all <code>org*</code> classes instead of only showing <code>org.apache*</code> classes.</p>
<span style="font-family:courier new;font-size:85%;"><pre>
org* * EXCLUDE
org.apache* * INCLUDE
</pre></span>
<p>Specify the filter below worked only for me in our group.</p>
<span style="font-family:courier new;font-size:85%;"><pre>
com.kelman.* * INCLUDE
</pre></span>
<p>Everyone else had to use the following.</p>
<span style="font-family:courier new;font-size:85%;"><pre>
com.kelman* * INCLUDE
</pre></span>
<p>The potential issue is Java 1.6 is not supported by TPTP. For the project I'm
working on it is not an issue since Java 1.5 works extremely well for us.</p>
<p>The documentation for TPTP is overly complex for someone wanting to simply run an application and do a bit of performance analysis.</p>
<p>Now that I've buried TPTP its time for a bit of praise. </p>
<p>Once we figured out the monitor configuration problems the tool worked like a charm. A great new feature is the integration of the Agent Controller. If you are debugging an application on a local machine, TPTP will start the Agent Controller. No more worries about installing and managing the Agent Controller as a service.</p>
<p>TPTP by default tries to show you as little as possible. I think this is a good thing. It keeps TPTP responsive and forces you to think hard about what packages or classes should be included in the performance analysis.</p>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com2tag:blogger.com,1999:blog-7170390006315916505.post-50741163379278218452007-07-10T12:31:00.000-06:002007-07-10T13:13:11.153-06:00BIRT is not evil<a href="http://www.eaglesflyinghigh.com/images/evil_bert.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://www.eaglesflyinghigh.com/images/evil_bert.jpg" border="0" alt="" /></a>I'm at the point in my project that most programmers dread. It is report generating time! Yeah, its not very exciting stuff to code. With the growing buzz around
<a href="http://www.eclipse.org/birt/phoenix/">BIRT (2.2)</a> (Business Intelligence and Reporting Tools) I thought I would give it a try.
<p>
I'm using BIRT with Eclipse Europa (3.3). Talk about a nice reporting tool. Building a report using the design tools was easy and obvious. I hooked it up to one of our
<a href="http://www.postgresql.org/">Postgres databases (8.2.3)</a> using a <a href="http://www.postgresql.org/docs/8.2/interactive/external-interfaces.html">type 4 JDBC driver</a> without any problems. A little SQL coding for a query and I was dragging and dropping fields into the report.
</p>
<p>
Creating customized formats for the duration fields and integrating the report into our application wasn't obvious so I went and bought the only two books available about BIRT.</p>
<table>
<tr>
<td><center><a href="http://www.amazon.com/exec/obidos/redirect?path=ASIN/0321442598&link_code=as2&camp=1789&tag=pww0c-20&creative=9325"><img src="http://images.amazon.com/images/P/0321442598.01.THUMBZZZ.jpg" border=0 width=60 height=75></a><img src="http://www.assoc-amazon.com/e/ir?t=pww0c-20&l=as2&o=1&a=0136290310" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></center></td><td><strong>BIRT: A Field Guide to Reporting (The Eclipse Series)</strong><br>by Diana Peh, Alethea Hannemann, Nola Hague<br>ISBN: 0321442598</td>
</tr>
<tr>
<td><center><a href="http://www.amazon.com/exec/obidos/redirect?path=ASIN/0321443853&link_code=as2&camp=1789&tag=pww0c-20&creative=9325"><img src="http://images.amazon.com/images/P/0321443853.01.THUMBZZZ.jpg" border=0 width=60 height=75></a><img src="http://www.assoc-amazon.com/e/ir?t=pww0c-20&l=as2&o=1&a=0136290310" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></center></td><td><strong>Integrating and Extending BIRT (The Eclipse Series)</strong><br>by Jason Weathersby, Don French, Tom Bondur, Jane Tatchell, Iana Chatalbasheva<br>ISBN: 0321443853</td>
</tr>
</table>
Both are easy to read, gave me additional background to how BIRT works and most importantly saved me a good deal of time learning how to use BIRT and integrating it into our application.David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com0tag:blogger.com,1999:blog-7170390006315916505.post-81392843636720324102007-07-08T09:43:00.000-06:002007-07-08T10:18:12.991-06:00Adding Go Into and Go Up to CNF viewI have always liked the Go Into and Up features of the navigation view in the Eclipse IDE. Here is a simple way of adding it to your CNF (Common Navigator Framework) view. I'm assuming you are familiar with CNF, if not check out <a href="http://richclientplatform.blogspot.com/2007/06/common-navigator-framework.html">Common Navigator Framework</a>.
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJRM3KbIHsop7fVHOOMj6wDgSNttCmT1Gw_sRlDVxIgVr-BEe_DlRT52b3qpghX6hm5J65jzFGRdJkwlOvornjC4Y-i0AThUJz_H6KbTvRo9rTTvtSw0w8UBOFtIJOLCxd9Kx3GdR6DP0/s1600-h/GoIntoGoUp.bmp"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJRM3KbIHsop7fVHOOMj6wDgSNttCmT1Gw_sRlDVxIgVr-BEe_DlRT52b3qpghX6hm5J65jzFGRdJkwlOvornjC4Y-i0AThUJz_H6KbTvRo9rTTvtSw0w8UBOFtIJOLCxd9Kx3GdR6DP0/s320/GoIntoGoUp.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5084856598481075298" /></a>
<br>You will need to add the Go Into action to your CNF view toolbar and the Up feature to the CNF view actions.
<span style="font-family:courier new;font-size:85%;">
<pre>
public class GoIntoAction extends Action {
private IWorkbenchPage page;
private CommonViewer commonViewer;
public GoIntoAction(IWorkbenchPage p, ISelectionProvider selectionProvider) {
page = p;
commonViewer = (CommonViewer) selectionProvider;
}
@SuppressWarnings("unchecked")
protected List getSelectedResources() {
ISelection selection = commonViewer.getSelection();
List resources = null;
if (selection.isEmpty()) {
resources = new ArrayList();
resources.add(ResourcesPlugin.getWorkspace().getRoot());
} else {
resources = ((IStructuredSelection) selection).toList();
}
return resources;
}
@Override
@SuppressWarnings("unchecked")
public boolean isEnabled() {
List resources = getSelectedResources();
return (resources.size() == 1) && (resources.get(0) instanceof IContainer);
}
@Override
@SuppressWarnings("unchecked")
public void run() {
((ProjectExplorerView)page.getActivePart()).setInput(getSelectedResources().get(0));
}
}</pre>
</span>
The GoIntoAction is added to the CNF view actionProvider extension. See <a href="http://scribbledideas.blogspot.com/2006/05/building-common-navigator-based-viewer.html">here</a> for Michael Elder's article on defining the viewer.
<span style="font-family:courier new;font-size:85%;">
<pre>
public class GoUpAction extends Action implements IViewActionDelegate {
private ProjectExplorerView view;
private CommonViewer commonViewer;
public void init(IViewPart aView) {
view = (ProjectExplorerView) aView;
commonViewer = ((ProjectExplorerView) aView).getCommonViewer();
}
@SuppressWarnings("unchecked")
@Override
public boolean isEnabled() {
return !(commonViewer.getInput() instanceof IWorkspaceRoot);
}
public void run(IAction action) {
view.setInput(((IResource) commonViewer.getInput()).getParent());
action.setEnabled(isEnabled());
}
public void selectionChanged(IAction action, ISelection aSelection) {
action.setEnabled(isEnabled());
}
}</pre>
</span>
Now add the GoUpAction to the CNF view toolbar.
<span style="font-family:courier new;font-size:85%;">
<pre>
<extension point="org.eclipse.ui.viewActions">
<viewContribution
id="com.kelman.navigator.ui.view.projectexplorercontribution"
targetID="com.kelman.navigator.ui.view.ProjectExplorer">
<action
class="com.kelman.navigator.ui.actions.GoUpAction"
icon="icons/elcl16/up_nav.gif"
id="com.kelman.navigator.ui.actions.goupaction"
label="%goUp.label"
style="push"
toolbarPath="Normal/additions"
tooltip="%goUp.tooltip">
</action>
</viewContribution>
</extension></pre>
</span>
I extracted the icons from the org.eclipse.ui.ide_3.*.jar file and dropped them into my plugin.
You will need the following method in your CommonNavigator implementation.
<span style="font-family:courier new;font-size:85%;">
<pre>
public void setInput(Object aObject) {
IResource resource = (IResource) aObject;
getCommonViewer().setInput(resource);
setContentDescription(resource.getName());
};</pre>
</span>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com0tag:blogger.com,1999:blog-7170390006315916505.post-37930018457655858242007-06-27T11:29:00.000-06:002007-07-20T14:22:02.738-06:00Debugging context sensitive help<blockquote><i>This feature was removed from the Europa (3.3) release. See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=197335">bug 197335</a> for details.</i></blockquote>
Context sensitive help allows you to assign a help page to an SWT widget. When it works it is a thing of beauty. When it doesn't it can be a small nightmare to debug.
I'm not going into details about how to use context sensitive help since it is well documented in the Eclipse IDE. What isn't covered is how to use tracing to help you debug.
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ppsxaxjNOnbzPMv67HVpUlocjTuRRvKSVIur2ya4giqQTbVraxGgds6hZwpzrLlNioOaf3er7P3EmI_VP_VKPCCS7dzarxH7-1kUr7XUnLlhN4Q2foYD5rx7w9RxbWiDOOIS4IKsDBQ/s1600-h/TracingDynamicHelp.gif"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ppsxaxjNOnbzPMv67HVpUlocjTuRRvKSVIur2ya4giqQTbVraxGgds6hZwpzrLlNioOaf3er7P3EmI_VP_VKPCCS7dzarxH7-1kUr7XUnLlhN4Q2foYD5rx7w9RxbWiDOOIS4IKsDBQ/s320/TracingDynamicHelp.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5080799129991642194" /></a>
<br>In your run configuration click on the tracing tab. Enable tracing and select the following plugins and all of the trace options for each plugin.
<ul>
<li>org.eclipse.help.base</li>
<li>org.eclipse.help.ui</li>
<li>org.eclipse.help.webapp</li>
</ul>
When you run your application/plugin you will see tracing information. Warning: the first time you activate the help plugin you will see a flood of trace messages.
If you display the Problems View and press F1 (Ctrl F1 on linux) you will see the following.
<span style="font-family:courier new;font-size:70%;">
<pre> ContextManager.getContext(org.eclipse.ui.problem_view_context)
ContextManager.getContext(org.eclipse.ui.problem_view_context)
ContextManager.getContext(org.eclipse.ui.problem_view_context)
</pre></span>
The context id is "problem_view_context" and is associated with plugin "org.eclipse.ui".David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com2tag:blogger.com,1999:blog-7170390006315916505.post-76730805108784802832007-06-15T13:32:00.000-06:002007-06-15T14:03:00.052-06:00ViewPart content descriptionI hadn't realized that a ViewPart can place a short description at the top.
<span style="font-family:courier new;font-size:85%;">
<pre>
public VintageView extends ViewPart {
public void createPartControl(Composite aParent) {
setContentDescription("C_TEST123456");
....
}
}</pre>
</span>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu2OmpjGJ-psRLN6tuo4N2oOyB3iG5s84fgb9lfwYjQVr0_U6y4diihDifMryLsq-_mHDKOsh2qb0JvTzllvnhTvNGdlftJ8cRthTOVJL4S8StHML5pUJ61JIjU4hZOLotZf2SLou6C7M/s1600-h/ViewPartSetContentDescription.gif"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu2OmpjGJ-psRLN6tuo4N2oOyB3iG5s84fgb9lfwYjQVr0_U6y4diihDifMryLsq-_mHDKOsh2qb0JvTzllvnhTvNGdlftJ8cRthTOVJL4S8StHML5pUJ61JIjU4hZOLotZf2SLou6C7M/s320/ViewPartSetContentDescription.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5076379470400818978" /></a>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com0tag:blogger.com,1999:blog-7170390006315916505.post-2021680688496593382007-06-06T09:48:00.001-06:002007-06-06T09:58:37.350-06:00Common Navigator Framework<p><a href="http://www.eclipse.org/webtools/people/person.php?name=elder">Michael Elder</a> has written a number of excellant blog entries on how to use the common navigator framework.</p>
<ul>
<li><a href="http://scribbledideas.blogspot.com/2006/05/building-common-navigator-based-viewer.html" target="cnf">Part I: Defining the Viewer</a></li>
<li><a href="http://scribbledideas.blogspot.com/2006/05/building-common-navigator-based-viewer_22.html" target="cnf">Part II: Adding Content</a></li>
<li><a href="http://scribbledideas.blogspot.com/2006/06/building-common-navigator-based-viewer.html" target="cnf">Part III: Configuring Menus</a></li>
<li><a href="http://scribbledideas.blogspot.com/2006/06/building-common-navigator-based-viewer_18.html" target="cnf">Part IV: Object Contributions</a></li>
<li><a href="http://scribbledideas.blogspot.com/2006/06/building-common-navigator-_115067357450703178.html" target="cnf">Part V: How to programmatically configure menus</a></li>
<li><a href="http://scribbledideas.blogspot.com/2006/07/label-decorators-in-common-navigator.html" target="cnf">Label Decorators in a Common Navigator Framework viewer</a></li>
<li><a href="http://scribbledideas.blogspot.com/2006/05/where-do-we-go-from-here.html" target="cnf">Where do we go from here?</a></li>
<li><a href="http://scribbledideas.blogspot.com/2006/07/response-to-comments-and-status-on.html" target="cnf">Response to comments and status on upcoming articles</a></li>
</ul>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com1tag:blogger.com,1999:blog-7170390006315916505.post-16350754046245949082007-06-01T10:55:00.001-06:002007-06-01T11:21:05.184-06:00Blog blog article articleHelpful links on Eclipse.
<ul>
<li><a href="http://www.eclipse.org/articles/">Eclipse Corner Articles</a></li>
<li><a href="http://planeteclipse.org/planet/">Planet Eclipse</a></li>
<li><a href="http://www-128.ibm.com/developerworks/java/">IBM Java technology</a></li>
</ul>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com0tag:blogger.com,1999:blog-7170390006315916505.post-54520278370859723382007-05-31T11:55:00.000-06:002007-05-31T12:03:59.226-06:00Adding a cheat sheet menu actionCreating a cheat sheet using the <code>org.eclipse.ui.cheatsheets.cheatSheetContent</code> extension is well documented. What is not documented is how to add the cheat sheet action to your application help menu.
You need to make your application plugin depend upon the org.eclipse.ui.cheatsheets plugin. Then add the following extension:
<span style="font-family:courier new;font-size:85%;">
<pre><extension point="org.eclipse.ui.actionSets">
<actionSet
label="Cheat Sheets"
visible="true"
id="org.eclipse.ui.cheatsheets.actionSet">
<action
label="Cheat Sheets"
class="org.eclipse.ui.cheatsheets.
CheatSheetExtensionFactory:helpMenuAction"
menubarPath="help/group.tutorials"
id="org.eclipse.ui.cheatsheets.
actions.CheatSheetHelpMenuAction">
</action>
</actionSet>
</extension>
</pre>
</span>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com1tag:blogger.com,1999:blog-7170390006315916505.post-88693865114905251312007-05-10T07:18:00.000-06:002007-05-10T08:00:52.802-06:00Plugin your images<p>Let <code>AbstractUIPlugin</code> handle sharing images with your plugins. It has its own <code>ImageRegistry</code> that handles storing, disposing, and retrieving of images.</p>
<p>A simple override of <code>initializeImageRegistry(ImageRegistry)</code> and you are on your way to Image sharing bliss.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>public class Activator extends AbstractUIPlugin {
public static final String ID = "rcp.eclipse";
public static final String MY_IMAGE_ID =
"image.myimage";
@Override
protected void initializeImageRegistry(ImageRegistry registry) {
super.initializeImageRegistry(registry);
Bundle bundle = Platform.getBundle(ID);
ImageDescriptor myImage = ImageDescriptor.createFromURL(
FileLocator.find(bundle,
new Path("icons/myImage..gif"),
null));
registry.put(MY_IMAGE_ID, myImage);
}
}
</pre></span>
<p>Put your image into <code>workspace/rcp.eclipse/icons/myImage.gif</code> and then access it in your code.</p>
<span style="font-family:courier new;font-size:85%;">
<pre>
AbstractUIPlugin plugin = Activator.getDefault();
ImageRegistry imageRegistry = plugin.getImageRegistry();
Image myImage = imageRegistry.get(Activator.MY_IMAGE_ID);
</pre></span>David Kylehttp://www.blogger.com/profile/01188144177878844017noreply@blogger.com5