Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kernel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
af3
kernel
Commits
6829438f
Commit
6829438f
authored
May 15, 2020
by
Alexander Diewald
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into 3994
parents
a0c8df3a
270f598a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
39 deletions
+65
-39
org.fortiss.tooling.base/src/org/fortiss/tooling/base/annotation/.ratings
...ing.base/src/org/fortiss/tooling/base/annotation/.ratings
+2
-2
org.fortiss.tooling.base/src/org/fortiss/tooling/base/annotation/AnnotationValueService.java
...rtiss/tooling/base/annotation/AnnotationValueService.java
+30
-32
org.fortiss.tooling.base/src/org/fortiss/tooling/base/annotation/IAnnotationValueService.java
...tiss/tooling/base/annotation/IAnnotationValueService.java
+8
-0
org.fortiss.tooling.base/src/org/fortiss/tooling/base/migration/.ratings
...ling.base/src/org/fortiss/tooling/base/migration/.ratings
+1
-1
org.fortiss.tooling.base/src/org/fortiss/tooling/base/migration/AddMissingAnnotationsMigrationProvider.java
...ase/migration/AddMissingAnnotationsMigrationProvider.java
+16
-1
org.fortiss.tooling.base/src/org/fortiss/tooling/base/utils/.ratings
....tooling.base/src/org/fortiss/tooling/base/utils/.ratings
+1
-3
org.fortiss.tooling.base/src/org/fortiss/tooling/base/utils/AnnotationUtils.java
...e/src/org/fortiss/tooling/base/utils/AnnotationUtils.java
+7
-0
No files found.
org.fortiss.tooling.base/src/org/fortiss/tooling/base/annotation/.ratings
View file @
6829438f
AnnotationEntry.java 928240a722fb5177da232619266c0d0dadcfa151 GREEN
AnnotationEntry.java 928240a722fb5177da232619266c0d0dadcfa151 GREEN
AnnotationValueService.java
19906a1c7a2a33897651a0d7e207c4e5a285d2ff
GREEN
AnnotationValueService.java
01fc46fb381854b16ce78779217ffc7c29036c14
GREEN
IAnnotationValueService.java
50cea844f4b4ff3308ec1286ba8aadf253d2f3b1
GREEN
IAnnotationValueService.java
81ff274a7b2d4c58e7b8485db857eb83f99710d0
GREEN
org.fortiss.tooling.base/src/org/fortiss/tooling/base/annotation/AnnotationValueService.java
View file @
6829438f
...
@@ -156,8 +156,10 @@ public class AnnotationValueService
...
@@ -156,8 +156,10 @@ public class AnnotationValueService
* Prepares the {@link AnnotationEntry} for a given {@link IModelElement} and ensures that all
* Prepares the {@link AnnotationEntry} for a given {@link IModelElement} and ensures that all
* {@link IAnnotatedSpecification}s are instantiated.
* {@link IAnnotatedSpecification}s are instantiated.
*/
*/
private
void
prepareAnnotationEntry
(
final
IModelElement
element
,
AnnotationEntry
entry
,
private
void
prepareAnnotationEntry
(
final
IModelElement
element
,
AnnotationEntry
entry
)
{
final
List
<
IAnnotationValueProvider
<
IAnnotatedSpecification
>>
registeredHandlers
)
{
final
List
<
IAnnotationValueProvider
<
IAnnotatedSpecification
>>
registeredHandlers
=
getRegisteredHandlers
(
element
.
getClass
());
for
(
IAnnotationValueProvider
<
IAnnotatedSpecification
>
annotationProvider
:
registeredHandlers
)
{
for
(
IAnnotationValueProvider
<
IAnnotatedSpecification
>
annotationProvider
:
registeredHandlers
)
{
IAnnotatedSpecification
annotatedSpecification
=
EcoreUtils
.
pickFirstInstanceOf
(
IAnnotatedSpecification
annotatedSpecification
=
EcoreUtils
.
pickFirstInstanceOf
(
...
@@ -214,14 +216,16 @@ public class AnnotationValueService
...
@@ -214,14 +216,16 @@ public class AnnotationValueService
getAnnotationEntry
(
element
,
false
);
getAnnotationEntry
(
element
,
false
);
}
}
/**
/** {@inheritDoc} */
* Predicate if for the given {@link IModelElement}, {@link #getAnnotationEntry(IModelElement)}
@Override
* will actually instantiate an annotation, i.e. modify the model.
public
boolean
requiresAnnotationInstantiation
(
final
IModelElement
element
)
{
*/
final
List
<
IAnnotationValueProvider
<
IAnnotatedSpecification
>>
registeredHandlers
=
private
boolean
requiresAnnotationInstantiation
(
final
IModelElement
element
,
getRegisteredHandlers
(
element
.
getClass
());
final
List
<
IAnnotationValueProvider
<
IAnnotatedSpecification
>>
registeredHandlers
)
{
if
(
registeredHandlers
==
null
)
{
for
(
IAnnotationValueProvider
<
IAnnotatedSpecification
>
annotationProvider
:
registeredHandlers
)
{
return
false
;
}
for
(
IAnnotationValueProvider
<
IAnnotatedSpecification
>
annotationProvider
:
registeredHandlers
)
{
IAnnotatedSpecification
annotatedSpecification
=
pickFirstInstanceOf
(
IAnnotatedSpecification
annotatedSpecification
=
pickFirstInstanceOf
(
annotationProvider
.
getAnnotationClazz
(),
element
.
getSpecifications
());
annotationProvider
.
getAnnotationClazz
(),
element
.
getSpecifications
());
...
@@ -252,30 +256,24 @@ public class AnnotationValueService
...
@@ -252,30 +256,24 @@ public class AnnotationValueService
return
null
;
return
null
;
}
}
final
List
<
IAnnotationValueProvider
<
IAnnotatedSpecification
>>
registeredHandlers
=
getRegisteredHandlers
(
element
.
getClass
());
final
AnnotationEntry
result
=
new
AnnotationEntry
(
element
);
final
AnnotationEntry
result
=
new
AnnotationEntry
(
element
);
if
(
registeredHandlers
!=
null
&&
!
registeredHandlers
.
isEmpty
())
{
final
ITopLevelElement
modelContext
=
IPersistencyService
.
getInstance
().
getTopLevelElementFor
(
element
);
// Wrap instantiation of new annotation into command if this method is invoked from the
// Wrap instantiation of new annotation into command if this method is invoked from the
// GUI context, i.e. from getAnnotationEntry(final IModelElement element), but only if
// GUI context, i.e. from getAnnotationEntry(final IModelElement element), but only if
// prepareAnnotationEntry() would actually modify the underlying model, and a model
// prepareAnnotationEntry() would actually modify the underlying model, and a model
// context is available.
// context is available.
if
(
requiresAnnotationInstantiation
(
element
,
registeredHandlers
)
&&
final
ITopLevelElement
modelContext
=
modelContext
!=
null
)
{
IPersistencyService
.
getInstance
().
getTopLevelElementFor
(
element
);
if
(
requiresAnnotationInstantiation
(
element
)
&&
modelContext
!=
null
)
{
modelContext
.
runAsCommand
(
new
Runnable
()
{
modelContext
.
runAsCommand
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
prepareAnnotationEntry
(
element
,
result
,
registeredHandlers
);
prepareAnnotationEntry
(
element
,
result
);
}
}
});
});
}
else
{
}
else
{
prepareAnnotationEntry
(
element
,
result
,
registeredHandlers
);
prepareAnnotationEntry
(
element
,
result
);
}
}
}
// Only put element into AnnotationEntry <-> IModelElement cache if method is invoked from
// Only put element into AnnotationEntry <-> IModelElement cache if method is invoked from
...
...
org.fortiss.tooling.base/src/org/fortiss/tooling/base/annotation/IAnnotationValueService.java
View file @
6829438f
...
@@ -58,4 +58,12 @@ public interface IAnnotationValueService {
...
@@ -58,4 +58,12 @@ public interface IAnnotationValueService {
* </p>
* </p>
*/
*/
void
instantiateAnnotations
(
IModelElement
element
);
void
instantiateAnnotations
(
IModelElement
element
);
/**
* Predicate if the given {@link IModelElement} is missing some of the {@link AnnotationEntry}s
* corresponding to the {@link IAnnotatedSpecification}s declared for its type.
* Calling {@link #getAnnotationEntry(IModelElement)} will actually instantiate an annotation,
* i.e. modify the model.
*/
boolean
requiresAnnotationInstantiation
(
final
IModelElement
element
);
}
}
org.fortiss.tooling.base/src/org/fortiss/tooling/base/migration/.ratings
View file @
6829438f
AddMissingAnnotationsMigrationProvider.java
ebc5b9348b61ffb23493942949ecccf1c1fa2ae1
GREEN
AddMissingAnnotationsMigrationProvider.java
283f11372ce778a26362d0c83dcffdea3290b4df
GREEN
RemoveDuplicatedAnnotationsMigrationProvider.java 6920909f8f211b9c5b5990644b5abcd8c4abaa3a GREEN
RemoveDuplicatedAnnotationsMigrationProvider.java 6920909f8f211b9c5b5990644b5abcd8c4abaa3a GREEN
RemoveOutdatedAnnotationInstanceMigrationProvider.java 245530d6026f9ff29ffc577983d9de03ae5e75e5 GREEN
RemoveOutdatedAnnotationInstanceMigrationProvider.java 245530d6026f9ff29ffc577983d9de03ae5e75e5 GREEN
org.fortiss.tooling.base/src/org/fortiss/tooling/base/migration/AddMissingAnnotationsMigrationProvider.java
View file @
6829438f
...
@@ -17,10 +17,13 @@ package org.fortiss.tooling.base.migration;
...
@@ -17,10 +17,13 @@ package org.fortiss.tooling.base.migration;
import
static
java
.
util
.
Collections
.
emptyMap
;
import
static
java
.
util
.
Collections
.
emptyMap
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
AnnotationUtils
.
instantiateAnnotationsRecursive
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
AnnotationUtils
.
instantiateAnnotationsRecursive
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
AnnotationUtils
.
requiresAnnotationInstantiation
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
getFirstChildWith
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Predicate
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.emf.ecore.xml.type.AnyType
;
import
org.eclipse.emf.ecore.xml.type.AnyType
;
...
@@ -45,8 +48,20 @@ public class AddMissingAnnotationsMigrationProvider implements IMigrationProvide
...
@@ -45,8 +48,20 @@ public class AddMissingAnnotationsMigrationProvider implements IMigrationProvide
if
(
migratedProjects
.
contains
(
modelElement
))
{
if
(
migratedProjects
.
contains
(
modelElement
))
{
return
false
;
return
false
;
}
}
Predicate
<
EObject
>
annotationTest
=
eObj
->
{
if
(
eObj
instanceof
IModelElement
&&
requiresAnnotationInstantiation
((
IModelElement
)
eObj
))
{
return
true
;
return
true
;
}
}
return
false
;
};
if
(
getFirstChildWith
(
modelElement
.
getRootModelElement
(),
annotationTest
)
!=
null
)
{
return
true
;
}
return
false
;
}
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
@Override
...
...
org.fortiss.tooling.base/src/org/fortiss/tooling/base/utils/.ratings
View file @
6829438f
AngleUtils.java 462551eae71738ff51f92c9906bff9a21a375d2b GREEN
AngleUtils.java 462551eae71738ff51f92c9906bff9a21a375d2b GREEN
AnnotationUtils.java
d97bf564f04487c2628a4ab03f93726bc2de8678
GREEN
AnnotationUtils.java
197ceb5f39af6b96eb8f7025e3fe3b1b39c35d42
GREEN
BaseMathUtils.java 65f6c39b641cba3c984a38f42b1bbf7dbf3287a3 GREEN
BaseMathUtils.java 65f6c39b641cba3c984a38f42b1bbf7dbf3287a3 GREEN
BaseModelElementUtils.java b8775b7a462efc168cf79a017aa3377a782d10f6 GREEN
BaseModelElementUtils.java b8775b7a462efc168cf79a017aa3377a782d10f6 GREEN
ConstraintsBaseUtils.java bba938b43756ce6f35c338f6cef21c3ab5d49a9d GREEN
DimensionUtils.java 0dc67f9de11a84e6e4c6e1eb627817dee91ff30a GREEN
DimensionUtils.java 0dc67f9de11a84e6e4c6e1eb627817dee91ff30a GREEN
EllipseLayoutUtils.java 5c3a0126fdca5d5b4fb441694747e1cb0f49cd9f GREEN
EllipseLayoutUtils.java 5c3a0126fdca5d5b4fb441694747e1cb0f49cd9f GREEN
LayoutDataUtils.java 5739dd16f0212e8f94927c0a0f51503390f2be69 GREEN
LayoutDataUtils.java 5739dd16f0212e8f94927c0a0f51503390f2be69 GREEN
LayoutModelElementAdapter.java d81dfc551baa832f2761b4804760dcd8f57b7c5b YELLOW
LayoutModelElementFactory.java c49fca2de5a8cb7502fb28cc2b7e64a272df11b0 GREEN
LayoutModelElementFactory.java c49fca2de5a8cb7502fb28cc2b7e64a272df11b0 GREEN
MigrationUtils.java ab9d8682233313c21c6a52b8b03e1c796aacd29c GREEN
MigrationUtils.java ab9d8682233313c21c6a52b8b03e1c796aacd29c GREEN
OffsetOrientationUtils.java 913cebbac2a5628bdd08b4df669b9412d6e07d94 GREEN
OffsetOrientationUtils.java 913cebbac2a5628bdd08b4df669b9412d6e07d94 GREEN
...
...
org.fortiss.tooling.base/src/org/fortiss/tooling/base/utils/AnnotationUtils.java
View file @
6829438f
...
@@ -316,6 +316,13 @@ public class AnnotationUtils {
...
@@ -316,6 +316,13 @@ public class AnnotationUtils {
for
(
IModelElement
child
:
getChildrenWithType
(
element
,
IModelElement
.
class
))
{
for
(
IModelElement
child
:
getChildrenWithType
(
element
,
IModelElement
.
class
))
{
as
.
instantiateAnnotations
(
child
);
as
.
instantiateAnnotations
(
child
);
}
}
}
/**
* Compact method to determine whether an {@link IModelElement} requires its annotations to be
* instantiated.
*/
public
static
boolean
requiresAnnotationInstantiation
(
IModelElement
element
)
{
return
IAnnotationValueService
.
getInstance
().
requiresAnnotationInstantiation
(
element
);
}
}
}
}
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