Skip to content
Snippets Groups Projects
Commit 34b5e95a authored by Andreas Bayha's avatar Andreas Bayha
Browse files

Merge branch '4191' into 'master'

Set getAllReferencesSetting to public for TaskReuseProvider

See merge request !167
parents bd11cf2d f2d09bbc
No related branches found
No related tags found
1 merge request!167Set getAllReferencesSetting to public for TaskReuseProvider
IReuseProvider.java 51dd0df5954bff99b80244cae94403300c4aadb1 GREEN
IReuseProviderService.java 6cf3ef4f67ab7515a1a78df2448439e8d6d97737 GREEN
LayoutedReuseProviderBase.java b0e4ce3cda818b0723ec37b925a4c4c3d0c41909 GREEN
ReuseProviderBase.java 0ee51474bda060f3d326094397bc0a7fd7247152 GREEN
ReuseProviderService.java 748eea63e16d286f1738aa7091219dc63e7ad16e GREEN
/*-------------------------------------------------------------------------+
| Copyright 2022 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.ext.reuse.service;
import static org.eclipse.emf.ecore.util.EcoreUtil.replace;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.replaceEObjectReferences;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
/***
* Implemented basic {@link IReuseProvider} based on layouted {@link EObject}
* aka {@link ILayoutedModelElement}. Can be extended or overridden by more
* specific implemented {@link IReuseProvider}.
*
* @author bergemann
*
* @param <T> The subclass of {@link EObject} for which this provider base shall
* be extended.
*/
public class LayoutedReuseProviderBase<T extends ILayoutedModelElement> extends ReuseProviderBase<T> {
/** {@inheritDoc} */
@Override
public boolean updateReuseElement(T elementToBeUpdated, T newElement) {
// keep old element position (replace it in new element)
ILayoutData oldPosLayout = null;
for (ILayoutData layout : elementToBeUpdated.getLayoutData()) {
if (layout.getKey().equals("pos")) {
oldPosLayout = layout;
}
}
if (oldPosLayout != null) {
for (ILayoutData layout : newElement.getLayoutData()) {
if (layout.getKey().equals("pos")) {
replace(layout, oldPosLayout);
}
}
}
replaceEObjectReferences(elementToBeUpdated, newElement);
replace(elementToBeUpdated, newElement);
return true;
}
}
CompositionUtils.java 34c0a191bd0fb4176c94b4d61abb5c88a679d5e8 GREEN
EMFResourceUtils.java 68e6712a52349548bf85346900b17aa65b5f0ea9 GREEN
EcoreSerializerBase.java 0a0c2969d793d2e68094c55c8f7b0a662ef6e5d5 GREEN
EcoreUtils.java aa5e8db2126f9b427d260cd1527e97f578d002dd GREEN
EcoreUtils.java a62460d445203b69ec6029479929da77e887866a GREEN
ExtensionPointUtils.java 7ce63242b49eb9a7cd4eaadd223f5ebce1dfd75b GREEN
HierarchicalNameComparator.java 6face1b673126701a0721af48ead2f9766c17d46 GREEN
IdentifierUtils.java fff43dc4e84cdd89c3ece4f5d9d89aec4b0749c2 GREEN
......
......@@ -691,7 +691,7 @@ public class EcoreUtils {
* @return A {@link Collection} containing all <EStructuralFeature.Setting>, which are
* references to 'referencedEObject'.
*/
private static Collection<EStructuralFeature.Setting>
public static Collection<EStructuralFeature.Setting>
getAllReferencesSetting(EObject referencedEObject) {
EObject rootEObject = getRootContainer(referencedEObject);
Resource resource = rootEObject.eResource();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment