| 1 | /* |
| 2 | * Copyright 2007, IPD, SDQ, University of Karlsruhe |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.repository.navigator; |
| 5 | |
| 6 | import java.util.ArrayList; |
| 7 | import java.util.Collection; |
| 8 | import java.util.Collections; |
| 9 | import java.util.HashMap; |
| 10 | import java.util.Iterator; |
| 11 | |
| 12 | import org.eclipse.core.resources.IFile; |
| 13 | import org.eclipse.emf.common.util.URI; |
| 14 | import org.eclipse.emf.ecore.resource.Resource; |
| 15 | import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; |
| 16 | import org.eclipse.emf.transaction.TransactionalEditingDomain; |
| 17 | import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; |
| 18 | import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; |
| 19 | import org.eclipse.gmf.runtime.notation.Diagram; |
| 20 | import org.eclipse.gmf.runtime.notation.Edge; |
| 21 | import org.eclipse.gmf.runtime.notation.View; |
| 22 | import org.eclipse.jface.viewers.Viewer; |
| 23 | import org.eclipse.ui.IMemento; |
| 24 | import org.eclipse.ui.navigator.ICommonContentExtensionSite; |
| 25 | import org.eclipse.ui.navigator.ICommonContentProvider; |
| 26 | |
| 27 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentComponentParameterCompartmentEditPart; |
| 28 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentEditPart; |
| 29 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentPassiveResourceCompartmentEditPart; |
| 30 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentSEFFCompartmentEditPart; |
| 31 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeEditPart; |
| 32 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeParentProvidesComponentTypesEditPart; |
| 33 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompositeComponentEditPart; |
| 34 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventGroupEditPart; |
| 35 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventGroupEventTypeListEditPart; |
| 36 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventTypeEditPart; |
| 37 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ImplementationComponentTypeParentCompleteComponentTypesEditPart; |
| 38 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureInterfaceEditPart; |
| 39 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureInterfaceInfrastructureSignatureListEditPart; |
| 40 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureProvidedRoleEditPart; |
| 41 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureRequiredRoleEditPart; |
| 42 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureSignatureEditPart; |
| 43 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationInterfaceEditPart; |
| 44 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationInterfaceSignatureListEditPart; |
| 45 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationProvidedRoleEditPart; |
| 46 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationRequiredRoleEditPart; |
| 47 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationSignatureEditPart; |
| 48 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.PassiveResourceEditPart; |
| 49 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ProvidesComponentTypeEditPart; |
| 50 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.RepositoryEditPart; |
| 51 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ResourceDemandingSEFFEditPart; |
| 52 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SinkRoleEditPart; |
| 53 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SourceRoleEditPart; |
| 54 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SubSystemEditPart; |
| 55 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableCharacterisationEditPart; |
| 56 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart; |
| 57 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableUsageEditPart; |
| 58 | import de.uka.ipd.sdq.pcm.gmf.repository.part.Messages; |
| 59 | import de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry; |
| 60 | |
| 61 | /** |
| 62 | * @generated |
| 63 | */ |
| 64 | public class PalladioComponentModelNavigatorContentProvider implements |
| 65 | ICommonContentProvider { |
| 66 | |
| 67 | /** |
| 68 | * @generated |
| 69 | */ |
| 70 | private static final Object[] EMPTY_ARRAY = new Object[0]; |
| 71 | |
| 72 | /** |
| 73 | * @generated |
| 74 | */ |
| 75 | private Viewer myViewer; |
| 76 | /** |
| 77 | * @generated |
| 78 | */ |
| 79 | private AdapterFactoryEditingDomain myEditingDomain; |
| 80 | /** |
| 81 | * @generated |
| 82 | */ |
| 83 | private WorkspaceSynchronizer myWorkspaceSynchronizer; |
| 84 | /** |
| 85 | * @generated |
| 86 | */ |
| 87 | private Runnable myViewerRefreshRunnable; |
| 88 | |
| 89 | /** |
| 90 | * @generated |
| 91 | */ |
| 92 | public PalladioComponentModelNavigatorContentProvider() { |
| 93 | TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE |
| 94 | .createEditingDomain(); |
| 95 | myEditingDomain = (AdapterFactoryEditingDomain) editingDomain; |
| 96 | myEditingDomain.setResourceToReadOnlyMap(new HashMap() { |
| 97 | public Object get(Object key) { |
| 98 | if (!containsKey(key)) { |
| 99 | put(key, Boolean.TRUE); |
| 100 | } |
| 101 | return super.get(key); |
| 102 | } |
| 103 | }); |
| 104 | myViewerRefreshRunnable = new Runnable() { |
| 105 | public void run() { |
| 106 | if (myViewer != null) { |
| 107 | myViewer.refresh(); |
| 108 | } |
| 109 | } |
| 110 | }; |
| 111 | myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, |
| 112 | new WorkspaceSynchronizer.Delegate() { |
| 113 | public void dispose() { |
| 114 | } |
| 115 | |
| 116 | public boolean handleResourceChanged(final Resource resource) { |
| 117 | for (Iterator it = myEditingDomain.getResourceSet() |
| 118 | .getResources().iterator(); it.hasNext();) { |
| 119 | Resource nextResource = (Resource) it.next(); |
| 120 | nextResource.unload(); |
| 121 | } |
| 122 | if (myViewer != null) { |
| 123 | myViewer.getControl().getDisplay().asyncExec( |
| 124 | myViewerRefreshRunnable); |
| 125 | } |
| 126 | return true; |
| 127 | } |
| 128 | |
| 129 | public boolean handleResourceDeleted(Resource resource) { |
| 130 | for (Iterator it = myEditingDomain.getResourceSet() |
| 131 | .getResources().iterator(); it.hasNext();) { |
| 132 | Resource nextResource = (Resource) it.next(); |
| 133 | nextResource.unload(); |
| 134 | } |
| 135 | if (myViewer != null) { |
| 136 | myViewer.getControl().getDisplay().asyncExec( |
| 137 | myViewerRefreshRunnable); |
| 138 | } |
| 139 | return true; |
| 140 | } |
| 141 | |
| 142 | public boolean handleResourceMoved(Resource resource, |
| 143 | final URI newURI) { |
| 144 | for (Iterator it = myEditingDomain.getResourceSet() |
| 145 | .getResources().iterator(); it.hasNext();) { |
| 146 | Resource nextResource = (Resource) it.next(); |
| 147 | nextResource.unload(); |
| 148 | } |
| 149 | if (myViewer != null) { |
| 150 | myViewer.getControl().getDisplay().asyncExec( |
| 151 | myViewerRefreshRunnable); |
| 152 | } |
| 153 | return true; |
| 154 | } |
| 155 | }); |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * @generated |
| 160 | */ |
| 161 | public void dispose() { |
| 162 | myWorkspaceSynchronizer.dispose(); |
| 163 | myWorkspaceSynchronizer = null; |
| 164 | myViewerRefreshRunnable = null; |
| 165 | for (Iterator it = myEditingDomain.getResourceSet().getResources() |
| 166 | .iterator(); it.hasNext();) { |
| 167 | Resource resource = (Resource) it.next(); |
| 168 | resource.unload(); |
| 169 | } |
| 170 | ((TransactionalEditingDomain) myEditingDomain).dispose(); |
| 171 | myEditingDomain = null; |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * @generated |
| 176 | */ |
| 177 | public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
| 178 | myViewer = viewer; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * @generated |
| 183 | */ |
| 184 | public Object[] getElements(Object inputElement) { |
| 185 | return getChildren(inputElement); |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * @generated |
| 190 | */ |
| 191 | public void restoreState(IMemento aMemento) { |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * @generated |
| 196 | */ |
| 197 | public void saveState(IMemento aMemento) { |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * @generated |
| 202 | */ |
| 203 | public void init(ICommonContentExtensionSite aConfig) { |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * @generated |
| 208 | */ |
| 209 | public Object[] getChildren(Object parentElement) { |
| 210 | if (parentElement instanceof IFile) { |
| 211 | IFile file = (IFile) parentElement; |
| 212 | URI fileURI = URI.createPlatformResourceURI(file.getFullPath() |
| 213 | .toString(), true); |
| 214 | Resource resource = myEditingDomain.getResourceSet().getResource( |
| 215 | fileURI, true); |
| 216 | Collection result = new ArrayList(); |
| 217 | result.addAll(createNavigatorItems(selectViewsByType(resource |
| 218 | .getContents(), RepositoryEditPart.MODEL_ID), file, false)); |
| 219 | return result.toArray(); |
| 220 | } |
| 221 | |
| 222 | if (parentElement instanceof PalladioComponentModelNavigatorGroup) { |
| 223 | PalladioComponentModelNavigatorGroup group = (PalladioComponentModelNavigatorGroup) parentElement; |
| 224 | return group.getChildren(); |
| 225 | } |
| 226 | |
| 227 | if (parentElement instanceof PalladioComponentModelNavigatorItem) { |
| 228 | PalladioComponentModelNavigatorItem navigatorItem = (PalladioComponentModelNavigatorItem) parentElement; |
| 229 | if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) { |
| 230 | return EMPTY_ARRAY; |
| 231 | } |
| 232 | return getViewChildren(navigatorItem.getView(), parentElement); |
| 233 | } |
| 234 | |
| 235 | return EMPTY_ARRAY; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * @generated |
| 240 | */ |
| 241 | private Object[] getViewChildren(View view, Object parentElement) { |
| 242 | switch (PalladioComponentModelVisualIDRegistry.getVisualID(view)) { |
| 243 | |
| 244 | case RepositoryEditPart.VISUAL_ID: { |
| 245 | Collection result = new ArrayList(); |
| 246 | result.addAll(getForeignShortcuts((Diagram) view, parentElement)); |
| 247 | PalladioComponentModelNavigatorGroup links = new PalladioComponentModelNavigatorGroup( |
| 248 | Messages.NavigatorGroupName_Repository_1000_links, |
| 249 | "icons/linksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 250 | Collection connectedViews = getChildrenByType(Collections |
| 251 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 252 | .getType(OperationInterfaceEditPart.VISUAL_ID)); |
| 253 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 254 | false)); |
| 255 | connectedViews = getChildrenByType(Collections.singleton(view), |
| 256 | PalladioComponentModelVisualIDRegistry |
| 257 | .getType(EventGroupEditPart.VISUAL_ID)); |
| 258 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 259 | false)); |
| 260 | connectedViews = getChildrenByType(Collections.singleton(view), |
| 261 | PalladioComponentModelVisualIDRegistry |
| 262 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 263 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 264 | false)); |
| 265 | connectedViews = getChildrenByType(Collections.singleton(view), |
| 266 | PalladioComponentModelVisualIDRegistry |
| 267 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 268 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 269 | false)); |
| 270 | connectedViews = getChildrenByType(Collections.singleton(view), |
| 271 | PalladioComponentModelVisualIDRegistry |
| 272 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 273 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 274 | false)); |
| 275 | connectedViews = getChildrenByType(Collections.singleton(view), |
| 276 | PalladioComponentModelVisualIDRegistry |
| 277 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 278 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 279 | false)); |
| 280 | connectedViews = getChildrenByType(Collections.singleton(view), |
| 281 | PalladioComponentModelVisualIDRegistry |
| 282 | .getType(SubSystemEditPart.VISUAL_ID)); |
| 283 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 284 | false)); |
| 285 | connectedViews = getChildrenByType(Collections.singleton(view), |
| 286 | PalladioComponentModelVisualIDRegistry |
| 287 | .getType(InfrastructureInterfaceEditPart.VISUAL_ID)); |
| 288 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 289 | false)); |
| 290 | connectedViews = getDiagramLinksByType(Collections.singleton(view), |
| 291 | PalladioComponentModelVisualIDRegistry |
| 292 | .getType(OperationProvidedRoleEditPart.VISUAL_ID)); |
| 293 | links |
| 294 | .addChildren(createNavigatorItems(connectedViews, links, |
| 295 | false)); |
| 296 | connectedViews = getDiagramLinksByType( |
| 297 | Collections.singleton(view), |
| 298 | PalladioComponentModelVisualIDRegistry |
| 299 | .getType(InfrastructureProvidedRoleEditPart.VISUAL_ID)); |
| 300 | links |
| 301 | .addChildren(createNavigatorItems(connectedViews, links, |
| 302 | false)); |
| 303 | connectedViews = getDiagramLinksByType( |
| 304 | Collections.singleton(view), |
| 305 | PalladioComponentModelVisualIDRegistry |
| 306 | .getType(InfrastructureRequiredRoleEditPart.VISUAL_ID)); |
| 307 | links |
| 308 | .addChildren(createNavigatorItems(connectedViews, links, |
| 309 | false)); |
| 310 | connectedViews = getDiagramLinksByType(Collections.singleton(view), |
| 311 | PalladioComponentModelVisualIDRegistry |
| 312 | .getType(SinkRoleEditPart.VISUAL_ID)); |
| 313 | links |
| 314 | .addChildren(createNavigatorItems(connectedViews, links, |
| 315 | false)); |
| 316 | connectedViews = getDiagramLinksByType(Collections.singleton(view), |
| 317 | PalladioComponentModelVisualIDRegistry |
| 318 | .getType(OperationRequiredRoleEditPart.VISUAL_ID)); |
| 319 | links |
| 320 | .addChildren(createNavigatorItems(connectedViews, links, |
| 321 | false)); |
| 322 | connectedViews = getDiagramLinksByType( |
| 323 | Collections.singleton(view), |
| 324 | PalladioComponentModelVisualIDRegistry |
| 325 | .getType(ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID)); |
| 326 | links |
| 327 | .addChildren(createNavigatorItems(connectedViews, links, |
| 328 | false)); |
| 329 | connectedViews = getDiagramLinksByType( |
| 330 | Collections.singleton(view), |
| 331 | PalladioComponentModelVisualIDRegistry |
| 332 | .getType(CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID)); |
| 333 | links |
| 334 | .addChildren(createNavigatorItems(connectedViews, links, |
| 335 | false)); |
| 336 | connectedViews = getDiagramLinksByType(Collections.singleton(view), |
| 337 | PalladioComponentModelVisualIDRegistry |
| 338 | .getType(SourceRoleEditPart.VISUAL_ID)); |
| 339 | links |
| 340 | .addChildren(createNavigatorItems(connectedViews, links, |
| 341 | false)); |
| 342 | if (!links.isEmpty()) { |
| 343 | result.add(links); |
| 344 | } |
| 345 | return result.toArray(); |
| 346 | } |
| 347 | |
| 348 | case OperationInterfaceEditPart.VISUAL_ID: { |
| 349 | Collection result = new ArrayList(); |
| 350 | PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup( |
| 351 | Messages.NavigatorGroupName_OperationInterface_2107_incominglinks, |
| 352 | "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 353 | Collection connectedViews = getChildrenByType(Collections |
| 354 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 355 | .getType(OperationInterfaceSignatureListEditPart.VISUAL_ID)); |
| 356 | connectedViews = getChildrenByType(connectedViews, |
| 357 | PalladioComponentModelVisualIDRegistry |
| 358 | .getType(OperationSignatureEditPart.VISUAL_ID)); |
| 359 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 360 | false)); |
| 361 | connectedViews = getIncomingLinksByType( |
| 362 | Collections.singleton(view), |
| 363 | PalladioComponentModelVisualIDRegistry |
| 364 | .getType(OperationProvidedRoleEditPart.VISUAL_ID)); |
| 365 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 366 | incominglinks, true)); |
| 367 | connectedViews = getIncomingLinksByType( |
| 368 | Collections.singleton(view), |
| 369 | PalladioComponentModelVisualIDRegistry |
| 370 | .getType(OperationRequiredRoleEditPart.VISUAL_ID)); |
| 371 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 372 | incominglinks, true)); |
| 373 | if (!incominglinks.isEmpty()) { |
| 374 | result.add(incominglinks); |
| 375 | } |
| 376 | return result.toArray(); |
| 377 | } |
| 378 | |
| 379 | case EventGroupEditPart.VISUAL_ID: { |
| 380 | Collection result = new ArrayList(); |
| 381 | PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup( |
| 382 | Messages.NavigatorGroupName_EventGroup_2108_incominglinks, |
| 383 | "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 384 | Collection connectedViews = getChildrenByType(Collections |
| 385 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 386 | .getType(EventGroupEventTypeListEditPart.VISUAL_ID)); |
| 387 | connectedViews = getChildrenByType(connectedViews, |
| 388 | PalladioComponentModelVisualIDRegistry |
| 389 | .getType(EventTypeEditPart.VISUAL_ID)); |
| 390 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 391 | false)); |
| 392 | connectedViews = getIncomingLinksByType( |
| 393 | Collections.singleton(view), |
| 394 | PalladioComponentModelVisualIDRegistry |
| 395 | .getType(SinkRoleEditPart.VISUAL_ID)); |
| 396 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 397 | incominglinks, true)); |
| 398 | connectedViews = getIncomingLinksByType( |
| 399 | Collections.singleton(view), |
| 400 | PalladioComponentModelVisualIDRegistry |
| 401 | .getType(SourceRoleEditPart.VISUAL_ID)); |
| 402 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 403 | incominglinks, true)); |
| 404 | if (!incominglinks.isEmpty()) { |
| 405 | result.add(incominglinks); |
| 406 | } |
| 407 | return result.toArray(); |
| 408 | } |
| 409 | |
| 410 | case BasicComponentEditPart.VISUAL_ID: { |
| 411 | Collection result = new ArrayList(); |
| 412 | PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup( |
| 413 | Messages.NavigatorGroupName_BasicComponent_2102_outgoinglinks, |
| 414 | "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 415 | Collection connectedViews = getChildrenByType(Collections |
| 416 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 417 | .getType(BasicComponentSEFFCompartmentEditPart.VISUAL_ID)); |
| 418 | connectedViews = getChildrenByType(connectedViews, |
| 419 | PalladioComponentModelVisualIDRegistry |
| 420 | .getType(ResourceDemandingSEFFEditPart.VISUAL_ID)); |
| 421 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 422 | false)); |
| 423 | connectedViews = getChildrenByType( |
| 424 | Collections.singleton(view), |
| 425 | PalladioComponentModelVisualIDRegistry |
| 426 | .getType(BasicComponentPassiveResourceCompartmentEditPart.VISUAL_ID)); |
| 427 | connectedViews = getChildrenByType(connectedViews, |
| 428 | PalladioComponentModelVisualIDRegistry |
| 429 | .getType(PassiveResourceEditPart.VISUAL_ID)); |
| 430 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 431 | false)); |
| 432 | connectedViews = getChildrenByType( |
| 433 | Collections.singleton(view), |
| 434 | PalladioComponentModelVisualIDRegistry |
| 435 | .getType(BasicComponentComponentParameterCompartmentEditPart.VISUAL_ID)); |
| 436 | connectedViews = getChildrenByType(connectedViews, |
| 437 | PalladioComponentModelVisualIDRegistry |
| 438 | .getType(VariableUsageEditPart.VISUAL_ID)); |
| 439 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 440 | false)); |
| 441 | connectedViews = getOutgoingLinksByType( |
| 442 | Collections.singleton(view), |
| 443 | PalladioComponentModelVisualIDRegistry |
| 444 | .getType(OperationProvidedRoleEditPart.VISUAL_ID)); |
| 445 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 446 | outgoinglinks, true)); |
| 447 | connectedViews = getOutgoingLinksByType( |
| 448 | Collections.singleton(view), |
| 449 | PalladioComponentModelVisualIDRegistry |
| 450 | .getType(InfrastructureProvidedRoleEditPart.VISUAL_ID)); |
| 451 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 452 | outgoinglinks, true)); |
| 453 | connectedViews = getOutgoingLinksByType( |
| 454 | Collections.singleton(view), |
| 455 | PalladioComponentModelVisualIDRegistry |
| 456 | .getType(InfrastructureRequiredRoleEditPart.VISUAL_ID)); |
| 457 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 458 | outgoinglinks, true)); |
| 459 | connectedViews = getOutgoingLinksByType( |
| 460 | Collections.singleton(view), |
| 461 | PalladioComponentModelVisualIDRegistry |
| 462 | .getType(SinkRoleEditPart.VISUAL_ID)); |
| 463 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 464 | outgoinglinks, true)); |
| 465 | connectedViews = getOutgoingLinksByType( |
| 466 | Collections.singleton(view), |
| 467 | PalladioComponentModelVisualIDRegistry |
| 468 | .getType(OperationRequiredRoleEditPart.VISUAL_ID)); |
| 469 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 470 | outgoinglinks, true)); |
| 471 | connectedViews = getOutgoingLinksByType( |
| 472 | Collections.singleton(view), |
| 473 | PalladioComponentModelVisualIDRegistry |
| 474 | .getType(ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID)); |
| 475 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 476 | outgoinglinks, true)); |
| 477 | connectedViews = getOutgoingLinksByType( |
| 478 | Collections.singleton(view), |
| 479 | PalladioComponentModelVisualIDRegistry |
| 480 | .getType(SourceRoleEditPart.VISUAL_ID)); |
| 481 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 482 | outgoinglinks, true)); |
| 483 | if (!outgoinglinks.isEmpty()) { |
| 484 | result.add(outgoinglinks); |
| 485 | } |
| 486 | return result.toArray(); |
| 487 | } |
| 488 | |
| 489 | case CompositeComponentEditPart.VISUAL_ID: { |
| 490 | Collection result = new ArrayList(); |
| 491 | PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup( |
| 492 | Messages.NavigatorGroupName_CompositeComponent_2103_outgoinglinks, |
| 493 | "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 494 | Collection connectedViews = getOutgoingLinksByType(Collections |
| 495 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 496 | .getType(OperationProvidedRoleEditPart.VISUAL_ID)); |
| 497 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 498 | outgoinglinks, true)); |
| 499 | connectedViews = getOutgoingLinksByType( |
| 500 | Collections.singleton(view), |
| 501 | PalladioComponentModelVisualIDRegistry |
| 502 | .getType(InfrastructureProvidedRoleEditPart.VISUAL_ID)); |
| 503 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 504 | outgoinglinks, true)); |
| 505 | connectedViews = getOutgoingLinksByType( |
| 506 | Collections.singleton(view), |
| 507 | PalladioComponentModelVisualIDRegistry |
| 508 | .getType(InfrastructureRequiredRoleEditPart.VISUAL_ID)); |
| 509 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 510 | outgoinglinks, true)); |
| 511 | connectedViews = getOutgoingLinksByType( |
| 512 | Collections.singleton(view), |
| 513 | PalladioComponentModelVisualIDRegistry |
| 514 | .getType(SinkRoleEditPart.VISUAL_ID)); |
| 515 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 516 | outgoinglinks, true)); |
| 517 | connectedViews = getOutgoingLinksByType( |
| 518 | Collections.singleton(view), |
| 519 | PalladioComponentModelVisualIDRegistry |
| 520 | .getType(OperationRequiredRoleEditPart.VISUAL_ID)); |
| 521 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 522 | outgoinglinks, true)); |
| 523 | connectedViews = getOutgoingLinksByType( |
| 524 | Collections.singleton(view), |
| 525 | PalladioComponentModelVisualIDRegistry |
| 526 | .getType(ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID)); |
| 527 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 528 | outgoinglinks, true)); |
| 529 | connectedViews = getOutgoingLinksByType( |
| 530 | Collections.singleton(view), |
| 531 | PalladioComponentModelVisualIDRegistry |
| 532 | .getType(SourceRoleEditPart.VISUAL_ID)); |
| 533 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 534 | outgoinglinks, true)); |
| 535 | if (!outgoinglinks.isEmpty()) { |
| 536 | result.add(outgoinglinks); |
| 537 | } |
| 538 | return result.toArray(); |
| 539 | } |
| 540 | |
| 541 | case CompleteComponentTypeEditPart.VISUAL_ID: { |
| 542 | Collection result = new ArrayList(); |
| 543 | PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup( |
| 544 | Messages.NavigatorGroupName_CompleteComponentType_2104_outgoinglinks, |
| 545 | "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 546 | PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup( |
| 547 | Messages.NavigatorGroupName_CompleteComponentType_2104_incominglinks, |
| 548 | "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 549 | Collection connectedViews = getOutgoingLinksByType(Collections |
| 550 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 551 | .getType(OperationProvidedRoleEditPart.VISUAL_ID)); |
| 552 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 553 | outgoinglinks, true)); |
| 554 | connectedViews = getOutgoingLinksByType( |
| 555 | Collections.singleton(view), |
| 556 | PalladioComponentModelVisualIDRegistry |
| 557 | .getType(InfrastructureProvidedRoleEditPart.VISUAL_ID)); |
| 558 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 559 | outgoinglinks, true)); |
| 560 | connectedViews = getOutgoingLinksByType( |
| 561 | Collections.singleton(view), |
| 562 | PalladioComponentModelVisualIDRegistry |
| 563 | .getType(InfrastructureRequiredRoleEditPart.VISUAL_ID)); |
| 564 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 565 | outgoinglinks, true)); |
| 566 | connectedViews = getOutgoingLinksByType( |
| 567 | Collections.singleton(view), |
| 568 | PalladioComponentModelVisualIDRegistry |
| 569 | .getType(SinkRoleEditPart.VISUAL_ID)); |
| 570 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 571 | outgoinglinks, true)); |
| 572 | connectedViews = getOutgoingLinksByType( |
| 573 | Collections.singleton(view), |
| 574 | PalladioComponentModelVisualIDRegistry |
| 575 | .getType(OperationRequiredRoleEditPart.VISUAL_ID)); |
| 576 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 577 | outgoinglinks, true)); |
| 578 | connectedViews = getIncomingLinksByType( |
| 579 | Collections.singleton(view), |
| 580 | PalladioComponentModelVisualIDRegistry |
| 581 | .getType(ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID)); |
| 582 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 583 | incominglinks, true)); |
| 584 | connectedViews = getOutgoingLinksByType( |
| 585 | Collections.singleton(view), |
| 586 | PalladioComponentModelVisualIDRegistry |
| 587 | .getType(CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID)); |
| 588 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 589 | outgoinglinks, true)); |
| 590 | connectedViews = getOutgoingLinksByType( |
| 591 | Collections.singleton(view), |
| 592 | PalladioComponentModelVisualIDRegistry |
| 593 | .getType(SourceRoleEditPart.VISUAL_ID)); |
| 594 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 595 | outgoinglinks, true)); |
| 596 | if (!outgoinglinks.isEmpty()) { |
| 597 | result.add(outgoinglinks); |
| 598 | } |
| 599 | if (!incominglinks.isEmpty()) { |
| 600 | result.add(incominglinks); |
| 601 | } |
| 602 | return result.toArray(); |
| 603 | } |
| 604 | |
| 605 | case ProvidesComponentTypeEditPart.VISUAL_ID: { |
| 606 | Collection result = new ArrayList(); |
| 607 | PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup( |
| 608 | Messages.NavigatorGroupName_ProvidesComponentType_2105_outgoinglinks, |
| 609 | "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 610 | PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup( |
| 611 | Messages.NavigatorGroupName_ProvidesComponentType_2105_incominglinks, |
| 612 | "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 613 | Collection connectedViews = getOutgoingLinksByType(Collections |
| 614 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 615 | .getType(OperationProvidedRoleEditPart.VISUAL_ID)); |
| 616 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 617 | outgoinglinks, true)); |
| 618 | connectedViews = getOutgoingLinksByType( |
| 619 | Collections.singleton(view), |
| 620 | PalladioComponentModelVisualIDRegistry |
| 621 | .getType(InfrastructureProvidedRoleEditPart.VISUAL_ID)); |
| 622 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 623 | outgoinglinks, true)); |
| 624 | connectedViews = getOutgoingLinksByType( |
| 625 | Collections.singleton(view), |
| 626 | PalladioComponentModelVisualIDRegistry |
| 627 | .getType(InfrastructureRequiredRoleEditPart.VISUAL_ID)); |
| 628 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 629 | outgoinglinks, true)); |
| 630 | connectedViews = getOutgoingLinksByType( |
| 631 | Collections.singleton(view), |
| 632 | PalladioComponentModelVisualIDRegistry |
| 633 | .getType(SinkRoleEditPart.VISUAL_ID)); |
| 634 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 635 | outgoinglinks, true)); |
| 636 | connectedViews = getOutgoingLinksByType( |
| 637 | Collections.singleton(view), |
| 638 | PalladioComponentModelVisualIDRegistry |
| 639 | .getType(OperationRequiredRoleEditPart.VISUAL_ID)); |
| 640 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 641 | outgoinglinks, true)); |
| 642 | connectedViews = getIncomingLinksByType( |
| 643 | Collections.singleton(view), |
| 644 | PalladioComponentModelVisualIDRegistry |
| 645 | .getType(CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID)); |
| 646 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 647 | incominglinks, true)); |
| 648 | connectedViews = getOutgoingLinksByType( |
| 649 | Collections.singleton(view), |
| 650 | PalladioComponentModelVisualIDRegistry |
| 651 | .getType(SourceRoleEditPart.VISUAL_ID)); |
| 652 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 653 | outgoinglinks, true)); |
| 654 | if (!outgoinglinks.isEmpty()) { |
| 655 | result.add(outgoinglinks); |
| 656 | } |
| 657 | if (!incominglinks.isEmpty()) { |
| 658 | result.add(incominglinks); |
| 659 | } |
| 660 | return result.toArray(); |
| 661 | } |
| 662 | |
| 663 | case SubSystemEditPart.VISUAL_ID: { |
| 664 | Collection result = new ArrayList(); |
| 665 | PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup( |
| 666 | Messages.NavigatorGroupName_SubSystem_2106_outgoinglinks, |
| 667 | "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 668 | Collection connectedViews = getOutgoingLinksByType(Collections |
| 669 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 670 | .getType(OperationProvidedRoleEditPart.VISUAL_ID)); |
| 671 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 672 | outgoinglinks, true)); |
| 673 | connectedViews = getOutgoingLinksByType( |
| 674 | Collections.singleton(view), |
| 675 | PalladioComponentModelVisualIDRegistry |
| 676 | .getType(InfrastructureProvidedRoleEditPart.VISUAL_ID)); |
| 677 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 678 | outgoinglinks, true)); |
| 679 | connectedViews = getOutgoingLinksByType( |
| 680 | Collections.singleton(view), |
| 681 | PalladioComponentModelVisualIDRegistry |
| 682 | .getType(InfrastructureRequiredRoleEditPart.VISUAL_ID)); |
| 683 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 684 | outgoinglinks, true)); |
| 685 | connectedViews = getOutgoingLinksByType( |
| 686 | Collections.singleton(view), |
| 687 | PalladioComponentModelVisualIDRegistry |
| 688 | .getType(SinkRoleEditPart.VISUAL_ID)); |
| 689 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 690 | outgoinglinks, true)); |
| 691 | connectedViews = getOutgoingLinksByType( |
| 692 | Collections.singleton(view), |
| 693 | PalladioComponentModelVisualIDRegistry |
| 694 | .getType(OperationRequiredRoleEditPart.VISUAL_ID)); |
| 695 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 696 | outgoinglinks, true)); |
| 697 | connectedViews = getOutgoingLinksByType( |
| 698 | Collections.singleton(view), |
| 699 | PalladioComponentModelVisualIDRegistry |
| 700 | .getType(SourceRoleEditPart.VISUAL_ID)); |
| 701 | outgoinglinks.addChildren(createNavigatorItems(connectedViews, |
| 702 | outgoinglinks, true)); |
| 703 | if (!outgoinglinks.isEmpty()) { |
| 704 | result.add(outgoinglinks); |
| 705 | } |
| 706 | return result.toArray(); |
| 707 | } |
| 708 | |
| 709 | case InfrastructureInterfaceEditPart.VISUAL_ID: { |
| 710 | Collection result = new ArrayList(); |
| 711 | PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup( |
| 712 | Messages.NavigatorGroupName_InfrastructureInterface_2109_incominglinks, |
| 713 | "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 714 | Collection connectedViews = getChildrenByType( |
| 715 | Collections.singleton(view), |
| 716 | PalladioComponentModelVisualIDRegistry |
| 717 | .getType(InfrastructureInterfaceInfrastructureSignatureListEditPart.VISUAL_ID)); |
| 718 | connectedViews = getChildrenByType(connectedViews, |
| 719 | PalladioComponentModelVisualIDRegistry |
| 720 | .getType(InfrastructureSignatureEditPart.VISUAL_ID)); |
| 721 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 722 | false)); |
| 723 | connectedViews = getIncomingLinksByType( |
| 724 | Collections.singleton(view), |
| 725 | PalladioComponentModelVisualIDRegistry |
| 726 | .getType(InfrastructureProvidedRoleEditPart.VISUAL_ID)); |
| 727 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 728 | incominglinks, true)); |
| 729 | connectedViews = getIncomingLinksByType( |
| 730 | Collections.singleton(view), |
| 731 | PalladioComponentModelVisualIDRegistry |
| 732 | .getType(InfrastructureRequiredRoleEditPart.VISUAL_ID)); |
| 733 | incominglinks.addChildren(createNavigatorItems(connectedViews, |
| 734 | incominglinks, true)); |
| 735 | if (!incominglinks.isEmpty()) { |
| 736 | result.add(incominglinks); |
| 737 | } |
| 738 | return result.toArray(); |
| 739 | } |
| 740 | |
| 741 | case VariableUsageEditPart.VISUAL_ID: { |
| 742 | Collection result = new ArrayList(); |
| 743 | Collection connectedViews = getChildrenByType( |
| 744 | Collections.singleton(view), |
| 745 | PalladioComponentModelVisualIDRegistry |
| 746 | .getType(VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart.VISUAL_ID)); |
| 747 | connectedViews = getChildrenByType( |
| 748 | connectedViews, |
| 749 | PalladioComponentModelVisualIDRegistry |
| 750 | .getType(VariableCharacterisationEditPart.VISUAL_ID)); |
| 751 | result.addAll(createNavigatorItems(connectedViews, parentElement, |
| 752 | false)); |
| 753 | return result.toArray(); |
| 754 | } |
| 755 | |
| 756 | case OperationProvidedRoleEditPart.VISUAL_ID: { |
| 757 | Collection result = new ArrayList(); |
| 758 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 759 | Messages.NavigatorGroupName_OperationProvidedRole_4105_target, |
| 760 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 761 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 762 | Messages.NavigatorGroupName_OperationProvidedRole_4105_source, |
| 763 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 764 | Collection connectedViews = getLinksTargetByType(Collections |
| 765 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 766 | .getType(OperationInterfaceEditPart.VISUAL_ID)); |
| 767 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 768 | true)); |
| 769 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 770 | PalladioComponentModelVisualIDRegistry |
| 771 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 772 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 773 | true)); |
| 774 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 775 | PalladioComponentModelVisualIDRegistry |
| 776 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 777 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 778 | true)); |
| 779 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 780 | PalladioComponentModelVisualIDRegistry |
| 781 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 782 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 783 | true)); |
| 784 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 785 | PalladioComponentModelVisualIDRegistry |
| 786 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 787 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 788 | true)); |
| 789 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 790 | PalladioComponentModelVisualIDRegistry |
| 791 | .getType(SubSystemEditPart.VISUAL_ID)); |
| 792 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 793 | true)); |
| 794 | if (!target.isEmpty()) { |
| 795 | result.add(target); |
| 796 | } |
| 797 | if (!source.isEmpty()) { |
| 798 | result.add(source); |
| 799 | } |
| 800 | return result.toArray(); |
| 801 | } |
| 802 | |
| 803 | case InfrastructureProvidedRoleEditPart.VISUAL_ID: { |
| 804 | Collection result = new ArrayList(); |
| 805 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 806 | Messages.NavigatorGroupName_InfrastructureProvidedRole_4111_target, |
| 807 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 808 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 809 | Messages.NavigatorGroupName_InfrastructureProvidedRole_4111_source, |
| 810 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 811 | Collection connectedViews = getLinksTargetByType(Collections |
| 812 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 813 | .getType(InfrastructureInterfaceEditPart.VISUAL_ID)); |
| 814 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 815 | true)); |
| 816 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 817 | PalladioComponentModelVisualIDRegistry |
| 818 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 819 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 820 | true)); |
| 821 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 822 | PalladioComponentModelVisualIDRegistry |
| 823 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 824 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 825 | true)); |
| 826 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 827 | PalladioComponentModelVisualIDRegistry |
| 828 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 829 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 830 | true)); |
| 831 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 832 | PalladioComponentModelVisualIDRegistry |
| 833 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 834 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 835 | true)); |
| 836 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 837 | PalladioComponentModelVisualIDRegistry |
| 838 | .getType(SubSystemEditPart.VISUAL_ID)); |
| 839 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 840 | true)); |
| 841 | if (!target.isEmpty()) { |
| 842 | result.add(target); |
| 843 | } |
| 844 | if (!source.isEmpty()) { |
| 845 | result.add(source); |
| 846 | } |
| 847 | return result.toArray(); |
| 848 | } |
| 849 | |
| 850 | case InfrastructureRequiredRoleEditPart.VISUAL_ID: { |
| 851 | Collection result = new ArrayList(); |
| 852 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 853 | Messages.NavigatorGroupName_InfrastructureRequiredRole_4112_target, |
| 854 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 855 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 856 | Messages.NavigatorGroupName_InfrastructureRequiredRole_4112_source, |
| 857 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 858 | Collection connectedViews = getLinksTargetByType(Collections |
| 859 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 860 | .getType(InfrastructureInterfaceEditPart.VISUAL_ID)); |
| 861 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 862 | true)); |
| 863 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 864 | PalladioComponentModelVisualIDRegistry |
| 865 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 866 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 867 | true)); |
| 868 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 869 | PalladioComponentModelVisualIDRegistry |
| 870 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 871 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 872 | true)); |
| 873 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 874 | PalladioComponentModelVisualIDRegistry |
| 875 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 876 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 877 | true)); |
| 878 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 879 | PalladioComponentModelVisualIDRegistry |
| 880 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 881 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 882 | true)); |
| 883 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 884 | PalladioComponentModelVisualIDRegistry |
| 885 | .getType(SubSystemEditPart.VISUAL_ID)); |
| 886 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 887 | true)); |
| 888 | if (!target.isEmpty()) { |
| 889 | result.add(target); |
| 890 | } |
| 891 | if (!source.isEmpty()) { |
| 892 | result.add(source); |
| 893 | } |
| 894 | return result.toArray(); |
| 895 | } |
| 896 | |
| 897 | case SinkRoleEditPart.VISUAL_ID: { |
| 898 | Collection result = new ArrayList(); |
| 899 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 900 | Messages.NavigatorGroupName_SinkRole_4109_target, |
| 901 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 902 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 903 | Messages.NavigatorGroupName_SinkRole_4109_source, |
| 904 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 905 | Collection connectedViews = getLinksTargetByType(Collections |
| 906 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 907 | .getType(EventGroupEditPart.VISUAL_ID)); |
| 908 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 909 | true)); |
| 910 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 911 | PalladioComponentModelVisualIDRegistry |
| 912 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 913 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 914 | true)); |
| 915 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 916 | PalladioComponentModelVisualIDRegistry |
| 917 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 918 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 919 | true)); |
| 920 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 921 | PalladioComponentModelVisualIDRegistry |
| 922 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 923 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 924 | true)); |
| 925 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 926 | PalladioComponentModelVisualIDRegistry |
| 927 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 928 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 929 | true)); |
| 930 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 931 | PalladioComponentModelVisualIDRegistry |
| 932 | .getType(SubSystemEditPart.VISUAL_ID)); |
| 933 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 934 | true)); |
| 935 | if (!target.isEmpty()) { |
| 936 | result.add(target); |
| 937 | } |
| 938 | if (!source.isEmpty()) { |
| 939 | result.add(source); |
| 940 | } |
| 941 | return result.toArray(); |
| 942 | } |
| 943 | |
| 944 | case OperationRequiredRoleEditPart.VISUAL_ID: { |
| 945 | Collection result = new ArrayList(); |
| 946 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 947 | Messages.NavigatorGroupName_OperationRequiredRole_4106_target, |
| 948 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 949 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 950 | Messages.NavigatorGroupName_OperationRequiredRole_4106_source, |
| 951 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 952 | Collection connectedViews = getLinksTargetByType(Collections |
| 953 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 954 | .getType(OperationInterfaceEditPart.VISUAL_ID)); |
| 955 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 956 | true)); |
| 957 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 958 | PalladioComponentModelVisualIDRegistry |
| 959 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 960 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 961 | true)); |
| 962 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 963 | PalladioComponentModelVisualIDRegistry |
| 964 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 965 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 966 | true)); |
| 967 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 968 | PalladioComponentModelVisualIDRegistry |
| 969 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 970 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 971 | true)); |
| 972 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 973 | PalladioComponentModelVisualIDRegistry |
| 974 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 975 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 976 | true)); |
| 977 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 978 | PalladioComponentModelVisualIDRegistry |
| 979 | .getType(SubSystemEditPart.VISUAL_ID)); |
| 980 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 981 | true)); |
| 982 | if (!target.isEmpty()) { |
| 983 | result.add(target); |
| 984 | } |
| 985 | if (!source.isEmpty()) { |
| 986 | result.add(source); |
| 987 | } |
| 988 | return result.toArray(); |
| 989 | } |
| 990 | |
| 991 | case ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID: { |
| 992 | Collection result = new ArrayList(); |
| 993 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 994 | Messages.NavigatorGroupName_ImplementationComponentTypeParentCompleteComponentTypes_4103_target, |
| 995 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 996 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 997 | Messages.NavigatorGroupName_ImplementationComponentTypeParentCompleteComponentTypes_4103_source, |
| 998 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 999 | Collection connectedViews = getLinksTargetByType(Collections |
| 1000 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 1001 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 1002 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 1003 | true)); |
| 1004 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1005 | PalladioComponentModelVisualIDRegistry |
| 1006 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 1007 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1008 | true)); |
| 1009 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1010 | PalladioComponentModelVisualIDRegistry |
| 1011 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 1012 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1013 | true)); |
| 1014 | if (!target.isEmpty()) { |
| 1015 | result.add(target); |
| 1016 | } |
| 1017 | if (!source.isEmpty()) { |
| 1018 | result.add(source); |
| 1019 | } |
| 1020 | return result.toArray(); |
| 1021 | } |
| 1022 | |
| 1023 | case CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID: { |
| 1024 | Collection result = new ArrayList(); |
| 1025 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 1026 | Messages.NavigatorGroupName_CompleteComponentTypeParentProvidesComponentTypes_4104_target, |
| 1027 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 1028 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 1029 | Messages.NavigatorGroupName_CompleteComponentTypeParentProvidesComponentTypes_4104_source, |
| 1030 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 1031 | Collection connectedViews = getLinksTargetByType(Collections |
| 1032 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 1033 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 1034 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 1035 | true)); |
| 1036 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1037 | PalladioComponentModelVisualIDRegistry |
| 1038 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 1039 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1040 | true)); |
| 1041 | if (!target.isEmpty()) { |
| 1042 | result.add(target); |
| 1043 | } |
| 1044 | if (!source.isEmpty()) { |
| 1045 | result.add(source); |
| 1046 | } |
| 1047 | return result.toArray(); |
| 1048 | } |
| 1049 | |
| 1050 | case SourceRoleEditPart.VISUAL_ID: { |
| 1051 | Collection result = new ArrayList(); |
| 1052 | PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup( |
| 1053 | Messages.NavigatorGroupName_SourceRole_4110_target, |
| 1054 | "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 1055 | PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup( |
| 1056 | Messages.NavigatorGroupName_SourceRole_4110_source, |
| 1057 | "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ |
| 1058 | Collection connectedViews = getLinksTargetByType(Collections |
| 1059 | .singleton(view), PalladioComponentModelVisualIDRegistry |
| 1060 | .getType(EventGroupEditPart.VISUAL_ID)); |
| 1061 | target.addChildren(createNavigatorItems(connectedViews, target, |
| 1062 | true)); |
| 1063 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1064 | PalladioComponentModelVisualIDRegistry |
| 1065 | .getType(BasicComponentEditPart.VISUAL_ID)); |
| 1066 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1067 | true)); |
| 1068 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1069 | PalladioComponentModelVisualIDRegistry |
| 1070 | .getType(CompositeComponentEditPart.VISUAL_ID)); |
| 1071 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1072 | true)); |
| 1073 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1074 | PalladioComponentModelVisualIDRegistry |
| 1075 | .getType(CompleteComponentTypeEditPart.VISUAL_ID)); |
| 1076 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1077 | true)); |
| 1078 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1079 | PalladioComponentModelVisualIDRegistry |
| 1080 | .getType(ProvidesComponentTypeEditPart.VISUAL_ID)); |
| 1081 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1082 | true)); |
| 1083 | connectedViews = getLinksSourceByType(Collections.singleton(view), |
| 1084 | PalladioComponentModelVisualIDRegistry |
| 1085 | .getType(SubSystemEditPart.VISUAL_ID)); |
| 1086 | source.addChildren(createNavigatorItems(connectedViews, source, |
| 1087 | true)); |
| 1088 | if (!target.isEmpty()) { |
| 1089 | result.add(target); |
| 1090 | } |
| 1091 | if (!source.isEmpty()) { |
| 1092 | result.add(source); |
| 1093 | } |
| 1094 | return result.toArray(); |
| 1095 | } |
| 1096 | } |
| 1097 | return EMPTY_ARRAY; |
| 1098 | } |
| 1099 | |
| 1100 | /** |
| 1101 | * @generated |
| 1102 | */ |
| 1103 | private Collection getLinksSourceByType(Collection edges, String type) { |
| 1104 | Collection result = new ArrayList(); |
| 1105 | for (Iterator it = edges.iterator(); it.hasNext();) { |
| 1106 | Edge nextEdge = (Edge) it.next(); |
| 1107 | View nextEdgeSource = nextEdge.getSource(); |
| 1108 | if (type.equals(nextEdgeSource.getType()) |
| 1109 | && isOwnView(nextEdgeSource)) { |
| 1110 | result.add(nextEdgeSource); |
| 1111 | } |
| 1112 | } |
| 1113 | return result; |
| 1114 | } |
| 1115 | |
| 1116 | /** |
| 1117 | * @generated |
| 1118 | */ |
| 1119 | private Collection getLinksTargetByType(Collection edges, String type) { |
| 1120 | Collection result = new ArrayList(); |
| 1121 | for (Iterator it = edges.iterator(); it.hasNext();) { |
| 1122 | Edge nextEdge = (Edge) it.next(); |
| 1123 | View nextEdgeTarget = nextEdge.getTarget(); |
| 1124 | if (type.equals(nextEdgeTarget.getType()) |
| 1125 | && isOwnView(nextEdgeTarget)) { |
| 1126 | result.add(nextEdgeTarget); |
| 1127 | } |
| 1128 | } |
| 1129 | return result; |
| 1130 | } |
| 1131 | |
| 1132 | /** |
| 1133 | * @generated |
| 1134 | */ |
| 1135 | private Collection getOutgoingLinksByType(Collection nodes, String type) { |
| 1136 | Collection result = new ArrayList(); |
| 1137 | for (Iterator it = nodes.iterator(); it.hasNext();) { |
| 1138 | View nextNode = (View) it.next(); |
| 1139 | result.addAll(selectViewsByType(nextNode.getSourceEdges(), type)); |
| 1140 | } |
| 1141 | return result; |
| 1142 | } |
| 1143 | |
| 1144 | /** |
| 1145 | * @generated |
| 1146 | */ |
| 1147 | private Collection getIncomingLinksByType(Collection nodes, String type) { |
| 1148 | Collection result = new ArrayList(); |
| 1149 | for (Iterator it = nodes.iterator(); it.hasNext();) { |
| 1150 | View nextNode = (View) it.next(); |
| 1151 | result.addAll(selectViewsByType(nextNode.getTargetEdges(), type)); |
| 1152 | } |
| 1153 | return result; |
| 1154 | } |
| 1155 | |
| 1156 | /** |
| 1157 | * @generated |
| 1158 | */ |
| 1159 | private Collection getChildrenByType(Collection nodes, String type) { |
| 1160 | Collection result = new ArrayList(); |
| 1161 | for (Iterator it = nodes.iterator(); it.hasNext();) { |
| 1162 | View nextNode = (View) it.next(); |
| 1163 | result.addAll(selectViewsByType(nextNode.getChildren(), type)); |
| 1164 | } |
| 1165 | return result; |
| 1166 | } |
| 1167 | |
| 1168 | /** |
| 1169 | * @generated |
| 1170 | */ |
| 1171 | private Collection getDiagramLinksByType(Collection diagrams, String type) { |
| 1172 | Collection result = new ArrayList(); |
| 1173 | for (Iterator it = diagrams.iterator(); it.hasNext();) { |
| 1174 | Diagram nextDiagram = (Diagram) it.next(); |
| 1175 | result.addAll(selectViewsByType(nextDiagram.getEdges(), type)); |
| 1176 | } |
| 1177 | return result; |
| 1178 | } |
| 1179 | |
| 1180 | /** |
| 1181 | * @generated |
| 1182 | */ |
| 1183 | private Collection selectViewsByType(Collection views, String type) { |
| 1184 | Collection result = new ArrayList(); |
| 1185 | for (Iterator it = views.iterator(); it.hasNext();) { |
| 1186 | View nextView = (View) it.next(); |
| 1187 | if (type.equals(nextView.getType()) && isOwnView(nextView)) { |
| 1188 | result.add(nextView); |
| 1189 | } |
| 1190 | } |
| 1191 | return result; |
| 1192 | } |
| 1193 | |
| 1194 | /** |
| 1195 | * @generated |
| 1196 | */ |
| 1197 | private boolean isOwnView(View view) { |
| 1198 | return RepositoryEditPart.MODEL_ID |
| 1199 | .equals(PalladioComponentModelVisualIDRegistry.getModelID(view)); |
| 1200 | } |
| 1201 | |
| 1202 | /** |
| 1203 | * @generated |
| 1204 | */ |
| 1205 | private Collection createNavigatorItems(Collection views, Object parent, |
| 1206 | boolean isLeafs) { |
| 1207 | Collection result = new ArrayList(); |
| 1208 | for (Iterator it = views.iterator(); it.hasNext();) { |
| 1209 | result.add(new PalladioComponentModelNavigatorItem( |
| 1210 | (View) it.next(), parent, isLeafs)); |
| 1211 | } |
| 1212 | return result; |
| 1213 | } |
| 1214 | |
| 1215 | /** |
| 1216 | * @generated |
| 1217 | */ |
| 1218 | private Collection getForeignShortcuts(Diagram diagram, Object parent) { |
| 1219 | Collection result = new ArrayList(); |
| 1220 | for (Iterator it = diagram.getChildren().iterator(); it.hasNext();) { |
| 1221 | View nextView = (View) it.next(); |
| 1222 | if (!isOwnView(nextView) |
| 1223 | && nextView.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ |
| 1224 | result.add(nextView); |
| 1225 | } |
| 1226 | } |
| 1227 | return createNavigatorItems(result, parent, false); |
| 1228 | } |
| 1229 | |
| 1230 | /** |
| 1231 | * @generated |
| 1232 | */ |
| 1233 | public Object getParent(Object element) { |
| 1234 | if (element instanceof PalladioComponentModelAbstractNavigatorItem) { |
| 1235 | PalladioComponentModelAbstractNavigatorItem abstractNavigatorItem = (PalladioComponentModelAbstractNavigatorItem) element; |
| 1236 | return abstractNavigatorItem.getParent(); |
| 1237 | } |
| 1238 | return null; |
| 1239 | } |
| 1240 | |
| 1241 | /** |
| 1242 | * @generated |
| 1243 | */ |
| 1244 | public boolean hasChildren(Object element) { |
| 1245 | return element instanceof IFile || getChildren(element).length > 0; |
| 1246 | } |
| 1247 | |
| 1248 | } |