Hi Simon,
We will try to maintain on site a list of API changes starting with Oxygen 11.2.
Here is a compiled list of changes which occurred between Oxygen 10.3 and 11.1:
Code: Select all
For the Author SDK API, the following major changes have appeared from Oxygen 10.3 to Oxygen 11.1:
1) Introduced the "AttributesValueEditor", "EditedAttribute" as a way for the developer to control editing attributes in the Attributes view
2) The possibility to insert an XML fragment as the last child of the current context (by adding a new relative position constant).
See the:
AuthorDocumentController.insertXMLFragment(String xmlFragment, AuthorNode relativeTo, String relativePosition) throws AuthorOperationException;
3) Added the following new methods to the AuthorDocumentController (see the Javadoc for more details):
void replaceRoot(AuthorDocumentFragment fragment);
AuthorDocumentFragment createNewDocumentTextFragment(String textFragment) throws AuthorOperationException;
void insertXMLFragment(String xmlFragment, AuthorNode relativeTo, String relativePosition) throws AuthorOperationException;
public void getChars(int where, int len, Segment chars) throws BadLocationException;
public AuthorSchemaManager getAuthorSchemaManager();
4) Added the possibility to implement a AuthorSchemaAwareEditingHandler (in the ExtensionsBundle) which can be used by developers to decide better paste, delete, insert strategies.
For example if some text is pasted the developer can choose to insert a new element and then insert the text in it. The developer also has access to the schema information associated with the XML document to make better editing decisions.
See the newly added methods from AuthorDocumentController.
5) Added an AuthorSchemaManager which can be used to get information from the schema associated to the edited XML file.
6) The following new methods can now be implemented for the ExtensionsBundle (see Javadoc for more details):
public AttributesValueEditor createAttributesValueEditor(boolean forEclipsePlugin)
public URL resolveCustomHref(String linkHref)
public AuthorSchemaAwareEditingHandler getAuthorSchemaAwareEditingHandler()
As for the second problem, you have no way to specify what you want from the CSS. Processing instructions are not elements. Indeed we made some extensions like the
oxy|processing-instruction you were using so that styles can be set to all processing instructions but the extension can not be used in complex CSS selectors.
What you can do is implement a
StylesFilter. You can find an implementation example in the
SimpleDocumentationFramework available in the
AuthorSDK.
The StylesFilter implementation should be something like:
Code: Select all
/**
* Set background color to element preceded by processing instruction.
*/
public Styles filter(Styles styles, AuthorNode authorNode) {
//Use background color red for "taxonomy" preceded by special processing instruction
if(authorNode.getName().equals("taxonomy")) {
AuthorNode parent = authorNode.getParent();
if(parent.getType() == AuthorNode.NODE_TYPE_ELEMENT) {
AuthorElement parentElem = (AuthorElement) parent;
List<AuthorNode> contentNodes = parentElem.getContentNodes();
int childIndex = contentNodes.indexOf(authorNode);
if(childIndex > 0) {
AuthorNode previousSibling = contentNodes.get(childIndex - 1);
if(previousSibling.getType() == AuthorNode.NODE_TYPE_PI) {
try {
//Found the processing instruction
if("SomeotherProcessingInstruction".equals(previousSibling.getTextContent())) {
ro.sync.exml.view.graphics.Color red = ro.sync.exml.view.graphics.Color.COLOR_RED;
styles.setProperty(Styles.KEY_BACKGROUND_COLOR, red);
}
} catch (BadLocationException e) {
e.printStackTrace();
}
}
}
}
}
return styles;
}
Regards,
Radu