Mercurial > projects > dwt-addons
comparison dwtx/jface/internal/text/link/contentassist/ContextInformationPopup2.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | 25f1f92fa3df |
children |
comparison
equal
deleted
inserted
replaced
161:f8d52b926852 | 162:1a5b8f8129df |
---|---|
86 } | 86 } |
87 | 87 |
88 private ITextViewer fViewer; | 88 private ITextViewer fViewer; |
89 private ContentAssistant2 fContentAssistant; | 89 private ContentAssistant2 fContentAssistant; |
90 | 90 |
91 private PopupCloser2 fPopupCloser= new PopupCloser2(); | 91 private PopupCloser2 fPopupCloser; |
92 private Shell fContextSelectorShell; | 92 private Shell fContextSelectorShell; |
93 private Table fContextSelectorTable; | 93 private Table fContextSelectorTable; |
94 private IContextInformation[] fContextSelectorInput; | 94 private IContextInformation[] fContextSelectorInput; |
95 private String fLineDelimiter= null; | 95 private String fLineDelimiter= null; |
96 | 96 |
97 private Shell fContextInfoPopup; | 97 private Shell fContextInfoPopup; |
98 private StyledText fContextInfoText; | 98 private StyledText fContextInfoText; |
99 private TextPresentation fTextPresentation; | 99 private TextPresentation fTextPresentation; |
100 | 100 |
101 private Stack fContextFrameStack= new Stack(); | 101 private Stack fContextFrameStack; |
102 | 102 |
103 | 103 |
104 /** | 104 /** |
105 * Creates a new context information popup. | 105 * Creates a new context information popup. |
106 * | 106 * |
107 * @param contentAssistant the content assist for computing the context information | 107 * @param contentAssistant the content assist for computing the context information |
108 * @param viewer the viewer on top of which the context information is shown | 108 * @param viewer the viewer on top of which the context information is shown |
109 */ | 109 */ |
110 public this(ContentAssistant2 contentAssistant, ITextViewer viewer) { | 110 public this(ContentAssistant2 contentAssistant, ITextViewer viewer) { |
111 fPopupCloser= new PopupCloser2(); | |
112 fContextFrameStack= new Stack(); | |
111 fContentAssistant= contentAssistant; | 113 fContentAssistant= contentAssistant; |
112 fViewer= viewer; | 114 fViewer= viewer; |
113 } | 115 } |
114 | 116 |
115 /** | 117 /** |
317 } | 319 } |
318 } | 320 } |
319 } | 321 } |
320 | 322 |
321 if (fContextInfoPopup is null) | 323 if (fContextInfoPopup is null) |
322 fContentAssistant.contextInformationClosed(); | 324 fContentAssistant.contextInformationClosed_package(); |
323 } | 325 } |
324 | 326 |
325 /** | 327 /** |
326 * Creates the context selector in case the user has the choice between multiple valid contexts | 328 * Creates the context selector in case the user has the choice between multiple valid contexts |
327 * at a given offset. | 329 * at a given offset. |
436 fContextSelectorShell.dispose(); | 438 fContextSelectorShell.dispose(); |
437 fContextSelectorShell= null; | 439 fContextSelectorShell= null; |
438 } | 440 } |
439 | 441 |
440 if (!Helper2.okToUse(fContextInfoPopup)) | 442 if (!Helper2.okToUse(fContextInfoPopup)) |
441 fContentAssistant.contextInformationClosed(); | 443 fContentAssistant.contextInformationClosed_package(); |
442 } | 444 } |
443 | 445 |
444 /** | 446 /** |
445 *Returns whether the context selector has the focus. | 447 *Returns whether the context selector has the focus. |
446 * | 448 * |
625 * Post the code in the event queue in order to ensure that the | 627 * Post the code in the event queue in order to ensure that the |
626 * action described by this verify key event has already beed executed. | 628 * action described by this verify key event has already beed executed. |
627 * Otherwise, we'd validate the context information based on the | 629 * Otherwise, we'd validate the context information based on the |
628 * pre-key-stroke state. | 630 * pre-key-stroke state. |
629 */ | 631 */ |
630 fContextInfoPopup.getDisplay().asyncExec(new class() Runnable { | 632 fContextInfoPopup.getDisplay().asyncExec(dgRunnable( (ContextFrame fFrame_) { |
631 | 633 |
632 private ContextFrame fFrame= cast(ContextFrame) fContextFrameStack.peek(); | 634 ContextFrame fFrame= fFrame_; |
633 | 635 |
634 public void run() { | 636 if (Helper2.okToUse(fContextInfoPopup) && fFrame is fContextFrameStack.peek()) { |
635 if (Helper2.okToUse(fContextInfoPopup) && fFrame is fContextFrameStack.peek()) { | 637 int offset= fViewer.getSelectedRange().x; |
636 int offset= fViewer.getSelectedRange().x; | 638 if (fFrame.fValidator is null || !fFrame.fValidator.isContextInformationValid(offset)) { |
637 if (fFrame.fValidator is null || !fFrame.fValidator.isContextInformationValid(offset)) { | 639 hideContextInfoPopup(); |
638 hideContextInfoPopup(); | 640 } else if (fFrame.fPresenter !is null && fFrame.fPresenter.updatePresentation(offset, fTextPresentation)) { |
639 } else if (fFrame.fPresenter !is null && fFrame.fPresenter.updatePresentation(offset, fTextPresentation)) { | 641 TextPresentation.applyTextPresentation(fTextPresentation, fContextInfoText); |
640 TextPresentation.applyTextPresentation(fTextPresentation, fContextInfoText); | 642 resize(); |
641 resize(); | |
642 } | |
643 } | 643 } |
644 } | 644 } |
645 }); | 645 }, cast(ContextFrame) fContextFrameStack.peek())); |
646 } | 646 } |
647 } | 647 } |