|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2010, 2020 itemis AG and others. |
| 2 | + * Copyright (c) 2010, 2021 itemis AG and others. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials are made available under the |
5 | 5 | * terms of the Eclipse Public License 2.0 which is available at |
@@ -306,13 +306,16 @@ public void completeAttribute_Value(EObject model, Assignment assignment, |
306 | 306 | ICompletionProposalAcceptor acceptor) { |
307 | 307 | if (model instanceof Attribute) { |
308 | 308 | Attribute attribute = (Attribute) model; |
| 309 | + Context attributeContext = DotAttributes.getContext(attribute); |
| 310 | + String attributeName = attribute.getName().toValue(); |
309 | 311 |
|
310 | 312 | context = context.copy() |
311 | 313 | .setMatcher(new AttributeValueMatcher(context.getMatcher())) |
312 | 314 | .toContext(); |
313 | 315 |
|
314 | | - if (DotAttributes.getContext(attribute) == Context.EDGE) { |
315 | | - switch (attribute.getName().toValue()) { |
| 316 | + switch (attributeContext) { |
| 317 | + case EDGE: |
| 318 | + switch (attributeName) { |
316 | 319 | case DotAttributes.ARROWHEAD__E: |
317 | 320 | case DotAttributes.ARROWTAIL__E: |
318 | 321 | proposeAttributeValues( |
@@ -385,8 +388,9 @@ public void completeAttribute_Value(EObject model, Assignment assignment, |
385 | 388 | acceptor); |
386 | 389 | break; |
387 | 390 | } |
388 | | - } else if (DotAttributes.getContext(attribute) == Context.GRAPH) { |
389 | | - switch (attribute.getName().toValue()) { |
| 391 | + break; |
| 392 | + case GRAPH: |
| 393 | + switch (attributeName) { |
390 | 394 | case DotAttributes.BGCOLOR__GC: |
391 | 395 | proposeColorListAttributeValues(attribute, context, |
392 | 396 | acceptor); |
@@ -438,8 +442,9 @@ public void completeAttribute_Value(EObject model, Assignment assignment, |
438 | 442 | acceptor); |
439 | 443 | break; |
440 | 444 | } |
441 | | - } else if (DotAttributes.getContext(attribute) == Context.NODE) { |
442 | | - switch (attribute.getName().toValue()) { |
| 445 | + break; |
| 446 | + case NODE: |
| 447 | + switch (attributeName) { |
443 | 448 | case DotAttributes.COLOR__CNE: |
444 | 449 | proposeColorAttributeValues(attribute, context, acceptor); |
445 | 450 | break; |
@@ -488,8 +493,9 @@ public void completeAttribute_Value(EObject model, Assignment assignment, |
488 | 493 | default: |
489 | 494 | break; |
490 | 495 | } |
491 | | - } else if (DotAttributes.getContext(attribute) == Context.CLUSTER) { |
492 | | - switch (attribute.getName().toValue()) { |
| 496 | + break; |
| 497 | + case CLUSTER: |
| 498 | + switch (attributeName) { |
493 | 499 | case DotAttributes.BGCOLOR__GC: |
494 | 500 | proposeColorListAttributeValues(attribute, context, |
495 | 501 | acceptor); |
@@ -525,17 +531,15 @@ public void completeAttribute_Value(EObject model, Assignment assignment, |
525 | 531 | DotActivator.ORG_ECLIPSE_GEF_DOT_INTERNAL_LANGUAGE_DOTESCSTRING, |
526 | 532 | context, acceptor); |
527 | 533 | } |
528 | | - } else if (DotAttributes |
529 | | - .getContext(attribute) == Context.SUBGRAPH) { |
530 | | - switch (attribute.getName().toValue()) { |
| 534 | + break; |
| 535 | + case SUBGRAPH: |
| 536 | + switch (attributeName) { |
531 | 537 | case DotAttributes.RANK__S: |
532 | 538 | proposeAttributeValues(RankType.values(), context, |
533 | 539 | acceptor); |
534 | 540 | break; |
535 | 541 | } |
536 | | - } |
537 | | - |
538 | | - else { |
| 542 | + default: |
539 | 543 | super.completeAttribute_Value(model, assignment, context, |
540 | 544 | acceptor); |
541 | 545 | } |
|
0 commit comments