Class ResourceFactory

  • All Implemented Interfaces:
    org.eclipse.emf.ecore.resource.Resource.Factory

    public class ResourceFactory
    extends Object
    implements org.eclipse.emf.ecore.resource.Resource.Factory
    • Constructor Detail

      • ResourceFactory

        public ResourceFactory​(org.nasdanika.drawio.ConnectionBase connectionBase,
                               org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
    • Method Detail

      • createResource

        public org.eclipse.emf.ecore.resource.Resource createResource​(org.eclipse.emf.common.util.URI uri)
        Specified by:
        createResource in interface org.eclipse.emf.ecore.resource.Resource.Factory
      • getSemanticElements

        protected Stream<org.eclipse.emf.ecore.EObject> getSemanticElements​(Map<org.nasdanika.graph.Element,​org.nasdanika.graph.processor.ProcessorInfo<ElementProcessor>> registry)
      • getBaseURI

        protected org.eclipse.emf.common.util.URI getBaseURI​(org.eclipse.emf.common.util.URI resourceURI)
        Base URI for resolving action relative references. This implementation returns a random absolute UR.
        Returns:
      • createLayerProcessor

        protected ElementProcessor createLayerProcessor​(org.eclipse.emf.common.util.URI uri,
                                                        org.nasdanika.graph.processor.ProcessorConfig<ElementProcessor> config,
                                                        org.eclipse.emf.common.util.URI baseURI)
      • createConnectionProcessor

        protected ElementProcessor createConnectionProcessor​(org.eclipse.emf.common.util.URI uri,
                                                             org.nasdanika.graph.processor.ProcessorConfig<ElementProcessor> config,
                                                             org.eclipse.emf.common.util.URI baseURI)
      • createDocumentProcessor

        protected ElementProcessor createDocumentProcessor​(org.eclipse.emf.common.util.URI uri,
                                                           org.nasdanika.graph.processor.ProcessorConfig<ElementProcessor> config,
                                                           org.eclipse.emf.common.util.URI baseURI)
      • createNodeProcessor

        protected ElementProcessor createNodeProcessor​(org.eclipse.emf.common.util.URI uri,
                                                       org.nasdanika.graph.processor.ProcessorConfig<ElementProcessor> config,
                                                       org.eclipse.emf.common.util.URI baseURI)
      • createRootProcessor

        protected ElementProcessor createRootProcessor​(org.eclipse.emf.common.util.URI uri,
                                                       org.nasdanika.graph.processor.ProcessorConfig<ElementProcessor> config,
                                                       org.eclipse.emf.common.util.URI baseURI)
      • createModelProcessor

        protected ElementProcessor createModelProcessor​(org.eclipse.emf.common.util.URI uri,
                                                        org.nasdanika.graph.processor.ProcessorConfig<ElementProcessor> config,
                                                        org.eclipse.emf.common.util.URI baseURI)
      • createPageProcessor

        protected ElementProcessor createPageProcessor​(org.eclipse.emf.common.util.URI uri,
                                                       org.nasdanika.graph.processor.ProcessorConfig<ElementProcessor> config,
                                                       org.eclipse.emf.common.util.URI baseURI)
      • resolveRole

        protected org.eclipse.emf.ecore.EReference resolveRole​(String roleName)
      • getPathProperty

        protected String getPathProperty()
      • getIconProperty

        protected String getIconProperty()
      • getRoleProperty

        protected String getRoleProperty()
      • getTargetRoleProperty

        protected String getTargetRoleProperty()
      • getDefaultConnectionTargetRoleProperty

        protected String getDefaultConnectionTargetRoleProperty()
      • getDefaultConnectionRoleProperty

        protected String getDefaultConnectionRoleProperty()
      • getConnectionBase

        protected org.nasdanika.drawio.ConnectionBase getConnectionBase()
      • getSelectorProperty

        protected String getSelectorProperty()
      • getDiagramViewer

        protected String getDiagramViewer()
        Returns:
        URL of the diagram viewer. If not null then a diagram initialization script is added to the page. Otherwise the diagram shall be initialized by some other means.
      • getConnectionsActionContainmentReference

        protected org.eclipse.emf.ecore.EReference getConnectionsActionContainmentReference​(org.nasdanika.drawio.Node node)
      • getListOpenTag

        protected String getListOpenTag​(org.nasdanika.graph.Element element)
      • getListCloseTag

        protected String getListCloseTag​(org.nasdanika.graph.Element element)
      • getPageElementFlagProperty

        protected String getPageElementFlagProperty()
      • getDefaultSort

        protected String getDefaultSort()
      • getSortProperty

        protected String getSortProperty()
      • getDocumentationProperty

        protected String getDocumentationProperty()
      • createDocumentAction

        protected Action createDocumentAction​(org.nasdanika.drawio.Document document)
      • getPageComparator

        protected Comparator<org.nasdanika.drawio.Page> getPageComparator​(org.nasdanika.drawio.Document document)
      • getRoleName

        protected String getRoleName​(org.nasdanika.drawio.ModelElement modelElement)
      • getRole

        protected org.eclipse.emf.ecore.EReference getRole​(org.nasdanika.drawio.ModelElement modelElement)
      • getRoleName

        protected String getRoleName​(org.nasdanika.drawio.Page page)
      • getPageRole

        protected org.eclipse.emf.ecore.EReference getPageRole​(org.nasdanika.drawio.Page page)
      • isPageElement

        protected boolean isPageElement​(org.nasdanika.drawio.ModelElement modelElement)
        Parameters:
        modelElement -
        Returns:
        true if this element is the main element on the page which "represents" the page.
      • getPageElement

        protected org.nasdanika.drawio.ModelElement getPageElement​(org.nasdanika.drawio.Page page)
        Parameters:
        page -
        Returns:
        Element with page-element property set to true or root if there is no such element.
      • createComparator

        protected Comparator<org.nasdanika.graph.Element> createComparator​(org.nasdanika.graph.Element semanticParent,
                                                                           String sortType,
                                                                           String config)
        Creates comparators from type and config. This implementation creates comparators from org.nasdanika.drawio.comparators package:
        • AngularNodeComparator - clockwise and counterclockwise types with the base angle in degrees as configuration with 90 as default value.
        • LabelModelElementComparator - label with optional descending configuration - compares label HTML plain text ignoring markup.
        • PropertyModelElementComparator - property with property name as required configuration. Compares using property values.
        Override to add support of additional sort types.
        Parameters:
        parent - Semantic parent of nodes to sort.
        sortType -
        config -
        Returns:
      • shallCreateLink

        protected boolean shallCreateLink​(org.nasdanika.drawio.ModelElement modelElement)
        Parameters:
        modelElement -
        Returns:
        true if a link shall be created for a given model element. This implementation returns true for Layerss, Nodes and Connections without a cross-reference or a pre-existing link which is not a page link.
      • match

        protected boolean match​(org.nasdanika.graph.Element element,
                                String expression)
        For cross-reference resolution.
        Parameters:
        element -
        expression -
        Returns:
      • getEvaluationContext

        protected org.springframework.expression.EvaluationContext getEvaluationContext()
      • shallCreateAction

        protected boolean shallCreateAction​(org.nasdanika.drawio.ModelElement modelElement)
        Parameters:
        modelElement -
        Returns:
        true if an action shall be created for a given model element. This implementation returns true for elements without external links and without cross-references. False is returned for undocumented connections.
      • getResourceSet

        protected org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
      • isRootPage

        public boolean isRootPage​(org.nasdanika.drawio.Page page)
      • getRootPageFlagProperty

        protected String getRootPageFlagProperty()
      • getExternalReference

        protected String getExternalReference​(org.nasdanika.graph.processor.ProcessorInfo<ElementProcessor> sourceInfo,
                                              org.nasdanika.drawio.ModelElement target)
        Parameters:
        sourceProcessor -
        target -
        Returns:
        Link to the target from the source. This implementation returns null. Override to resolve external references.