Skip to content
Snippets Groups Projects
Commit a70f55d8 authored by Simon Barner's avatar Simon Barner
Browse files

- Remove unneeded (and currently deactivated) migration provider.

- Annotations are now instantiated in ElementCompositorService. Hence, this migration will not be required in the future.
refs 2208
parent 2f9d0aef
No related branches found
No related tags found
No related merge requests found
......@@ -21,14 +21,4 @@
restorable="true">
</view>
</extension>
<!--extension point="org.fortiss.tooling.kernel.migrationProvider">
<migrationProvider
migrationProvider="org.fortiss.tooling.base.ui.annotation.AnnotationInstantiationMigrationProvider">
<objectClass
objectClass="org.fortiss.tooling.kernel.extension.data.ITopLevelElement">
</objectClass>
</migrationProvider>
</extension-->
</plugin>
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2013 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.ui.annotation;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.kernel.extension.IMigrationProvider;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
/**
* {@link IMigrationProvider} that ensures that all {@link IAnnotatedSpecification}s that have been
* registered for model element types in the current model are actually instantiated.
*
* This is required for new {@link IAnnotatedSpecification}s that have been registered after the
* creation of the model.
*
* @author barner
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: DB938B8077EEAFB9455F8A83BF92CD86
*/
public class AnnotationInstantiationMigrationProvider implements IMigrationProvider {
/**
* Set of models already processed during this run. The implementation of a predicate function
* if model migration is needed (for use in {@link #needMigration(ITopLevelElement, Map)} would
* be as complex as the migration itself.
*/
private Set<ITopLevelElement> processedModels = new HashSet<ITopLevelElement>();
/** {@inheritDoc} */
@Override
public boolean needMigration(ITopLevelElement modelElement,
Map<EObject, AnyType> unknownFeatures) {
return modelElement != null && modelElement.getRootModelElement() != null &&
!processedModels.contains(modelElement);
}
/** {@inheritDoc} */
@Override
public void migrate(ITopLevelElement modelElement, Map<EObject, AnyType> unknownFeatures) {
processedModels.add(modelElement);
for(Iterator<EObject> i = modelElement.getRootModelElement().eAllContents(); i.hasNext();) {
EObject eo = i.next();
if(eo instanceof IModelElement) {
// IAnnotationValueService.INSTANCE.instantiateAnnotations((IModelElement)eo);
}
}
}
}
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