Showing posts with label plugins. Show all posts
Showing posts with label plugins. Show all posts

Apr 1, 2008

Content type Specific File icons

Eclipse 3.4 M6 is out. It has lots of wonderful features 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.

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.

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.

<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type base-type="org.eclipse.core.runtime.properties"
file-extensions="config"

id="in.cypal.eclipse.myConfig"
name="My Config File"

priority="normal">

</content-type>

</extension
>
<extension point="org.eclipse.ui.editors">
<editor
class="org.eclipse.jdt.internal.ui.propertiesfileeditor.PropertiesFileEditor"
default="false"

extensions="config"

icon="icons/sample.gif"

id="in.cypal.eclipse.editors.myConfigEditor"

name="My Config Editor">
<contentTypeBinding contentTypeId="in.cypal.eclipse.myConfig">
</contentTypeBinding>
</editor>
</extension>





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!

Mar 6, 2008

Eclipse CVS

The 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.

Platform, SWT, JFace, Equinox, JDT, launcher, UI, update, search, debug, team, etc) are available here:
:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse
Mylyn, GEF, CDT, COBOL, VE:
:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
AspectJ, Nebula, EPP:
:pserver:anonymous@dev.eclipse.org:/cvsroot/technology
EMF, GMF, MDT:
:pserver:anonymous@dev.eclipse.org:/cvsroot/modeling
WTP:
:pserver:anonymous@dev.eclipse.org:/cvsroot/webtools
Data Tools:
:pserver:anonymous@dev.eclipse.org:/cvsroot/datatools


If you want to browse thru the CVS, you can use the web based viewer also: http://dev.eclipse.org/viewcvs/
More info on connecting to Eclipse CVS: http://wiki.eclipse.org/index.php/CVS_Howto

Related:
Searching Eclipse Sources

Feb 19, 2008

EMF Packing changes in 2.4

EMF has changed the packaging in 2.4. 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 early adopters of WTP. If you are an early adopter, then probably you may want to do vote for the all-in-one package for the milestone builds.

Related:
How does EMF finds the right parser?
Converting EMF Resource to Platform Resource (IFile)
EMF Packing changes in 2.4
Using EMF with XML Catalog

Feb 11, 2008

Eclipse Icons - follow up post

Follow up 1:
Ben had a nice script for fetching all the icons from the cvs. I'm adding it here:

#!/bin/sh

CVSROOT=:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse
export CVSROOT

mkdir -p eclipse
cd eclipse
cvs -q co org.eclipse.debug.ui/icons
cvs -q co org.eclipse.pde.ui/icons
cvs -q co org.eclipse.jdt.ui/icons
cvs -q co org.eclipse.vcm.ui/icons
cvs -q co org.eclipse.team.ui/icons
cvs -q co org.eclipse.ant.ui/icons
cvs -q co org.eclipse.help.ui/icons
cvs -q co org.eclipse.ui/icons
cvs -q co org.eclipse.ui.views/icons
cvs -q co org.eclipse.ui.console/icons
cd ..
rm -f ~/public_html/eclipse-icons.zip
find eclipse -name "*.gif" -print | zip ~/public_html/eclipse-icons.zip -@

Follow up 2:
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 most commonly used ones, download them here.

Follow up 3:
Phillipus left a comment in the post saying how to access the icons from other plugins without bundling them in your plugin:

AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.ui", "$nl$/icons/full/etool16/import_wiz.gif");

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.

Related:

Eclipse Icons - original post
Searching for Eclipse - source, blogs, images ...
Accessing CVS of Eclipse.org

Feb 8, 2008

Eclipse icons

Explaining 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 , jar library , plugins 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 :-).

Many common images (undo, redo, file, folder, cut, copy) are available thru the org.eclipse.ui.ISharedImages interface. You can get them with IWorkbench:

Image folderImg = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);

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:

Add, Delete :
Collapse All/Expand All:
Navigation:
Window operations:
Run & Debug:
Import & Export:
Date & Time:
Editor Operations:
Vertical & Horizontal:
Flat & Hierarchical:
Misc: Eclipse , Config & , Console , Font Help , Lock , Stop , Properties , Search & , Tip/Quick Fix , Sort , Task & , Sync & , Pulldown Menu, Binary , Bookmark , Category

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 here.

Related:
Eclipse Icons - follow up post
Searching for Eclipse - source, blogs, images ...
Accessing CVS of Eclipse.org

Feb 6, 2008

Feature based configuration of an RCP application

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 sent a nice mail on his experience to the news group. Instead of copy-pasting the whole thing here, I present the information with little modifications. Thanks Jan.

  • Open your product file and select features in the Overview tab:


  • In the Configuration tab, click "New Feature...", and create the new feature:

  • In the newly created feature, go to the included features tab and add "org.eclipse.rcp" feature:
  • Go to the plugins tab and add your product's plugins
  • 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:
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.

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 :-)



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:

org.eclipse.update.core/debug=true
org.eclipse.update.core/debug/warning=true
org.eclipse.update.core/debug/parsing=true
org.eclipse.update.core/debug/install=true
org.eclipse.update.core/debug/configuration=true
org.eclipse.update.core/debug/type=true
org.eclipse.update.core/debug/web=true
org.eclipse.update.core/debug/installhandler=true
org.eclipse.update.core/debug/reconciler=true


Click here for more info on the .options