diff options
author | 2021-10-31 18:57:56 +0100 | |
---|---|---|
committer | 2021-10-31 19:26:16 +0100 | |
commit | d36affa468c0f874485d8d8aa55b34c8c30e9f14 (patch) | |
tree | 6390fcccae7d4d863d4ff8e8a4a8b06c3274fc40 /language-web/src/main/java/tools | |
parent | fix(web): fix push message race condition (diff) | |
download | refinery-d36affa468c0f874485d8d8aa55b34c8c30e9f14.tar.gz refinery-d36affa468c0f874485d8d8aa55b34c8c30e9f14.tar.zst refinery-d36affa468c0f874485d8d8aa55b34c8c30e9f14.zip |
fix(web): not dot display spurious occurrences
Only return find occurrences results for NamedElement instances,
as other objects cannot be referenced by name and thus cannot have any
references at all.
Diffstat (limited to 'language-web/src/main/java/tools')
-rw-r--r-- | language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java | 6 | ||||
-rw-r--r-- | language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java | 16 |
2 files changed, 22 insertions, 0 deletions
diff --git a/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java b/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java index ac8934ed..ec55036f 100644 --- a/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java +++ b/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java | |||
@@ -6,7 +6,9 @@ package tools.refinery.language.web; | |||
6 | import org.eclipse.xtext.web.server.XtextServiceDispatcher; | 6 | import org.eclipse.xtext.web.server.XtextServiceDispatcher; |
7 | import org.eclipse.xtext.web.server.model.IWebDocumentProvider; | 7 | import org.eclipse.xtext.web.server.model.IWebDocumentProvider; |
8 | import org.eclipse.xtext.web.server.model.XtextWebDocumentAccess; | 8 | import org.eclipse.xtext.web.server.model.XtextWebDocumentAccess; |
9 | import org.eclipse.xtext.web.server.occurrences.OccurrencesService; | ||
9 | 10 | ||
11 | import tools.refinery.language.web.occurrences.ProblemOccurrencesService; | ||
10 | import tools.refinery.language.web.xtext.server.push.PushServiceDispatcher; | 12 | import tools.refinery.language.web.xtext.server.push.PushServiceDispatcher; |
11 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentAccess; | 13 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentAccess; |
12 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentProvider; | 14 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentProvider; |
@@ -26,4 +28,8 @@ public class ProblemWebModule extends AbstractProblemWebModule { | |||
26 | public Class<? extends XtextServiceDispatcher> bindXtextServiceDispatcher() { | 28 | public Class<? extends XtextServiceDispatcher> bindXtextServiceDispatcher() { |
27 | return PushServiceDispatcher.class; | 29 | return PushServiceDispatcher.class; |
28 | } | 30 | } |
31 | |||
32 | public Class<? extends OccurrencesService> bindOccurrencesService() { | ||
33 | return ProblemOccurrencesService.class; | ||
34 | } | ||
29 | } | 35 | } |
diff --git a/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java b/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java new file mode 100644 index 00000000..d32bbb54 --- /dev/null +++ b/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java | |||
@@ -0,0 +1,16 @@ | |||
1 | package tools.refinery.language.web.occurrences; | ||
2 | |||
3 | import org.eclipse.emf.ecore.EObject; | ||
4 | import org.eclipse.xtext.web.server.occurrences.OccurrencesService; | ||
5 | |||
6 | import com.google.inject.Singleton; | ||
7 | |||
8 | import tools.refinery.language.model.problem.NamedElement; | ||
9 | |||
10 | @Singleton | ||
11 | public class ProblemOccurrencesService extends OccurrencesService { | ||
12 | @Override | ||
13 | protected boolean filter(EObject element) { | ||
14 | return super.filter(element) && element instanceof NamedElement; | ||
15 | } | ||
16 | } | ||