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
c6375dcd
Commit
c6375dcd
authored
Feb 09, 2018
by
Andreas Bayha
Browse files
Rollback of ElementCompositorBase (used in variability)
refs 2998
parent
0bf7cdb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/ElementCompositorBase.java
0 → 100644
View file @
c6375dcd
/*-------------------------------------------------------------------------+
| Copyright 2014 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.kernel.extension.base
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
import
org.fortiss.tooling.kernel.extension.IElementCompositor
;
import
org.fortiss.tooling.kernel.extension.data.IElementCompositionContext
;
import
org.fortiss.tooling.kernel.extension.data.Prototype
;
/**
* Base implementation for supporting composition of {@link IElementCompositor}.
*
* This class is used for example in the variability plugin.
*
* @author moudy
*/
public
abstract
class
ElementCompositorBase
<
C
extends
EObject
>
implements
IElementCompositor
<
C
>
{
/** {@inheritDoc} */
@Override
public
boolean
canCompose
(
C
container
,
EObject
contained
,
IElementCompositionContext
context
)
{
return
isCorrectClass
(
contained
);
}
/** {@inheritDoc} */
@Override
public
boolean
canComposePrototype
(
Prototype
prototype
)
{
return
isCorrectClass
(
prototype
.
getPrototype
());
}
/** Returns true if the contained object is an instance of an acceptable class. */
protected
abstract
boolean
isCorrectClass
(
EObject
contained
);
/** {@inheritDoc} */
@Override
abstract
public
boolean
compose
(
C
container
,
EObject
contained
,
IElementCompositionContext
context
);
/** {@inheritDoc} */
@Override
public
boolean
canDecompose
(
EObject
contained
)
{
return
isCorrectClass
(
contained
);
}
/** {@inheritDoc} */
@Override
public
boolean
decompose
(
EObject
contained
)
{
EcoreUtil
.
delete
(
contained
,
true
);
return
true
;
}
}
Write
Preview
Supports
Markdown
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