tag:blogger.com,1999:blog-64608706515795015882008-05-13T09:54:50.044+05:30Eclipse TipsPrakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comBlogger43125tag:blogger.com,1999:blog-6460870651579501588.post-57171221777444037572008-05-05T22:26:00.014+05:302008-05-05T22:46:41.265+05:30Adding util methods to the generated EMF classesWe had EMF generated model classes and a Util class with lot of helper methods. Both were exposed to clients as an API. Most of the methods in the Util classes were like:<br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family:courier new;">//API - Util class<br /></span><span style="font-family:courier new;">Book getBook(Writer writer, String title);<br /></span><br /><span style="font-family:courier new;">//Customer code</span> <span style="font-family:courier new;"><br />Util.getBook(daveSteinberg, "Eclipse Modeling Framew</span></span><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family:courier new;">ork");</span></span><br /><br />These methods would have been more appropriate in the Writer class itself rather than in a Util class, and it will be more natural to code like:<br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family:courier new;">daveSteinberg.getBook("Eclipse Modeling Framework");</span></span><br /><br />This tip is about how to add such methods in the generated code.<br /><br />The first way is simple. Just edit the generated java code and add these methods. EMF is smart enough to identify this method and keeps it safe during regeneration of code. But if you were like me, who consider the generated Java files are as good as class files and don't want them checked into the repository, you can follow the second way.<br /><br />In the eCore Editor for your model, right click the EClass and add a new child EOperation.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_hsp14iFkRLs/SB8-s9tbfrI/AAAAAAAACOQ/Mow0h950T0Q/s1600-h/CreateEOperation.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_hsp14iFkRLs/SB8-s9tbfrI/AAAAAAAACOQ/Mow0h950T0Q/s400/CreateEOperation.png" alt="" id="BLOGGER_PHOTO_ID_5196941437209116338" border="0" /></a><br />Go to the Properties view and specify the name, this will be the name of your method. The EType represents the return type of the method.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_hsp14iFkRLs/SB8-bttbfqI/AAAAAAAACOI/BzWL_13Jees/s1600-h/EOperationProperties.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_hsp14iFkRLs/SB8-bttbfqI/AAAAAAAACOI/BzWL_13Jees/s400/EOperationProperties.png" alt="" id="BLOGGER_PHOTO_ID_5196941140856372898" border="0" /></a><br />If your method has any parameters, then add EParameter children to the EOperation &amp; specify their types and names.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_hsp14iFkRLs/SB8979tbfoI/AAAAAAAACN4/5Qay460NGzg/s1600-h/CreateParameter.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_hsp14iFkRLs/SB8979tbfoI/AAAAAAAACN4/5Qay460NGzg/s400/CreateParameter.png" alt="" id="BLOGGER_PHOTO_ID_5196940595395526274" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_hsp14iFkRLs/SB8-GdtbfpI/AAAAAAAACOA/gRIjg36KQks/s1600-h/EParameterProperties.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_hsp14iFkRLs/SB8-GdtbfpI/AAAAAAAACOA/gRIjg36KQks/s400/EParameterProperties.png" alt="" id="BLOGGER_PHOTO_ID_5196940775784152722" border="0" /></a><br />To add the code, add an EAnnotation to the EOperation.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_hsp14iFkRLs/SB89W9tbfmI/AAAAAAAACNo/tfNvoiWAL4Y/s1600-h/EAnnotationCreation.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_hsp14iFkRLs/SB89W9tbfmI/AAAAAAAACNo/tfNvoiWAL4Y/s400/EAnnotationCreation.png" alt="" id="BLOGGER_PHOTO_ID_5196939959740366434" border="0" /></a><br />In the properties view, set the Source to "http://www.eclipse.org/emf/2002/GenModel".<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_hsp14iFkRLs/SB8849tbfkI/AAAAAAAACNY/nzGoqMYwRO4/s1600-h/EAnnotationProperties.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_hsp14iFkRLs/SB8849tbfkI/AAAAAAAACNY/nzGoqMYwRO4/s400/EAnnotationProperties.png" alt="" id="BLOGGER_PHOTO_ID_5196939444344290882" border="0" /></a><br />Add a details entry to the EAnnotation.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_hsp14iFkRLs/SB89vNtbfnI/AAAAAAAACNw/dBhZc28O4Cg/s1600-h/DetailsEntryCreation.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_hsp14iFkRLs/SB89vNtbfnI/AAAAAAAACNw/dBhZc28O4Cg/s400/DetailsEntryCreation.png" alt="" id="BLOGGER_PHOTO_ID_5196940376352194162" border="0" /></a><br /><br />In the properties view set the key to 'body' and value to the code that you want to be generated.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_hsp14iFkRLs/SB89KNtbflI/AAAAAAAACNg/nrsr67W6FMk/s1600-h/DetailsEntryProperties.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_hsp14iFkRLs/SB89KNtbflI/AAAAAAAACNg/nrsr67W6FMk/s400/DetailsEntryProperties.png" alt="" id="BLOGGER_PHOTO_ID_5196939740697034322" border="0" /></a><br />Reload your .genmodel from .ecore and generate the code:<br /><br /><img style="margin: 0px auto 10px; display: block; text-align: center;" src="http://bp3.blogger.com/_hsp14iFkRLs/SB88l9tbfjI/AAAAAAAACNQ/99LX6HE0vAs/s400/GeneratedCode.png" alt="" id="BLOGGER_PHOTO_ID_5196939117926776370" border="0" /><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-54934906052940499312008-05-03T12:58:00.007+05:302008-05-03T13:21:16.921+05:30Single column TableViewer and TableColumnLayoutIf you have a single column TableViewer (which is commonly used because ListViewer won't show you the images), the single coloumn won't take the entire space. For example if you run the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet001TableViewer.java?view=markup">TableViewer snippet</a>, the output is like this:<br /><br /><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_hsp14iFkRLs/SBwWWNtbfgI/AAAAAAAACM4/2J78Pasqctw/s400/BeforeLayout.png" alt="" id="BLOGGER_PHOTO_ID_5196052640971849218" border="0" /><br />To get rid of the other spurious coloum that appears on the right, you have to use the TableColumnLayout. Modifying the code to use that:<br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family: courier new;">public Snippet001TableViewer(Shell shell) {</span><br /><br /><span style="font-family: courier new;"> Composite tableComposite = new Composite(shell, SWT.NONE);</span><br /><span style="font-family: courier new;"> final TableViewer v = new TableViewer(tableComposite);</span><br /><span style="font-family: courier new;"> v.setLabelProvider(new LabelProvider());</span><br /><span style="font-family: courier new;"> v.setContentProvider(new MyContentProvider());</span><br /><span style="font-family: courier new;"> MyModel[] model = createModel();</span><br /><span style="font-family: courier new;"> v.setInput(model);</span><br /><span style="font-family: courier new;"> v.getTable().setLinesVisible(true);</span><br /><br /><span style="font-family: courier new;"> TableColumn singleColumn = new TableColumn(v.getTable(), SWT.NONE);</span><br /><span style="font-family: courier new;"> TableColumnLayout tableColumnLayout = new TableColumnLayout();</span><br /><span style="font-family: courier new;"> tableColumnLayout.setColumnData(singleColumn, new ColumnWeightData(100));</span><br /><span style="font-family: courier new;"> tableComposite.setLayout(tableColumnLayout);</span><br /><br /><span style="font-family: courier new;">}</span><br /></span><br />Remember, the TableColumnLayout should be applied on the composite that holds the Table. And the composite should contain only the table and nothing else. Here is the result:<br /><br /><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_hsp14iFkRLs/SBwY5dtbfhI/AAAAAAAACNA/vEM76AcQKgM/s400/AfterLayout.png" alt="" id="BLOGGER_PHOTO_ID_5196055445585493522" border="0" /><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-71110826982388066062008-04-24T15:27:00.004+05:302008-04-24T15:40:55.245+05:30Save hours of EMF coding ...Questions:<br /><br /><ul><li>How would you perform a deep copy an EObject with all it references?</li><li>How would you resolve all the proxies of an EObject?</li><li>How would you find whether one EObject is a child of other (directly/indirectly)?</li><li>How would you get the root containder of a given EObject?</li></ul><br />These are common problems which you would face in your EMF code. Before you try to write the generic code using powerful EMF reflections, resist yourself. Somehow in between posting 5 millionth news group message and shooting 100k photographs (both the numbers are my guess, and true values should be more than that :-P ), <a href="http://ed-merks.blogspot.com/">Ed Merks</a> finds time to do all that work for us. This nice solution, which is available in EMF itself: <a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.emf.doc/references/javadoc/org/eclipse/emf/ecore/util/EcoreUtil.html">ECoreUtil</a>.<br /><br />Take a look at the other methods in the class. Will surely come handy sometimes.<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-34532243928153530452008-04-23T10:40:00.003+05:302008-04-23T11:26:30.091+05:30Window Title in an RCP appIn Eclipse IDE, you can see the window title in the format: perspective - editPart name - Eclipse SDK - workspace. But in an RCP app, the title is usually the Product Name defined in the *.product file. This tip explains how to change it dynamically like IM clients - where the window title should be product name - user name.<br /><br />Window title is *not* set on the IWorkbenchWindow. You need to do it on the IWorkbenchWindowConfigurer.<br /><br />Whenever the user performs a login/logout, you need to set the window title. The details are sketchy, as its left to you whether to pass the instance of the windowConfigurer to the Login/LogoutAction or implement some sort of event listener for login/logout and do the title change there. But in general:<br /><br /><span style="font-family: courier new; color: rgb(51, 51, 255);font-size:100%;" >IWorkbenchWindowConfigurer windowConfigurer = ...;<br />String title = Platform.getProduct().getName();<br />if(loggedIn)<br /> title = title + " - " + userName;<br />windowConfigurer.setTitle(title);</span><br /><br /><br />In case you were wondering where to get the instance of the windowConfigurer, it will be passed to your application thru the WorkbenchAdvisor.createWorkbenchWindowAdvisor() method.<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-19170107589466545172008-04-01T11:58:00.006+05:302008-04-01T13:47:17.216+05:30Content type Specific File iconsEclipse 3.4 M6 is out. It has lots of <a href="http://download.eclipse.org/eclipse/downloads/drops/S-3.4M6-200803301350/eclipse-news-M6.html">wonderful features</a> like p2 and the installer. But one small change that is going to save a lot of developers time is the content type specific file icons. Earlier if I had to contribute an icon for a specific file, I've to write my own label decorator. Now Eclipse comes with a label decorator that does the same.<br /><br />All you have to do is to define the content type and associate an editor with that content type. If you were wondering writing an editor is not a trivial task, don't worry, you can reuse the existing ones.<br /><br />Assume that in my app, I have some files with extension 'config'. They are nothing but normal properties files. I would like to invoke the Properties editor on this extension and give a different icon. Here is how I create a new content type for the extension associated the Properties editor for that.<br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" > <span style="font-family:courier new;"> &lt;extension</span> <span style="font-family:courier new;"> point="org.eclipse.core.contenttype.contentTypes"&gt;</span><br /><span style="font-family:courier new;"> &lt;content-type</span> <span style="font-family:courier new;"> base-type="org.eclipse.core.runtime.properties"</span> <span style="font-family:courier new;"> <br /> file-extensions="config"</span><br /><span style="font-family:courier new;"> id="in.cypal.eclipse.myConfig"</span> <span style="font-family:courier new;"> <br /> name="My Config File"</span> <span style="font-family:courier new;"> <br /> priority="normal"&gt;</span> <span style="font-family:courier new;"> <br /> &lt;/content-type&gt;</span> <span style="font-family:courier new;"><br />&lt;/extension</span></span><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family:courier new;">&gt;<br /></span></span><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family:courier new;">&lt;extension</span> <span style="font-family:courier new;"> point="org.eclipse.ui.editors"&gt;</span> <span style="font-family:courier new;"> <br /> &lt;editor</span> <span style="font-family:courier new;"> class="org.eclipse.jdt.internal.ui.propertiesfileeditor.PropertiesFileEditor"</span> <span style="font-family:courier new;"> <br /> default="false"</span> <span style="font-family:courier new;"> <br /> extensions="config"</span> <span style="font-family:courier new;"> <br /> icon="icons/sample.gif"</span> <span style="font-family:courier new;"> <br /> id="in.cypal.eclipse.editors.myConfigEditor"</span> <span style="font-family:courier new;"> <br /> name="My Config Editor"&gt;<br /></span> <span style="font-family:courier new;"> &lt;contentTypeBinding</span> <span style="font-family:courier new;"> contentTypeId="in.cypal.eclipse.myConfig"&gt;<br /></span> <span style="font-family:courier new;"> &lt;/contentTypeBinding&gt;<br /></span> <span style="font-family:courier new;"> &lt;/editor&gt;</span> <span style="font-family:courier new;"><br />&lt;/extension&gt;</span></span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_hsp14iFkRLs/R_HtuVkUr8I/AAAAAAAACI0/LDk5j0rz5w4/s1600-h/ConfigEditor.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_hsp14iFkRLs/R_HtuVkUr8I/AAAAAAAACI0/LDk5j0rz5w4/s400/ConfigEditor.png" alt="" id="BLOGGER_PHOTO_ID_5184186026399412162" border="0" /></a><br /><br /><br />Content types are not just based on file names/extensions. If you have an xml file, you can use the XMLContentDescriber to find the content type based on the root element; create an editor extension; specify the Text Editor/XML Editor class; associate the content id and add the icon to the editor. You are done. All of this without writing a single line of code!<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-61069205355387970082008-03-18T22:44:00.007+05:302008-03-18T23:26:37.096+05:30Exporting GEF figure to an imageQuite often you need to export the current contents of a GEF editor to an image. Here is the simple code to do that:<br /><br /><span style="font-size:85%;"><span style="color: rgb(51, 51, 255);font-family:courier new;" >GraphicalViewer graphicalViewer = ...; // get it from your editor<br />String saveLocation = ...; // get it thru a FileDialog </span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) graphicalViewer.getEditPartRegistry().get(LayerManager.ID);</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />IFigure rootFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.PRINTABLE_LAYERS);</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />Rectangle rootFigureBounds = rootFigure.getBounds();</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />Control figureCanvas = graphicalViewer.getControl();</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br /></span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />Image img = new Image(Display.getDefault(), rootFigureBounds.width, rootFigureBounds.height);</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />GC imageGC = new GC(img);</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />figureCanvas.print(imageGC); // This is Eclipse 3.4 only API<br /></span></span><span style="font-size:85%;"><span style="color: rgb(51, 51, 255);font-family:courier new;" ><br /></span><span style="color: rgb(51, 51, 255);font-family:courier new;" >ImageLoader imgLoader = new ImageLoader();</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />imgLoader.data = new ImageData[] { img.getImageData() };</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />imgLoader.save(saveLocation, SWT.IMAGE_JPEG);<br /></span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />imageGC.dispose();</span> <span style="color: rgb(51, 51, 255);font-family:courier new;" ><br />img.dispose();</span></span><br /><br /><br />Just in case you need, here is a nice image <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_hsp14iFkRLs/R9_8-HrsJqI/AAAAAAAACHQ/TtbAELvWGPk/s1600-h/export.gif"><img style="cursor: pointer;" src="http://bp1.blogger.com/_hsp14iFkRLs/R9_8-HrsJqI/AAAAAAAACHQ/TtbAELvWGPk/s200/export.gif" alt="" id="BLOGGER_PHOTO_ID_5179136240643745442" border="0" /></a> to represent this Action :-)<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-31891142359393874582008-03-15T21:18:00.008+05:302008-03-17T22:12:48.685+05:30How does EMF finds the right parser?<span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 255);font-family:courier new;font-size:100%;" >ResourceSet resourceSet = new ResourceSetImpl();<br />Resource resource = resourceSet.createResource(someUri);</span><br /><br />The API can't get any simpler. But the implementation details behind this is not simple. Resources are generally loaded by Resource.Factory. Your ECore model would have generated an appropriate Factory. You can find it in the util package with the name {your model name}ResourceFactoryImpl. Lets take a journey from the ResourceSet to this Factory.<br /><br />ResourceSetImpl class delegates the job of finding the right Factory to the Resource.Factory.Registry. The default implementation of the registry (ResourceFactoryRegistryImpl) tries to find the factory by:<br /><br />* lookup in the protocol map for the uri<br />* lookup in the extension map for the uri<br />* lookup in the content type map for the uri<br />* lookup in the extension map for the default extension (*)<br />* lookup in the content type map for the default content type (*)<br /><br /><br />If the above lookups did not find a factory then the delegatedGetFactory() method is called.<br /><br />All three maps (protocol, extension &amp; content type) are by default empty in the ResourceFactoryRegistryImpl. Either you can subclass and initialize in your constructor or call the resourceFactory.get{map type}ToFactoryMap().put({key}, {value}) to add your entries.<br /><br />Since we have not added any entries in the registry, the delegatedGetFactory() method is called. The ResourceSetImpl overrides that method (thru an anonymous subclass of ResourceFactoryRegistryImpl) and calls again the getFactory() method with the maps from Resource.Factory.Registry.INSTANCE. BTW, all three maps in that instance are filled with the details from the extension points:<br /><br />org.eclipse.emf.ecore.protocol_parser<br />org.eclipse.emf.ecore.extension_parser<br />org.eclipse.emf.ecore.content_parser<br /><br />You should be using these extensions to register the right parser (the generated </span></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">ResourceFactoryImpl</span></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">) for your resource.<br /><br />Phew! If you think its done, you should look into the EMF code. All the above said stuff are optimized to the core. The ResourceSetImpl creates the ResourceFactoryRegistryImpl instance only when the getResourceFactoryRegistry() is called for the first time; all the above lookups are performed only when the map is not empty; and so on. EMF takes all the pain and finally we end up with:<br /><br /></span></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 255);font-family:courier new;font-size:100%;" >ResourceSet resourceSet = new ResourceSetImpl();<br />Resource resource = resourceSet.createResource(someUri);</span></span></span><br /><br />See, you got to love EMF. Or in general, Eclipse for making our life easier :-)<br /><br />Related:<br /><a href="http://blog.cypal-solutions.com/2008/02/emf-packing-changes-in-24.html"></a><blockquote><a href="http://blog.cypal-solutions.com/2008/02/emf-packing-changes-in-24.html">EMF Packing changes in 2.4</a><br /><a href="http://blog.cypal-solutions.com/2008/02/using-emf-with-xml-catalog.html">Using EMF with XML Catalog</a><br /><a href="http://blog.cypal-solutions.com/2008/03/converting-emf-resource-to-platform.html">Converting EMF Resource to Platform Resource (IFile)</a></blockquote><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-2367726937021372362008-03-15T11:57:00.006+05:302008-03-17T18:20:57.449+05:30Wizard as a DialogIn an RCP application, I had these requirements for a Dialog box:<br /><ul><li>OK button should not be enabled until all the mandatory fields are filled<br /></li><li>Hints for probably incorrect data (The email id grprakash+eclipse@gmail.com "looks" like a wrong one) These should not stop the user from pressing OK</li><li>Progress bar should be shown for long running operations (clicking OK, "check for user id availability", etc)</li></ul><br />I was thinking on how to handle all these in a Dialog and something flashed in my mind - JFace Wizards. All the above requirements can be easily done if I use a Wizard. The Finish button is disabled when we call setPageComplete(false), we can show warnings and still allow the user to finish and by calling setNeedsProgressMonitor() &amp; getContainer().run() we can show the progress bar in the UI as well. But there are two small issues to be handled when we use the wizard.<br /><br /><ul><li>The first one is to get rid of the Back and Next buttons. We are lucky here because JFace will not show those buttons if there is only one page in the wizard<br /></li><li>The "Finish" looks odd and should be renamed to "OK" or "Submit. This can be done by subclassing the WizardDialog:<br /></li></ul><span style="font-size:100%;"><span style="color: rgb(51, 51, 255);font-family:courier new;" >WizardDialog dialog = new WizardDialog(shell, wizard) {</span><br /><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" > @Override</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" > protected void createButtonsForButtonBar(Composite parent) {</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" > super.createButtonsForButtonBar(parent);</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" > Button finishButton = getButton(IDialogConstants.FINISH_ID);</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" > finishButton.setText(IDialogConstants.OK_LABEL);</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" > }</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >};</span></span><br /><br />Now with the <a href="http://blog.cypal-solutions.com/2008/02/handy-util-method-for-wizardpages.html">util method</a>, I can enable/disable the "OK" button, reflecting the status of the UI items.<br /><br /><blockquote>Related:<br /><a href="http://blog.cypal-solutions.com/2008/02/handy-util-method-for-wizardpages.html">Util method for Wizard Pages</a><br /><a href="http://blog.cypal-solutions.com/2007/11/jface-wizard-guidelines.html">JFace Wizard Guidelines</a></blockquote><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-78430619878337970862008-03-11T13:53:00.001+05:302008-03-11T13:56:11.726+05:30Converting EMF Resource to Platform Resource (IFile)Simple one:<br /><br /><span style="font-size:85%;"><span style="color: rgb(51, 51, 255); font-family: arial;">EObject eObject = ...;</span><br /><span style="color: rgb(51, 51, 255); font-family: arial;">Resource eResource = eObject.eResource();</span><br /><span style="color: rgb(51, 51, 255); font-family: arial;">URI eUri = eResource.getURI();</span><br /><span style="color: rgb(51, 51, 255); font-family: arial;">if (eUri.isPlatformResource()) {</span><br /><span style="color: rgb(51, 51, 255); font-family: arial;"> String platformString = eUri.toPlatformString(true);</span><br /><span style="color: rgb(51, 51, 255); font-family: arial;"> return ResourcesPlugin.getWorkspace().getRoot().findMember(platformString);</span><br /><span style="color: rgb(51, 51, 255); font-family: arial;">}</span><br /><span style="color: rgb(51, 51, 255); font-family: arial;">return null;</span></span><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-10006736357915572112008-03-06T23:20:00.006+05:302008-03-17T22:14:15.925+05:30Eclipse CVSThe CVS Repositories view in Eclipse allows you to paste a CVS URL in the "New Repository Location" Wizard. (If you are on 3.3, you can directly paste on the view without the Wizard) In case you want to browse thru the Eclipse CVS repository, here are the URLs you can copy and paste into the wizard.<br /><br />Platform, SWT, JFace, Equinox, JDT, launcher, UI, update, search, debug, team, etc) are available here:<br /><span style="color: rgb(51, 51, 255);">:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse</span><br />Mylyn, GEF, CDT, COBOL, VE:<br /><span style="color: rgb(51, 51, 255);">:pserver:anonymous@dev.eclipse.org:/cvsroot/tools</span><br />AspectJ, Nebula, EPP:<br /><span style="color: rgb(51, 51, 255);">:pserver:anonymous@dev.eclipse.org:/cvsroot/technology</span><br />EMF, GMF, MDT:<br /><span style="color: rgb(51, 51, 255);">:pserver:anonymous@dev.eclipse.org:/cvsroot/modeling</span><br />WTP:<br /><span style="color: rgb(51, 51, 255);">:pserver:anonymous@dev.eclipse.org:/cvsroot/webtools</span><br />Data Tools:<br /><span style="color: rgb(51, 51, 255);">:pserver:anonymous@dev.eclipse.org:/cvsroot/datatools</span><br /><br /><br />If you want to browse thru the CVS, you can use the web based viewer also: <a href="http://dev.eclipse.org/viewcvs/">http://dev.eclipse.org/viewcvs/</a><br />More info on connecting to Eclipse CVS: <a href="http://wiki.eclipse.org/index.php/CVS_Howto">http://wiki.eclipse.org/index.php/CVS_Howto</a><br /><br />Related:<br /><a href="http://blog.cypal-solutions.com/2008/02/eclipse-search.html">Searching Eclipse Sources</a><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-71881074911745007282008-02-19T14:39:00.005+05:302008-03-17T22:15:21.401+05:30EMF Packing changes in 2.4EMF has changed the <a href="http://wiki.eclipse.org/EMF/EMF_2.4/Packaging_Changes">packaging in 2.4</a>. You need to download an additional jar for docs and source for EMF and XSD. While this might be a good news for those who are bundling EMF in RCP apps, not for the <a href="http://blog.cypal-solutions.com/2008/02/all-wtp-early-adopters-please-stand-up.html">early adopters of WTP</a>. If you are an early adopter, then probably you may want to do vote for the <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=169723"> all-in-one package for the milestone</a> builds.<br /><br /><blockquote>Related:<br /><a href="http://blog.cypal-solutions.com/2008/03/how-does-emf-finds-right-parser.html">How does EMF finds the right parser?</a><br /><a href="http://blog.cypal-solutions.com/2008/03/converting-emf-resource-to-platform.html">Converting EMF Resource to Platform Resource (IFile)</a><br /><a href="http://blog.cypal-solutions.com/2008/02/emf-packing-changes-in-24.html">EMF Packing changes in 2.4</a><br /><a href="http://blog.cypal-solutions.com/2008/02/using-emf-with-xml-catalog.html">Using EMF with XML Catalog</a></blockquote><a href="http://blog.cypal-solutions.com/2008/02/using-emf-with-xml-catalog.html"></a><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-4355313229682932662008-02-18T23:37:00.001+05:302008-02-18T02:41:04.507+05:30Handy util method for WizardPagesConsider this familiar New Java class wizard.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_hsp14iFkRLs/R7HiYiTcxFI/AAAAAAAAB2c/UVVPzBPF5rQ/s1600-h/NewClassWizard.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_hsp14iFkRLs/R7HiYiTcxFI/AAAAAAAAB2c/UVVPzBPF5rQ/s320/NewClassWizard.png" alt="" id="BLOGGER_PHOTO_ID_5166159158723789906" border="0" /></a><br />It has to keep track of the status of the source folder, package, enclosing type, name, ... When ever there is a change in these fields, the WizardPage's status has to be updated. The algorithm goes like this: find the most severe status and update the wizard page with that status. This is a very common operation can be applied to any WizardPage. So I've written a helper method which I usually use it in almost all of the WizardPage I create. Let me know if it can be improved<br /><br /><span style="color: rgb(51, 51, 255);font-family:courier new;font-size:85%;" >public static void applyStatus(WizardPage page, IStatus[] statuses) {<br /><br /> IStatus severeStatus = statuses[0];<br /> for (IStatus status : statuses) {<br /> severeStatus = severeStatus.getSeverity() >= status.getSeverity() ? severeStatus : status;<br /> }<br /><br /> String message = severeStatus.getMessage();<br /> switch (severeStatus.getSeverity()) {<br /> case IStatus.OK:<br /> page.setMessage(null, IMessageProvider.NONE);<br /> page.setErrorMessage(null);<br /> break;<br /> case IStatus.WARNING:<br /> page.setMessage(message, IMessageProvider.WARNING);<br /> page.setErrorMessage(null);<br /> break;<br /> case IStatus.INFO:<br /> page.setMessage(message, IMessageProvider.INFORMATION);<br /> page.setErrorMessage(null);<br /> break;<br /> default:<br /> if (message.length() == 0) {<br /> message = null;<br /> }<br /> page.setMessage(null);<br /> page.setErrorMessage(message);<br /> break;<br /> }<br />}</span><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-58235708727901057682008-02-15T22:56:00.001+05:302008-03-15T21:12:24.205+05:30Using EMF with XML CatalogWhen you try to load an XML document using EMF, you might have noticed that the XML Catalog is not respected and might throw parse exceptions. First I thought I had made a mistake in extending org.eclipse.wst.xml.core.catalogContributions and was debugging that. Only after a while I realized that the XML Catalog is contributed by WTP and EMF is not depending on that. So there is no way for EMF to know the existence of such catalog. I found a quick solution using some internal classes. I'm not sure whether its the best, but it works (at least for my requirement)<br /><br />The idea is when EMF fails to resolve when loading an XML we should get the WTP Catalog and try to resolve with that:<br /><br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family:courier new;">loadOptions.put(XMLResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl() {<br /><br /></span><span style="font-family:courier new;">@Override<br /></span><span style="font-family:courier new;">public synchronized XMLDefaultHandler getDefaultHandler(XMLResource resource, XMLLoad xmlLoad, XMLHelper helper, Map options) {<br /></span><span style="font-family:courier new;">return</span><br /><span style="font-family:courier new;"> new SAXXMLHandler(resource, helper, options)</span><br /><span style="font-family:courier new;">{<br /></span><span style="font-family:courier new;">@Override</span><br /><span style="font-family:courier new;"> public InputSource resolveEntity(String publicId, String systemId) throws SAXException {<br /></span><span style="font-family:courier new;">InputSource result;<br /></span><span style="font-family:courier new;">try {<br /></span><span style="font-family:courier new;">result = super.resolveEntity(publicId, systemId);<br /></span><span style="font-family:courier new;">}catch(SAXException e) {<br /></span><span style="font-family:courier new;">try {<br /></span><span style="font-family:courier new;">ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();<br /></span><span style="font-family:courier new;">String resolvePublic = catalog.resolvePublic(publicId, systemId).substring(5);<br /></span><span style="font-family:courier new;">InputStream inputStream = getURIConverter().createInputStream(URI.createFileURI(resolvePublic));<br /></span><span style="font-family:courier new;">result = new InputSource(inputStream);<br /></span><span style="font-family:courier new;">result.setPublicId(publicId);<br /></span><span style="font-family:courier new;">result.setSystemId(systemId);<br /></span><span style="font-family:courier new;">return result;<br /></span><span style="font-family:courier new;">} catch (Exception exception) {<br /></span><span style="font-family:courier new;">throw new SAXException(exception);<br /></span><span style="font-family:courier new;">}<br /></span><span style="font-family:courier new;">}<br /></span><span style="font-family:courier new;">return result;<br /></span><span style="font-family:courier new;">}<br /></span><span style="font-family:courier new;"> };<br /><br /></span><span style="font-family:courier new;"> }<br /></span><span style="font-family:courier new;"></span><br /><span style="font-family:courier new;">});</span><br /></span><br />There are many cases where this code will fail (like if you had added the catalog entry by uri/systemId) and there might be a much better way of doing that without using any internal classes. Till I find that, I'm going to live with this hack.<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-69194010838067082622008-02-14T21:11:00.003+05:302008-03-17T22:16:08.719+05:30FullScreen mode in SWT/RCP ApplicationIf you didn't know the Eclipse Summer of Code gave us a nice addition - Full Screen mode for SWT (From Eclipse 3.4 only. Won't work with 3.3 or earlier). No tricky API, just a getter/setter. <span style=";font-family:courier new;font-size:85%;" ><span style="color: rgb(0, 0, 153);">Shell.setFullScreen(true)</span></span> Go play!<br /><br /><blockquote>Related:<br /><a href="http://blog.cypal-solutions.com/2008/01/using-trayitem-in-eclipse-rcp.html">How to add TrayItem in Eclipse RCP application?</a><br /><a href="http://blog.cypal-solutions.com/2008/01/how-to-add-status-bar-in-rcp-app.html">How to add a status bar in an RCP app?</a></blockquote><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-7734282563054464232008-02-14T17:07:00.004+05:302008-03-17T22:17:21.459+05:30Eclipse Forum India 2008This year's Eclipse Forum India is happening in Bangalore on 8-11 April. Its now open for registrations. There is a "very early bird" price, which closes Feb 15th (Yes, its tomorrow) In case you miss it, the "normal" early bird prices are open till March 14th.<br /><br />I had mixed experience after attending last year's EFI. The workshop was definitely nice and few other sessions as well. But the rest of the sessions were simply not that great and not useful. I decided not to attend this year (Esp, I with just 3 <a href="http://www.eclipseforumindia.com/sessions.php">sessions</a> on Eclipse). May be I'll wait for the feedback of this year and decide for EFI 2009 :-)<br /><br /><blockquote>Related:<br /><a href="http://blog.cypal-solutions.com/2007/05/eclipse-forum-india-first-impressions.html">Eclipse Forum India 2007 - First Impressions ...</a><br /><a href="http://blog.cypal-solutions.com/2007/05/eclipse-forum-india-day-2.html">Eclipse Forum India - Day 2</a><br /><a href="http://blog.cypal-solutions.com/2007/05/eclipse-forum-india-day-3.html">Eclipse Forum India - Day 3</a></blockquote><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-51826785991318244672008-02-13T16:29:00.005+05:302008-04-28T21:39:40.523+05:30Using ConnectionDragCreationTool in GEFConnection creation tools in the palette are nice. But the only problem with those is that it would require three mouse clicks from the user. Click the connection creation tool in the palette; the click the source edit part and then finally click the target edit part.<br /><br />How good if we can simplify this further? Like just drag-n-drop an edit part into another should create a connection between them. Implementing this feature might be much easier than you think. Override the getDragTracker in your source edit part and return the ConnectionDragCreationTool :-)<br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" >@Override<br />public DragTracker getDragTracker(Request request) {<br /> return new ConnectionDragCreationTool();<br />}<br /></span><br />Remember this will be applicable only if your edit parts are not moveable. If they have to be movable in your application, then drag-n-drop should change their position - not create a connection!<br /><br />[Update]<br />You cannot select the source edit part, if you use the ConnectionDragCreationTool. The fix is simple:<br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" >@Override<br />public DragTracker getDragTracker(Request request) {<br />getViewer().select(this);<br /> return new ConnectionDragCreationTool();<br />}<br /></span><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-54280558942168503682008-02-12T13:55:00.000+05:302008-02-12T15:05:33.884+05:30Eclipse SearchIt was during 2007 Eclipse Awards I guess. When I Googled for <a href="http://www.google.com/search?q=eclipse+awards" target="_blank">Eclipse Awards</a>, I ended up with more results on horse racing than our Eclipse Awards. (Its much better now, that the result I wanted is at least in the first page) I thought how good, if we can filter out only "our" eclipse related results. Soon after that I created a custom search engine, which does that filtering. After that, I always search with that. Recently Google introduced Labels and Refinements to the Custom Search Engine. I tried adding few labels and it works nicely. For example, if I want to search for <a href="http://www.google.com/cse?cx=005277575644117340741%3A2jvfseaipss&amp;q=cheat+sheet">Cheat Sheet</a>, I get a whole lot of results. All of them are relevant.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_hsp14iFkRLs/R7FiNCTcxDI/AAAAAAAAB2M/3X3re-iY4T0/s1600-h/EclipseSearchRefinements.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 350px; height: 312px;" src="http://bp3.blogger.com/_hsp14iFkRLs/R7FiNCTcxDI/AAAAAAAAB2M/3X3re-iY4T0/s400/EclipseSearchRefinements.png" alt="" id="BLOGGER_PHOTO_ID_5166018223666938930" border="0" /></a><br />I can filter them with the labels, so I can see what blogs are available, the source code, the documentation or even the images that are related to Cheat Sheets.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_hsp14iFkRLs/R7FcQyTcxAI/AAAAAAAAB10/29mHlxniZfQ/s1600-h/Blogs.png"><img style="cursor: pointer;" src="http://bp2.blogger.com/_hsp14iFkRLs/R7FcQyTcxAI/AAAAAAAAB10/29mHlxniZfQ/s200/Blogs.png" alt="" id="BLOGGER_PHOTO_ID_5166011691021681666" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_hsp14iFkRLs/R7FchCTcxBI/AAAAAAAAB18/Jy53mKdDQ9U/s1600-h/Docs.png"><img style="cursor: pointer;" src="http://bp3.blogger.com/_hsp14iFkRLs/R7FchCTcxBI/AAAAAAAAB18/Jy53mKdDQ9U/s200/Docs.png" alt="" id="BLOGGER_PHOTO_ID_5166011970194555922" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_hsp14iFkRLs/R7FmdCTcxEI/AAAAAAAAB2U/v43ENzl8-Mk/s1600-h/Articles.png"><img style="cursor: pointer;" src="http://bp3.blogger.com/_hsp14iFkRLs/R7FmdCTcxEI/AAAAAAAAB2U/v43ENzl8-Mk/s200/Articles.png" alt="" id="BLOGGER_PHOTO_ID_5166022896591356994" border="0" /></a><br /><br />I've added many of the sites and blogs (Thanks to <a href="http://planeteclipse.org/">Planet Eclipse</a>, I can find them in one place) to this search engine, in case your favorite site/blog doesn't appear in the results, I might have missed it out. Let me know, I'll add them.<br /><br />You can try out the <a href="http://www.cypal.in/eclipsesearch">Eclipse Search</a> and find yourself the usefulness of it<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-60289360669782187242008-02-11T23:05:00.001+05:302008-03-17T18:18:45.888+05:30Eclipse Icons - follow up post<span style="font-style: italic;">Follow up 1:</span><br />Ben had <a href="http://blogs.codehaus.org/people/bwalding/archives/000779_icons_borrowed_from_eclipse.html">a nice script</a> for fetching all the icons from the cvs. I'm adding it here:<br /><p style="color: rgb(51, 51, 255);font-family:courier new;"><span style="font-size:85%;">#!/bin/sh</span></p> <p style="color: rgb(51, 51, 255);font-family:courier new;"><span style="font-size:85%;">CVSROOT=:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse<br />export CVSROOT</span></p> <p style="color: rgb(51, 51, 255);font-family:courier new;"><span style="font-size:85%;">mkdir -p eclipse<br />cd eclipse<br />cvs -q co org.eclipse.debug.ui/icons<br />cvs -q co org.eclipse.pde.ui/icons<br />cvs -q co org.eclipse.jdt.ui/icons<br />cvs -q co org.eclipse.vcm.ui/icons<br />cvs -q co org.eclipse.team.ui/icons<br />cvs -q co org.eclipse.ant.ui/icons<br />cvs -q co org.eclipse.help.ui/icons<br />cvs -q co org.eclipse.ui/icons<br />cvs -q co org.eclipse.ui.views/icons<br />cvs -q co org.eclipse.ui.console/icons<br />cd ..<br />rm -f ~/public_html/eclipse-icons.zip<br />find eclipse -name "*.gif" -print | zip ~/public_html/eclipse-icons.zip -@</span></p><span style="font-style: italic;">Follow up 2:</span><br />I remember Ben having a HTML page which lists all the icons. But due to bandwidth issues, he moved it to a zipped set of icons. Now that is also gone from the page. I've a back up of those icons. So if you want the complete set of icons, instead of the <a href="http://www.cypal.in/EclipseIcons.zip">most commonly used</a> ones, download them <a href="http://www.cypal.in/EclipseIconsAll.zip">here</a>.<br /><br /><span style="font-style: italic;">Follow up 3:</span><br />Phillipus left a comment in the post saying how to access the icons from other plugins without bundling them in your plugin:<br /><br /><span style="color: rgb(51, 51, 255);font-size:85%;" ><span style="font-family:courier new;">AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.ui", "$nl$/icons/full/etool16/import_wiz.gif");</span></span><br /><br />This is cool but raises an interesting question. What happens during an Eclipse upgrade? Will they be retained in the same name? Or rather a straight question: Are these icons part of API? I didn't know the answer. So posting the question here. Those who know please throw some light on this.<br /><br />Related:<br /><br /><a href="http://blog.cypal-solutions.com/2008/02/eclipse-icons.html">Eclipse Icons - original post</a><br /><a href="http://blog.cypal-solutions.com/2008/02/eclipse-search.html">Searching for Eclipse - source, blogs, images ...</a><br /><a href="http://blog.cypal-solutions.com/2008/03/eclipse-cvs.html">Accessing CVS of Eclipse.org</a><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-69842112839018926912008-02-08T23:24:00.002+05:302008-03-17T18:16:31.406+05:30Eclipse iconsExplaining an action or describing an object with fewer words is tough. Showing them as 16x16 icons is even more tougher. Eclipse has a wonderful collection of icons. The best part of it - the whole set is consistent in sizing, coloring and styling. (I personally feel that icons like the filter <img src="http://lh3.google.com/grprakash/R6yhmT19s0I/AAAAAAAABwQ/VMMq8m3m55M/s144/filter.gif" />, jar library <img src="http://lh4.google.com/grprakash/R6ymTj19tbI/AAAAAAAAB1I/UwvKybc12_I/s144/jar_l_obj.gif" />, plugins <img src="http://lh6.google.com/grprakash/R6yhrD19tAI/AAAAAAAABxw/8jLW0LB3NMw/s144/plugin.gif" /> are brilliantly done). You can reuse them in many places in your own plugins/RCP Application as well. AFAIK, these icons are under Eclipse Public License and so you should not be falling into any legal trap for using these (don't take my word, I'm not a lawyer :-).<br /><br />Many common images (undo, redo, file, folder, cut, copy) are available thru the <span style="color: rgb(51, 51, 255);font-family:courier new;" >org.eclipse.ui.ISharedImages</span> interface. You can get them with <span style="color: rgb(51, 51, 255);font-family:courier new;" >IWorkbench</span>:<br /><br /><span style="font-size:85%;"><span style="color: rgb(51, 51, 255);font-family:courier new;" >Image folderImg = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER)</span></span>;<br /><br />For other common items (refresh, filter, collapse all, expand all), finding the images inside the plugins jars will be a tough task. So here are some images that you can reuse in your plugins:<br /><br />Add, Delete : <img src="http://lh4.google.com/grprakash/R6yhLj19slI/AAAAAAAABuA/l9kAr2mPgjk/s144/add.gif" /> <img src="http://lh6.google.com/grprakash/R6yhlD19sxI/AAAAAAAABv4/GgvFIsB9oB8/s144/delete.gif" /> <img src="http://lh4.google.com/grprakash/R6yhij19sqI/AAAAAAAABvA/m7CLXqyDxqk/s144/clear.gif" /> <img src="http://lh4.google.com/grprakash/R6yhxj19tUI/AAAAAAAAB0Q/n8kuFnmKuYo/s144/trash.gif" /><br />Collapse All/Expand All: <img src="http://lh4.google.com/grprakash/R6yhjj19ssI/AAAAAAAABvQ/tf5SvdQditg/s144/collapseall.gif" /><br />Navigation: <img src="http://lh6.google.com/grprakash/R6yhhD19smI/AAAAAAAABug/bpEI9WYrTfA/s144/back.gif" /> <img src="http://lh5.google.com/grprakash/R6yhnz19s3I/AAAAAAAABwo/cS0uXFVNLFQ/s144/forward.gif" /> <img src="http://lh3.google.com/grprakash/R6yhoT19s6I/AAAAAAAABxA/Lzm0nE74fYM/s144/home_nav.gif" /> <img src="http://lh3.google.com/grprakash/R6yhsT19tEI/AAAAAAAAByQ/7sUQT38h6UI/s144/refresh.gif" /> <img src="http://lh4.google.com/grprakash/R6yh0j19taI/AAAAAAAAB1A/wG9mwp6JsWQ/s144/web.gif" /><br />Window operations: <img src="http://lh4.google.com/grprakash/R6yhqj19s_I/AAAAAAAABxo/Zv7SLRebrxc/s144/min.gif" /><img src="http://lh3.google.com/grprakash/R6yhxT19tTI/AAAAAAAAB0I/p388_7EYu5s/s144/thin_restore_view.GIF" /><img src="http://lh6.google.com/grprakash/R6yhqD19s-I/AAAAAAAABxg/aH2YMrdA8H8/s144/maximize.gif" /><img src="http://lh5.google.com/grprakash/R6yhiz19srI/AAAAAAAABvI/MAWafR1Qh0c/s144/close.gif" /><br />Run &amp; Debug: <img src="http://lh4.google.com/grprakash/R6yhtj19tGI/AAAAAAAAByg/DARBocxZwWs/s144/run.gif" /> <img src="http://lh5.google.com/grprakash/R6yhkz19swI/AAAAAAAABvw/dgPcXQBigO4/s144/debug.gif" /><br />Import &amp; Export: <img src="http://lh6.google.com/grprakash/R6yhpD19s8I/AAAAAAAABxQ/pTT6-1uuI2Y/s144/import_wiz.gif" /> <img src="http://lh6.google.com/grprakash/R6yhmD19szI/AAAAAAAABwI/bLQ6tglMAvA/s144/export.gif" /><br />Date &amp; Time: <img src="http://lh4.google.com/grprakash/R6yhkj19svI/AAAAAAAABvo/NjvITGGOPOk/s144/dates.gif" /> <img src="http://lh4.google.com/grprakash/R6yhzj19tZI/AAAAAAAAB04/7mVYcL4_sbI/s144/waiting.gif" /><br />Editor Operations: <img src="http://lh5.google.com/grprakash/R6yhtz19tHI/AAAAAAAAByo/o6dRjBBWYhU/s144/save_edit.gif" /> <img src="http://lh6.google.com/grprakash/R6yhuD19tII/AAAAAAAAByw/7II-NGaCEXc/s144/saveall_edit.gif" /> <img src="http://lh3.google.com/grprakash/R6yhuT19tJI/AAAAAAAABy4/caSItG0NXUc/s144/saveas_edit.gif" /> <img src="http://lh3.google.com/grprakash/R6yhrT19tBI/AAAAAAAABx4/jUJkxpKmLtY/s144/print_edit.gif" /><br />Vertical &amp; Horizontal: <img src="http://lh3.google.com/grprakash/R6yhyT19tXI/AAAAAAAAB0o/KeAK0mvTVWs/s144/vertical.gif" /> <img src="http://lh6.google.com/grprakash/R6yhpD19s7I/AAAAAAAABxI/Uv8w-9zdTF4/s144/horizontal.gif" /><br />Flat &amp; Hierarchical: <img src="http://lh6.google.com/grprakash/R6yhnD19s1I/AAAAAAAABwY/iVHVEU5PcqQ/s144/flat.gif" /><img src="http://lh6.google.com/grprakash/R6yhoD19s5I/AAAAAAAABw4/YouvrbiPdXA/s144/hierarchical.gif" /><br />Misc: Eclipse <img src="http://lh5.google.com/grprakash/R6yhlz19syI/AAAAAAAABwA/2ij6H6uniJo/s144/eclipse.gif" />, Config <img src="http://lh6.google.com/grprakash/R6yhkD19stI/AAAAAAAABvY/qg34tvdBPgI/s144/configs.gif" /> &amp; <img src="http://lh6.google.com/grprakash/R6yhvD19tMI/AAAAAAAABzQ/RD3rvJkCtpE/s144/settings.gif" />, Console <img src="http://lh3.google.com/grprakash/R6yhkT19suI/AAAAAAAABvg/8flrPN1FBDA/s144/console.gif" />, Font <img src="http://lh3.google.com/grprakash/R6yhnT19s2I/AAAAAAAABwg/BXFXYHk7sAI/s144/font.gif" /> Help <img src="http://lh6.google.com/grprakash/R6yhoD19s4I/AAAAAAAABww/RQYe7qKYQaE/s144/help.gif" />, Lock <img src="http://lh4.google.com/grprakash/R6yhpj19s9I/AAAAAAAABxY/Ljimodn5MT4/s144/lockedstate.gif" />, Stop <img src="http://lh4.google.com/grprakash/R6yhrj19tCI/AAAAAAAAByA/rfwIEMENRXA/s144/progress_stop.gif" />, Properties <img src="http://lh5.google.com/grprakash/R6yhrz19tDI/AAAAAAAAByI/DOCIGYlwEuI/s144/properties.gif" />, Search <img src="http://lh3.google.com/grprakash/R6yhuT19tKI/AAAAAAAABzA/gW8o-zvKdfA/s144/search_src.gif" /> &amp; <img src="http://lh4.google.com/grprakash/R6yhuj19tLI/AAAAAAAABzI/PCENpjf6qtk/s144/search.gif" />, Tip/Quick Fix <img src="http://lh3.google.com/grprakash/R6yhvT19tNI/AAAAAAAABzY/mSSVGn_fPeU/s144/smartmode_co.gif" />, Sort <img src="http://lh5.google.com/grprakash/R6yhvz19tOI/AAAAAAAABzg/KLbR0yImhgI/s144/sort.gif" />, Task <img src="http://lh6.google.com/grprakash/R6yhwD19tPI/AAAAAAAABzo/gCRLL3ux78A/s144/step_done.gif" /> &amp; <img src="http://lh6.google.com/grprakash/R6yhyD19tWI/AAAAAAAAB0g/YFVByQ6GHqA/s144/validate.gif" />, Sync <img src="http://lh3.google.com/grprakash/R6yhwT19tQI/AAAAAAAABzw/OMvOExdXTcY/s144/synced.gif" /> &amp; <img src="http://lh5.google.com/grprakash/R6yhxz19tVI/AAAAAAAAB0Y/1nQ0_nrtzGA/s144/update.gif" />, Pulldown Menu<img src="http://lh4.google.com/grprakash/R6yhyj19tYI/AAAAAAAAB0w/lmw0GeBwfFY/s144/view_menu.gif" />, Binary <img src="http://lh3.google.com/grprakash/R6yhhT19snI/AAAAAAAABuo/dp96AqTG-Z0/s144/binary.gif" />, Bookmark <img src="http://lh4.google.com/grprakash/R6yhhj19soI/AAAAAAAABuw/PpRC4FUwHEk/s144/bookmark.gif" />, Category <img src="http://lh5.google.com/grprakash/R6yhhz19spI/AAAAAAAABu4/4G4ablvrwSQ/s144/category.gif" /><br /><br />Let me know if I've missed any commonly used icon. I'll add it to this list. The complete set of above icons can be downloaded from <a href="http://www.cypal.in/EclipseIcons.zip">here</a>.<br /><br /><span style="font-size:130%;"></span><blockquote><span style="font-family: verdana;font-size:130%;" >Related:</span><br /><a href="http://blog.cypal-solutions.com/2008/02/eclipse-icons-follow-up-post.html">Eclipse Icons - follow up post</a><br /><a href="http://blog.cypal-solutions.com/2008/02/eclipse-search.html">Searching for Eclipse - source, blogs, images ...</a><br /><a href="http://blog.cypal-solutions.com/2008/03/eclipse-cvs.html">Accessing CVS of Eclipse.org</a></blockquote><a href="http://blog.cypal-solutions.com/2008/03/eclipse-cvs.html"></a><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-67881069878554859442008-02-08T15:25:00.000+05:302008-02-08T16:27:43.457+05:30All WTP early adopters, please stand upIf you are an early adopter of <a href="http://www.eclipse.org/webtools/">WTP</a> like me, probably you would have gone thru the pain of downloading &amp; installing all the prerequisites of WTP, that too for every milestone build. Of course, EPP has downloads for the milestone builds, but those are not enough. If you <a href="http://www.eclipse.org/downloads/moreinfo/compare.php">compare the versions</a>, JEE version<img style="width: 32px; height: 32px;" src="http://bp2.blogger.com/_hsp14iFkRLs/R6wmMz19siI/AAAAAAAABts/-DK00tPQN0U/s200/jee.jpg" alt="" id="BLOGGER_PHOTO_ID_5164544874203951650" border="0" /> doesn't have source, which I quite often refer for how-tos or as sample implementations of an extension point) and the RCP version<img style="width: 32px; height: 32px;" src="http://bp3.blogger.com/_hsp14iFkRLs/R6wmbD19sjI/AAAAAAAABt0/xyeN4U8Wlmw/s200/rcp.jpg" alt="" id="BLOGGER_PHOTO_ID_5164545119017087538" border="0" /> doesn't have JST. Recently I found that there is a bug already opened for providing all-in-one version for milestone builds, but its not been done because the PMC is not sure of how many people need it. If you are one of the guys who are in need of such build, do vote <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=169723">here</a>.<br /><br />Rest of us can download<img style="width: 16px; height: 16px;" src="http://bp0.blogger.com/_hsp14iFkRLs/R6wljT19shI/AAAAAAAABtk/U2ixJsU7bBs/s200/download.png" alt="" id="BLOGGER_PHOTO_ID_5164544161239380498" border="0" /> the EPP's Milestone builds<a href="http://www.eclipse.org/epp/download.php"> here</a>.<br /><br /><br /><a href="http://www.eclipse.org/epp/download.php"><br /></a><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-79534305460520792302008-02-06T15:51:00.000+05:302008-02-07T11:27:32.717+05:30Feature based configuration of an RCP application<span style="font-family:lucida grande;">For a RCP application, I started with plugins based product configuration. When I reached a point where I need to provide software updates thru an update site, I needed a feature based product configuration. I thought should be as simple as selecting the features check box and adding the feature. But I spent around two whole days googling and debugging to bring it up and running. I think everyone would have gone thru the phase. I thought I'll write a blog entry on the issues, but I was lazy to draft such a long post. Yesterday Jan Kohnert </span><a style="font-family: lucida grande;" href="http://www.eclipsezone.com/eclipse/forums/t106810.html">sent a nice mail</a><span style="font-family:lucida grande;"> on his experience to the news group. Instead of copy-pasting the whole thing here, I present the information with little modifications. Thanks Jan.<br /></span><ul><li><span style="font-family:lucida grande;">Open your product file and select features in the Overview tab:</span><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_hsp14iFkRLs/R6qXxz19seI/AAAAAAAABtE/kef2NGy4M8c/s1600-h/RCPIncluded.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://lh4.google.com/grprakash/R6mM9T19sbI/AAAAAAAABso/gjjTRcUSWdU/s800/FeatureBased.png" alt="" border="0" /></a></li></ul><br /><br /><ul><li><span style="font-family:lucida grande;">In the Configuration tab, click "New Feature...", and create the new feature:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_hsp14iFkRLs/R6qXPz19sdI/AAAAAAAABs8/0jTB-sT31uo/s1600-h/NewFeature.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_hsp14iFkRLs/R6qXPz19sdI/AAAAAAAABs8/0jTB-sT31uo/s400/NewFeature.png" alt="" id="BLOGGER_PHOTO_ID_5164106220604076498" border="0" /></a></li><li><span style="font-family:lucida grande;">In the newly created feature, go to the included features tab and add "org.eclipse.rcp" feature:</span><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_hsp14iFkRLs/R6qXxz19seI/AAAAAAAABtE/kef2NGy4M8c/s1600-h/RCPIncluded.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_hsp14iFkRLs/R6qXxz19seI/AAAAAAAABtE/kef2NGy4M8c/s400/RCPIncluded.png" alt="" id="BLOGGER_PHOTO_ID_5164106804719628770" border="0" /></a></li><li style="font-family: lucida grande;">Go to the plugins tab and add your product's plugins</li><li><span style="font-family:lucida grande;">RCP feature has most of the plugins that you would require. However if you use anything other plugins (core.resources, ui.forms, etc), you need to add those plugins to the feature:</span><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_hsp14iFkRLs/R6qYgT19sfI/AAAAAAAABtM/SJnX7oqysMY/s1600-h/Plugins.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_hsp14iFkRLs/R6qYgT19sfI/AAAAAAAABtM/SJnX7oqysMY/s400/Plugins.png" alt="" id="BLOGGER_PHOTO_ID_5164107603583545842" border="0" /></a></li></ul><span style="font-family:lucida grande;">At this point you should be successfully running your RCP application. If you are not interesting in providing support for Software Updates for your app, you should be fine with this.</span><br /><br /><span style="font-family:lucida grande;">Ideally, even for software updates, this should work fine. However, if you try to create an update site and try running software update, you will be hitting the java.lang.SecurityException: "Invalid signature file digest for Manifest main attributes". To get rid of that, remove the RCP feature from the included features list of your feature and add the plugins in RCP feature to your feature. Thanks to PDE team, copy-pasting works in the plugins tab of Feature Editor :-)</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_hsp14iFkRLs/R6qZbD19sgI/AAAAAAAABtU/PbjhfwW1YxY/s1600-h/CopyPaste.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_hsp14iFkRLs/R6qZbD19sgI/AAAAAAAABtU/PbjhfwW1YxY/s400/CopyPaste.png" alt="" id="BLOGGER_PHOTO_ID_5164108612900860418" border="0" /></a><br /><br /><span style="font-family:lucida grande;">While going thru the update stuff, I realized that the update will not function as expected if we launch it from the IDE (Not sure of why). So I have to export the product and run from the disk, which means I can't debug and step thru the code :-( To know what happens during the update, I start the application with -debug options and add these lines in the .options file:</span><br /><br /><span style="color: rgb(0, 0, 153);font-family:lucida grande;font-size:85%;" >org.eclipse.update.core/debug=true<br />org.eclipse.update.core/debug/warning=true<br />org.eclipse.update.core/debug/parsing=true<br />org.eclipse.update.core/debug/install=true<br />org.eclipse.update.core/debug/configuration=true<br />org.eclipse.update.core/debug/type=true<br />org.eclipse.update.core/debug/web=true<br />org.eclipse.update.core/debug/installhandler=true<br />org.eclipse.update.core/debug/reconciler=true</span><br /><br /><span style="font-family:lucida grande;">Click </span><a style="font-family: lucida grande;" href="http://blog.cypal-solutions.com/2007/09/debug-your-app.html">here</a><span style="font-family:lucida grande;"> for more info on the .options</span><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-26771412950544741362008-02-05T16:15:00.000+05:302008-02-05T21:34:09.467+05:30Eclipse on Mac OS LeopardIn case you are experiencing frequent crashes of Eclipse on Mac OS Leopard, here is the simple solution: update your SWT plugins from the latest stream build. Looks like it still has few issues, so make sure to back up the originals before replacing (Does Time Machine help?). More details are available <a href="http://plan4041.com/blog/?p=10">here</a>.<br /><br />PS: I'm a happy Tiger user still searching for solid reasons to spend for $129 upgrade<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-78256310142504792622008-02-05T12:59:00.000+05:302008-02-05T13:10:32.593+05:30How to prevent multiple instances of an RCP Application?The Eclipse IDE does this by obtaining lock on a file in the workspace. However, this method allows you to run multiple instances of the same IDE, each of them in a separate workspace.<br /><br />In an RCP Application, if you follow the file lock mechanism, you need to get a lock on a well known file (like C:\Program Files\My App\instance.lock). Alternatively you can also prevent multiple instances by creating a server socket on some port (this method might alert Virus scanners/Firewalls)<br /><br />There is no technique that is specific to RCP application, that is used to achieve this. You can use any Java application technique. You can <a href="java%20single%20instance%20application">Google</a> around for more Java solutions and apply them in your RCP applicaiton.<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-31418101049509238832008-02-04T22:02:00.000+05:302008-02-04T22:42:38.082+05:30How to automatically update my RCP Application?Updating a RCP application might be different from updating Eclipse IDE. In Eclipse IDE, the update *usually* triggered by the user and he is allowed to select the updates he wants to install and cancel it at any time. But in RCP application, the situation might be different. You might have a requirement that you should be always running the latest version. In this case, the application update need not be triggered by the user, rather it can be triggered automatically during startup (like Gchat) and/or periodically by a job.<br /><br />To enable such updates, you need to specify the update site in your feature:<br /><img style="margin: 0px auto 10px; display: block; text-align: center;" src="http://bp2.blogger.com/_hsp14iFkRLs/R6dHED19sUI/AAAAAAAABqg/zrPLasZAYro/s400/Feature.png" alt="" id="BLOGGER_PHOTO_ID_5163173632880259394" /><br /><br />In your Application's startup code, add this:<br /><br /><span style="color: rgb(51, 51, 255);font-size:100%;" >ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell(display, SWT.NONE));<br />dialog.run(false, false, new IRunnableWithProgress() {<br /><br /> public void run(IProgressMonitor monitor) {<br /></span><span style="color: rgb(51, 51, 255);font-size:100%;" > UpdateCommand command = new UpdateCommand("in.cypal.studio.wsdlEditor", "false");<br /></span><span style="color: rgb(51, 51, 255);font-size:100%;" > command.run(monitor);<br /> }<br />});<br /></span><br />The comman.run() method returns a boolean value indicating whether an update happened or not. Depending on that you can decide whether to proceed normally or to force a restart by returning IApplication.EXIT_RESTART from the start method of your Application.<div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-6460870651579501588.post-85463206056306163852008-01-27T21:50:00.000+05:302008-01-27T21:57:00.448+05:30Interesting error messageI have quite a load of plugins installed in my Eclipse installation and not sure which one caused this error. But it was interesting enough to add it here:<br /><br /><div style="text-align: left;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_hsp14iFkRLs/R5yvuj19rOI/AAAAAAAABdc/AJ8nNxA7zSM/s1600-h/2008-01-19_1418.png"><img style="margin: 0px auto 10px; display: block; text-align: left; cursor: pointer; width: 516px; height: 190px;" src="http://lh4.google.com/grprakash/R5yvuj19rOI/AAAAAAAABdc/zVFoTmRrFYY/s800/2008-01-19_1418.png" alt="" id="BLOGGER_PHOTO_ID_5160192487490170082" border="0" /></a><br /></div><div class="blogger-post-footer"><br/><br/> From <a href="http://blog.cypal-solutions.com/">Eclipse Tips</a> by <a href="http://www.cypal.in/">Cypal Solutions</a> <br/> Like the tip? <a href="http://feeds.feedburner.com/cypal">Subscribe</a> <br/></div>Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.com