Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2013-09-06 19:44:16 +0000
committerChristian W. Damus2013-09-06 20:36:18 +0000
commit42145dce2b0d7f55953dd5ab357df9fcfc1e2005 (patch)
treef61c8fb4891f9955f7e74ee2ce28ccfd254f54ea /extraplugins
parentf1cc4b5280be5bf1100807d2b560457c29a7955e (diff)
downloadorg.eclipse.papyrus-42145dce2b0d7f55953dd5ab357df9fcfc1e2005.tar.gz
org.eclipse.papyrus-42145dce2b0d7f55953dd5ab357df9fcfc1e2005.tar.xz
org.eclipse.papyrus-42145dce2b0d7f55953dd5ab357df9fcfc1e2005.zip
415371: Fix advanced search handling of inherited attributes and multiple EClasses
https://bugs.eclipse.org/bugs/show_bug.cgi?id=415371
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java
index 4c7627bcaa2..939be7a04a8 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java
@@ -111,8 +111,10 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider {
// attributes specifically selected, add all of its attributes
final Multimap<EClass, EAttribute> attributes = ArrayListMultimap.create();
for(ParticipantTypeAttribute next : filter(queryInfo.getParticipantTypes(), ParticipantTypeAttribute.class)) {
- EAttribute attr = (EAttribute)next.getElement();
- attributes.put(attr.getEContainingClass(), attr);
+ if(next.getParent().getElement() instanceof EClass) {
+ EAttribute attr = (EAttribute)next.getElement();
+ attributes.put((EClass)next.getParent().getElement(), attr);
+ }
}
for(ParticipantTypeElement next : filter(queryInfo.getParticipantTypes(), not(instanceOf(ParticipantTypeAttribute.class)))) {
if(next.getElement() instanceof EClass) {
@@ -318,14 +320,21 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider {
// from our candidate elements, select those that match the attribute criteria
result.append("->select(e | "); //$NON-NLS-1$
+ boolean firstEClass = true;
for(EClass next : attributes.keySet()) {
+ if(firstEClass) {
+ firstEClass = false;
+ } else {
+ result.append(" or ");
+ }
+
result.append("e.oclIsKindOf(").append(next.getName()).append(") and ("); //$NON-NLS-1$ //$NON-NLS-2$
result.append("let s : ").append(next.getName()).append(" = e.oclAsType(").append(next.getName()).append(") in "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- boolean first = true;
+ boolean firstAttr = true;
for(EAttribute attr : attributes.get(next)) {
- if(first) {
- first = false;
+ if(firstAttr) {
+ firstAttr = false;
} else {
result.append(" or ");
}

Back to the top