Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2019-08-02 10:00:11 -0400
committerPierre-Charles David2019-08-05 09:23:28 -0400
commit5a1d40a6f97c012530249001d63348d0626aca8c (patch)
treec6ef12bcedc64414a6ccbc970918f6380a96ddd7
parentc1f510aafd0bb60a2bb16a525676130808057d5c (diff)
downloadorg.eclipse.sirius-5a1d40a6f97c012530249001d63348d0626aca8c.tar.gz
org.eclipse.sirius-5a1d40a6f97c012530249001d63348d0626aca8c.tar.xz
org.eclipse.sirius-5a1d40a6f97c012530249001d63348d0626aca8c.zip
Revert "[cleanup] Simplify DialectUIManagerImpl.completeToolTipText(String, EObject, EStructuralFeature)"
This reverts commit 2a2a7ee1921adeed877a1a8b877212e745878ce6, which can cause ClassCastExceptions: the two code blocks that were merged into one were not exactly the same, one handled RepresentationDescription (and casts to that), and the other handles RepresentationExtensionDescription, which can *not* be cast to RepresentationDescription. Change-Id: Ib86d416fd45eaa1db0fdd1f935e193b7c0ad1e73 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/DialectUIManagerImpl.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/DialectUIManagerImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/DialectUIManagerImpl.java
index 2e8ae6bee2..499b9d7360 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/DialectUIManagerImpl.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/DialectUIManagerImpl.java
@@ -366,16 +366,22 @@ public class DialectUIManagerImpl implements DialectUIManager {
@Override
public String completeToolTipText(String toolTipText, EObject eObject, EStructuralFeature feature) {
String toolTip = toolTipText;
- Option<EObject> parentDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationDescription());
- if (!parentDescription.some()) {
- parentDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationExtensionDescription());
- }
- if (parentDescription.some()) {
+ Option<EObject> parentRepresentationDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationDescription());
+ if (parentRepresentationDescription.some()) {
for (final DialectUI dialect : dialects.values()) {
- if (dialect.getServices().canHandle((RepresentationDescription) parentDescription.get())) {
+ if (dialect.getServices().canHandle((RepresentationDescription) parentRepresentationDescription.get())) {
toolTip = dialect.getServices().completeToolTipText(toolTipText, eObject, feature);
}
}
+ } else {
+ Option<EObject> parentRepresentationExtensionDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationExtensionDescription());
+ if (parentRepresentationDescription.some()) {
+ for (final DialectUI dialect : dialects.values()) {
+ if (dialect.getServices().canHandle((RepresentationExtensionDescription) parentRepresentationExtensionDescription.get())) {
+ toolTip = dialect.getServices().completeToolTipText(toolTipText, eObject, feature);
+ }
+ }
+ }
}
return toolTip;
}

Back to the top