| /* |
| * Copyright (c) 2008, 2009 Borland Software Corp. |
| * |
| * 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: |
| * Artem Tikhomirov (Borland) - initial API and implementation |
| */ |
| «IMPORT 'http://www.eclipse.org/gmf/2008/Context'» |
| |
| «EXTENSION Context» |
| |
| «DEFINE New(conditionAccessors : Sequence(context::FeatureContext)) FOR Sequence(context::FeatureContext)-» |
| «IF not self->isEmpty()-» |
| «IF withChildren(self)->isEmpty()»«EXPAND newFeatureTracker-» |
| «ELSE-» |
| «IF not withoutChildren(self)->isEmpty()»«EXPAND newFeatureTracker FOR withoutChildren(self)», «ENDIF-» |
| «EXPAND newAttachAdapter(conditionAccessors) FOREACH filterEReference(withChildren(self)) SEPARATOR ','-» |
| «ENDIF-» |
| «ENDIF-» |
| «ENDDEFINE» |
| |
| |
| «DEFINE newFeatureTracker FOR Sequence(context::FeatureContext)-» |
| new FeatureTracker(this, «EXPAND MetaModel::accessor FOREACH self.selector SEPARATOR ','»)«ENDDEFINE» |
| |
| «REM»assumes !fc.children.isEmpty«ENDREM» |
| «DEFINE newAttachAdapter(conditionAccessors : Sequence(context::FeatureContext)) FOR context::FeatureContext-» |
| new AttachAdapter(«EXPAND MetaModel::accessor FOR selector», «IF conditionAccessors->includes(self)-» |
| new ChangeTracker() { |
| public void modelChanged(org.eclipse.emf.common.notify.Notification n) { |
| // FIXME enable/disable widget(s) -- HOWEVER, need access to Binding/Widget here, so can't share the template with e.g. Alex's ItemProviders |
| } |
| }, «ENDIF-» |
| «EXPAND New(conditionAccessors) FOR (children)[context::FeatureContext]->asSequence()»)«ENDDEFINE» |