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
e76e3cf7
Commit
e76e3cf7
authored
8 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
adds compositor base for constraint instance containers
refs 2708
parent
47cb971b
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.base/trunk/src/org/fortiss/tooling/base/compose/ConstraintInstanceContainerCompositor.java
+76
-0
76 additions, 0 deletions
...g/base/compose/ConstraintInstanceContainerCompositor.java
with
76 additions
and
0 deletions
org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/compose/ConstraintInstanceContainerCompositor.java
0 → 100644
+
76
−
0
View file @
e76e3cf7
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.tooling.base.compose
;
import
static
org
.
eclipse
.
emf
.
ecore
.
util
.
EcoreUtil
.
delete
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
ConstraintsBaseUtils
.
removeFromConstraintInstanceContainer
;
import
org.eclipse.emf.ecore.EObject
;
import
org.fortiss.tooling.base.model.base.ConstraintInstanceContainer
;
import
org.fortiss.tooling.kernel.extension.IElementCompositor
;
import
org.fortiss.tooling.kernel.extension.data.IElementCompositionContext
;
import
org.fortiss.tooling.kernel.extension.data.Prototype
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintInstance
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceContainer
;
/**
* {@link IElementCompositor} implementation for {@link ConstraintInstanceContainer}s.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: A67C7B2EE1682BEC369EEF27FF1FF200
*/
public
class
ConstraintInstanceContainerCompositor
<
CIC
extends
IConstraintInstanceContainer
>
implements
IElementCompositor
<
CIC
>
{
/** {@inheritDoc} */
@Override
public
boolean
canCompose
(
CIC
container
,
EObject
contained
,
IElementCompositionContext
context
)
{
return
contained
instanceof
ConstraintInstance
;
}
/** {@inheritDoc} */
@Override
public
boolean
compose
(
CIC
container
,
EObject
contained
,
IElementCompositionContext
context
)
{
ConstraintInstance
c
=
(
ConstraintInstance
)
contained
;
container
.
getConstraintInstances
().
add
(
c
);
return
true
;
}
/** {@inheritDoc} */
@Override
public
boolean
canComposePrototype
(
Prototype
prototype
)
{
// As of now constraints should never be added by prototype.
return
false
;
}
/** {@inheritDoc} */
@Override
public
boolean
canDecompose
(
EObject
contained
)
{
return
contained
instanceof
ConstraintInstance
;
}
/** {@inheritDoc} */
@Override
public
boolean
decompose
(
EObject
contained
)
{
removeFromConstraintInstanceContainer
((
ConstraintInstance
)
contained
);
delete
(
contained
);
return
true
;
}
}
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