diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java index 2e72bd5f20e5cd094e942803a592985ade3889ef..70425e175ca43a07cc3ed46e648603bcf89d4831 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java @@ -33,7 +33,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 8E3FE62B80ACF1DA5FF9DCA2A91B2A3E + * @ConQAT.Rating YELLOW Hash: DFE80532CB79D43BBCC951603AA91A9B */ public final class KernelModelElementUtils { diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/PrototypesUtils.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/PrototypesUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..31d1268ddd079b100752b81e8c67ea1bbc94dccf --- /dev/null +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/PrototypesUtils.java @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2012 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.utils; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.kernel.extension.data.Prototype; +import org.fortiss.tooling.kernel.service.IPrototypeService; + +/** + * Utility methods for dealing with prototypes. + * + * @author ratiu + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating YELLOW Hash: 6EE14E172A9708B6E42379AEB3A61219 + */ +public class PrototypesUtils { + + /** Returns a prototype with a given name that is composable with a given model element type. */ + public static Prototype findPrototypeComposableWith(Class<? extends EObject> modelElementType, + String prototypeName) { + List<Prototype> prototypes = + IPrototypeService.INSTANCE.getComposablePrototypes(modelElementType); + for(Prototype prot : prototypes) { + if(prot.getName().equals(prototypeName)) { + return prot; + } + } + return null; + } +}