diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/TutorialUIServiceUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/TutorialUIServiceUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..e2af56d299cdefe8e79ce276d0f2a58bf763a7a5 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/TutorialUIServiceUtils.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2016 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.ui.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.action.IContributionItem; +import org.fortiss.tooling.kernel.extension.data.Prototype; +import org.fortiss.tooling.kernel.ui.service.IActionService; + +/** + * Utility class providing common methods used when implementing UI parts of tutorials. + * + * @author hoelzl + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class TutorialUIServiceUtils { + /** Returns whether the given contribution is a new menu prototype instance of the given class. */ + public static boolean isNewMenuContributionPrototype(IContributionItem contribution, + Class<? extends EObject> clazz) { + Prototype proto = IActionService.INSTANCE.getNewMenuContributionPrototype(contribution); + return proto != null && clazz.isInstance(proto.getPrototype()); + } +}