|
Lines 13-26
package org.eclipse.sirius.diagram.description.tool.provider;
Link Here
|
| 13 |
|
13 |
|
| 14 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
| 15 |
import java.util.Collection; |
15 |
import java.util.Collection; |
|
|
16 |
import java.util.List; |
| 16 |
|
17 |
|
| 17 |
import org.eclipse.emf.common.notify.Adapter; |
18 |
import org.eclipse.emf.common.notify.Adapter; |
| 18 |
import org.eclipse.emf.common.notify.Notification; |
19 |
import org.eclipse.emf.common.notify.Notification; |
| 19 |
import org.eclipse.emf.common.notify.Notifier; |
20 |
import org.eclipse.emf.common.notify.Notifier; |
|
|
21 |
import org.eclipse.emf.common.util.ResourceLocator; |
| 22 |
import org.eclipse.emf.ecore.EObject; |
| 23 |
import org.eclipse.emf.edit.command.CommandParameter; |
| 24 |
import org.eclipse.emf.edit.domain.EditingDomain; |
| 20 |
import org.eclipse.emf.edit.provider.ChangeNotifier; |
25 |
import org.eclipse.emf.edit.provider.ChangeNotifier; |
| 21 |
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
26 |
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 22 |
import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
27 |
import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
| 23 |
import org.eclipse.emf.edit.provider.IChangeNotifier; |
28 |
import org.eclipse.emf.edit.provider.IChangeNotifier; |
|
|
29 |
import org.eclipse.emf.edit.provider.IChildCreationExtender; |
| 24 |
import org.eclipse.emf.edit.provider.IDisposable; |
30 |
import org.eclipse.emf.edit.provider.IDisposable; |
| 25 |
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
31 |
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 26 |
import org.eclipse.emf.edit.provider.IItemLabelProvider; |
32 |
import org.eclipse.emf.edit.provider.IItemLabelProvider; |
|
Lines 28-34
import org.eclipse.emf.edit.provider.IItemPropertySource;
Link Here
|
| 28 |
import org.eclipse.emf.edit.provider.INotifyChangedListener; |
34 |
import org.eclipse.emf.edit.provider.INotifyChangedListener; |
| 29 |
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
35 |
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 30 |
import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
36 |
import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
|
|
37 |
import org.eclipse.sirius.diagram.description.tool.ToolFactory; |
| 31 |
import org.eclipse.sirius.diagram.description.tool.util.ToolAdapterFactory; |
38 |
import org.eclipse.sirius.diagram.description.tool.util.ToolAdapterFactory; |
|
|
39 |
import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; |
| 40 |
import org.eclipse.sirius.viewpoint.description.DescriptionPackage; |
| 41 |
import org.eclipse.sirius.viewpoint.description.Environment; |
| 42 |
import org.eclipse.sirius.viewpoint.description.tool.ContainerModelOperation; |
| 43 |
import org.eclipse.sirius.viewpoint.description.tool.InitEdgeCreationOperation; |
| 44 |
import org.eclipse.sirius.viewpoint.description.tool.InitialContainerDropOperation; |
| 45 |
import org.eclipse.sirius.viewpoint.description.tool.InitialNodeCreationOperation; |
| 46 |
import org.eclipse.sirius.viewpoint.description.tool.InitialOperation; |
| 47 |
import org.eclipse.sirius.viewpoint.description.tool.SwitchChild; |
| 48 |
import org.eclipse.sirius.viewpoint.description.tool.ToolPackage; |
| 49 |
import org.eclipse.sirius.viewpoint.description.tool.util.ToolSwitch; |
| 50 |
import org.eclipse.sirius.viewpoint.description.util.DescriptionSwitch; |
| 32 |
|
51 |
|
| 33 |
/** |
52 |
/** |
| 34 |
* This is the factory that is used to provide the interfaces needed to support |
53 |
* This is the factory that is used to provide the interfaces needed to support |
|
Lines 883-886
public class ToolItemProviderAdapterFactory extends ToolAdapterFactory implement
Link Here
|
| 883 |
containerDropDescriptionItemProvider.dispose(); |
902 |
containerDropDescriptionItemProvider.dispose(); |
| 884 |
} |
903 |
} |
| 885 |
|
904 |
|
|
|
905 |
/** |
| 906 |
* A child creation extender for the {@link DescriptionPackage}. <!-- |
| 907 |
* begin-user-doc --> <!-- end-user-doc --> |
| 908 |
* |
| 909 |
* @generated |
| 910 |
*/ |
| 911 |
public static class DescriptionChildCreationExtender implements IChildCreationExtender { |
| 912 |
/** |
| 913 |
* The switch for creating child descriptors specific to each extended |
| 914 |
* class. <!-- begin-user-doc --> <!-- end-user-doc --> |
| 915 |
* |
| 916 |
* @generated |
| 917 |
*/ |
| 918 |
protected static class CreationSwitch extends DescriptionSwitch<Object> { |
| 919 |
/** |
| 920 |
* The child descriptors being populated. <!-- begin-user-doc --> |
| 921 |
* <!-- end-user-doc --> |
| 922 |
* |
| 923 |
* @generated |
| 924 |
*/ |
| 925 |
protected List<Object> newChildDescriptors; |
| 926 |
|
| 927 |
/** |
| 928 |
* The domain in which to create the children. <!-- begin-user-doc |
| 929 |
* --> <!-- end-user-doc --> |
| 930 |
* |
| 931 |
* @generated |
| 932 |
*/ |
| 933 |
protected EditingDomain editingDomain; |
| 934 |
|
| 935 |
/** |
| 936 |
* Creates the a switch for populating child descriptors in the |
| 937 |
* given domain. <!-- begin-user-doc --> <!-- end-user-doc --> |
| 938 |
* |
| 939 |
* @generated |
| 940 |
*/ |
| 941 |
CreationSwitch(List<Object> newChildDescriptors, EditingDomain editingDomain) { |
| 942 |
this.newChildDescriptors = newChildDescriptors; |
| 943 |
this.editingDomain = editingDomain; |
| 944 |
} |
| 945 |
|
| 946 |
/** |
| 947 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 948 |
* |
| 949 |
* @generated |
| 950 |
*/ |
| 951 |
@Override |
| 952 |
public Object caseEnvironment(Environment object) { |
| 953 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createToolGroup())); |
| 954 |
|
| 955 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createNodeCreationDescription())); |
| 956 |
|
| 957 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createEdgeCreationDescription())); |
| 958 |
|
| 959 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createContainerCreationDescription())); |
| 960 |
|
| 961 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createDeleteElementDescription())); |
| 962 |
|
| 963 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createDoubleClickDescription())); |
| 964 |
|
| 965 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createReconnectEdgeDescription())); |
| 966 |
|
| 967 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createRequestDescription())); |
| 968 |
|
| 969 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createDirectEditLabel())); |
| 970 |
|
| 971 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createBehaviorTool())); |
| 972 |
|
| 973 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createDiagramCreationDescription())); |
| 974 |
|
| 975 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createDiagramNavigationDescription())); |
| 976 |
|
| 977 |
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENVIRONMENT__DEFAULT_TOOLS, ToolFactory.eINSTANCE.createContainerDropDescription())); |
| 978 |
|
| 979 |
return null; |
| 980 |
} |
| 981 |
|
| 982 |
/** |
| 983 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 984 |
* |
| 985 |
* @generated |
| 986 |
*/ |
| 987 |
protected CommandParameter createChildParameter(Object feature, Object child) { |
| 988 |
return new CommandParameter(null, feature, child); |
| 989 |
} |
| 990 |
|
| 991 |
} |
| 992 |
|
| 993 |
/** |
| 994 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 995 |
* |
| 996 |
* @generated |
| 997 |
*/ |
| 998 |
public Collection<Object> getNewChildDescriptors(Object object, EditingDomain editingDomain) { |
| 999 |
ArrayList<Object> result = new ArrayList<Object>(); |
| 1000 |
new CreationSwitch(result, editingDomain).doSwitch((EObject) object); |
| 1001 |
return result; |
| 1002 |
} |
| 1003 |
|
| 1004 |
/** |
| 1005 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1006 |
* |
| 1007 |
* @generated |
| 1008 |
*/ |
| 1009 |
public ResourceLocator getResourceLocator() { |
| 1010 |
return DiagramUIPlugin.INSTANCE; |
| 1011 |
} |
| 1012 |
} |
| 1013 |
|
| 1014 |
/** |
| 1015 |
* A child creation extender for the {@link ToolPackage}. <!-- |
| 1016 |
* begin-user-doc --> <!-- end-user-doc --> |
| 1017 |
* |
| 1018 |
* @generated |
| 1019 |
*/ |
| 1020 |
public static class ToolChildCreationExtender implements IChildCreationExtender { |
| 1021 |
/** |
| 1022 |
* The switch for creating child descriptors specific to each extended |
| 1023 |
* class. <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1024 |
* |
| 1025 |
* @generated |
| 1026 |
*/ |
| 1027 |
protected static class CreationSwitch extends ToolSwitch<Object> { |
| 1028 |
/** |
| 1029 |
* The child descriptors being populated. <!-- begin-user-doc --> |
| 1030 |
* <!-- end-user-doc --> |
| 1031 |
* |
| 1032 |
* @generated |
| 1033 |
*/ |
| 1034 |
protected List<Object> newChildDescriptors; |
| 1035 |
|
| 1036 |
/** |
| 1037 |
* The domain in which to create the children. <!-- begin-user-doc |
| 1038 |
* --> <!-- end-user-doc --> |
| 1039 |
* |
| 1040 |
* @generated |
| 1041 |
*/ |
| 1042 |
protected EditingDomain editingDomain; |
| 1043 |
|
| 1044 |
/** |
| 1045 |
* Creates the a switch for populating child descriptors in the |
| 1046 |
* given domain. <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1047 |
* |
| 1048 |
* @generated |
| 1049 |
*/ |
| 1050 |
CreationSwitch(List<Object> newChildDescriptors, EditingDomain editingDomain) { |
| 1051 |
this.newChildDescriptors = newChildDescriptors; |
| 1052 |
this.editingDomain = editingDomain; |
| 1053 |
} |
| 1054 |
|
| 1055 |
/** |
| 1056 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1057 |
* |
| 1058 |
* @generated |
| 1059 |
*/ |
| 1060 |
@Override |
| 1061 |
public Object caseContainerModelOperation(ContainerModelOperation object) { |
| 1062 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.CONTAINER_MODEL_OPERATION__SUB_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateView())); |
| 1063 |
|
| 1064 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.CONTAINER_MODEL_OPERATION__SUB_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateEdgeView())); |
| 1065 |
|
| 1066 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.CONTAINER_MODEL_OPERATION__SUB_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createNavigation())); |
| 1067 |
|
| 1068 |
return null; |
| 1069 |
} |
| 1070 |
|
| 1071 |
/** |
| 1072 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1073 |
* |
| 1074 |
* @generated |
| 1075 |
*/ |
| 1076 |
@Override |
| 1077 |
public Object caseInitialNodeCreationOperation(InitialNodeCreationOperation object) { |
| 1078 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_NODE_CREATION_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateView())); |
| 1079 |
|
| 1080 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_NODE_CREATION_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateEdgeView())); |
| 1081 |
|
| 1082 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_NODE_CREATION_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createNavigation())); |
| 1083 |
|
| 1084 |
return null; |
| 1085 |
} |
| 1086 |
|
| 1087 |
/** |
| 1088 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1089 |
* |
| 1090 |
* @generated |
| 1091 |
*/ |
| 1092 |
@Override |
| 1093 |
public Object caseInitialOperation(InitialOperation object) { |
| 1094 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateView())); |
| 1095 |
|
| 1096 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateEdgeView())); |
| 1097 |
|
| 1098 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createNavigation())); |
| 1099 |
|
| 1100 |
return null; |
| 1101 |
} |
| 1102 |
|
| 1103 |
/** |
| 1104 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1105 |
* |
| 1106 |
* @generated |
| 1107 |
*/ |
| 1108 |
@Override |
| 1109 |
public Object caseInitEdgeCreationOperation(InitEdgeCreationOperation object) { |
| 1110 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INIT_EDGE_CREATION_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateView())); |
| 1111 |
|
| 1112 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INIT_EDGE_CREATION_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateEdgeView())); |
| 1113 |
|
| 1114 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INIT_EDGE_CREATION_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createNavigation())); |
| 1115 |
|
| 1116 |
return null; |
| 1117 |
} |
| 1118 |
|
| 1119 |
/** |
| 1120 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1121 |
* |
| 1122 |
* @generated |
| 1123 |
*/ |
| 1124 |
@Override |
| 1125 |
public Object caseInitialContainerDropOperation(InitialContainerDropOperation object) { |
| 1126 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_CONTAINER_DROP_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateView())); |
| 1127 |
|
| 1128 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_CONTAINER_DROP_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateEdgeView())); |
| 1129 |
|
| 1130 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.INITIAL_CONTAINER_DROP_OPERATION__FIRST_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createNavigation())); |
| 1131 |
|
| 1132 |
return null; |
| 1133 |
} |
| 1134 |
|
| 1135 |
/** |
| 1136 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1137 |
* |
| 1138 |
* @generated |
| 1139 |
*/ |
| 1140 |
@Override |
| 1141 |
public Object caseSwitchChild(SwitchChild object) { |
| 1142 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.SWITCH_CHILD__SUB_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateView())); |
| 1143 |
|
| 1144 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.SWITCH_CHILD__SUB_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createCreateEdgeView())); |
| 1145 |
|
| 1146 |
newChildDescriptors.add(createChildParameter(ToolPackage.Literals.SWITCH_CHILD__SUB_MODEL_OPERATIONS, ToolFactory.eINSTANCE.createNavigation())); |
| 1147 |
|
| 1148 |
return null; |
| 1149 |
} |
| 1150 |
|
| 1151 |
/** |
| 1152 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1153 |
* |
| 1154 |
* @generated |
| 1155 |
*/ |
| 1156 |
protected CommandParameter createChildParameter(Object feature, Object child) { |
| 1157 |
return new CommandParameter(null, feature, child); |
| 1158 |
} |
| 1159 |
|
| 1160 |
} |
| 1161 |
|
| 1162 |
/** |
| 1163 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1164 |
* |
| 1165 |
* @generated |
| 1166 |
*/ |
| 1167 |
public Collection<Object> getNewChildDescriptors(Object object, EditingDomain editingDomain) { |
| 1168 |
ArrayList<Object> result = new ArrayList<Object>(); |
| 1169 |
new CreationSwitch(result, editingDomain).doSwitch((EObject) object); |
| 1170 |
return result; |
| 1171 |
} |
| 1172 |
|
| 1173 |
/** |
| 1174 |
* <!-- begin-user-doc --> <!-- end-user-doc --> |
| 1175 |
* |
| 1176 |
* @generated |
| 1177 |
*/ |
| 1178 |
public ResourceLocator getResourceLocator() { |
| 1179 |
return DiagramUIPlugin.INSTANCE; |
| 1180 |
} |
| 1181 |
} |
| 1182 |
|
| 886 |
} |
1183 |
} |