File tree Expand file tree Collapse file tree
org.eclipse.tm4e.ui/src/main/java/org/eclipse/tm4e/ui/internal/templates Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 *******************************************************************************/
1212package org .eclipse .tm4e .ui .internal .templates ;
1313
14- import java .util .ArrayList ;
15- import java .util .Collections ;
1614import java .util .List ;
1715
1816import org .eclipse .core .runtime .Platform ;
4038
4139public class TMTemplateCompletionProcessor extends TemplateCompletionProcessor {
4240
43- private static final ICompletionProposal [] NO_PROPOSALS = {};
4441 private static final Template [] NO_TEMPLATES = {};
4542
4643 @ Override
4744 public ICompletionProposal [] computeCompletionProposals (final ITextViewer viewer , final int offset ) {
48- // TODO check why Invalid thread access exception occurs here without syncExec()
49- final ArrayList <ICompletionProposal > templateProposals = new ArrayList <>();
50- UI .getDisplay ().syncExec (() -> {
51- final ICompletionProposal [] proposalsFromParent = TMTemplateCompletionProcessor .super .computeCompletionProposals (
52- viewer , offset );
53- Collections .addAll (templateProposals , proposalsFromParent );
54- });
55-
56- if (templateProposals .size () > 0 ) {
57- final ICompletionProposal [] proposals = templateProposals
58- .toArray (new ICompletionProposal [templateProposals .size ()]);
59- return proposals ;
60- }
61-
62- return NO_PROPOSALS ;
45+ // TODO Check why Invalid thread access exception occurs here without UI.runSync()
46+ return UI .runSync (() -> TMTemplateCompletionProcessor .super .computeCompletionProposals (viewer , offset ));
6347 }
6448
6549 private static class TmTokenRegion implements IRegion {
You can’t perform that action at this time.
0 commit comments