| [comment encoding = UTF-8 |
| ******************************************************************************* |
| * Copyright (c) 2008-2009 Obeo. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Obeo - initial API and implementation |
| ******************************************************************************* |
| /] |
| [module filters('http://www.eclipse.org/emf/eef/mapping/filters/1.0.0', 'http://www.eclipse.org/emf/eef/components/1.0.0', 'http://www.eclipse.org/emf/eef/views/1.0.0', 'http://www.eclipse.org/emf/2002/Ecore', 'http://www.eclipse.org/emf/eef/generation/1.0.0')/] |
| |
| [import org::eclipse::emf::eef::codegen::services::naming /] |
| [import org::eclipse::emf::eef::codegen::services::common /] |
| [import org::eclipse::emf::eef::codegen::services::viewCommon /] |
| [import org::eclipse::emf::eef::codegen::services::imports /] |
| [import org::eclipse::emf::eef::codegen::services::emfCodeGen /] |
| |
| [template public filterBody(bindingFilter : BindingFilter, editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent)] |
| // FIXME default case for filter body generation. |
| [/template] |
| |
| [template public filterBody(bindingFilter : StrictTypingFilter, editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent)] |
| [comment Do nothing. Here to avoid FIXME tag generation /] |
| [/template] |
| |
| [template public filterBody(filter : JavaDeclarationFilter, editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent)] |
| [view.viewIdentifier(pec)/].addFilterTo[editionElement.views->first().viewPackageSignature()/](new [include('org.eclipse.jface.viewers.ViewerFilter')/]() { |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) |
| */ |
| public boolean select([include('org.eclipse.jface.viewers.Viewer')/] viewer, Object parentElement, Object element) { |
| return [filter.methodName/](viewer, parentElement, element); |
| } |
| |
| }); |
| [/template] |
| |
| [template public filterBody(filter : JavaExpressionFilter, editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent)] |
| [view.viewIdentifier(pec)/].addFilterTo[editionElement.views->first().viewPackageSignature()/](new [include('org.eclipse.jface.viewers.ViewerFilter')/]() { |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) |
| */ |
| public boolean select([include('org.eclipse.jface.viewers.Viewer')/] viewer, Object parentElement, Object element) { |
| [if (filter.javaBody->size()> 0)][filter.javaBody/][else]return false;[/if] |
| } |
| |
| }); |
| [/template] |
| |
| [template public filterBody(filter : OnlyReferenceTypeFilter, editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent)] |
| [view.viewIdentifier(pec)/].addFilterTo[editionElement.views->first().viewPackageSignature()/](new [include('org.eclipse.jface.viewers.ViewerFilter')/]() { |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) |
| */ |
| public boolean select([include('org.eclipse.jface.viewers.Viewer')/] viewer, Object parentElement, Object element) { |
| Object result = [include('org.eclipse.emf.eef.runtime.impl.utils.EEFUtils')/].choiceOfValues([pec.subPECClass(view)/].this.semanticObject, [filter.reference.metamodelGetter()/][addImport(filter.reference.eContainingClass.ePackage.qualifiedMetamodelPackage())/]); |
| if (result instanceof [include('java.util.Collection')/]) { |
| return ((Collection)result).contains(element); |
| } else if (result instanceof ResourceSet && element instanceof EObject) { |
| return ((EObject)element).eResource() != null && ((EObject)element).eResource().getResourceSet() != null && ((EObject)element).eResource().getResourceSet().equals(result); |
| } |
| return element instanceof [include('org.eclipse.emf.ecore.resource.Resource')/]; |
| } |
| }); |
| [/template] |
| |
| [template public filterBody(bindingFilter : OCLFilter, editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent)] |
| // OCLFilter not implemented yet |
| [/template] |
| |
| [template public javaDeclarationFilter(pee : PropertiesEditionElement)] |
| [for (bindingFilter : JavaDeclarationFilter | pee.bindingFilters->filter(JavaDeclarationFilter)) separator ('\n')] |
| /** |
| * [bindingFilter.documentation/] |
| */ |
| private boolean [bindingFilter.methodName/](Viewer viewer, Object parentElement, Object element){ |
| [if (pee.element.eContainer(PropertiesEditionContext).associatedGenModel().useJMergeForUserCode)] |
| return true; |
| [else] |
| // [protected ('for user filter '.concat(bindingFilter.methodName))] |
| return true; |
| // [/protected] |
| [/if] |
| } |
| [/for] |
| [/template] |