Ruler Column

Identifier:
org.eclipse.ui.workbench.texteditor.rulerColumns

Since:
3.3

Description:
Ruler column contributions are line based information areas that are normally shown in the vertical ruler area of a textual editor.

Configuration Markup:

<!ELEMENT extension (column+)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED

>


<!ELEMENT column ((targetEditor | targetContentType | targetClass)+ , placement)>

<!ATTLIST column

id            CDATA #REQUIRED

name          CDATA #IMPLIED

icon          CDATA #IMPLIED

class         CDATA #REQUIRED

enabled       (true | false) "true"

global        (true | false) "true"

includeInMenu (true | false) "true"

>

The specification of a ruler column contribution.



<!ELEMENT targetEditor EMPTY>

<!ATTLIST targetEditor

id IDREF #REQUIRED

>

Describes an editor that the column is contributed to. See the org.eclipse.ui.editors extension point. Note that the rulerColumns extension point is typically only supported by line based text editors.



<!ELEMENT targetContentType EMPTY>

<!ATTLIST targetContentType

id CDATA #REQUIRED

>

Describes a content type that the column is contributed to. See the org.eclipse.core.runtime.contentTypes extension point. Note that the rulerColumns extension point is typically only supported by line based text editors.



<!ELEMENT targetClass EMPTY>

<!ATTLIST targetClass

class CDATA #REQUIRED

>

Describes an editor class that the column is contributed to. Subclasses of the specified class are also targeted by this colum contribution.



<!ELEMENT placement ((before | after))*>

<!ATTLIST placement

gravity CDATA "1.0"

>

Describes the placement of this ruler column relative to other contributed columns. A column may request to be placed before or after other known columns (identified by their id). Columns that would end up at the same position are ordered by gravity (see below). If the ordering is contradicting or no ordering can be found that fulfills all placement requests, some placement requirements are dropped until the placement can be achieved. If a column does not fully specify its placement it will be placed at an arbitrary but consistent location.



<!ELEMENT before EMPTY>

<!ATTLIST before

id IDREF #REQUIRED

>

Requests placement before another column. The meaning of before is similar to the SWT.LEAD flag: In left-to-right environments, before means to the left of, in right-to-left environments, it means to the right of.



<!ELEMENT after EMPTY>

<!ATTLIST after

id IDREF #REQUIRED

>

Requests placement after another column. The meaning of after is similar to the SWT.TRAIL flag: In left-to-right environments, after means to the right of, in right-to-left environments, it means to the left of.



Examples:
The following is an example of a ruler column definition:

<extension
  point="org.eclipse.ui.workbench.texteditor.rulerColumns">
  <column
    id="org.eclipse.ui.editors.columns.linenumbers"
    name="Line Numbers"
    class="org.eclipse.ui.internal.texteditor.LineNumberColumn"
    enabled="false"
    global="true"
    includeInMenu="false">
    <placement
       gravity="0.9">
       <after id="org.eclipse.ui.editors.columns.annotations"/>
    </placement>
    <targetClass
       class="org.eclipse.ui.texteditor.AbstractDecoratedTextEditor">
    </targetClass>
  </column>
</extension>

API Information:
The extension point is supported by the org.eclipse.ui.texteditor.rulers package. RulerColumnRegistry gives access to all contributions, which in turn are described by RulerColumnDescriptor instances.

Editors that want to support the extension point need to provide an adapter for IColumnSupport. AbstractTextEditor already adapts to IColumnSupport and hence its subclasses should override createColumnSupport() with the suggested implementation, rather than providing the adapter again. Subclasses of AbstractDecoratedTextEditor automatically have this support installed.

Supplied Implementation:
All ruler column contributions must implement org.eclipse.ui.texteditor.rulers.IContributedRulerColumn. Many contributors will find the supplied org.eclipse.ui.texteditor.rulers.AbstractContributedRulerColumn useful which serves as super class for contributed ruler columns. Others might start off org.eclipse.jface.text.source.AbstractRulerColumn which takes over most painting and scrolling aspects of a line based column and can be extended at various granularity levels. Those subclassing the latter class will have to implement org.eclipse.ui.texteditor.rulers.IContributedRulerColumn on their own by using org.eclipse.ui.texteditor.rulers.AbstractContributedRulerColumn as template.


Copyright (c) 2006, 2008 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html