Class InsertListOperation

java.lang.Object
ro.sync.ecss.extensions.commons.operations.InsertListOperation
All Implemented Interfaces:
AuthorOperation, Extension
Direct Known Subclasses:
DITAInsertListOperation, DocbookInsertListOperation, TEIInsertListOperation, XHTMLInsertListOperation

@API(type=INTERNAL, src=PUBLIC) public abstract class InsertListOperation extends Object implements AuthorOperation
Operation used to convert a selection to an ordered/unordered list.
  • Field Details

    • SCHEMA_AWARE_ARGUMENT_DESCRIPTOR

      protected static final ArgumentDescriptor SCHEMA_AWARE_ARGUMENT_DESCRIPTOR
      Schema aware argument.
    • CONVERT_ELEMENT_AT_CARET_ARGUMENT

      public static final String CONVERT_ELEMENT_AT_CARET_ARGUMENT
      Argument that controls whether the action inserts a new list or converts the element at caret if no selection is made.
      See Also:
    • CONVERT_ELEMENT_AT_CARET_ARGUMENT_DESCRIPTOR

      protected static final ArgumentDescriptor CONVERT_ELEMENT_AT_CARET_ARGUMENT_DESCRIPTOR
      Schema aware argument.
    • LIST_TYPE_ARGUMENT

      public static final String LIST_TYPE_ARGUMENT
      Argument that controls the type of the list that will be inserted.
      See Also:
    • authorAccess

      protected AuthorAccess authorAccess
      The author access.
    • listType

      protected String listType
      The new list type.
  • Constructor Details

    • InsertListOperation

      public InsertListOperation()
  • Method Details

    • doOperation

      public void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws AuthorOperationException
      Description copied from interface: AuthorOperation
      Perform the actual operation. You can check if the operation was invoked from the oXygen standalone application or from the oXygen plugin for Eclipse by using the method: ApplicationInformationAccess.getPlatform(). To get to the Workspace you may use: AuthorAccess.getWorkspaceAccess().
      Specified by:
      doOperation in interface AuthorOperation
      Parameters:
      authorAccess - The author access. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility a.s.o.
      args - The map of arguments. All the arguments defined by method AuthorOperation.getArguments() must be present in the map of arguments.
      Throws:
      AuthorOperationException - Thrown when the operation fails.
      See Also:
    • getElementAtCaretToConvert

      public Optional<AuthorNode> getElementAtCaretToConvert(AuthorAccess authorAccess, CommonsOperationsUtil.ConversionElementHelper helper)
      Returns the element at caret that is suitable to be converted.
      Parameters:
      authorAccess - The author access.
      helper - Used to check if the elements from selection can be converted in other elements (table cells or list entries)
      Returns:
      The element to convert.
    • isListElement

      protected boolean isListElement(AuthorNode node)
      Checks if the given node is a list element or list item.
      Parameters:
      node - The element to check.
      Returns:
      true if the node is a list element.
    • isList

      protected abstract boolean isList(AuthorNode node)
      Checks if the given node is a list.
      Parameters:
      node - The element to check.
      Returns:
      true if the node is a list.
    • getParentListType

      protected abstract String getParentListType(AuthorNode node)
      Get the type of the list in which the new list will be inserted. Can be null.
      Parameters:
      node - The node at offset.
      Returns:
      the type of the list in which the new list will be inserted. Can be null.
    • getConversionElementsChecker

      protected abstract CommonsOperationsUtil.ConversionElementHelper getConversionElementsChecker()
      Get the conversion element checker.
      Returns:
      The conversion element checker.
    • insertContent

      protected abstract void insertContent(AuthorAccess authorAccess, AuthorNode listNode, List<CommonsOperationsUtil.SelectedFragmentInfo> selectedFragmentsInfos)
      Insert content.
      Parameters:
      authorAccess - The author access.
      listNode - The list node.
      selectedFragmentsInfos - The fragments to be inserted.
    • getNamespace

      protected abstract String getNamespace()
      Get namespace.
      Returns:
      The namespace to be used at insertion.
    • getXMLFragment

      protected abstract String getXMLFragment(AuthorAccess authorAccess, String listType, String parentListType)
      Get XML fragment to be inserted when nothing is selected.
      Parameters:
      authorAccess - The author access.
      listType - The type of the list to be inserted.
      parentListType - The type of the parent list, can be null
      Returns:
      the fragment to be inserted.
    • getListXMLFragment

      protected abstract StringBuilder getListXMLFragment(String listType, Map<String,String> listAttributes, int numberOfListItems, AuthorAccess authorAccess)
      Get list XML fragment.
      Parameters:
      listType - The list type.
      listAttributes - The attributes to add to list items.
      numberOfListItems - The number of list items.
      authorAccess - The author access.
      Returns:
      The list XML fragment.
    • getListTypeDescription

      protected abstract String getListTypeDescription(String listType)
      Obtain the name of every list type.
      Parameters:
      listType - The list type.
      Returns:
      A string representing the name of the given list type.