| 1 | /* |
| 2 | *Copyright 2007, IPD, SDQ, University of Karlsruhe |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.repository.part; |
| 5 | |
| 6 | import org.eclipse.core.runtime.Platform; |
| 7 | import org.eclipse.emf.ecore.EAnnotation; |
| 8 | import org.eclipse.emf.ecore.EObject; |
| 9 | import org.eclipse.gmf.runtime.notation.Diagram; |
| 10 | import org.eclipse.gmf.runtime.notation.View; |
| 11 | |
| 12 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentComponentParameterCompartmentEditPart; |
| 13 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentEditPart; |
| 14 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentEntityNameEditPart; |
| 15 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentPassiveResourceCompartmentEditPart; |
| 16 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentSEFFCompartmentEditPart; |
| 17 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeEditPart; |
| 18 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeEntityNameEditPart; |
| 19 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeParentProvidesComponentTypesEditPart; |
| 20 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeParentProvidesComponentTypesLabelEditPart; |
| 21 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompositeComponentEditPart; |
| 22 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompositeComponentEntityNameEditPart; |
| 23 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventGroupEditPart; |
| 24 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventGroupEntityNameEditPart; |
| 25 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventGroupEventTypeListEditPart; |
| 26 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventTypeEditPart; |
| 27 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ImplementationComponentTypeParentCompleteComponentTypesEditPart; |
| 28 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ImplementationComponentTypeParentCompleteTypesLabelEditPart; |
| 29 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureInterfaceEditPart; |
| 30 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureInterfaceEntityNameEditPart; |
| 31 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureInterfaceInfrastructureSignatureListEditPart; |
| 32 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureProvidedRoleEditPart; |
| 33 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureRequiredRoleEditPart; |
| 34 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureSignatureEditPart; |
| 35 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationInterfaceEditPart; |
| 36 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationInterfaceEntityNameEditPart; |
| 37 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationInterfaceSignatureListEditPart; |
| 38 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationProvidedRoleEditPart; |
| 39 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationProvidedRoleLabelEditPart; |
| 40 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationRequiredRoleEditPart; |
| 41 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationRequiredRoleLabelEditPart; |
| 42 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationSignatureEditPart; |
| 43 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.PassiveResourceEditPart; |
| 44 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ProvidesComponentTypeEditPart; |
| 45 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ProvidesComponentTypeEntityNameEditPart; |
| 46 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.RepositoryEditPart; |
| 47 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ResourceDemandingSEFFEditPart; |
| 48 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SinkRoleEditPart; |
| 49 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SinkRoleLabelEditPart; |
| 50 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SourceRoleEditPart; |
| 51 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SourceRoleLabelEditPart; |
| 52 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SubSystemEditPart; |
| 53 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SubSystemEntityNameEditPart; |
| 54 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableCharacterisationEditPart; |
| 55 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart; |
| 56 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableUsageEditPart; |
| 57 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableUsageLabelEditPart; |
| 58 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.WrappingLabel2EditPart; |
| 59 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.WrappingLabelEditPart; |
| 60 | import de.uka.ipd.sdq.pcm.parameter.ParameterPackage; |
| 61 | import de.uka.ipd.sdq.pcm.repository.Repository; |
| 62 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
| 63 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
| 64 | import de.uka.ipd.sdq.pcm.subsystem.SubsystemPackage; |
| 65 | |
| 66 | /** |
| 67 | * This registry is used to determine which type of visual object should be |
| 68 | * created for the corresponding Diagram, Node, ChildNode or Link represented |
| 69 | * by a domain model object. |
| 70 | * |
| 71 | * @generated |
| 72 | */ |
| 73 | public class PalladioComponentModelVisualIDRegistry { |
| 74 | |
| 75 | /** |
| 76 | * @generated |
| 77 | */ |
| 78 | private static final String DEBUG_KEY = "de.uka.ipd.sdq.pcm.gmf.repository/debug/visualID"; //$NON-NLS-1$ |
| 79 | |
| 80 | /** |
| 81 | * @generated |
| 82 | */ |
| 83 | public static int getVisualID(View view) { |
| 84 | if (view instanceof Diagram) { |
| 85 | if (RepositoryEditPart.MODEL_ID.equals(view.getType())) { |
| 86 | return RepositoryEditPart.VISUAL_ID; |
| 87 | } else { |
| 88 | return -1; |
| 89 | } |
| 90 | } |
| 91 | return de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry |
| 92 | .getVisualID(view.getType()); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * @generated |
| 97 | */ |
| 98 | public static String getModelID(View view) { |
| 99 | View diagram = view.getDiagram(); |
| 100 | while (view != diagram) { |
| 101 | EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ |
| 102 | if (annotation != null) { |
| 103 | return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$ |
| 104 | } |
| 105 | view = (View) view.eContainer(); |
| 106 | } |
| 107 | return diagram != null ? diagram.getType() : null; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * @generated |
| 112 | */ |
| 113 | public static int getVisualID(String type) { |
| 114 | try { |
| 115 | return Integer.parseInt(type); |
| 116 | } catch (NumberFormatException e) { |
| 117 | if (Boolean.TRUE.toString().equalsIgnoreCase( |
| 118 | Platform.getDebugOption(DEBUG_KEY))) { |
| 119 | PalladioComponentModelRepositoryDiagramEditorPlugin |
| 120 | .getInstance().logError( |
| 121 | "Unable to parse view type as a visualID number: " |
| 122 | + type); |
| 123 | } |
| 124 | } |
| 125 | return -1; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * @generated |
| 130 | */ |
| 131 | public static String getType(int visualID) { |
| 132 | return String.valueOf(visualID); |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * @generated |
| 137 | */ |
| 138 | public static int getDiagramVisualID(EObject domainElement) { |
| 139 | if (domainElement == null) { |
| 140 | return -1; |
| 141 | } |
| 142 | if (RepositoryPackage.eINSTANCE.getRepository().isSuperTypeOf( |
| 143 | domainElement.eClass()) |
| 144 | && isDiagram((Repository) domainElement)) { |
| 145 | return RepositoryEditPart.VISUAL_ID; |
| 146 | } |
| 147 | return -1; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * @generated |
| 152 | */ |
| 153 | public static int getNodeVisualID(View containerView, EObject domainElement) { |
| 154 | if (domainElement == null) { |
| 155 | return -1; |
| 156 | } |
| 157 | String containerModelID = de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry |
| 158 | .getModelID(containerView); |
| 159 | if (!RepositoryEditPart.MODEL_ID.equals(containerModelID)) { |
| 160 | return -1; |
| 161 | } |
| 162 | int containerVisualID; |
| 163 | if (RepositoryEditPart.MODEL_ID.equals(containerModelID)) { |
| 164 | containerVisualID = de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry |
| 165 | .getVisualID(containerView); |
| 166 | } else { |
| 167 | if (containerView instanceof Diagram) { |
| 168 | containerVisualID = RepositoryEditPart.VISUAL_ID; |
| 169 | } else { |
| 170 | return -1; |
| 171 | } |
| 172 | } |
| 173 | switch (containerVisualID) { |
| 174 | case OperationInterfaceSignatureListEditPart.VISUAL_ID: |
| 175 | if (RepositoryPackage.eINSTANCE.getOperationSignature() |
| 176 | .isSuperTypeOf(domainElement.eClass())) { |
| 177 | return OperationSignatureEditPart.VISUAL_ID; |
| 178 | } |
| 179 | break; |
| 180 | case EventGroupEventTypeListEditPart.VISUAL_ID: |
| 181 | if (RepositoryPackage.eINSTANCE.getEventType().isSuperTypeOf( |
| 182 | domainElement.eClass())) { |
| 183 | return EventTypeEditPart.VISUAL_ID; |
| 184 | } |
| 185 | break; |
| 186 | case BasicComponentSEFFCompartmentEditPart.VISUAL_ID: |
| 187 | if (SeffPackage.eINSTANCE.getResourceDemandingSEFF().isSuperTypeOf( |
| 188 | domainElement.eClass())) { |
| 189 | return ResourceDemandingSEFFEditPart.VISUAL_ID; |
| 190 | } |
| 191 | break; |
| 192 | case BasicComponentPassiveResourceCompartmentEditPart.VISUAL_ID: |
| 193 | if (RepositoryPackage.eINSTANCE.getPassiveResource().isSuperTypeOf( |
| 194 | domainElement.eClass())) { |
| 195 | return PassiveResourceEditPart.VISUAL_ID; |
| 196 | } |
| 197 | break; |
| 198 | case BasicComponentComponentParameterCompartmentEditPart.VISUAL_ID: |
| 199 | if (ParameterPackage.eINSTANCE.getVariableUsage().isSuperTypeOf( |
| 200 | domainElement.eClass())) { |
| 201 | return VariableUsageEditPart.VISUAL_ID; |
| 202 | } |
| 203 | break; |
| 204 | case VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart.VISUAL_ID: |
| 205 | if (ParameterPackage.eINSTANCE.getVariableCharacterisation() |
| 206 | .isSuperTypeOf(domainElement.eClass())) { |
| 207 | return VariableCharacterisationEditPart.VISUAL_ID; |
| 208 | } |
| 209 | break; |
| 210 | case InfrastructureInterfaceInfrastructureSignatureListEditPart.VISUAL_ID: |
| 211 | if (RepositoryPackage.eINSTANCE.getInfrastructureSignature() |
| 212 | .isSuperTypeOf(domainElement.eClass())) { |
| 213 | return InfrastructureSignatureEditPart.VISUAL_ID; |
| 214 | } |
| 215 | break; |
| 216 | case RepositoryEditPart.VISUAL_ID: |
| 217 | if (RepositoryPackage.eINSTANCE.getOperationInterface() |
| 218 | .isSuperTypeOf(domainElement.eClass())) { |
| 219 | return OperationInterfaceEditPart.VISUAL_ID; |
| 220 | } |
| 221 | if (RepositoryPackage.eINSTANCE.getEventGroup().isSuperTypeOf( |
| 222 | domainElement.eClass())) { |
| 223 | return EventGroupEditPart.VISUAL_ID; |
| 224 | } |
| 225 | if (RepositoryPackage.eINSTANCE.getBasicComponent().isSuperTypeOf( |
| 226 | domainElement.eClass())) { |
| 227 | return BasicComponentEditPart.VISUAL_ID; |
| 228 | } |
| 229 | if (RepositoryPackage.eINSTANCE.getCompositeComponent() |
| 230 | .isSuperTypeOf(domainElement.eClass())) { |
| 231 | return CompositeComponentEditPart.VISUAL_ID; |
| 232 | } |
| 233 | if (RepositoryPackage.eINSTANCE.getCompleteComponentType() |
| 234 | .isSuperTypeOf(domainElement.eClass())) { |
| 235 | return CompleteComponentTypeEditPart.VISUAL_ID; |
| 236 | } |
| 237 | if (RepositoryPackage.eINSTANCE.getProvidesComponentType() |
| 238 | .isSuperTypeOf(domainElement.eClass())) { |
| 239 | return ProvidesComponentTypeEditPart.VISUAL_ID; |
| 240 | } |
| 241 | if (SubsystemPackage.eINSTANCE.getSubSystem().isSuperTypeOf( |
| 242 | domainElement.eClass())) { |
| 243 | return SubSystemEditPart.VISUAL_ID; |
| 244 | } |
| 245 | if (RepositoryPackage.eINSTANCE.getInfrastructureInterface() |
| 246 | .isSuperTypeOf(domainElement.eClass())) { |
| 247 | return InfrastructureInterfaceEditPart.VISUAL_ID; |
| 248 | } |
| 249 | break; |
| 250 | } |
| 251 | return -1; |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * @generated |
| 256 | */ |
| 257 | public static boolean canCreateNode(View containerView, int nodeVisualID) { |
| 258 | String containerModelID = de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry |
| 259 | .getModelID(containerView); |
| 260 | if (!RepositoryEditPart.MODEL_ID.equals(containerModelID)) { |
| 261 | return false; |
| 262 | } |
| 263 | int containerVisualID; |
| 264 | if (RepositoryEditPart.MODEL_ID.equals(containerModelID)) { |
| 265 | containerVisualID = de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry |
| 266 | .getVisualID(containerView); |
| 267 | } else { |
| 268 | if (containerView instanceof Diagram) { |
| 269 | containerVisualID = RepositoryEditPart.VISUAL_ID; |
| 270 | } else { |
| 271 | return false; |
| 272 | } |
| 273 | } |
| 274 | switch (containerVisualID) { |
| 275 | case OperationInterfaceEditPart.VISUAL_ID: |
| 276 | if (OperationInterfaceEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 277 | return true; |
| 278 | } |
| 279 | if (OperationInterfaceSignatureListEditPart.VISUAL_ID == nodeVisualID) { |
| 280 | return true; |
| 281 | } |
| 282 | break; |
| 283 | case EventGroupEditPart.VISUAL_ID: |
| 284 | if (EventGroupEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 285 | return true; |
| 286 | } |
| 287 | if (EventGroupEventTypeListEditPart.VISUAL_ID == nodeVisualID) { |
| 288 | return true; |
| 289 | } |
| 290 | break; |
| 291 | case BasicComponentEditPart.VISUAL_ID: |
| 292 | if (BasicComponentEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 293 | return true; |
| 294 | } |
| 295 | if (BasicComponentSEFFCompartmentEditPart.VISUAL_ID == nodeVisualID) { |
| 296 | return true; |
| 297 | } |
| 298 | if (BasicComponentPassiveResourceCompartmentEditPart.VISUAL_ID == nodeVisualID) { |
| 299 | return true; |
| 300 | } |
| 301 | if (BasicComponentComponentParameterCompartmentEditPart.VISUAL_ID == nodeVisualID) { |
| 302 | return true; |
| 303 | } |
| 304 | break; |
| 305 | case CompositeComponentEditPart.VISUAL_ID: |
| 306 | if (CompositeComponentEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 307 | return true; |
| 308 | } |
| 309 | break; |
| 310 | case CompleteComponentTypeEditPart.VISUAL_ID: |
| 311 | if (CompleteComponentTypeEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 312 | return true; |
| 313 | } |
| 314 | break; |
| 315 | case ProvidesComponentTypeEditPart.VISUAL_ID: |
| 316 | if (ProvidesComponentTypeEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 317 | return true; |
| 318 | } |
| 319 | break; |
| 320 | case SubSystemEditPart.VISUAL_ID: |
| 321 | if (SubSystemEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 322 | return true; |
| 323 | } |
| 324 | break; |
| 325 | case InfrastructureInterfaceEditPart.VISUAL_ID: |
| 326 | if (InfrastructureInterfaceEntityNameEditPart.VISUAL_ID == nodeVisualID) { |
| 327 | return true; |
| 328 | } |
| 329 | if (InfrastructureInterfaceInfrastructureSignatureListEditPart.VISUAL_ID == nodeVisualID) { |
| 330 | return true; |
| 331 | } |
| 332 | break; |
| 333 | case VariableUsageEditPart.VISUAL_ID: |
| 334 | if (VariableUsageLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 335 | return true; |
| 336 | } |
| 337 | if (VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart.VISUAL_ID == nodeVisualID) { |
| 338 | return true; |
| 339 | } |
| 340 | break; |
| 341 | case OperationInterfaceSignatureListEditPart.VISUAL_ID: |
| 342 | if (OperationSignatureEditPart.VISUAL_ID == nodeVisualID) { |
| 343 | return true; |
| 344 | } |
| 345 | break; |
| 346 | case EventGroupEventTypeListEditPart.VISUAL_ID: |
| 347 | if (EventTypeEditPart.VISUAL_ID == nodeVisualID) { |
| 348 | return true; |
| 349 | } |
| 350 | break; |
| 351 | case BasicComponentSEFFCompartmentEditPart.VISUAL_ID: |
| 352 | if (ResourceDemandingSEFFEditPart.VISUAL_ID == nodeVisualID) { |
| 353 | return true; |
| 354 | } |
| 355 | break; |
| 356 | case BasicComponentPassiveResourceCompartmentEditPart.VISUAL_ID: |
| 357 | if (PassiveResourceEditPart.VISUAL_ID == nodeVisualID) { |
| 358 | return true; |
| 359 | } |
| 360 | break; |
| 361 | case BasicComponentComponentParameterCompartmentEditPart.VISUAL_ID: |
| 362 | if (VariableUsageEditPart.VISUAL_ID == nodeVisualID) { |
| 363 | return true; |
| 364 | } |
| 365 | break; |
| 366 | case VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart.VISUAL_ID: |
| 367 | if (VariableCharacterisationEditPart.VISUAL_ID == nodeVisualID) { |
| 368 | return true; |
| 369 | } |
| 370 | break; |
| 371 | case InfrastructureInterfaceInfrastructureSignatureListEditPart.VISUAL_ID: |
| 372 | if (InfrastructureSignatureEditPart.VISUAL_ID == nodeVisualID) { |
| 373 | return true; |
| 374 | } |
| 375 | break; |
| 376 | case RepositoryEditPart.VISUAL_ID: |
| 377 | if (OperationInterfaceEditPart.VISUAL_ID == nodeVisualID) { |
| 378 | return true; |
| 379 | } |
| 380 | if (EventGroupEditPart.VISUAL_ID == nodeVisualID) { |
| 381 | return true; |
| 382 | } |
| 383 | if (BasicComponentEditPart.VISUAL_ID == nodeVisualID) { |
| 384 | return true; |
| 385 | } |
| 386 | if (CompositeComponentEditPart.VISUAL_ID == nodeVisualID) { |
| 387 | return true; |
| 388 | } |
| 389 | if (CompleteComponentTypeEditPart.VISUAL_ID == nodeVisualID) { |
| 390 | return true; |
| 391 | } |
| 392 | if (ProvidesComponentTypeEditPart.VISUAL_ID == nodeVisualID) { |
| 393 | return true; |
| 394 | } |
| 395 | if (SubSystemEditPart.VISUAL_ID == nodeVisualID) { |
| 396 | return true; |
| 397 | } |
| 398 | if (InfrastructureInterfaceEditPart.VISUAL_ID == nodeVisualID) { |
| 399 | return true; |
| 400 | } |
| 401 | break; |
| 402 | case OperationProvidedRoleEditPart.VISUAL_ID: |
| 403 | if (OperationProvidedRoleLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 404 | return true; |
| 405 | } |
| 406 | break; |
| 407 | case InfrastructureProvidedRoleEditPart.VISUAL_ID: |
| 408 | if (WrappingLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 409 | return true; |
| 410 | } |
| 411 | break; |
| 412 | case InfrastructureRequiredRoleEditPart.VISUAL_ID: |
| 413 | if (WrappingLabel2EditPart.VISUAL_ID == nodeVisualID) { |
| 414 | return true; |
| 415 | } |
| 416 | break; |
| 417 | case SinkRoleEditPart.VISUAL_ID: |
| 418 | if (SinkRoleLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 419 | return true; |
| 420 | } |
| 421 | break; |
| 422 | case OperationRequiredRoleEditPart.VISUAL_ID: |
| 423 | if (OperationRequiredRoleLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 424 | return true; |
| 425 | } |
| 426 | break; |
| 427 | case ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID: |
| 428 | if (ImplementationComponentTypeParentCompleteTypesLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 429 | return true; |
| 430 | } |
| 431 | break; |
| 432 | case CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID: |
| 433 | if (CompleteComponentTypeParentProvidesComponentTypesLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 434 | return true; |
| 435 | } |
| 436 | break; |
| 437 | case SourceRoleEditPart.VISUAL_ID: |
| 438 | if (SourceRoleLabelEditPart.VISUAL_ID == nodeVisualID) { |
| 439 | return true; |
| 440 | } |
| 441 | break; |
| 442 | } |
| 443 | return false; |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * @generated |
| 448 | */ |
| 449 | public static int getLinkWithClassVisualID(EObject domainElement) { |
| 450 | if (domainElement == null) { |
| 451 | return -1; |
| 452 | } |
| 453 | if (RepositoryPackage.eINSTANCE.getOperationProvidedRole() |
| 454 | .isSuperTypeOf(domainElement.eClass())) { |
| 455 | return OperationProvidedRoleEditPart.VISUAL_ID; |
| 456 | } |
| 457 | if (RepositoryPackage.eINSTANCE.getInfrastructureProvidedRole() |
| 458 | .isSuperTypeOf(domainElement.eClass())) { |
| 459 | return InfrastructureProvidedRoleEditPart.VISUAL_ID; |
| 460 | } |
| 461 | if (RepositoryPackage.eINSTANCE.getInfrastructureRequiredRole() |
| 462 | .isSuperTypeOf(domainElement.eClass())) { |
| 463 | return InfrastructureRequiredRoleEditPart.VISUAL_ID; |
| 464 | } |
| 465 | if (RepositoryPackage.eINSTANCE.getSinkRole().isSuperTypeOf( |
| 466 | domainElement.eClass())) { |
| 467 | return SinkRoleEditPart.VISUAL_ID; |
| 468 | } |
| 469 | if (RepositoryPackage.eINSTANCE.getOperationRequiredRole() |
| 470 | .isSuperTypeOf(domainElement.eClass())) { |
| 471 | return OperationRequiredRoleEditPart.VISUAL_ID; |
| 472 | } |
| 473 | if (RepositoryPackage.eINSTANCE.getSourceRole().isSuperTypeOf( |
| 474 | domainElement.eClass())) { |
| 475 | return SourceRoleEditPart.VISUAL_ID; |
| 476 | } |
| 477 | return -1; |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * User can change implementation of this method to handle some specific |
| 482 | * situations not covered by default logic. |
| 483 | * |
| 484 | * @generated |
| 485 | */ |
| 486 | private static boolean isDiagram(Repository element) { |
| 487 | return true; |
| 488 | } |
| 489 | } |