In addition to the support for configuring the proposals that appear in the Content Completion Assistant, Oxygen XML Author Eclipse plugin also includes support for customizing how the elements are rendered. You can do this by using the XMLNodeRendererCustomizer API extension, but you can also use the same configuration file that is used to configure the content completion proposals.
For an example of a specific use-case, suppose that in DITA you want the names of paragraph
elements (<p>) to be rendered as "Paragraph" instead of "p" in
the various components in Author mode (such as in the Outline
view, Elements view, Attributes
view, and the breadcrumb navigation bar). To achieve this, you can use the
<elementRenderings> element in the configuration file.
If you extend a framework, you need to copy the content of the cc_config.xml file from the base framework and modify it (e.g. create a resources folder in your framework extension folder and place the file there). You also need to make sure that the folder that contains the cc_config.xml file in your extension (e.g. resources) is listed in the Classpath tab before the one from the base framework.
If you only want to make small changes or add extra rules in your custom content completion configuration file, you need to name it cc_config_ext.xml and all the rules inside it are merged with the base cc_config.xml file. The merging is done by taking all the rules specified in the cc_config_ext.xml file into consideration after processing the set of rules from the base cc_config.xml file.
Refresh
(F5) action to test your customizations, without
having to restart the application.For the purposes of customizing how the content completion elements are rendered, you can
use the <render> element inside a <elementRenderings> element
to specify how element names, their annotations, and their icons are rendered.
The <elementRenderings> element supports the @platform
attribute, which can have one of the following values:
@platform attribute is missing, the
element renderings are applied to all types of distributions.You can use the following attributes for the <render> element:
Provides the name (label) that will be displayed for the element in various components in Author mode (the Content Completion Assistant, the breadcrumb navigation bar, the Full Tags display mode, and the Outline, Elements, and Attributes views). This attribute is optional. If it is missing, the name of the element is used.
${i18n(key_name)} editor variable. The following code
snippet shows how the DITA paragraph elements (<p>) can be
translated:<elementRenderings>
<render element="p" as="${i18n(cc_p)}"/>
</elementRenderings>cc_p id is a key that identifies the translations available for
the paragraph element."/", and the image
file will be searched for in the Oxygen XML Author Eclipse plugin classpath resources (for
example,"/images/OrderedList16.png" will load an icon from the
built-in Oxygen XML Author Eclipse plugin
JAR file resources.${i18n(key_name)} editor variable instead. Optional
attribute that could be used to render the same element differently, depending on
the language. If there are multiple <render> elements for the
same @element attribute (element name) and the
@xml:lang attribute is missing on one of them, that one will be
considered the default fallback value to be used if none of the others match the
language specified in the interface.<p>) to be rendered as "Paragraphe" if the language
is French, "Absatz" if the language is German, and "Paragraph" if the language is
English (or any other language). Your configuration file should look something like
this:<elementRenderings>
<render element="p" as="Paragraph"/>
<render element="p" as="Paragraphe" xml:lang="fr"/>
<render element="p" as="Absatz" xml:lang="de"/>
</elementRenderings>You can also use the configuration file to customize the annotations for elements. For this
purpose, the <render> element also accepts the following element to change
the tooltip annotations for an element (in both Author mode and
Text mode):
<render> element to customize the
tooltip annotations that are displayed for the element in various components in
Author mode (such as tooltips shown in the Content
Completion Assistant documentation window, the breadcrumb navigation bar, the
Full
Tags display mode, and the Outline, Elements, Attributes views), as well as the tooltips that are
displayed when you hover over elements in Text mode. You can
use HTML content to style the annotations (see the example
below).<elementRenderings>
<render element="p" as="${i18n(cc_p)}">
<annotation>${i18n(cc_p)}</annotation>
</render>
</elementRenderings>
Reload
(F5) action to test your customizations.<title> element to begin with a capital letter, use a custom icon
for it, and provide specific documentation for that element in the various components in
Author mode. The configuration file should look like
this:<elementRenderings>
<render element="title" as="Title" iconPath="cimg/AcceptAll16.png">
<annotation>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Documentation for the Title Element</title>
</head>
<body>
<p>A <i>heading</i> or <b>label</b> for the main parts of a topic</p>
</body>
</html>
</annotation>
</render>
</elementRenderings>