Class DITAAccess

java.lang.Object
ro.sync.ecss.dita.DITAAccess

@API(type=NOT_EXTENDABLE, src=PRIVATE) public final class DITAAccess extends Object
Utility methods for DITA interaction.
  • Field Details

    • IMPOSED_INSERTION_TYPE

      public static final String IMPOSED_INSERTION_TYPE
      Query parameter that imposes how a reference will be inserted in DITA
      Since:
      25
      See Also:
    • FULLY_QUALIFIED_KEYNAME_URL_PARAM

      public static final String FULLY_QUALIFIED_KEYNAME_URL_PARAM
      Can be sent as an URL parameter to give more information about the keyref fully qualified value.
      See Also:
    • REUSABLE_COMPONENT_TARGET_PATH_PARAM

      public static final String REUSABLE_COMPONENT_TARGET_PATH_PARAM
      Can be sent as an URL parameter to give more information about the element that will be inserted - path to the element ID (topicID/elementID).
      See Also:
    • REUSABLE_COMPONENT_TARGET_QNAME_PARAM

      public static final String REUSABLE_COMPONENT_TARGET_QNAME_PARAM
      Can be sent as an URL parameter to specify the qname of the element that will be inserted as conref/conkeyref.
      See Also:
    • REUSABLE_COMPONENT_ELEMENT_CLASS_PARAM

      public static final String REUSABLE_COMPONENT_ELEMENT_CLASS_PARAM
      Can be sent as an URL parameter to specify the class of the element that will be inserted as conref/conkeyref.
      See Also:
    • DITA_ROOT_MAP_URL_ATTRIBUTE

      public static final String DITA_ROOT_MAP_URL_ATTRIBUTE
      The attribute name for the dita root map url. The attribute is given as string.
      See Also:
    • DITA_VAL_URL_ATTRIBUTE

      public static final String DITA_VAL_URL_ATTRIBUTE
      The attribute name for the ditaval url. The attribute is given as string.
      See Also:
    • DITA_ROOT_MAP_KEYS_MANAGER_ATTRIBUTE

      public static final String DITA_ROOT_MAP_KEYS_MANAGER_ATTRIBUTE
      The attribute name for the keys manager. If set it has priority over DITA_ROOT_MAP_URL_ATTRIBUTE. The attribute class is ContextKeyManager.
      See Also:
    • REF_ATTRIBUTES

      public static final String[] REF_ATTRIBUTES
      DITA reference attributes.
    • DEFAULT_CONKEYREF_CONREFEND

      public static final String DEFAULT_CONKEYREF_CONREFEND
      Value for conrefend attribute value when a conkeyref is used.
      See Also:
    • KEYREF_TYPE

      public static final int KEYREF_TYPE
      Keyref
      See Also:
    • CONREF_TYPE

      public static final int CONREF_TYPE
      Conref
      See Also:
    • CONKEYREF_TYPE

      public static final int CONKEYREF_TYPE
      Conkeyref
      See Also:
    • ID_FIRST_TOPIC_ID

      public static final String ID_FIRST_TOPIC_ID
      Identifier used in references path, representing that the topic id is the first topic ID in the file.
      See Also:
    • ID_ANY

      @Deprecated public static final String ID_ANY
      Deprecated.
      Use ID_FIRST_TOPIC_ID instead which has a clearer meaning.

      Identifier used in references path, representing that the topic id can be excluded from the reference.
      See Also:
    • INHERITANCE_GENERALIZATION

      public static final int INHERITANCE_GENERALIZATION
      If the source is a generalization of the target
      See Also:
    • INHERITANCE_SPECIALIZATION

      public static final int INHERITANCE_SPECIALIZATION
      If the source is a specialization of the target
      See Also:
    • INHERITANCE_SAME

      public static final int INHERITANCE_SAME
      If the source class is the same as the target class.
      See Also:
    • INHERITANCE_NONE

      public static final int INHERITANCE_NONE
      No match between the two classes..
      See Also:
  • Method Details

    • setKeyNameGenerator

      public static void setKeyNameGenerator(DITAKeyNameGenerator ditaKeyNameGenerator)
      Set a key name generator for when the "keys" attribute is automatically generated and set to topicrefs based on the names of the referenced files.
      Parameters:
      ditaKeyNameGenerator - The dita key name generator to set. null to remove the previous one.
      Since:
      23
    • getKeysAttributeValueBasedOnFilename

      public static String getKeysAttributeValueBasedOnFilename(URL url)
      Get the value of the "keys" attribute based on the current filename.
      Parameters:
      url - The URL of the current file.
      Returns:
      the value.
    • createReferencesGraph

      public static Object createReferencesGraph()
      Create a references graph, will make subsequent searches much faster and it can be reused among multiple searches with the method ro.sync.ecss.dita.DITAAccess.searchReferences(URL, Object).
      Returns:
      the references graph. Can be null is something went wrong.
      Since:
      23
    • searchReferences

      public static List<DocumentPositionedInfo> searchReferences(URL targetTopicURL)
      Search the references to this topic.
      Parameters:
      targetTopicURL - The URL of the target topic (i.e. the topic that is referenced).
      Returns:
      the references or an empty list. Never null;
    • searchReferences

      public static List<DocumentPositionedInfo> searchReferences(URL targetTopicURL, Object referencesGraph)
      Search the references to this topic.
      Parameters:
      targetTopicURL - The URL of the target topic (i.e. the topic that is referenced).
      referencesGraph - The already created graph, if not null the search will be much faster.
      Returns:
      the references or an empty list. Never null;
      Since:
      23
    • insertTopicref

      public static void insertTopicref(AuthorAccess authorAccess) throws AuthorOperationException
      Insert a topic ref.
      Parameters:
      authorAccess - The author access.
      Throws:
      AuthorOperationException
    • handleTopicRefInsertUrl

      public static void handleTopicRefInsertUrl(AuthorAccess authorAccess, URL topicUrl) throws AuthorOperationException
      Insert a topic ref with the given URL. No dialog is displayed.
      Parameters:
      authorAccess - The author access.
      topicUrl - The URL of the topic to be inserted.
      Throws:
      AuthorOperationException
    • insertTopicgroup

      public static void insertTopicgroup(AuthorAccess authorAccess) throws AuthorOperationException
      Insert a topic group.
      Parameters:
      authorAccess - The author access.
      Throws:
      AuthorOperationException
    • getTopicRefInfo

      @Deprecated public static void getTopicRefInfo(URL location, Object parentFrame, ro.sync.ecss.contentcompletion.AuthorCCManager ccM, ro.sync.ecss.ue.AuthorDocumentControllerImpl ctrl, int caretOffset, ro.sync.ecss.dita.topic.ref.TopicrefInfo initialTopicrefInfo, ro.sync.ecss.dita.topic.ref.TopicRefInserter inserter)
      Deprecated.
      This method is not used anymore from oXygen to insert topic reference elements and it will be removed in a future release. All topic reference elements are inserted using the same method: editProperties(URL, AuthorCCManager, AuthorDocumentControllerImpl, AuthorElement[], TopicRefInserter, Object, boolean)
      Show the topic reference info dialog with some initial content
      Parameters:
      location - The DITA map location
      parentFrame - The parent frame.
      ccM - The CC Manager.
      ctrl - The document controller.
      caretOffset - The caret offset.
      initialTopicrefInfo - Initial topic ref info.
      inserter - Callback when the dialog is used.
    • getInsertTopicref

      public static void getInsertTopicref(URL editorLocation, Object parentFrame, ro.sync.ecss.contentcompletion.AuthorCCManager ccM, AuthorDocumentController ctrl, int caretOffset, String initialTopicRefLocation, ro.sync.ecss.dita.topic.ref.TopicRefInserter inserter, String preferredElementName, boolean displayReferenceUrl)
      Insert a topic reference.
      Parameters:
      editorLocation - The editor location.
      parentFrame - The parent frame.
      ccM - The CC Manager.
      ctrl - The document controller.
      caretOffset - The caret offset.
      initialTopicRefLocation - The initial location (relative or absolute) to set to the topic ref insert dialog.
      inserter - Topic ref inserter
      preferredElementName - Preferred name or class of the element to insert
      displayReferenceUrl - If true the URL input will be displayed in the insert topic reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
    • insertKeydefWithKeyword

      public static void insertKeydefWithKeyword(Object parentFrame, ro.sync.ecss.contentcompletion.AuthorCCManager ccM, AuthorDocumentController ctrl, int caretOffset, ro.sync.ecss.dita.topic.ref.TopicRefInserter inserter, boolean append)
      Insert a key definition with keyword.
      Parameters:
      parentFrame - The parent frame.
      ccM - The CC Manager.
      ctrl - The document controller.
      caretOffset - The caret offset.
      inserter - Topic reference inserter
      Note: the preferredElementName parameter is not used on Eclipse plugin implementation.
      append - true to append child, false to insert after.
    • insertKeydefWithKeyword

      public static void insertKeydefWithKeyword(Object parentFrame, ro.sync.ecss.contentcompletion.AuthorCCManager ccM, AuthorDocumentController ctrl, int caretOffset, ro.sync.ecss.dita.topic.ref.TopicRefInserter inserter, DITATopicInsertionPosition insertPos)
      Insert a key definition with keyword.
      Parameters:
      parentFrame - The parent frame.
      ccM - The CC Manager.
      ctrl - The document controller.
      caretOffset - The caret offset.
      inserter - Topic reference inserter
      Note: the preferredElementName parameter is not used on Eclipse plugin implementation.
      insertPos - one of the values defined in DITATopicInsertionPosition.
    • insertKeydefWithKeyword

      public static void insertKeydefWithKeyword(AuthorAccess authorAccess)
      Insert a key definition with keyword.
      Parameters:
      authorAccess - Author access.
    • insertTopichead

      public static void insertTopichead(AuthorAccess authorAccess) throws AuthorOperationException
      Insert a topic head.
      Parameters:
      authorAccess - The author access.
      Throws:
      AuthorOperationException
    • setDitaAccessCustomizer

      public static void setDitaAccessCustomizer(ro.sync.ecss.dita.DITAAccessCustomizer ditaAccessCustomizer)
      Set the DITA access customizer from SA or EC.
      Parameters:
      ditaAccessCustomizer - The DITA access customizer.
    • getDitaAccessCustomizer

      public static ro.sync.ecss.dita.DITAAccessCustomizer getDitaAccessCustomizer()
      Returns:
      Returns the ditaAccessCustomizer.
    • hasAPIKeysManager

      public static boolean hasAPIKeysManager()
      Returns:
      true if we have a keys manager provided through the API.
    • getAPIKeysManagerDescription

      public static String getAPIKeysManagerDescription()
      Returns:
      A description for the API Keys manager.
    • editProperties

      public static void editProperties(URL location, ro.sync.ecss.contentcompletion.AuthorCCManager ccM, ro.sync.ecss.ue.AuthorDocumentControllerImpl ctrl, AuthorElement[] elementsToEdit, ro.sync.ecss.dita.topic.ref.TopicRefInserter topicRefInserter, Object parentFrame, boolean displayReferenceUrl)
      Edit properties for the given reference elements.
      Parameters:
      location - DITA Map editor location.
      ccM - The CC Manager
      ctrl - The Author document controller.
      elementsToEdit - The elements that must be edited.
      topicRefInserter - Callback to insert/edit a topic ref
      parentFrame - Parent frame.
      displayReferenceUrl - If true the URL input will be displayed in the edit reference dialog (the user will have the possibility to change the reference URL).
      Since:
      17.1
    • editProperties

      public static void editProperties(AuthorAccess authorAccess) throws AuthorOperationException
      Edit properties for the given reference elements.
      Parameters:
      authorAccess - the author access.
      Throws:
      AuthorOperationException
    • insertHref

      public static void insertHref(AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, boolean isHrefTypeDitaTopic, URL initialReferenceURL, boolean displayReferenceUrl) throws AuthorOperationException
      Insert a Xref or link element.
      Parameters:
      authorAccess - The author access.
      typeValue - The type attribute value. If not null, the generated reference will have the 'type="typeValue"' attribute set to it.
      formatValue - The format attribute value. If not null and the reference points to a non-DITA resource, the generated reference will have the 'format="formatValue"' attribute set to it.
      scopeValue - The scope attribute value. If not null, the generated reference will have the 'scope="scopeValue"' attribute set to it.
      isXref - true if we need to insert an <xref> element, false for the <link> element.
      isHrefTypeDitaTopic - If true the user wants to insert a reference to a DITA resource (Insert Cross Reference action) If false the user wants to a reference to an external non-dita resource (Web Link action or File Reference action).
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      Throws:
      AuthorOperationException
      Since:
      14.2
    • insertHref

      public static void insertHref(AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, boolean isHrefTypeDitaTopic) throws AuthorOperationException
      Insert a Xref.
      Parameters:
      authorAccess - The author access.
      typeValue - The the attribute value.
      formatValue - The format attribute value.
      scopeValue - The scope attribute value.
      isXref - true if we need to insert a xref element, false for link element.
      isHrefTypeDitaTopic - if true a dita topic chooser will be shown otherwise a input url dialog will be show for the href attribute value.
      Throws:
      AuthorOperationException
    • insertContentKeyReference

      public static void insertContentKeyReference(AuthorAccess authorAccess, String initialKeyName) throws AuthorOperationException
      Shows a dialog that allows inserting a content key reference and setting the original key to select in the Keys combo box.
      Parameters:
      authorAccess - The Author access.
      initialKeyName - The key that will be displayed in the Key field of the insert reference dialog.
      Throws:
      AuthorOperationException
      Since:
      21
      Note: this API method is implemented only for Eclipse plugin.
    • insertContentReference

      public static void insertContentReference(AuthorAccess authorAccess, URL initialReferenceURL, boolean displayReferenceUrl) throws AuthorOperationException
      Shows a dialog that allows inserting a content reference (conref).
      Parameters:
      authorAccess - The Author access.
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      Throws:
      AuthorOperationException
      Since:
      14.2
    • insertTopicref

      public static void insertTopicref(AuthorAccess authorAccess, URL initialReferenceURL, boolean displayReferenceUrl) throws AuthorOperationException
      Insert a topic reference.
      Parameters:
      authorAccess - The Author access.
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      Throws:
      AuthorOperationException
      Since:
      14.2
    • insertTopicref

      public static void insertTopicref(WSDITAMapEditorPage ditaPageAccess, URL initialReferenceURL, String preferredElementName, boolean asChild, boolean displayReferenceUrl) throws AuthorOperationException
      Insert a topic reference in the DITA Map tree.
      Parameters:
      ditaPageAccess - The DITA Page access.
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      preferredElementName - The preferred name of the element to insert.
      asChild - true to insert as a child of the selected item, false to insert as a next sibling.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      Throws:
      AuthorOperationException
      Since:
      15
    • insertTopicref

      public static void insertTopicref(WSDITAMapEditorPage ditaPageAccess, URL initialReferenceURL, String preferredElementName, DITATopicInsertionPosition insertPos, boolean displayReferenceUrl) throws AuthorOperationException
      Insert a topic reference in the DITA Map tree.
      Parameters:
      ditaPageAccess - The DITA Page access.
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      preferredElementName - The preferred name of the element to insert.
      insertPos - one of the values defined in DITATopicInsertionPosition.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      Throws:
      AuthorOperationException
      Since:
      15
    • insertReference

      public static void insertReference(AuthorAccess authorAccess, int refType) throws AuthorOperationException
      Insert a keyref or a conkeyref.
      Parameters:
      authorAccess - The author access.
      refType - Reference type. Can be one of the following constants:
      Throws:
      AuthorOperationException
    • showInsertReferenceDialog

      public static void showInsertReferenceDialog(ro.sync.ecss.contentcompletion.AuthorCCManager ccManager, ro.sync.ecss.ue.AuthorDocumentControllerImpl controller, int caretOffset, Object parentFrame, int refType, boolean showOnlyKeysList, ro.sync.ecss.dita.topic.ref.ReferenceInserter referenceInserter) throws AuthorOperationException
      Shows the keyref/conkeyref insert dialog and returns the chosen reference information.
      Parameters:
      ccManager - CC manager.
      controller - Author document controller.
      caretOffset - Caret offset.
      parentFrame - Parent frame.
      refType - One of: KEYREF_TYPE, CONREF_TYPE, CONKEYREF_TYPE
      showOnlyKeysList - true to show only keys list in the insert reference dialog.
      referenceInserter - The reference inserter.
      Throws:
      AuthorOperationException - When the insertion fails.
    • showInsertReferenceDialog

      public static void showInsertReferenceDialog(ro.sync.ecss.contentcompletion.AuthorCCManager ccManager, ro.sync.ecss.ue.AuthorDocumentControllerImpl controller, int caretOffset, Object parentFrame, int refType, boolean showOnlyKeysList, ro.sync.ecss.dita.topic.ref.ReferenceInserter referenceInserter, ro.sync.ecss.dita.IKeyInfoFilter keysFilter, boolean useModalDialog) throws AuthorOperationException
      Shows the keyref/conkeyref insert dialog and returns the chosen reference information.
      Parameters:
      ccManager - CC manager.
      controller - Author document controller.
      caretOffset - Caret offset.
      parentFrame - Parent frame.
      refType - One of: KEYREF_TYPE, CONREF_TYPE, CONKEYREF_TYPE
      showOnlyKeysList - true to show only keys list in the insert reference dialog.
      referenceInserter - The reference inserter.
      keysFilter - Filters the keys.
      useModalDialog - true if the dialog should be modal.
      Throws:
      AuthorOperationException - When the insertion fails.
    • insertReference

      public static void insertReference(AuthorAccess authorAccess, String referenceValue, String targetElementQName, String elementClass) throws AuthorOperationException
      Inserts a reference from the information passed in the ArgumentsMap.
      Parameters:
      authorAccess - the AuthorAccess
      referenceValue - the reference value.
      targetElementQName - the target element qualified name.
      elementClass - the element class.
      Throws:
      AuthorOperationException - if the operation fails.
    • insertReference

      public static void insertReference(AuthorAccess authorAccess, String referenceValue, int refType, String targetElementQName, String elementClass) throws AuthorOperationException
      Inserts a reference from the information passed in the ArgumentsMap.
      Parameters:
      authorAccess - The AuthorAccess
      referenceValue - The reference value.
      refType - The reference type
      targetElementQName - The target element qualified name.
      elementClass - The element class.
      Throws:
      AuthorOperationException - if the operation fails.
    • insertReference

      public static int insertReference(AuthorAccess authorAccess, int refType, ro.sync.ecss.component.HeadlessViewport viewport, ro.sync.ecss.contentcompletion.AuthorCCManager ccManager, ro.sync.ecss.dita.reference.ReferenceInfo refInfo) throws AuthorOperationException
      Insert the given reference information with the given type.
      Parameters:
      authorAccess - The author access
      refType - The reference type
      viewport - The viewport
      ccManager - The CC Manager
      refInfo - The reference info.
      Returns:
      The offset where the insertion took place.
      Throws:
      AuthorOperationException - When a problem occurs.
    • getRootMapURL

      public static URL getRootMapURL()
      Get DITA root map URL.
      Returns:
      DITA root map URL.
    • resolveKeyRef

      @Deprecated public static URL resolveKeyRef(String keyRef)
      Deprecated.
      Please use the equivalent method which also receives the URL of the requestor.
      Deprecated method for resolving a keyref. Preserved for backward compatibility.
      Parameters:
      keyRef - The keyref value
      Returns:
      The absolute value of the key ref target.
    • resolveKeyRef

      @Deprecated public static URL resolveKeyRef(String keyRef, boolean addANYIdentifierForKeys)
      Deprecated.
      Please use the equivalent method which also receives the URL of the requestor.
      Resolve a keyref.
      Parameters:
      keyRef - The keyref value
      addANYIdentifierForKeys - If true then reference keys will be prefixed by 'ANY/'. in a element_keyref function.
      Returns:
      The absolute value of the key ref target.
    • resolveKeyRef

      public static URL resolveKeyRef(URL originatorURL, String keyRef, boolean addANYIdentifierForKeys)
      Resolve a keyref.
      Parameters:
      originatorURL - The originator URL.
      keyRef - The keyref value
      addANYIdentifierForKeys - If true then reference keys will be prefixed by 'ANY/'. in a element_keyref function.
      Returns:
      The absolute value of the key ref target.
    • checkValidKeyRef

      public static String checkValidKeyRef(String keyref)
      Check if a keyref has a valid key name.
      Parameters:
      keyref - The keyref (may also contain the "/").
      Returns:
      an error message if the key name is not valid or null if the key name is valid.
    • resolveKeyRef

      public static URL resolveKeyRef(URL originatorURL, String keyRef, ContextKeyManager keysManager, boolean addANYIdentifierForKeys)
      Resolve a keyref.
      Parameters:
      originatorURL - The url that contains the key.
      keyRef - The keyref value
      keysManager - The key manager.
      addANYIdentifierForKeys - If true then reference keys will be prefixed by 'ANY/'. in a element_keyref function.
      Returns:
      The absolute value of the key ref target.
    • resolveKeyRefToHref

      public static String resolveKeyRefToHref(URL originatorURL, String keyRef, ContextKeyManager keysManager, boolean addANYIdentifierForKeys)
      Resolve a keyref to a plain href which may or may not be an URL.
      Parameters:
      originatorURL - The url that contains the key.
      keyRef - The keyref value
      keysManager - The key manager.
      addANYIdentifierForKeys - If true then reference keys will be prefixed by 'ANY/'. in a element_keyref function.
      Returns:
      The absolute value of the key ref target.
      Since:
      27.1
    • resolveKeyRef

      public static ro.sync.ecss.dita.KeyTargetURLWithTypeInfo resolveKeyRef(String keyRef, ro.sync.ecss.dita.reference.keyref.KeyResolver kr)
      Resolve a keyref.
      Parameters:
      keyRef - The keyref value
      kr - The key resolver.
      Returns:
      The absolute value of the key ref target.
    • createReusableComponent

      public static void createReusableComponent(AuthorAccess authorAccess, ro.sync.ecss.extensions.api.DITAUniqueIDAssigner idsAssigner) throws AuthorOperationException
      Reuse the selected content.
      Parameters:
      authorAccess - The author access
      idsAssigner - The IDs assigner
      Throws:
      AuthorOperationException - If fails
    • insertReusableComponent

      public static void insertReusableComponent(AuthorAccess authorAccess) throws AuthorOperationException
      Insert a reusable component
      Parameters:
      authorAccess - The author access
      Throws:
      AuthorOperationException
    • replaceAllConrefs

      public static List<DocumentPositionedInfo> replaceAllConrefs(AuthorAccess authorAccess) throws AuthorOperationException
      Expand all conrefs and conkeyrefs from the current document.
      Parameters:
      authorAccess - The access in author page.
      Returns:
      A list with problems from this process.
      Throws:
      AuthorOperationException - If failed to find conrefs or conkeyrefs.
    • replaceConref

      public static void replaceConref(AuthorAccess authorAccess) throws AuthorOperationException
      Replace the conref at caret position
      Parameters:
      authorAccess -
      Throws:
      AuthorOperationException
    • expandAllKeyrefs

      public static List<DocumentPositionedInfo> expandAllKeyrefs(AuthorAccess authorAccess, LinkTextResolver linkTextResolver) throws AuthorOperationException
      Expand all keyrefs from the current document. The keyrefs from xrefs and links are changed with hrefs.
      Parameters:
      authorAccess - Access class to the author functions.
      linkTextResolver - Resolves a link and obtains a text representation.
      Returns:
      A list with problems from this process.
      Throws:
      AuthorOperationException - If failed to find keyrefs.
    • removeReference

      public static void removeReference(AuthorAccess authorAccess) throws AuthorOperationException
      Remove a content reference from a DITA document.
      Parameters:
      authorAccess - The author access.
      Throws:
      AuthorOperationException
    • addEditReference

      public static void addEditReference(AuthorAccess authorAccess) throws AuthorOperationException
      Add a new conref to the current element or edit the existing one.
      Parameters:
      authorAccess - The author access
      Throws:
      AuthorOperationException
    • isGeneralizationOf

      @Deprecated public static boolean isGeneralizationOf(String sourceClass, String targetClass)
      Deprecated.
      use getInheritanceType instead.
      True if the first class value is a generalization or the same as the second class value.
      Parameters:
      sourceClass - The source class value
      targetClass - The target class value
      Returns:
      True if the first class value is a generalization of the second
    • getInheritanceType

      public static int getInheritanceType(String sourceClass, String targetClass)
      Check what inheritance is between the two classes.
      Parameters:
      sourceClass - The source class value
      targetClass - The target class value
      Returns:
      the inheritance type between the source and target class
    • parseDITAHref

      public static Reference parseDITAHref(String baseUrl, String hrefValue) throws MalformedURLException
      Parse the href attribute and returns the absolute URL and the id.
      Parameters:
      baseUrl - The base document URL.
      hrefValue - The href attribute value. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility
      Returns:
      A container object with the content reference URI and topicID or null.
      Throws:
      MalformedURLException - Can't create the URL.
    • parseDITAHref

      public static Reference parseDITAHref(String baseUrl, String hrefValue, boolean isHrefToDITAResource) throws MalformedURLException
      Parse the href attribute and returns the absolute URL and the id.
      Parameters:
      baseUrl - The base document URL.
      hrefValue - The href attribute value. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility
      isHrefToDITAResource - true if this is an href to a DITA resource
      Returns:
      A container object with the content reference URI and topicID or null.
      Throws:
      MalformedURLException - Can't create the URL.
    • parseDITAKeyRef

      @Deprecated public static Reference parseDITAKeyRef(String keyref) throws MalformedURLException
      Deprecated.
      Please use the equivalent method which also receives the URL of the requestor.
      Parse the DITA conkeyref value
      Parameters:
      keyref - The attribute 'conkeyref' value
      Returns:
      The DITA Conref object
      Throws:
      MalformedURLException
    • parseDITAKeyRef

      public static Reference parseDITAKeyRef(URL originatorURL, String keyref) throws MalformedURLException
      Parse the DITA conkeyref value
      Parameters:
      originatorURL - The originator URL.
      keyref - The attribute 'conkeyref' value
      Returns:
      The DITA Conref object
      Throws:
      MalformedURLException
    • parseDITAKeyRef

      public static Reference parseDITAKeyRef(URL originatorURL, ContextKeyManager keyManager, String keyref) throws MalformedURLException
      Parse the DITA conkeyref value
      Parameters:
      originatorURL - The originator URL.
      keyManager - The key manager used to resolve the keyref.
      keyref - The attribute 'conkeyref' value
      Returns:
      The DITA Conref object
      Throws:
      MalformedURLException
    • parseDITAKeyRef

      public static Reference parseDITAKeyRef(String keyref, ro.sync.ecss.dita.reference.keyref.KeyResolver kr) throws MalformedURLException
      Parse the DITA conkeyref value
      Parameters:
      keyref - The attribute 'conkeyref' value
      kr - The keys resolver
      Returns:
      The DITA Conref object
      Throws:
      MalformedURLException
    • getAutoInsertTopicRefElementName

      public static String getAutoInsertTopicRefElementName(AuthorAccess authorAccess, int caretPosition)
      Get the name of the topic ref element to insert
      Parameters:
      authorAccess - The author access
      caretPosition - Caret position
      Returns:
      A name for the topic ref to insert
    • getAutoInsertTopicRefElementName

      public static String getAutoInsertTopicRefElementName(AuthorDocumentController authorDocumentController, int caretPosition)
      Get the name of the topic ref element to insert
      Parameters:
      authorDocumentController - The author document controller.
      caretPosition - Caret position
      Returns:
      A name for the topic ref to insert
      Since:
      23.1
    • getAutoInsertRefElementName

      public static String getAutoInsertRefElementName(AuthorAccess authorAccess, int caretPosition)
      Get the name of the topic ref element to insert
      Parameters:
      authorAccess - The author access
      caretPosition - Caret position
      Returns:
      A name for the topic ref to insert
    • getAutoInsertImageRefElementName

      public static String getAutoInsertImageRefElementName(AuthorAccess authorAccess, int caretPosition)
      Get the name of the image element to insert.
      Parameters:
      authorAccess - The author access
      caretPosition - Caret position
      Returns:
      A name for the topic ref to insert
    • getPossibleElements

      public static CIElement[] getPossibleElements(AuthorDocumentController ctrl, int offset, String reqAttr, String... classFrag)
      Get the possible elements that can be inserted at a given offset and have the class 'classFrag' and a 'reqAttr' attribute.
      Parameters:
      ctrl - the author document controller.
      offset - the offset.
      reqAttr - the required attribute that needs to be on the element.
      classFrag - the class fragments to search for in the element.
      Returns:
      the possible elements that can be inserted at a given offset and have the class 'classFrag' and a 'reqAttr' attribute.
    • getEquivalentChildCIElement

      public static CIElement getEquivalentChildCIElement(AuthorAccess authorAccess, int caretOffset, String tagName)
      Get the equivalent child CIElement
      Parameters:
      authorAccess - Author access
      caretOffset - The caret offset
      tagName - The tag name
      Returns:
      the equivalent child CIElement
    • getKeys

      @Deprecated public static LinkedHashMap<String,ro.sync.ecss.dita.reference.keyref.KeyInfo> getKeys()
      Deprecated.
      Please use the equivalent method which also receives the URL of the requestor.
      Returns:
      The mapped DITA 1.2 keys
    • getKeys

      public static LinkedHashMap<String,ro.sync.ecss.dita.reference.keyref.KeyInfo> getKeys(URL originatorURL)
      Parameters:
      originatorURL - The URL for which the keys are requested
      Returns:
      The mapped DITA 1.2 keys
    • getKeysForInsertion

      public static List<ro.sync.ecss.dita.reference.keyref.KeyInfo> getKeysForInsertion(URL originatorURL)
      Get the list of keys which can be inserted in the topic identified by the "originatorURL" field. Depending on the places where the topic is referenced in the DITA Map, if there are key scopes defined the list of keys may contain the same key present multiple number of times but with different key scope prefixed names.
      Parameters:
      originatorURL - The URL for which the keys are requested
      Returns:
      The list of keys depends on the current editing context.
    • getKeys

      public static LinkedHashMap<String,ro.sync.ecss.dita.reference.keyref.KeyInfo> getKeys(URL originatorURL, ContextKeyManager keysManager)
      Returns the mapped DITA 1.2 keys
      Parameters:
      originatorURL - The URL of the document which contains the keys.
      keysManager - The key manager that is aware of the context of the document.
      Returns:
      The mapped DITA 1.2 keys
    • getURLKeyScopeContexts

      public static LinkedHashMap<URL,List<Stack<Set<String>>>> getURLKeyScopeContexts(URL originatorURL, ContextKeyManager keysManager)
      Returns a mapping between topic URLs and DITA 1.3 key scopes where the URLs are referenced.
      Parameters:
      originatorURL - The URL of the document which contains the keys.
      keysManager - The key manager that is aware of the context of the document.
      Returns:
      The mapped DITA 1.2 keys
    • computeFormatForURLPasteAndDnD

      public static String computeFormatForURLPasteAndDnD(UtilAccess utilAccess, URL url, ReferenceType refType)
      Computes the format of the xref.
      Parameters:
      utilAccess - The util access API. Never null.
      url - The URL to paste.
      refType - The reference type.
      Returns:
      The format.
    • computeLinkScope

      public static String computeLinkScope(URL editorLocation, URL hrefURL)
      Compute the scope attribute.
      Parameters:
      editorLocation - Editor location
      hrefURL - Href location.
      Returns:
      the computed scope attribute construction. Never null.
    • pasteAsReference

      public static String pasteAsReference(AuthorAccess authorAccess, boolean asConref) throws AuthorOperationException
      Paste as reference
      Parameters:
      authorAccess - The author access.
      asConref - True if paste as conref, false as link
      Returns:
      information about how this action should be used.
      Throws:
      AuthorOperationException
    • pasteAsReference

      public static String pasteAsReference(AuthorAccess authorAccess, DITAAccess.PasteInfo pasteInfo) throws AuthorOperationException
      Paste as reference
      Parameters:
      authorAccess - The author access.
      pasteInfo - Paste type of clipboard fragments.
      Returns:
      information about how this action should be used.
      Throws:
      AuthorOperationException
    • pasteClipboardFragmentsAsReference

      public static boolean pasteClipboardFragmentsAsReference(AuthorAccess authorAccess, DITAAccess.PasteInfo pasteInfo, ro.sync.ecss.component.AuthorDocumentFragmentClipboardObject[] fragments) throws AuthorOperationException
      Paste the fragments from clipboard as reference.
      Parameters:
      authorAccess - The author access.
      pasteInfo - Paste type of clipboard fragments.
      fragments - The fragments to paste with.
      Returns:
      true if the paste was valid.
      Throws:
      AuthorOperationException
    • pasteClipboardFragmentsAsReference

      public static boolean pasteClipboardFragmentsAsReference(AuthorAccess authorAccess, DITAAccess.PasteInfo pasteInfo, ro.sync.ecss.component.AuthorDocumentFragmentClipboardObject[] fragments, SelectionInterpretationMode selectionInterpretationMode) throws AuthorOperationException
      Paste the fragments from clipboard as reference.
      Parameters:
      authorAccess - The author access.
      pasteInfo - Paste type of clipboard fragments.
      fragments - The fragments to paste with.
      selectionInterpretationMode - Selection interpretation mode
      Returns:
      true if the paste was valid.
      Throws:
      AuthorOperationException
    • filterAttributeValues

      @Deprecated public static List<CIValue> filterAttributeValues(List<CIValue> attributeValues, WhatPossibleValuesHasAttributeContext context, String documentTypeName)
      Deprecated.
      Please use the equivalent method which also receives the URL of the requestor.
      Propose additional attribute values.
      Parameters:
      attributeValues - The attribute values.
      context - The context.
      documentTypeName - The document type name.
      Returns:
      The enriched list.
    • filterAttributeValues

      public static List<CIValue> filterAttributeValues(List<CIValue> attributeValues, WhatPossibleValuesHasAttributeContext context, String documentTypeName, AuthorAccess authorAccess)
      Propose additional attribute values.
      Parameters:
      attributeValues - The attribute values.
      context - The context.
      documentTypeName - The document type name.
      authorAccess - The Author Access.
      Returns:
      The enriched list.
    • filterAttributeValues

      public static List<CIValue> filterAttributeValues(List<CIValue> attributeValues, WhatPossibleValuesHasAttributeContext context, ContextKeyManager keyManager, String documentTypeName, AuthorAccess authorAccess)
      Propose additional attribute values.
      Parameters:
      attributeValues - The attribute values.
      context - The context.
      keyManager - The key manager to use to propose values for attributes like keyref.
      documentTypeName - The document type name.
      authorAccess - The Author Access. Can be null
      Returns:
      The enriched list.
    • computeElementClazz

      public static String computeElementClazz(WhatPossibleValuesHasAttributeContext context)
      Compute the element's clazz
      Parameters:
      context - The attributes editing context.
      Returns:
      The element clazz or null.
    • insertImage

      public static void insertImage(AuthorAccess authorAccess, String ref) throws AuthorOperationException
      Insert a DITA Image
      Parameters:
      authorAccess - The author access
      ref - The reference.
      Throws:
      AuthorOperationException
    • insertMedia

      public static void insertMedia(AuthorAccess authorAccess, ro.sync.ecss.dita.MediaInfo ref) throws AuthorOperationException
      Insert a media object.
      Parameters:
      authorAccess - The author access.
      ref - Media reference.
      Throws:
      AuthorOperationException - When fail.
    • chooseMediaReference

      public static ro.sync.ecss.dita.MediaInfo chooseMediaReference(AuthorAccess authorAccess) throws AuthorOperationException
      Allows the user to choose an media file reference, which will be inserted inside the document.
      Parameters:
      authorAccess - The author access.
      Returns:
      A MediaInfo object containing all the properties for the file which will be inserted.
      Throws:
      AuthorOperationException - On fail.
    • insertMediaSchemaAware

      public static SchemaAwareHandlerResult insertMediaSchemaAware(AuthorAccess authorAccess, ro.sync.ecss.dita.MediaInfo reference) throws AuthorOperationException
      Insert a DITA media object.
      Parameters:
      authorAccess - The author access
      reference - The reference value.
      Returns:
      The insertion result
      Throws:
      AuthorOperationException - On fail.
    • computeMediaReferenceXMLToInsert

      public static String computeMediaReferenceXMLToInsert(AuthorAccess authorAccess, ro.sync.ecss.dita.MediaInfo reference)
      Compute the media reference XML fragment to insert.
      Parameters:
      authorAccess - The author access.
      reference - The reference information .
      Returns:
      the image reference XML fragment to insert.
    • insertImage

      public static void insertImage(AuthorAccess authorAccess, ro.sync.ecss.dita.ImageInfo ref) throws AuthorOperationException
      Insert a DITA Image.
      Parameters:
      authorAccess - The author access
      ref - The information reference.
      Throws:
      AuthorOperationException - If the image could not be inserted.
    • chooseImageReference

      public static ro.sync.ecss.dita.ImageInfo chooseImageReference(AuthorAccess authorAccess) throws AuthorOperationException
      Allows the user to choose an image reference, which will be inserted inside the document.
      Parameters:
      authorAccess - The author access.
      Returns:
      A ImageInfo object containing all the properties for the image, which will be inserted.
      Throws:
      AuthorOperationException
    • insertImageSchemaAware

      public static SchemaAwareHandlerResult insertImageSchemaAware(AuthorAccess authorAccess, String ref) throws AuthorOperationException
      Insert a DITA Image
      Parameters:
      authorAccess - The author access
      ref - The reference.
      Returns:
      The insertion result
      Throws:
      AuthorOperationException
    • insertImageSchemaAware

      public static SchemaAwareHandlerResult insertImageSchemaAware(AuthorAccess authorAccess, String refAttrName, String refValue) throws AuthorOperationException
      Insert a DITA Image
      Parameters:
      authorAccess - The author access
      refAttrName - The reference attribute name.
      refValue - The reference value.
      Returns:
      The insertion result
      Throws:
      AuthorOperationException
    • insertImageSchemaAware

      public static SchemaAwareHandlerResult insertImageSchemaAware(AuthorAccess authorAccess, ro.sync.ecss.dita.ImageInfo reference) throws AuthorOperationException
      Insert a DITA image.
      Parameters:
      authorAccess - The author access
      reference - The reference value.
      Returns:
      The insertion result
      Throws:
      AuthorOperationException
    • computeImageReferenceXMLToInsert

      public static String computeImageReferenceXMLToInsert(AuthorAccess authorAccess, String refAttrName, String refValue)
      Compute the image reference XML fragment to insert.
      Parameters:
      authorAccess - The author access.
      refAttrName - The reference attribute name
      refValue - The reference value name
      Returns:
      the image reference XML fragment to insert.
    • buildFigureHrefImageXMLToInsert

      public static String buildFigureHrefImageXMLToInsert(AuthorAccess authorAccess, String figTitle, String refAttrValue)
      Creates a figure with title and image with href XML element.
      Parameters:
      authorAccess - Offers access to Author page API.
      figTitle - The title of the figure.
      refAttrValue - The value of the href attribute.
      Returns:
      a figure with title and image XML element.
      Since:
      25.0
    • buildFigureKeyrefImageXMLToInsert

      public static String buildFigureKeyrefImageXMLToInsert(AuthorAccess authorAccess, String figTitle, String keyName)
      Creates a figure with title and image with keyref XML element.
      Parameters:
      authorAccess - Offers access to Author page API.
      figTitle - The title of the figure.
      keyName - The name of the key.
      Returns:
      a figure with title and image with keyref XML element.
      Since:
      25.0
    • getPossibleElementQName

      public static String getPossibleElementQName(AuthorDocumentController ctrl, String clazzFrag, String mostUsed)
      Obtain the qualified name of the element with the given class, which will be inserted in the document.
      Parameters:
      ctrl - The author document controller.
      clazzFrag - The class of the element, whose name is searched.
      mostUsed - The most used name of the element with the given class.
      Returns:
      The qualified name of the element with the given class.
    • searchReferences

      public static void searchReferences(AuthorAccess authorAccess)
      Search references to a certain element at the caret position.
      Parameters:
      authorAccess - The author access.
    • computeLinkText

      @Deprecated public static String computeLinkText(String hrefValue, String baseSystemID) throws MalformedURLException, IOException, ParserConfigurationException, SAXException, Exception
      Obtains information about the referred target.
      Parameters:
      hrefValue - The relative location of the target.
      baseSystemID - base system ID.
      Returns:
      The computed title information.
      Throws:
      MalformedURLException
      IOException
      ParserConfigurationException
      SAXException
      Exception
    • computeLinkText

      @Deprecated public static String computeLinkText(AuthorNode contextNode, String hrefValue, String baseSystemID) throws MalformedURLException, IOException, ParserConfigurationException, SAXException, Exception
      Obtains information about the referred target.
      Parameters:
      contextNode - The context node.
      hrefValue - The relative location of the target.
      baseSystemID - base system ID.
      Returns:
      The computed title information.
      Throws:
      MalformedURLException
      IOException
      ParserConfigurationException
      SAXException
      Exception
    • computeLinkText

      @Deprecated public static String computeLinkText(AuthorNode contextNode, String keyRefValue, String hrefValue, String baseSystemID) throws MalformedURLException, IOException, ParserConfigurationException, SAXException, Exception
      Obtains information about the referred target.
      Parameters:
      contextNode - The context node.
      keyRefValue - The fully prefixed key scope value
      hrefValue - The relative location of the target.
      baseSystemID - base system ID.
      Returns:
      The computed title information.
      Throws:
      MalformedURLException
      IOException
      ParserConfigurationException
      SAXException
      Exception
    • computeLinkText

      public static String computeLinkText(AuthorNode contextNode, String keyRefValue, String hrefValue, String baseSystemID, KeysManagerBase keysManager) throws Exception
      Obtains information about the referred target.
      Parameters:
      contextNode - The context node.
      keyRefValue - The fully prefixed key scope value
      hrefValue - The relative location of the target.
      baseSystemID - base system ID.
      keysManager - The key manager.
      Returns:
      The computed title information.
      Throws:
      Exception
      Since:
      21
    • filterElements

      public static List<CIElement> filterElements(List<CIElement> elements, WhatElementsCanGoHereContext context)
      Filter the given elements according to the given context.
      Parameters:
      elements - The list of CIElement elements.
      context - The context.
      Returns:
      The filtered CIElements.
    • filterElements

      public static List<CIElement> filterElements(List<CIElement> elements, WhatElementsCanGoHereContext context, String authorName)
      Filter the given elements according to the given context.
      Parameters:
      elements - The list of CIElement elements.
      context - The context.
      authorName - the name of the author to be used for draft comment author attribute. If null, the user from the current editor is used.
      Returns:
      The filtered CIElements.
    • resolveKeyNotFoundError

      public static void resolveKeyNotFoundError(AuthorAccess authorAccess, String keyref)
      The give key was not found. We will present a warning dialog to the user and we will offer the user as a possible solution to change the root map.
      Parameters:
      authorAccess - Interface to the author context.
      keyref - The key that wasn't found in the current root map context.
    • filterDITAVALAttributeValues

      public static List<CIValue> filterDITAVALAttributeValues(List<CIValue> attributeValues, WhatPossibleValuesHasAttributeContext context)
      Filter DITAVAL Attribute values.
      Parameters:
      attributeValues - The current list of attribute values.
      context - The what attribute values context.
      Returns:
      The modified list of values.
    • createNewTopicReference

      public static void createNewTopicReference(AuthorAccess authorAccess) throws Exception
      Create a new DITA topic and link to it as a reference.
      Parameters:
      authorAccess - The Author Access
      Throws:
      Exception - if it fails.
    • pushElement

      public static void pushElement(AuthorAccess authorAccess) throws AuthorOperationException
      Shows a dialog that allows the user to push an element.
      Parameters:
      authorAccess - The Author access.
      Throws:
      AuthorOperationException - When the operation could not be completed.
      Since:
      17.1
    • isDITA

      public static boolean isDITA(Attributes atts)
      Check if the resource is DITA.
      Parameters:
      atts - The SAX attributes from the root element.
      Returns:
      true if the topic or map with a certain architecture version is DITA,
      Since:
      20.1
    • isDITA1_3OrNewer

      public static boolean isDITA1_3OrNewer(Attributes atts)
      Check if the topic or map with a certain architecture version is DITA 1.3 or newer,
      Parameters:
      atts - The SAX attributes from the root element.
      Returns:
      true if the topic or map with a certain architecture version is DITA 1.3 or newer,
      Since:
      20.1
    • isDITA1_3OrNewer

      public static boolean isDITA1_3OrNewer(String archVersion)
      Check if the topic or map with a certain architecture version is DITA 1.3 or newer,
      Parameters:
      archVersion - The architecture version taken from the root element.
      Returns:
      true if the topic or map with a certain architecture version is DITA 1.3 or newer,
    • insertLinkReference

      public static void insertLinkReference(AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, String hrefType, URL initialReferenceURL, boolean displayReferenceUrl) throws AuthorOperationException
      Insert a Xref or link element.
      Parameters:
      authorAccess - The author access.
      typeValue - The type attribute value. If not null, the generated reference will have the 'type="typeValue"' attribute set to it.
      formatValue - The format attribute value. If not null and the reference points to a non-DITA resource, the generated reference will have the 'format="formatValue"' attribute set to it.
      scopeValue - The scope attribute value. If not null, the generated reference will have the 'scope="scopeValue"' attribute set to it.
      isXref - true if we need to insert an <xref> element, false for the <link> element.
      hrefType - The type of the link. If LINK_TYPE_DITA_TOPIC, the user wants to insert a reference to a DITA resource (Insert Cross Reference action). If LINK_TYPE_NON_DITA_RESOURCE, wants to a reference to an external non-dita resource (Web Link action or File Reference action).
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      Throws:
      AuthorOperationException
    • insertLinkReference

      public static void insertLinkReference(AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, String preferredElName, String hrefType, URL initialReferenceURL, boolean displayReferenceUrl) throws AuthorOperationException
      Insert a Xref or link element.
      Parameters:
      authorAccess - The author access.
      typeValue - The type attribute value. If not null, the generated reference will have the 'type="typeValue"' attribute set to it.
      formatValue - The format attribute value. If not null and the reference points to a non-DITA resource, the generated reference will have the 'format="formatValue"' attribute set to it.
      scopeValue - The scope attribute value. If not null, the generated reference will have the 'scope="scopeValue"' attribute set to it.
      isXref - true if we need to insert an <xref> element, false for the <link> element.
      preferredElName - The preferred name of the reference element.
      hrefType - The type of the link. If LINK_TYPE_DITA_TOPIC, the user wants to insert a reference to a DITA resource (Insert Cross Reference action). If LINK_TYPE_NON_DITA_RESOURCE, wants to a reference to an external non-dita resource (Web Link action or File Reference action).
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      Throws:
      AuthorOperationException
    • insertLinkReference

      public static void insertLinkReference(AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, String hrefType, URL initialReferenceURL, boolean displayReferenceUrl, DITAAccess.InsertLinkReferenceShortcut insertLinkReferenceShortcut) throws AuthorOperationException
      Insert a Xref or link element.
      Parameters:
      authorAccess - The author access.
      typeValue - The type attribute value. If not null, the generated reference will have the 'type="typeValue"' attribute set to it.
      formatValue - The format attribute value. If not null and the reference points to a non-DITA resource, the generated reference will have the 'format="formatValue"' attribute set to it.
      scopeValue - The scope attribute value. If not null, the generated reference will have the 'scope="scopeValue"' attribute set to it.
      isXref - true if we need to insert an <xref> element, false for the <link> element.
      hrefType - The type of the link. If LINK_TYPE_DITA_TOPIC, the user wants to insert a reference to a DITA resource (Insert Cross Reference action). If LINK_TYPE_NON_DITA_RESOURCE, wants to a reference to an external non-dita resource (Web Link action or File Reference action).
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      insertLinkReferenceShortcut - A shortcut class that allows us to collectthe references before inserting them into document.
      Throws:
      AuthorOperationException
      Since:
      18
    • insertLinkReference

      public static void insertLinkReference(AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, String preferredElName, String hrefType, URL initialReferenceURL, boolean displayReferenceUrl, DITAAccess.InsertLinkReferenceShortcut insertLinkReferenceShortcut) throws AuthorOperationException
      Insert a Xref or link element.
      Parameters:
      authorAccess - The author access.
      typeValue - The type attribute value. If not null, the generated reference will have the type="typeValue" attribute set to it.
      formatValue - The format attribute value. If not null and the reference points to a non-DITA resource, the generated reference will have the format="formatValue" attribute set to it.
      scopeValue - The scope attribute value. If not null, the generated reference will have the scope="scopeValue" attribute set to it.
      isXref - true if we need to insert an <xref> element, false for the <link> element.
      preferredElName - The preferred name of the reference element.
      hrefType - The type of the link. If LINK_TYPE_DITA_TOPIC, the user wants to insert a reference to a DITA resource (Insert Cross Reference action). If LINK_TYPE_NON_DITA_RESOURCE, wants to a reference to an external non-dita resource (Web Link action or File Reference action).
      initialReferenceURL - The default URL that will be displayed in the URL field of the insert reference dialog.
      Note: this parameter is not used on Eclipse plugin implementation.
      displayReferenceUrl - If true the URL input will be displayed in the insert reference dialog (the user will have the possibility to change the reference URL). This parameter can be set to false when an initialReferenceURL is provided, and the user must not have the possibility to change it (the reference URL must be fixed).
      Note: this parameter is not used on Eclipse plugin implementation.
      insertLinkReferenceShortcut - A shortcut class that allows us to collectthe references before inserting them into document.
      Throws:
      AuthorOperationException
      Since:
      18
    • insertLinkReference

      public static void insertLinkReference(String referenceValue, String targetElementClass, String targetElementQName, AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, String hrefType) throws AuthorOperationException
      Insert a Xref or link element.
      Parameters:
      referenceValue - The class of the target element.
      targetElementClass - The class of the target element.
      targetElementQName - The qualified name of the target element.
      authorAccess - The author access.
      typeValue - The type attribute value. If not null, the generated reference will have the 'type="typeValue"' attribute set to it.
      formatValue - The format attribute value. If not null and the reference points to a non-DITA resource, the generated reference will have the 'format="formatValue"' attribute set to it.
      scopeValue - The scope attribute value. If not null, the generated reference will have the 'scope="scopeValue"' attribute set to it.
      isXref - true if we need to insert an <xref> element, false for the <link> element.
      hrefType - The type of the link. If LINK_TYPE_DITA_TOPIC, the user wants to insert a reference to a DITA resource (Insert Cross Reference action). If LINK_TYPE_NON_DITA_RESOURCE, wants to a reference to an external non-dita resource (Web Link action or File Reference action).
      Throws:
      AuthorOperationException
      Since:
      18
    • insertLinkReference

      public static void insertLinkReference(String referenceValue, String targetElementClass, String targetElementQName, AuthorAccess authorAccess, String typeValue, String formatValue, String scopeValue, boolean isXref, boolean useKeyRef, String hrefType) throws AuthorOperationException
      Insert a Xref or link element.
      Parameters:
      referenceValue - The class of the target element.
      targetElementClass - The class of the target element.
      targetElementQName - The qualified name of the target element.
      authorAccess - The author access.
      typeValue - The type attribute value. If not null, the generated reference will have the 'type="typeValue"' attribute set to it.
      formatValue - The format attribute value. If not null and the reference points to a non-DITA resource, the generated reference will have the 'format="formatValue"' attribute set to it.
      scopeValue - The scope attribute value. If not null, the generated reference will have the 'scope="scopeValue"' attribute set to it.
      isXref - true if we need to insert an <xref> element, false for the <link> element.
      useKeyRef - true if the reference is a keyref.
      hrefType - The type of the link. If LINK_TYPE_DITA_TOPIC, the user wants to insert a reference to a DITA resource (Insert Cross Reference action). If LINK_TYPE_NON_DITA_RESOURCE, wants to a reference to an external non-dita resource (Web Link action or File Reference action).
      Throws:
      AuthorOperationException
      Since:
      21
    • rewriteKeyref

      public static String rewriteKeyref(LinkedHashMap<URL,List<Stack<Set<String>>>> urlKeyScopesMapping, LinkedHashMap<String,ro.sync.ecss.dita.reference.keyref.KeyInfo> keys, AuthorNode contextNode, String keyref)
      Rewrite a keyref looking also at key scopes..
      Parameters:
      urlKeyScopesMapping - Global URL to key scopes mapping.
      keys - Map of keys.
      contextNode - The context node.
      keyref - The original keyref.
      Returns:
      The rewritten reference.
    • getURLKeyScopeContexts

      public static LinkedHashMap<URL,List<Stack<Set<String>>>> getURLKeyScopeContexts(URL originatorURL)
      Get the URL to key scopes context for the default keys manager.
      Parameters:
      originatorURL - The originator URL.
      Returns:
      the URL to key scopes context mapping for the default keys manager.
    • editTopicref

      public static void editTopicref(AuthorElement[] topicrefNodes, AuthorAccess authorAccess)
      Edits one or more topicref elements inside a specialized dialog.
      Parameters:
      topicrefNodes - The topicref elements.
      authorAccess - Author access.
    • getDitaReferenceTargets

      public static List<DitaReferenceTargetDescriptor> getDitaReferenceTargets(AuthorAccess authorAccess, URL targetURL) throws IOException
      Returns the DITA reference targets in the given topic.
      Parameters:
      authorAccess - The author access of the currently opened document.
      targetURL - The URL of the topic.
      Returns:
      the DITA reference targets in the given topic.
      Throws:
      IOException - If an error occured while reading the URL.
      Since:
      18.0
    • getDitaReferenceTargets

      public static List<DitaReferenceTargetDescriptor> getDitaReferenceTargets(URL baseUrl, URL topicUrl) throws IOException
      Returns the DITA reference targets in the given topic.
      Parameters:
      baseUrl - the target URL.
      topicUrl - the URL of the source topic.
      Returns:
      the DITA reference targets in the given topic.
      Throws:
      IOException
      Since:
      23.0
    • getFormat

      @Deprecated public static String getFormat(String hrefValue, String formatValue, boolean fillFormatAttr)
      Get the format for the specified resource.
      Parameters:
      hrefValue - The HREF of the resource.
      formatValue - The default format value.
      fillFormatAttr - true if the attribute should be filled when serializing.
      Returns:
      The format for the resource.
    • getFormatForLinkCreatedFromGUI

      public static String getFormatForLinkCreatedFromGUI(String hrefValue, String formatValue, boolean fillFormatAttr)
      Get the format for the specified resource.
      Parameters:
      hrefValue - The HREF of the resource.
      formatValue - The default format value.
      fillFormatAttr - true if the attribute should be filled when serializing.
      Returns:
      The format for the resource.
    • checkValidKeyName

      public static String checkValidKeyName(String keyName)
      Check if a keyref has a valid key name.
      Parameters:
      keyName - The key name.
      Returns:
      an error message if the key name is not valid or null if the key name is valid.
    • getHrefInformation

      public static HrefInfo getHrefInformation(AuthorNode node)
      Get the reference information (by analizing attributes like keyref, href, mapref, ...) of a node.
      Parameters:
      node - The author node to get the reference information for.
      Returns:
      The information about what the given node references.
      Since:
      18.1
    • getHrefInformation

      public static HrefInfo getHrefInformation(KeysManagerBase keyManager, AuthorNode node)
      Get the reference information (by analizing attributes like keyref, href, mapref, ...) of a node.
      Parameters:
      keyManager - The key manager to use to resolve keys.
      node - The author node to get the reference information for.
      Returns:
      The information about what the given node references.
      Since:
      22
    • exportDITAMap

      public static void exportDITAMap(URL ditamapURL, File exportDirectory, boolean exportAsZip, String zipFileName, ExportProgressUpdater progressUpdater)
      Export DITA Map as zip.
      Parameters:
      ditamapURL - The DITA Map URL.
      exportDirectory - The export directory.
      exportAsZip - true to export as ZIP
      zipFileName - Zip file name.
      progressUpdater - The progress updater.
      Since:
      18.1
    • attachKeyScopeInformation

      @Deprecated public static URL attachKeyScopeInformation(URL targetURL, String keyref, String contextMapURL)
      Deprecated.
      Attach key scope information to the target URL.
      Parameters:
      targetURL - The URL which needs to be opened, referenced via a keyref.
      keyref - The fully qualified keyref.
      contextMapURL - The URL of the context map.
      Since:
      19
    • attachKeyScopeInformation

      public static URL attachKeyScopeInformation(URL targetURL, String keyref, String contextMapURL, String originalKeyName)
      Attach key scope information to the target URL.
      Parameters:
      targetURL - The URL which needs to be opened, referenced via a keyref.
      keyref - The fully qualified keyref.
      contextMapURL - The URL of the context map.
      originalKeyName - The original key name without key scopes.
      Returns:
      The URL with key scope information attached, so that we know from what key scope the URL was opened.
      Since:
      25.1
    • attachKeyScopeInformation

      public static URL attachKeyScopeInformation(URL targetURL, Stack<Set<String>> context, String contextMapURL)
      Attach key scope information to the target URL.
      Parameters:
      targetURL - The URL which needs to be opened, referenced via a keyref.
      context - The key scope context.
      As an example, for a DITA map looking like this:
      <map><topicref keyscope="a b c"><topicref keyscope="d e f"/></topicref></map>
      the stack consists of two sets, the first containing [a, b, c] and the second containing [d, e, f].
      contextMapURL - The URL of the context map.
      Returns:
      The URL with key scope information attached, so that we know from what key scope the URL was opened.
      Since:
      19
    • computeVariableKeyrefElementName

      public static String computeVariableKeyrefElementName(AuthorAccess authorAccess)
      Compute the elements name.
      Parameters:
      authorAccess - The author access.
      Returns:
      Returns the name of an element, that allows
    • computeVariableKeyrefElementName

      public static String computeVariableKeyrefElementName(AuthorAccess authorAccess, boolean preferImageElement)
      Compute the elements name.
      Parameters:
      authorAccess - The author access.
      preferImageElement - true if an image should be inserted.
      Returns:
      Returns the name of an element, that allows
    • computeKeyScopeStack

      public static Stack<Set<String>> computeKeyScopeStack(AuthorNode contextNode, LinkedHashMap<URL,List<Stack<Set<String>>>> urlKeyScopesMapping)
      Compute the entire key scope stack.
      Parameters:
      contextNode - The context node.
      urlKeyScopesMapping - The URL to key scopes mapping.
      Returns:
      the entire key scope stack.
      Since:
      19
    • computeKeyScopeStack

      public static Stack<Set<String>> computeKeyScopeStack(AuthorNode contextNode, LinkedHashMap<URL,List<Stack<Set<String>>>> urlKeyScopesMapping, Map<AuthorNode,Set<String>> stackCache)
      Compute the entire key scope stack.
      Parameters:
      contextNode - The context node.
      urlKeyScopesMapping - The URL to key scopes mapping.
      stackCache - Key scopes stack cache. Can be null.
      Returns:
      the entire key scope stack.
      Since:
      23
    • getKeyForUrl

      public static String getKeyForUrl(KeysManagerBase keyManager, URL url, URL editorLocation)
      Get the key corresponding to the given URL.
      Parameters:
      keyManager - The key manager
      url - The URL for which the search for a key is performed.
      editorLocation - The URL which is edited.
      Returns:
      The name of the corresponding key, if existing, or null.
      Since:
      21
    • getKeyForUrl

      public static String getKeyForUrl(KeysManagerBase keyManager, URL url, URL editorLocation, AuthorNode contextNode)
      Get the key corresponding to the given URL.
      Parameters:
      keyManager - The key manager
      url - The URL for which the search for a key is performed.
      editorLocation - The URL which is edited.
      contextNode - The context node. Can be null
      Returns:
      The name of the corresponding key, if existing, or null.
      Since:
      24
    • getKeyForUrl

      public static String getKeyForUrl(URL url, URL editorLocation)
      Get the key corresponding to the given URL.
      Parameters:
      url - The URL for which the search for a key is performed.
      editorLocation - The URL which is edited.
      Returns:
      The name of the corresponding key, if existing, or null.
    • getKeyRefValueForUrl

      public static String getKeyRefValueForUrl(KeysManagerBase keysManager, URL referenceUrl, URL editorLocation)
      Get the key reference corresponding to the given URL.
      Parameters:
      referenceUrl - The URL for which the search for a key is performed.
      editorLocation - The URL which is edited.
      keysManager - The context keys manager.
      Returns:
      The name of the corresponding key, if existing, or null.
      Since:
      21
    • checkConsecutiveInsertionWarning

      protected static int checkConsecutiveInsertionWarning(int previousOperationOffset, int selectionStart, int selectionEnd, ro.sync.ecss.dita.reference.ReferenceInfo previousReferenceInfo, ro.sync.ecss.dita.reference.ReferenceInfo currentReferenceInfo)
      Show a warning message when consecutive insertion of the same references are performed.
      Parameters:
      previousOperationOffset - The previous operation offset, usually where the caret is positioned.
      selectionStart - The current selection start.
      selectionEnd - The current selection end.
      previousReferenceInfo - The previous inserted reference.
      currentReferenceInfo - The current inserted reference. !!! OBS: Do not delete. Internal API. !!!
    • isKeyReferenceToImage

      public static boolean isKeyReferenceToImage(ro.sync.ecss.dita.reference.keyref.KeyInfo key)
      Checks if the current key is a reference to an image.
      Parameters:
      key - Current key to check.
      Returns:
      true if we should treat the key as a reference to an image.
    • isGenericMediaContent

      public static boolean isGenericMediaContent(ro.sync.ecss.dita.reference.keyref.KeyInfo selectedKey)
      Checks if the selected key refers resources that can be wrapped in a media object.s
      Parameters:
      selectedKey - Current key to check.
      Returns:
      true if the current key has a reference to content that can be embedded in a media object.
    • detectMediaObjectOutputclass

      public static String detectMediaObjectOutputclass(ro.sync.ecss.dita.reference.keyref.KeyInfo key)
      Detects the output class of a key.
      Parameters:
      key - The key info.
      Returns:
      the output class that should be used when the key is inserted as a media object.
    • isReferenceToDITAResource

      public static boolean isReferenceToDITAResource(AuthorNode node, ro.sync.ecss.dita.reference.keyref.KeyInfo keyInfo)
      Check if this reference points to a DITA topic, map or variable text.
      Parameters:
      node - The node.
      keyInfo - The referenced key definition, can be null
      Returns:
      true if this reference points to a DITA topic, map or variable text.
      Since:
      21
    • isReferenceToDITACompatibleResource

      public static boolean isReferenceToDITACompatibleResource(AuthorNode node, ro.sync.ecss.dita.reference.keyref.KeyInfo keyInfo)
      Check if this reference points to a DITA compatible resource (that can be converted to DITA using dynamic converter DITA-OT plugin).
      Parameters:
      node - The node.
      keyInfo - The referenced key definition, can be null
      Returns:
      true if this reference points to a DITA topic, map or variable text.
      Since:
      25
    • getConverterFormatForDITACompatibleResource

      public static String getConverterFormatForDITACompatibleResource(String resourceExtension)
      Get the converter format that corresponds with the given file extension of the DITA Compatible resource
      Parameters:
      resourceExtension - The file extension.
      Returns:
      The converter format, or null when resource is not DITA-compatible or it's DITA.
      Since:
      25
    • convertDitaCompatibleResource

      public static String convertDitaCompatibleResource(Reader toConvert, String systemId, String format) throws ro.sync.exml.editor.xmleditor.ErrorListException
      Get the DITA-translated content for the given compatible resource
      Parameters:
      toConvert - The content to convert.
      systemId - The system id of the content.
      format - The compatible resource conversion format.
      Returns:
      The DITA content.
      Throws:
      ro.sync.exml.editor.xmleditor.ErrorListException - if something goes wrong.
      Since:
      25
    • isKeyDefToDITAResource

      public static boolean isKeyDefToDITAResource(ro.sync.ecss.dita.reference.keyref.KeyInfo keyInfo)
      Check if this key definition points to a DITA topic, map or variable text.
      Parameters:
      keyInfo - The key info.
      Returns:
      true if this key definition points to a DITA topic, map or variable text.
      Since:
      21
    • annotateAttributes

      @Deprecated public static List<CIAttribute> annotateAttributes(List<CIAttribute> attributes)
      Deprecated.
      This method does not do anything anynmore, the attribute annotations are gathered from the framework folder.
      Annotate a list of attributes.
      Parameters:
      attributes - The attributes list.
      Returns:
      The list of attributes with annotations.
    • getFragWithMostSuitableTopicrefs

      public static AuthorDocumentFragment getFragWithMostSuitableTopicrefs(AuthorDocumentController controller, AuthorDocumentFragment frag, int insertOffset) throws BadLocationException
      When moving/copying topic references, maybe they are not allowed at the new position. Try with other topic reference elements.
      Parameters:
      controller - Document controller
      frag - The fragment to move
      insertOffset - The offset position
      Returns:
      the created fragment
      Throws:
      BadLocationException
    • getFragWithMostSuitableTopicrefs

      public static AuthorDocumentFragment getFragWithMostSuitableTopicrefs(AuthorDocumentController controller, AuthorNode selectedElem, int insertOffset) throws BadLocationException
      When moving/copying topic references, maybe they are not allowed at the new position. Try with other topic reference elements.
      Parameters:
      controller - document controller
      selectedElem - the node to move
      insertOffset - the offset position
      Returns:
      the created fragment
      Throws:
      BadLocationException
    • findSimilarTopics

      public static void findSimilarTopics(AuthorAccess authorAccess)
      Find similar topics based on words found in title, shortdesc, keyword, and indexterm elements.
      Parameters:
      authorAccess - The author access.
    • getRelatedLinksFromReltable

      public static List<RelLink> getRelatedLinksFromReltable(URL originatorURL)
      Get the list of related links from all the relationship tables defined in the DITA Maps.
      Parameters:
      originatorURL - The topic for which we are searching for outgoing links.
      Returns:
      The list of related links from all the relationship tables defined in the DITA Maps.
      Since:
      22
    • proposeFolderUrlForChildTopicref

      public static URL proposeFolderUrlForChildTopicref(AuthorElement parent)
      Propose a folder URL where to save a new topicref that is added in a DITA Map as a child of the given node.
      Parameters:
      parent - The parent node in the DITA Map of the new topicref element.
      Returns:
      the folder URL where this topicref should be saved.
      Since:
      25.0
    • detectInsertionType

      public static DITAImposedReferenceType detectInsertionType(URL url)
      Looks at the provided URL and detects if the referred resource should be inserted as a specific XML element.
      Parameters:
      url - The url.
      Returns:
      the type the resource should be inserted.
      Since:
      25.0
    • computeQualifiedKeyNames

      public static List<String> computeQualifiedKeyNames(String keyToken, Stack<Set<String>> keyScopeStack)
      Compute key names qualified with key scope stack prefix.
      Parameters:
      keyToken - The key token.
      keyScopeStack - The current key scope stack.
      Returns:
      key names qualified with key scope stack prefix.
      Since:
      25.1
    • preferAddingKeyrefToAlreadyReferencedResource

      public static boolean preferAddingKeyrefToAlreadyReferencedResource(URL editorURL)
      Check if a keyref is preferred to be added when inserting a resource (that is already referred) in the editor .
      Parameters:
      editorURL - The URL location of the editor in which an already referenced resource needs to be inserted
      Returns:
      true if a keyref should be added to the resource that needs to be inserted
      Since:
      25.1
    • showNewFileDialog

      public static URL showNewFileDialog(AuthorAccess authorAccess, String proposedTitle)
      Shows the New File wizard to allow creating new documents.
      Parameters:
      authorAccess - The author access of the current opened document in Author page.
      proposedTitle - The title that will be presented in the New Document wizard. If null no proposal will be presented.
      Returns:
      the URL of the newly created document or null.
      Since:
      26.0
    • showKeysAndReusableComponents

      public static void showKeysAndReusableComponents(AuthorAccess authorAccess, boolean showKeys, boolean showComps)
      Show a content completion window with keys and components. Implemented only in the Oxygen desktop application.
      Parameters:
      authorAccess - The author access
      showKeys - true to show keys.
      showComps - true to show components
      Since:
      26.1