Class ResourceUIUtil
java.lang.Object
org.eclipse.emf.compare.rcp.ui.internal.util.ResourceUIUtil
This class will be used to provide various utilities aimed at NotLoadedFragment manipulation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringID of the graph of EMF resources used by EMFCompare to compute the logical model. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IMergeViewerItemaddNewContainerForNotLoadedFragmentMatches(Collection<IMergeViewerItem> items, IMergeViewer.MergeViewerSide side, Comparison comparison, AdapterFactory adapterFactory) Adds a new parent container to the given list of IMergeViewerItems if needed and returns it.static booleanCheck if the given list of TreeNodes contains at least two nodes that have NotLoadedFragmentMatch for data.static IMergeViewerItemcreateItemForNotLoadedFragmentMatch(Match match, IMergeViewer.MergeViewerSide side, Comparison comparison, AdapterFactory adapterFactory) Constructs aNotLoadedFragmentMatchfrom the givenMatchand then return theIMergeViewerItemcorresponding to this NotLoadedFragmentMatch.static Collection<Match> getChildrenMatchWithNotLoadedParent(Comparison comparison, Match match, IMergeViewer.MergeViewerSide side) Filters, from the root matches of the given comparison, those who will children matches of the given match if all fragments of the whole models involved in comparison had been loaded, for the given side of the comparison.static ResourceSetgetDataResourceSet(Match match) Get the Resource's ResourceSet of the data associated to the given Match.static ResourceSetgetDataResourceSet(Match match, IMergeViewer.MergeViewerSide side) Get the Resource's ResourceSet of the data associated to the given Match, and for the given side of the comparison.static URIgetDataURI(Match match) Get the Resource's URI of the data associated to the given Matchstatic URIgetDataURI(Match match, IMergeViewer.MergeViewerSide side) Get the Resource's URI of the data associated to the given Match, and for the given side of the comparison. .static Collection<URI> getDataURIs(Collection<Match> matches, IMergeViewer.MergeViewerSide side) Get the Resource's URIs of the data associated to the given list of Matches.static EObjectgetEObjectParent(ResourceSet rs, URI uri) Get the first loaded EObject parent of the given resource (represented by its URI) contained in the given ResourceSet.static Collection<Match> Get from the given list ofIMergeViewerItems, the NotLoadedFragmentMatchs.static ResourcegetParent(ResourceSet rs, URI uri) Get the parent of the given resource (represented by its URI) contained in the given ResourceSet.static URIgetParentResourceURI(ResourceSet rs, URI uri) Get the first loaded parent resource URI of the given resource (represented by its URI) contained in the given ResourceSet.static StringGet the resource's name associated with the data of the given NotLoadedFragmentMatch.static IGraphView<URI> Get the graph of resources' URI for the models involved in the current comparison.static URIgetRootResourceURI(URI uri) Get the root resource of the whole model that contains the given fragment (represented by its uri).static TreeNodegetTreeNode(Collection<TreeNode> nodes, Match match) Search from the given list of TreeNodes (and recursively on its children), the one that is associated to the given Match.static TreeNodegetTreeNodeFromURI(Collection<TreeNode> nodes, URI uri) Get from the given list of TreeNodes, the one that has its data's resource's URI (TreeNode -> Match -> EObject -> Resource -> URI) corresponding to the given URI.static booleanisChildOf(URI uri, Collection<URI> uris) Check if the given URI is a child (directly or not) of one of the given list of URIs.static booleanisFirstLevelFragment(URI uri) Check if the given URI corresponds to a fragment of model that is at the first level of the model, in other words a fragment that is directly under a root resource.static booleanisFragment(URI uri) Check if the given URI correspond to a fragment of model.static booleanisFragment(Match rootMatch, IMergeViewer.MergeViewerSide side) Check if the given match is a root match of its comparison model and is a fragment.static booleanisRootResource(URI uri) Check if the given URI correspond to the root resource of a model.
-
Field Details
-
RESOURCES_GRAPH_ID
ID of the graph of EMF resources used by EMFCompare to compute the logical model.- See Also:
-
-
Constructor Details
-
ResourceUIUtil
public ResourceUIUtil()
-
-
Method Details
-
getResourcesURIGraph
Get the graph of resources' URI for the models involved in the current comparison.- Returns:
- the graph if it exists,
nullotherwise.
-
isRootResource
Check if the given URI correspond to the root resource of a model. In this case a root resource is a piece of a whole model that is not a fragment of the model.- Parameters:
uri- the given URI.- Returns:
trueif the given URI is root resource of a model,falseotherwise.
-
isFragment
Check if the given URI correspond to a fragment of model. In this case a fragment is a piece of a whole model that is not the root resource of the model.- Parameters:
uri- the given URI.- Returns:
trueif the given URI is a fragment of a model,falseotherwise.
-
isFragment
Check if the given match is a root match of its comparison model and is a fragment. In this case a fragment is a piece of a whole model that is not the root resource of the model.- Parameters:
rootMatch- the given match.side- the side for which we want to know if it is a fragment or not.- Returns:
trueif the given match is a root match of its comparison model and is a fragment,falseotherwise.
-
isFirstLevelFragment
Check if the given URI corresponds to a fragment of model that is at the first level of the model, in other words a fragment that is directly under a root resource. In this case a fragment is a piece of a whole model that is not the root resource of the model.If the given fragment (represented by the given URI) has several parents, this method will return
false.- Parameters:
uri- the given URI.- Returns:
trueif the given URI is a fragment of a model,falseotherwise.
-
getRootResourceURI
Get the root resource of the whole model that contains the given fragment (represented by its uri).If at some point of the process a fragment has several parents, this method will return
null.- Parameters:
uri- the given URI.- Returns:
- the root resource of the whole model that contains the given fragment if found,
nullotherwise.
-
getParentResourceURI
Get the first loaded parent resource URI of the given resource (represented by its URI) contained in the given ResourceSet.If at some point of the process the current resource (represented by its URI) has several parents, this method will return
null.- Parameters:
rs- the ResourceSet in which the first loaded parent must be found.uri- the URI of the resource for which we want to get its first loaded parent.- Returns:
- the URI of the first loaded resource parent if found,
nullotherwise.
-
getParent
Get the parent of the given resource (represented by its URI) contained in the given ResourceSet.If the given resource (represented by its URI) has several parents, this method will return
null.- Parameters:
rs- the ResourceSet in which the parent must be found.uri- the URI of the resource for which we want to get its parent.- Returns:
- the parent of the given resource (represented by its URI) if found,
nullotherwise.
-
getEObjectParent
Get the first loaded EObject parent of the given resource (represented by its URI) contained in the given ResourceSet.If at some point of the process the current resource (represented by its URI) has several parents, this method will return
null.- Parameters:
rs- the ResourceSet in which the first loaded parent must be found.uri- the URI of the resource for which we want to get its first loaded parent.- Returns:
- the first loaded EObject parent of the given resource (represented by its URI) if found,
nullotherwise.
-
getTreeNode
Search from the given list of TreeNodes (and recursively on its children), the one that is associated to the given Match.- Parameters:
nodes- the given list of TreeNodes.match- the given Match.- Returns:
- the TreeNode that is associated to the given Match.
-
getTreeNodeFromURI
Get from the given list of TreeNodes, the one that has its data's resource's URI (TreeNode -> Match -> EObject -> Resource -> URI) corresponding to the given URI.- Parameters:
nodes- the given list of TreeNodes.uri- the given URI.- Returns:
- the TreeNode that has its data's resource's URI corresponding to the given URI, or null if no one match.
-
getDataURI
Get the Resource's URI of the data associated to the given Match- Parameters:
match- the given Match.- Returns:
- the Resource's URI of the data associated to the given Match.
-
getDataURIs
public static Collection<URI> getDataURIs(Collection<Match> matches, IMergeViewer.MergeViewerSide side) Get the Resource's URIs of the data associated to the given list of Matches.- Parameters:
matches- the given list of Matches.side- the given side of the comparison.- Returns:
- the Resource's URIs of the data associated to the given list of Matches.
-
getDataURI
Get the Resource's URI of the data associated to the given Match, and for the given side of the comparison. .- Parameters:
match- the given Match.side- the given side of the comparison.- Returns:
- the Resource's URI of the data associated to the given Match.
-
getDataResourceSet
Get the Resource's ResourceSet of the data associated to the given Match.- Parameters:
match- the given Match.- Returns:
- the Resource's ResourceSet of the data associated to the given Match.
-
getDataResourceSet
Get the Resource's ResourceSet of the data associated to the given Match, and for the given side of the comparison.- Parameters:
match- the given Match.side- the given side of the comparison.- Returns:
- the Resource's ResourceSet of the data associated to the given Match.
-
containsNotLoadedFragmentNodes
Check if the given list of TreeNodes contains at least two nodes that have NotLoadedFragmentMatch for data.- Parameters:
nodes- the given list of TreeNodes.- Returns:
trueif the given list of TreeNodes contains at least two nodes that have NotLoadedFragmentMatch for data, false otherwise.
-
getNotLoadedFragmentMatches
Get from the given list ofIMergeViewerItems, the NotLoadedFragmentMatchs.- Parameters:
items- the given list of IMergeViewerItems.- Returns:
- a list of Match.
-
getResourceName
Get the resource's name associated with the data of the given NotLoadedFragmentMatch. If it is a NotLoadedFragmentMatch containing others NotLoadedFragmentMatch, then it returns an empty string.- Parameters:
match- the given NotLoadedFragmentMatch.- Returns:
- the resource's name associated with the data of the given NotLoadedFragmentMatch.
-
getChildrenMatchWithNotLoadedParent
public static Collection<Match> getChildrenMatchWithNotLoadedParent(Comparison comparison, Match match, IMergeViewer.MergeViewerSide side) Filters, from the root matches of the given comparison, those who will children matches of the given match if all fragments of the whole models involved in comparison had been loaded, for the given side of the comparison.- Parameters:
comparison- the given comparison, cannot benull.match- the given match, can benull.side- the given side of the comparison.- Returns:
- a list of Matches.
-
isChildOf
Check if the given URI is a child (directly or not) of one of the given list of URIs.- Parameters:
uri- the given URI.uris- the given list of URIs.- Returns:
- true if the given URI is a child (directly or not) of one of the given list of URIs, false otherwise.
-
createItemForNotLoadedFragmentMatch
public static IMergeViewerItem createItemForNotLoadedFragmentMatch(Match match, IMergeViewer.MergeViewerSide side, Comparison comparison, AdapterFactory adapterFactory) Constructs aNotLoadedFragmentMatchfrom the givenMatchand then return theIMergeViewerItemcorresponding to this NotLoadedFragmentMatch.- Parameters:
match- the given Match.side- the side of the Match.comparison- the comparison object that contains the Match.adapterFactory- the adapter factory used to create the merge viewer item.- Returns:
- an IMergeViewerItem.
-
addNewContainerForNotLoadedFragmentMatches
public static IMergeViewerItem addNewContainerForNotLoadedFragmentMatches(Collection<IMergeViewerItem> items, IMergeViewer.MergeViewerSide side, Comparison comparison, AdapterFactory adapterFactory) Adds a new parent container to the given list of IMergeViewerItems if needed and returns it. If the given items don't need a new parent, return null.- Parameters:
items- the given IMergeViewerItems.side- the side of the Match.comparison- the comparison object that contains the Match.adapterFactory- the adapter factory used to create the merge viewer item.- Returns:
- an IMergeViewerItem, or null.
-