carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefresher.xpt
author cawthron
Fri, 04 Dec 2009 11:06:59 -0600
changeset 422 033392511bf7
permissions -rw-r--r--
add files for RCL_2_2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
422
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     1
/*
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     2
 * Copyright (c) 2007, 2008 Borland Software Corporation
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     3
 * 
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     4
 * All rights reserved. This program and the accompanying materials
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     5
 * are made available under the terms of the Eclipse Public License v1.0
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     6
 * which accompanies this distribution, and is available at
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     7
 * http://www.eclipse.org/legal/epl-v10.html
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     8
 *
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
     9
 * Contributors:
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    10
 *    bblajer (Borland) - initial API and implementation
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    11
 */
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    12
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    13
«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    14
«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    15
«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    16
«EXTENSION xpt::GenModelUtils»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    17
«EXTENSION xpt::diagram::LinkFinder»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    18
«EXTENSION xpt::diagram::parts::LinkNotationModelRefresher»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    19
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    20
«DEFINE installClause FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    21
«IF needsLinkNotationModelRefresher()-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    22
installLinkNotationModelRefresher();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    23
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    24
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    25
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    26
«DEFINE uninstallClause FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    27
«IF needsLinkNotationModelRefresher()-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    28
uninstallLinkNotationModelRefresher();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    29
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    30
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    31
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    32
«DEFINE all FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    33
«IF needsLinkNotationModelRefresher()-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    34
«EXPAND install-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    35
«EXPAND uninstall-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    36
«EXPAND getLinkNotationModelRefresher-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    37
«EXPAND viewService-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    38
«EXPAND refresh-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    39
«EXPAND LinkNotationModelRefresher-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    40
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    41
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    42
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    43
«DEFINE className FOR gmfgen::GenCommonBase»LinkNotationModelRefresher«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    44
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    45
«DEFINE install FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    46
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    47
private void installLinkNotationModelRefresher() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    48
	«EXPAND className» refresher = getLinkNotationModelRefresher();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    49
	if (!getTransactionalUpdateManager().isNotationModelRefresherInstalled(refresher)) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    50
		getTransactionalUpdateManager().addNotationModelRefresher(refresher);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    51
		try {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    52
			refreshLinkNotationModel();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    53
		} catch (java.lang.IllegalStateException readOnlyContext) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    54
			//Most likely, this means that the host element was created in a precommit notification of a transaction.
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    55
			//While it is impossible to execute this command here, it will be executed as a trigger command.
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    56
			//See org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager for details.
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    57
		}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    58
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    59
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    60
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    61
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    62
«DEFINE uninstall FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    63
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    64
private void uninstallLinkNotationModelRefresher() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    65
	«EXPAND className» refresher = getLinkNotationModelRefresher();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    66
	getTransactionalUpdateManager().removeNotationModelRefresher(refresher);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    67
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    68
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    69
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    70
«DEFINE getLinkNotationModelRefresher FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    71
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    72
private «EXPAND className» linkNotationModelRefresher;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    73
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    74
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    75
private «EXPAND className» getLinkNotationModelRefresher() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    76
	if (linkNotationModelRefresher == null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    77
		linkNotationModelRefresher = new «EXPAND className»(getViewService());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    78
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    79
	return linkNotationModelRefresher;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    80
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    81
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    82
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    83
«DEFINE viewService FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    84
«EXPAND xpt::Common::generatedMemberComment("Service to find a notational element that corresponds to the given underlying domain element.")»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    85
private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    86
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    87
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    88
private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService getViewService() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    89
	if (viewService == null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    90
		viewService = new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.EditPartRegistryBasedViewService(getViewer());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    91
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    92
	return viewService;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    93
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    94
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    95
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    96
«DEFINE refresh FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    97
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    98
protected void refreshLinkNotationModel() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    99
	«EXPAND className» linkRefresher = getLinkNotationModelRefresher();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   100
	org.eclipse.emf.common.command.Command command = linkRefresher.buildRefreshNotationModelCommand();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   101
	if (command == null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   102
		return;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   103
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   104
	org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::parts::Common::getDiagramElementCode»);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   105
	getViewer().getEditDomain().getCommandStack().execute(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(domainModelEditDomain, command));
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   106
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   107
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   108
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   109
«DEFINE LinkNotationModelRefresher FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   110
«EXPAND xpt::Common::generatedClassComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   111
private class «EXPAND className» «EXPAND supertypes» {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   112
	«EXPAND ctors-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   113
	«EXPAND getConstrainedChildrenFilter-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   114
	«EXPAND createUncontainedLinksFilter-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   115
	«EXPAND createFilter-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   116
	«EXPAND getSemanticLinks-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   117
	«EXPAND getNotationalLinks-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   118
	«EXPAND getCreateNotationalElementCommand-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   119
	«EXPAND shouldCreateView-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   120
	«EXPAND getHost-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   121
	«EXPAND additions-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   122
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   123
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   124
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   125
«DEFINE supertypes FOR gmfgen::GenCommonBase»extends org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.OwnedLinksNotationModelRefresher«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   126
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   127
«DEFINE ctors FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   128
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   129
public «EXPAND className»(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   130
	super(viewService);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   131
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   132
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   133
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   134
«DEFINE getConstrainedChildrenFilter FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   135
«IF containedLinksWithSelector().size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   136
«EXPAND xpt::Common::generatedMemberComment("TODO: Child links of this element are selected based on constraint declared in " + getDiagram().getVisualIDRegistryQualifiedClassName() + ". \n" + 
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   137
  "Since no assumptions may be made concerning the runtime behavior of the constraint, <b>any</b> non-touch notification may result in \n" + 
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   138
  "notational model having to be updated.\n" + 
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   139
  "<p/>User is encouraged to change implementation of this method to provide an optimization if it is safe to assume that not all notifications\n" + 
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   140
  "result in such an update.")»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   141
private org.eclipse.emf.transaction.NotificationFilter getConstrainedChildLinksFilter() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   142
	return org.eclipse.emf.transaction.NotificationFilter.NOT_TOUCH;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   143
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   144
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   145
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   146
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   147
«DEFINE createUncontainedLinksFilter FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   148
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   149
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   150
«DEFINE createUncontainedLinksFilter FOR gmfgen::GenDiagram-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   151
«EXPAND xpt::Common::generatedMemberComment("Creates a notification filter which filters notifications that may possibly result in uncontained links. ")»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   152
private org.eclipse.emf.transaction.NotificationFilter createUncontainedLinksFilter() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   153
	return org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.SET).or(
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   154
		org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.UNSET).or(
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   155
		org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.REMOVE).or(
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   156
		org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.REMOVE_MANY)
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   157
	)));
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   158
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   159
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   160
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   161
«DEFINE createFilter FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   162
«EXPAND xpt::Common::generatedMemberComment("Creates a notification filter which filters notifications that may possibly affect the notational model")»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   163
protected org.eclipse.emf.transaction.NotificationFilter createFilter() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   164
«LET getAffectingFeatures() AS affectingFeatures-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   165
«FOREACH affectingFeatures AS nextFeature ITERATOR it-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   166
	«IF it.isFirstIteration()»org.eclipse.emf.transaction.NotificationFilter filter = «EXPAND createFeatureFilter FOR nextFeature»;«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   167
	filter = filter.or(«EXPAND createFeatureFilter FOR nextFeature»);«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   168
«ENDFOREACH-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   169
«IF containedLinksWithSelector().size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   170
	«IF affectingFeatures.size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   171
	filter = getConstrainedChildLinksFilter().or(filter);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   172
	«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   173
	org.eclipse.emf.transaction.NotificationFilter filter = getConstrainedChildLinksFilter();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   174
	«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   175
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   176
«IF {this}.typeSelect(gmfgen::GenDiagram).size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   177
	«IF affectingFeatures.size() + containedLinksWithSelector().size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   178
	filter = filter.or(createUncontainedLinksFilter());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   179
	«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   180
	org.eclipse.emf.transaction.NotificationFilter filter = createUncontainedLinksFilter();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   181
	«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   182
«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   183
	«REM»Make sure filter var is declared«ENDREM-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   184
	«IF affectingFeatures.size() + containedLinksWithSelector().size() == 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   185
	org.eclipse.emf.transaction.NotificationFilter filter = org.eclipse.emf.transaction.NotificationFilter.NOT_TOUCH;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   186
	«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   187
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   188
«ENDLET-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   189
	return filter;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   190
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   191
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   192
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   193
«DEFINE createFeatureFilter FOR genmodel::GenFeature»org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(«EXPAND MetaModel::MetaFeature»)«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   194
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   195
«DEFINE getSemanticLinks FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   196
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   197
protected java.util.List getSemanticChildLinks() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   198
«EXPAND xpt::diagram::parts::semanticChildLinks::semanticChildLinks("getHost()")-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   199
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   200
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   201
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   202
«DEFINE getNotationalLinks FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   203
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   204
protected java.util.List getNotationalChildLinks() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   205
	java.util.List result = new java.util.LinkedList();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   206
	java.util.List allLinks = «EXPAND xpt::diagram::parts::Common::getDiagramCode».getEdges();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   207
	for(java.util.Iterator it = allLinks.iterator(); it.hasNext(); ) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   208
		org.eclipse.gmf.runtime.notation.Edge next = (org.eclipse.gmf.runtime.notation.Edge) it.next();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   209
		«EXPAND uncontainedLinks-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   210
		«EXPAND containedFeatureModelLinks-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   211
		«EXPAND containedTypeModelLinks-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   212
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   213
	return result;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   214
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   215
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   216
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   217
«DEFINE uncontainedLinks FOR gmfgen::GenCommonBase»«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   218
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   219
«DEFINE uncontainedLinks FOR gmfgen::GenDiagram-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   220
if (next.isSetElement() && next.getElement() != null && next.getElement().eResource() == null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   221
	result.add(next);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   222
	continue;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   223
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   224
org.eclipse.gmf.runtime.notation.View source = next.getSource();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   225
if (source == null || (source.isSetElement() && source.getElement() != null && source.getElement().eResource() == null)) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   226
	result.add(next);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   227
	continue;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   228
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   229
org.eclipse.gmf.runtime.notation.View target = next.getTarget();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   230
if (target == null || (target.isSetElement() && target.getElement() != null && target.getElement().eResource() == null)) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   231
	result.add(next);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   232
	continue;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   233
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   234
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   235
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   236
«DEFINE containedFeatureModelLinks FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   237
«IF containedFeatureModelFacetLinks().size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   238
if (next.isSetElement() && next.getElement() == null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   239
	if (next.getSource() == getHost()) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   240
		int linkVID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   241
		switch (linkVID) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   242
		«EXPAND caseVisualId FOREACH containedFeatureModelFacetLinks()-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   243
			result.add(next);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   244
			break;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   245
		}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   246
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   247
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   248
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   249
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   250
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   251
«DEFINE containedTypeModelLinks FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   252
«IF containedTypeModelFacetLinks().size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   253
if (next.isSetElement() && next.getElement() != null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   254
	if (next.getElement().eContainer() == «EXPAND xpt::diagram::parts::Common::getViewCode».getElement()) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   255
		int linkVID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   256
		switch (linkVID) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   257
		«EXPAND caseVisualId FOREACH containedTypeModelFacetLinks()-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   258
			result.add(next);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   259
			break;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   260
		}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   261
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   262
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   263
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   264
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   265
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   266
«DEFINE caseVisualId FOR gmfgen::GenLink-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   267
case «getEditPartQualifiedClassName()».VISUAL_ID:
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   268
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   269
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   270
«DEFINE getCreateNotationalElementCommand FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   271
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   272
protected org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreateNotationalElementCommand(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor descriptor) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   273
«IF primNeedsLinkNotationModelRefresher()-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   274
	org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor linkDescriptor = (org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor) descriptor;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   275
	«EXPAND xpt::commands::createNotationalElementCommand::defineDecorator-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   276
	«IF getDiagram().shortcutsProvidedFor.size() > 0-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   277
	String diagramModelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(getHost().getDiagram());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   278
	if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(diagramModelID)) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   279
		return new «EXPAND xpt::commands::CreateShortcutEdgeCommand::qualifiedClassName FOR getDiagram()»(getHost().getDiagram(), linkDescriptor.getElement(), sourceView, targetView, decorator);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   280
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   281
	«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   282
	«EXPAND xpt::commands::createNotationalElementCommand::instantiateNotationalEdgeCommand("getHost().getDiagram()")-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   283
«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   284
	return null;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   285
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   286
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   287
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   288
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   289
«DEFINE shouldCreateView FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   290
«EXPAND xpt::Common::generatedMemberComment("Returns whether a notational edge should be created for the given domain element. \n" + 
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   291
  "The generated code respects canonical style. If the canonycal style is not present, " + (getDiagram().synchronized ? "true" : "false") + " is always returned. \n" + 
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   292
  "User can change implementation of this method to handle a more sophisticated logic.")»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   293
protected boolean shouldCreateView(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor descriptor) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   294
	org.eclipse.gmf.runtime.notation.CanonicalStyle style = (org.eclipse.gmf.runtime.notation.CanonicalStyle) «EXPAND xpt::diagram::parts::Common::getViewCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getCanonicalStyle());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   295
	if (style == null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   296
		return «getDiagram().synchronized»;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   297
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   298
	return style.isCanonical();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   299
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   300
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   301
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   302
«DEFINE getHost FOR gmfgen::GenCommonBase-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   303
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   304
protected org.eclipse.gmf.runtime.notation.View getHost() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   305
	return «EXPAND xpt::diagram::parts::Common::getViewCode»;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   306
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   307
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   308
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   309
«DEFINE additions FOR gmfgen::GenCommonBase»«ENDDEFINE»