blob: 801a3eaa02a10c00ea61046736ae046212dd8ac2 [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2009-2010 Thales Corporate Services S.A.S.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales Corporate Services S.A.S - initial API and implementation
*
* </copyright>
*/
package org.eclipse.egf.pattern.strategy;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.egf.model.pattern.Pattern;
import org.eclipse.egf.model.pattern.PatternContext;
import org.eclipse.egf.model.pattern.PatternException;
import org.eclipse.egf.model.pattern.TypePatternSubstitution;
import org.eclipse.egf.pattern.collector.PatternCollector;
import org.eclipse.egf.pattern.extension.ExtensionHelper.MissingExtensionException;
import org.eclipse.egf.pattern.utils.SubstitutionHelper;
/**
* Pattern are executed in the given order. Pattern libraries are substituted by
* their contents.
*
* @author Thomas Guiu
*
*/
public class DefaultStrategy extends AbstractPatternStrategy {
public void execute(PatternContext context, Object parameter) throws PatternException, MissingExtensionException {
List<Pattern> result = new ArrayList<Pattern>();
// to replace libraries by their contents
PatternCollector.INSTANCE.collect(patternElements, result);
TypePatternSubstitution substitutions = (TypePatternSubstitution) context.getValue(PatternContext.PATTERN_SUBSTITUTIONS);
SubstitutionHelper.apply(result, substitutions);
doExecute(result, context);
}
}