Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
1a321a72
Commit
1a321a72
authored
8 years ago
by
Sudeep Kanav
Browse files
Options
Downloads
Patches
Plain Diff
reverted code to the old state of 15742
refs 2572
parent
022d37ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java
+3
-29
3 additions, 29 deletions
...iss/tooling/kernel/internal/ElementCompositorService.java
with
3 additions
and
29 deletions
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java
+
3
−
29
View file @
1a321a72
...
...
@@ -32,7 +32,6 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService;
import
org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService
;
import
org.fortiss.tooling.kernel.introspection.items.ElementCompositorServiceIntrospectionDetailsItem
;
import
org.fortiss.tooling.kernel.model.ILibraryElementReference
;
import
org.fortiss.tooling.kernel.model.INamedElement
;
import
org.fortiss.tooling.kernel.service.IElementCompositorService
;
import
org.fortiss.tooling.kernel.service.IPersistencyService
;
import
org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase
;
...
...
@@ -44,7 +43,7 @@ import org.fortiss.tooling.kernel.utils.LoggingUtils;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
40A8C2F33D7EA00AD729B89098BB8911
* @ConQAT.Rating YELLOW Hash:
A3C3DACAD6D38C54CBD29735646CB874
*/
public
final
class
ElementCompositorService
extends
EObjectAwareServiceBase
<
IElementCompositor
<
EObject
>>
implements
IElementCompositorService
,
...
...
@@ -100,12 +99,9 @@ public final class ElementCompositorService extends
// Add element to the model (might instantiate annotations for IModelElements)
boolean
rval
=
compositor
.
compose
(
container
,
element
,
context
);
if
(
rval
)
{
makeNameDistinct
(
container
,
element
);
// Generate IDs (including potentially instantiated annotations)
IPersistencyService
.
INSTANCE
.
getTopLevelElementFor
(
container
).
prepareIDs
(
element
);
}
// Generate IDs (including potentially instantiated annotations)
IPersistencyService
.
INSTANCE
.
getTopLevelElementFor
(
container
).
prepareIDs
(
element
);
return
rval
;
}
...
...
@@ -203,26 +199,4 @@ public final class ElementCompositorService extends
public
IIntrospectionDetailsItem
getDetailsItem
()
{
return
new
ElementCompositorServiceIntrospectionDetailsItem
(
handlerMap
);
}
/**
* This function checks if the name of any element of same type and name as "contained" exists
* in the container, and modifies the name in case if required.
* */
private
void
makeNameDistinct
(
EObject
container
,
EObject
contained
)
{
if
(!(
contained
instanceof
INamedElement
)
||
((
INamedElement
)
contained
).
getName
()
==
null
)
return
;
INamedElement
neNew
=
(
INamedElement
)
contained
;
int
index
=
0
;
for
(
EObject
o
:
container
.
eContents
())
{
if
(
o
.
getClass
().
isInstance
(
contained
)
&&
o
instanceof
INamedElement
)
{
INamedElement
e
=
(
INamedElement
)
o
;
if
(
e
.
getName
().
equals
(
neNew
.
getName
())
||
e
.
getName
().
equals
(
neNew
.
getName
()
+
index
))
{
index
++;
}
}
}
if
(
index
>
0
)
neNew
.
setName
(
neNew
.
getName
()
+
index
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment