Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base141
1 files changed, 0 insertions, 141 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base
deleted file mode 100644
index f8788ab488d..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2007, 2010 Borland Software Corporation and others
- *
- * 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«EXTENSION xpt::diagram::Utils»
-
-«REM»
- Check whether link may be created.
-«ENDREM»
-«DEFINE canCreate(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && «EXPAND MetaModel::NotInstance('source') FOR getSourceType()») {
- return false;
- }
- if (target != null && «EXPAND MetaModel::NotInstance('target') FOR getTargetType()») {
- return false;
- }
- if (getSource() == null) {
- return true; // link creation is in progress; source is not defined yet
- }
- // target may be null here but it's possible to check constraint
- «EXPAND canCreateElement(link)-»
- }
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet-»
-«IF hasContainerOtherThanSource(self)-»
- if (getContainer() == null) {
- return false;
- }
-«ENDIF-»
- return «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::canCreateCall(link, 'getContainer()', 'getSource()', 'getTarget()')»;
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) FOR gmfgen::FeatureLinkModelFacet-»
- return «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::canCreateCall(link, 'getSource()', 'getTarget()')»;
-«ENDDEFINE»
-
-«REM»
- Fields of command that creates link.
-«ENDREM»
-«DEFINE fields FOR gmfgen::LinkModelFacet»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject source;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject target;
-«ENDDEFINE»
-
-«DEFINE fields FOR gmfgen::TypeLinkModelFacet»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject source;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject target;
-«IF hasContainerOtherThanSource(self)»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container;
-«ENDIF-»
-«ENDDEFINE»
-
-«REM»
- Field accessors of command that creates link.
-«ENDREM»
-«DEFINE accessors FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getSource() {
- return «EXPAND MetaModel::CastEObject('source') FOR getSourceType()»;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getTarget() {
- return «EXPAND MetaModel::CastEObject('target') FOR getTargetType()»;
- }
- «EXPAND containerAccessor-»
-«ENDDEFINE»
-
-«DEFINE containerAccessor FOR gmfgen::LinkModelFacet»«ENDDEFINE»
-
-«DEFINE containerAccessor FOR gmfgen::TypeLinkModelFacet-»
-«IF hasContainerOtherThanSource(self)-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» getContainer() {
- return container;
- }
-
- «EXPAND xpt::Common::generatedMemberComment(
- 'Default approach is to traverse ancestors of the source to find instance of container.\n' +
- 'Modify with appropriate logic.'
- )»
- protected «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) {
- if («EXPAND MetaModel::IsInstance('element') FOR containmentMetaFeature.genClass») {
- return «EXPAND MetaModel::CastEObject('element') FOR containmentMetaFeature.genClass»;
- }
- }
- return null;
- }
-«ENDIF-»
-
-«ENDDEFINE»
-
-«REM»
- Part of the constructor that performs initialization.
-«ENDREM»
-«DEFINE _init FOR gmfgen::LinkModelFacet-»
- this.source = source;
- this.target = target;
-«ENDDEFINE»
-
-«DEFINE _init FOR gmfgen::TypeLinkModelFacet-»
- this.source = source;
- this.target = target;
-«IF hasContainerOtherThanSource(self)-»
- container = deduceContainer(source, target);
-«ENDIF-»
-«ENDDEFINE» \ No newline at end of file

Back to the top