How is eclipse line number status line contribution item implemented?

I need to update status line editor-specific information. I already have my own implementation, but I would like to take a look how is eclipse contribution item, which shows line number/column position in status line is implemented. Can anyone point me, where could I find the source code?

Thanks in advance, AlexG.


I've been looking into it, it's quite involved, and I'm not sure I got the complete picture, but in case this helps someone...

The declarative way of binding an Editor with the contributions to the StatusLine (and Menu and Toolbar) is through IEditorActionBarContributor class. This class is declared for a editor type in plugin.xml - and typically a single instance is created for each editor type (several running instances of a same editor type will share a IEditorActionBarContributor instance, calling its doSetActiveEditor() method when activated), and it will be disposed when when the last running editor of that type is closed.

Lets take as an example how the default text editor in Eclipse updates the "Insert/Override" info in the status line (from Eclipse 3.7)

The default text editor is declared in org.eclipse.ui.editors's plugin.xml (some lines trimmed) as:

 <extension point="org.eclipse.ui.editors">
      <editor  name="%Editors.DefaultTextEditor"

TextEditorActionContributor is the key. What interest us is implemented in the parent class BasicTextEditorActionContributor; it defines (statically) the 4 status fields (STATUS_FIELD_DEFS) and it stores internally a fixed map (fStatusFields) of each statusField (the spec, say) to a StatusLineContributionItem object). When called from the Eclipse UI, it registers the 4 fields in the status line (the titles, basically) in the method contributeToStatusLine(IStatusLineManager statusLineManager) And each time a editor is activated, it passes to it -in doSetActiveEditor(IEditorPart part)- the full set of StatusLineContributionItems , prepared with the corresponding actionHandlers. The editor understands all this because it implements ITextEditorExtension.setStatusField().

In the case of AbstractTextEditor, it has an private field of (inner class) type ToggleOverwriteModeAction, which calls


The editor looks if it has a statusField stored with this category, if so it will call IStatusField.setText("Insert" / "Overwrite") and this will result in the update of the status line message.

This is an example, but I guess it gives the general idea: an instance of EditorActionContributor, binded to a editor type, mantains a list of the StatusLineContributionItem to be updated, and the editor must write into the objects of this list when the corresponding status changes. In this way, the editor is decoupled from the status line (it doesn't know if/how a status change will be displayed in the UI).

Need Your Help

AS3: diagonal movement

flash actionscript-3 movement diagonal

I'm programming a flash game, I made an array of points (x and y positions) that some movieclips must follow. Those movieclips have a certain speed (they make steps of 5 pixels for now). When I wan...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.