carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/CompartmentEditPart.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 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
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    17
«DEFINE CompartmentEditPart FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    18
«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    19
package «getDiagram().editPartsPackageName»;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    20
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    21
«EXPAND xpt::Common::generatedClassComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    22
public class «editPartClassName» «EXPAND supertypes» {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    23
	«EXPAND xpt::diagram::parts::Common::visualIDConstant-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    24
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    25
	«EXPAND xpt::diagram::parts::Common::ctors-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    26
	«EXPAND xpt::diagram::parts::Common::notSelectable-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    27
	«EXPAND getModelChildren-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    28
	«EXPAND xpt::diagram::parts::Common::declareViewCode-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    29
	«EXPAND createEditPolicies-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    30
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    31
	«EXPAND createSelectionHandles-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    32
	«EXPAND xpt::diagram::parts::requests::performRequest-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    33
	«EXPAND getTitleName-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    34
	«EXPAND createFigure-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    35
	«EXPAND xpt::diagram::parts::Common::getAdapter-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    36
	«EXPAND xpt::diagram::parts::Common::contentPane-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    37
	«EXPAND setupCompartmentHolder-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    38
	«EXPAND xpt::diagram::parts::Common::activate-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    39
	«EXPAND xpt::diagram::parts::Common::deactivate-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    40
	«EXPAND xpt::diagram::parts::Common::getTransactionalUpdateManager-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    41
	«EXPAND xpt::diagram::parts::NotationModelRefresher::all-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    42
	«EXPAND xpt::diagram::parts::refresh::refresher-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    43
	«EXPAND additions-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    44
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    45
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    46
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    47
«DEFINE supertypes FOR gmfgen::GenCompartment»extends org.eclipse.gef.editparts.AbstractGraphicalEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    48
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    49
«DEFINE getModelChildren FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    50
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    51
protected java.util.List getModelChildren() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    52
	org.eclipse.gmf.runtime.notation.DrawerStyle style = (org.eclipse.gmf.runtime.notation.DrawerStyle) «EXPAND xpt::diagram::parts::Common::getViewCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    53
	if (style != null && style.isCollapsed()) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    54
		return java.util.Collections.EMPTY_LIST;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    55
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    56
	return «EXPAND xpt::diagram::parts::Common::getViewCode».getVisibleChildren();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    57
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    58
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    59
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    60
«DEFINE createEditPolicies FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    61
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    62
protected void createEditPolicies() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    63
	installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new «EXPAND xpt::diagram::policies::LayoutEditPolicy::qualifiedClassName»());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    64
	«EXPAND xpt::diagram::parts::Common::behaviour-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    65
	«EXPAND xpt::diagram::parts::NotationModelRefresher::installClause-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    66
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    67
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    68
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    69
«DEFINE createSelectionHandles FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    70
«EXPAND xpt::Common::generatedMemberComment("Returns the selection handles that should be contributed to the parent when it becomes selected.")»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    71
public java.util.List createSelectionHandles() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    72
«IF canCollapse-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    73
	return java.util.Collections.singletonList(new org.eclipse.gmf.runtime.lite.handles.CompartmentCollapseHandle(this, getTitleName()));
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    74
«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    75
	return java.util.Collections.singletonList(new org.eclipse.gmf.runtime.lite.handles.CompartmentNameHandle(this, getTitleName()));
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    76
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    77
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    78
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    79
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    80
«DEFINE getTitleName FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    81
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    82
protected String getTitleName() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    83
«IF needsTitle-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    84
	return "«title»";	«EXPAND xpt::Common::nonNLS»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    85
«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    86
	return "";	«EXPAND xpt::Common::nonNLS»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    87
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    88
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    89
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    90
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    91
«DEFINE createFigure FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    92
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    93
public org.eclipse.draw2d.IFigure createFigure() {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    94
	org.eclipse.draw2d.Figure result = new org.eclipse.gmf.runtime.lite.figures.CompartmentFigure();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    95
	result.setLayoutManager(new org.eclipse.draw2d.StackLayout());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    96
	org.eclipse.draw2d.ScrollPane scrollPane = new org.eclipse.draw2d.ScrollPane();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    97
	result.add(scrollPane);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    98
«IF listLayout-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
    99
		org.eclipse.draw2d.Viewport viewport = new org.eclipse.draw2d.Viewport();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   100
		contentPane = new org.eclipse.draw2d.Figure();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   101
		contentPane.setLayoutManager(new org.eclipse.draw2d.ToolbarLayout());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   102
«ELSE-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   103
		org.eclipse.draw2d.Viewport viewport = new org.eclipse.draw2d.FreeformViewport();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   104
		contentPane = new org.eclipse.draw2d.FreeformLayer();
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   105
		contentPane.setLayoutManager(new org.eclipse.draw2d.FreeformLayout());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   106
«ENDIF-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   107
	viewport.setContents(contentPane);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   108
	scrollPane.setViewport(viewport);
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   109
	return result;
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   110
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   111
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   112
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   113
«DEFINE setupCompartmentHolder FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   114
«EXPAND setupCompartmentHolder FOR viewmap-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   115
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   116
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   117
«DEFINE setupCompartmentHolder FOR gmfgen::Viewmap»«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   118
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   119
«DEFINE setupCompartmentHolder FOR gmfgen::ParentAssignedViewmap-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   120
«EXPAND xpt::Common::generatedMemberComment»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   121
public void setupCompartmentHolder(org.eclipse.draw2d.IFigure shape) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   122
	if (shape.getLayoutManager() == null) {
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   123
		shape.setLayoutManager(new org.eclipse.draw2d.StackLayout());
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   124
	}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   125
}
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   126
«ENDDEFINE»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   127
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   128
«DEFINE additions FOR gmfgen::GenCompartment-»
033392511bf7 add files for RCL_2_2
cawthron
parents:
diff changeset
   129
«ENDDEFINE»