List<Object> listOfElementsToWrite = new ArrayList<Object>();
// test if this treeNode is an extended SBase.
if (treeNode instanceof SBase && (! (treeNode instanceof Model)) && ((SBase) treeNode).getExtension(getNamespaceURI()) != null) {
SBasePlugin sbasePlugin = ((SBase) treeNode).getExtension(getNamespaceURI());
if (sbasePlugin != null) {
listOfElementsToWrite = super.getListOfSBMLElementsToWrite(sbasePlugin);
logger.debug("getListOfSBMLElementsToWrite: nb children = " + sbasePlugin.getChildCount());
}
} else {
listOfElementsToWrite = super.getListOfSBMLElementsToWrite(treeNode);
}