Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
kernel
Commits
393167d8
Commit
393167d8
authored
Mar 06, 2018
by
Simon Barner
Browse files
- Add replaceEObjectReferences()
refs 3219
parent
91ad96ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/.ratings
View file @
393167d8
...
...
@@ -2,7 +2,7 @@ CompositionUtils.java a2b1c7f4b1ae4d0783b4e170e432a9e02fc451fd GREEN
ConstraintsUtils.java 93ae55d9c4a2645a97bb4162f43eb00acbc94633 GREEN
EMFResourceUtils.java 01cddc68d7dd199191792d87f8256d6c52540856 GREEN
EcoreSerializerBase.java 63b879cb32a0981dc1fefaf33db098abe81fe520 GREEN
EcoreUtils.java
008f4743d5092afb13c7f4cbbfcb83f1dc6b7721 GREEN
EcoreUtils.java
c191385af86ff630d1ad9daacb42751527db8744 YELLOW
ExtensionPointUtils.java e3ec0d396b0a88c040fd0117d4a369340d6099f4 GREEN
IdentifierUtils.java d074a0f40d0ace7c2dd4ec145f0c2d783fbe115d GREEN
JavaUtils.java 88bebee35226100989e118b272c766fa63f3c87c GREEN
...
...
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/EcoreUtils.java
View file @
393167d8
...
...
@@ -18,6 +18,7 @@ package org.fortiss.tooling.kernel.utils;
import
static
org
.
eclipse
.
emf
.
common
.
notify
.
Notification
.
EVENT_TYPE_COUNT
;
import
static
org
.
eclipse
.
emf
.
ecore
.
util
.
EcoreUtil
.
getAllContents
;
import
static
org
.
eclipse
.
emf
.
ecore
.
util
.
EcoreUtil
.
getRootContainer
;
import
static
org
.
eclipse
.
emf
.
ecore
.
util
.
EcoreUtil
.
replace
;
import
static
org
.
eclipse
.
emf
.
ecore
.
util
.
EcoreUtil
.
UsageCrossReferencer
.
find
;
import
java.util.Collection
;
...
...
@@ -43,6 +44,7 @@ import org.eclipse.emf.ecore.EPackage;
import
org.eclipse.emf.ecore.EPackage.Registry
;
import
org.eclipse.emf.ecore.EReference
;
import
org.eclipse.emf.ecore.EStructuralFeature
;
import
org.eclipse.emf.ecore.EStructuralFeature.Setting
;
import
org.eclipse.emf.ecore.resource.Resource
;
import
org.eclipse.emf.ecore.resource.ResourceSet
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
...
...
@@ -495,6 +497,22 @@ public class EcoreUtils {
return
usages
;
}
/**
* Replaces all references to the {@link EObject}s contained in the key set of the given
* {@code objectMap} with the corresponding elements they are mapped to.
*
* @param eObjectMap
* Maps each old {@link EObject} to the corresponding new {@link EObject}
*/
public
static
void
replaceEObjectReferences
(
Map
<?
extends
EObject
,
?
extends
EObject
>
eObjectMap
)
{
for
(
EObject
eObject
:
eObjectMap
.
keySet
())
{
for
(
Setting
setting
:
getAllReferences
(
eObject
))
{
replace
(
setting
,
eObject
,
eObjectMap
.
get
(
eObject
));
}
}
}
/**
* <p>
* Disables the notifications emitted by the given {@link EObject} and its children.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment