Mercurial > projects > dwt-addons
comparison dwtx/jface/text/contentassist/CompletionProposalPopup.d @ 135:65801ad2b265
Regex fix for anon classes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:52:31 +0200 |
parents | 51e6e63f930e |
children | 6dcb0baaa031 |
comparison
equal
deleted
inserted
replaced
134:51e6e63f930e | 135:65801ad2b265 |
---|---|
383 /** | 383 /** |
384 * The filter runnable. | 384 * The filter runnable. |
385 * | 385 * |
386 * @since 3.1.1 | 386 * @since 3.1.1 |
387 */ | 387 */ |
388 private final Runnable fFilterRunnable= new Runnable() { | 388 private final Runnable fFilterRunnable= new class() Runnable { |
389 public void run() { | 389 public void run() { |
390 if (!fIsFilterPending) | 390 if (!fIsFilterPending) |
391 return; | 391 return; |
392 | 392 |
393 fIsFilterPending= false; | 393 fIsFilterPending= false; |
508 if (!Helper.okToUse(fProposalShell) && control !is null && !control.isDisposed()) { | 508 if (!Helper.okToUse(fProposalShell) && control !is null && !control.isDisposed()) { |
509 // add the listener before computing the proposals so we don't move the caret | 509 // add the listener before computing the proposals so we don't move the caret |
510 // when the user types fast. | 510 // when the user types fast. |
511 fContentAssistSubjectControlAdapter.addKeyListener(fKeyListener); | 511 fContentAssistSubjectControlAdapter.addKeyListener(fKeyListener); |
512 | 512 |
513 BusyIndicator.showWhile(control.getDisplay(), new Runnable() { | 513 BusyIndicator.showWhile(control.getDisplay(), new class() Runnable { |
514 public void run() { | 514 public void run() { |
515 | 515 |
516 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x; | 516 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x; |
517 fFilterOffset= fInvocationOffset; | 517 fFilterOffset= fInvocationOffset; |
518 fLastCompletionOffset= fFilterOffset; | 518 fLastCompletionOffset= fFilterOffset; |
607 fProposalShell= new Shell(control.getShell(), DWT.ON_TOP | DWT.RESIZE ); | 607 fProposalShell= new Shell(control.getShell(), DWT.ON_TOP | DWT.RESIZE ); |
608 fProposalShell.setFont(JFaceResources.getDefaultFont()); | 608 fProposalShell.setFont(JFaceResources.getDefaultFont()); |
609 if cast(USE_VIRTUAL) { | 609 if cast(USE_VIRTUAL) { |
610 fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL | DWT.VIRTUAL); | 610 fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL | DWT.VIRTUAL); |
611 | 611 |
612 Listener listener= new Listener() { | 612 Listener listener= new class() Listener { |
613 public void handleEvent(Event event) { | 613 public void handleEvent(Event event) { |
614 handleSetData(event); | 614 handleSetData(event); |
615 } | 615 } |
616 }; | 616 }; |
617 fProposalTable.addListener(DWT.SetData, listener); | 617 fProposalTable.addListener(DWT.SetData, listener); |
654 fProposalTable.setLayoutData(data); | 654 fProposalTable.setLayoutData(data); |
655 fProposalShell.pack(); | 655 fProposalShell.pack(); |
656 } | 656 } |
657 fContentAssistant.addToLayout(this, fProposalShell, ContentAssistant.LayoutManager.LAYOUT_PROPOSAL_SELECTOR, fContentAssistant.getSelectionOffset()); | 657 fContentAssistant.addToLayout(this, fProposalShell, ContentAssistant.LayoutManager.LAYOUT_PROPOSAL_SELECTOR, fContentAssistant.getSelectionOffset()); |
658 | 658 |
659 fProposalShell.addControlListener(new ControlListener() { | 659 fProposalShell.addControlListener(new class() ControlListener { |
660 | 660 |
661 public void controlMoved(ControlEvent e) {} | 661 public void controlMoved(ControlEvent e) {} |
662 | 662 |
663 public void controlResized(ControlEvent e) { | 663 public void controlResized(ControlEvent e) { |
664 if (fAdditionalInfoController !is null) { | 664 if (fAdditionalInfoController !is null) { |
676 fProposalTable.setBackground(c); | 676 fProposalTable.setBackground(c); |
677 | 677 |
678 c= getForegroundColor(control); | 678 c= getForegroundColor(control); |
679 fProposalTable.setForeground(c); | 679 fProposalTable.setForeground(c); |
680 | 680 |
681 fProposalTable.addSelectionListener(new SelectionListener() { | 681 fProposalTable.addSelectionListener(new class() SelectionListener { |
682 | 682 |
683 public void widgetSelected(SelectionEvent e) {} | 683 public void widgetSelected(SelectionEvent e) {} |
684 | 684 |
685 public void widgetDefaultSelected(SelectionEvent e) { | 685 public void widgetDefaultSelected(SelectionEvent e) { |
686 insertSelectedProposalWithMask(e.stateMask); | 686 insertSelectedProposalWithMask(e.stateMask); |
687 } | 687 } |
688 }); | 688 }); |
689 | 689 |
690 fPopupCloser.install(fContentAssistant, fProposalTable, fAdditionalInfoController); | 690 fPopupCloser.install(fContentAssistant, fProposalTable, fAdditionalInfoController); |
691 | 691 |
692 fProposalShell.addDisposeListener(new DisposeListener() { | 692 fProposalShell.addDisposeListener(new class() DisposeListener { |
693 public void widgetDisposed(DisposeEvent e) { | 693 public void widgetDisposed(DisposeEvent e) { |
694 unregister(); // but don't dispose the shell, since we're being called from its disposal event! | 694 unregister(); // but don't dispose the shell, since we're being called from its disposal event! |
695 } | 695 } |
696 }); | 696 }); |
697 | 697 |
726 * @since 3.2 | 726 * @since 3.2 |
727 */ | 727 */ |
728 private void addCommandSupport(final Control control) { | 728 private void addCommandSupport(final Control control) { |
729 final KeySequence commandSequence= fContentAssistant.getRepeatedInvocationKeySequence(); | 729 final KeySequence commandSequence= fContentAssistant.getRepeatedInvocationKeySequence(); |
730 if (commandSequence !is null && !commandSequence.isEmpty() && fContentAssistant.isRepeatedInvocationMode()) { | 730 if (commandSequence !is null && !commandSequence.isEmpty() && fContentAssistant.isRepeatedInvocationMode()) { |
731 control.addFocusListener(new FocusListener() { | 731 control.addFocusListener(new class() FocusListener { |
732 private CommandKeyListener fCommandKeyListener; | 732 private CommandKeyListener fCommandKeyListener; |
733 public void focusGained(FocusEvent e) { | 733 public void focusGained(FocusEvent e) { |
734 if (Helper.okToUse(control)) { | 734 if (Helper.okToUse(control)) { |
735 if (fCommandKeyListener is null) { | 735 if (fCommandKeyListener is null) { |
736 fCommandKeyListener= new CommandKeyListener(commandSequence); | 736 fCommandKeyListener= new CommandKeyListener(commandSequence); |
744 fCommandKeyListener= null; | 744 fCommandKeyListener= null; |
745 } | 745 } |
746 } | 746 } |
747 }); | 747 }); |
748 } | 748 } |
749 control.addFocusListener(new FocusListener() { | 749 control.addFocusListener(new class() FocusListener { |
750 private TraverseListener fTraverseListener; | 750 private TraverseListener fTraverseListener; |
751 public void focusGained(FocusEvent e) { | 751 public void focusGained(FocusEvent e) { |
752 if (Helper.okToUse(control)) { | 752 if (Helper.okToUse(control)) { |
753 if (fTraverseListener is null) { | 753 if (fTraverseListener is null) { |
754 fTraverseListener= new TraverseListener() { | 754 fTraverseListener= new class() TraverseListener { |
755 public void keyTraversed(TraverseEvent event) { | 755 public void keyTraversed(TraverseEvent event) { |
756 if (event.detail is DWT.TRAVERSE_TAB_NEXT) { | 756 if (event.detail is DWT.TRAVERSE_TAB_NEXT) { |
757 IInformationControl iControl= fAdditionalInfoController.getCurrentInformationControl2(); | 757 IInformationControl iControl= fAdditionalInfoController.getCurrentInformationControl2(); |
758 if (fAdditionalInfoController.getInternalAccessor().canReplace(iControl)) { | 758 if (fAdditionalInfoController.getInternalAccessor().canReplace(iControl)) { |
759 fAdditionalInfoController.getInternalAccessor().replaceInformationControl(true); | 759 fAdditionalInfoController.getInternalAccessor().replaceInformationControl(true); |
826 fMessageText.setBackground(getBackgroundColor(fProposalShell)); | 826 fMessageText.setBackground(getBackgroundColor(fProposalShell)); |
827 fMessageText.setForeground(getForegroundColor(fProposalShell)); | 827 fMessageText.setForeground(getForegroundColor(fProposalShell)); |
828 | 828 |
829 if (fContentAssistant.isRepeatedInvocationMode()) { | 829 if (fContentAssistant.isRepeatedInvocationMode()) { |
830 fMessageText.setCursor(fProposalShell.getDisplay().getSystemCursor(DWT.CURSOR_HAND)); | 830 fMessageText.setCursor(fProposalShell.getDisplay().getSystemCursor(DWT.CURSOR_HAND)); |
831 fMessageText.addMouseListener(new MouseAdapter() { | 831 fMessageText.addMouseListener(new class() MouseAdapter { |
832 public void mouseUp(MouseEvent e) { | 832 public void mouseUp(MouseEvent e) { |
833 fLastCompletionOffset= fFilterOffset; | 833 fLastCompletionOffset= fFilterOffset; |
834 fProposalTable.setFocus(); | 834 fProposalTable.setFocus(); |
835 handleRepeatedInvocation(); | 835 handleRepeatedInvocation(); |
836 } | 836 } |
920 */ | 920 */ |
921 private void insertProposal(ICompletionProposal p, char trigger, int stateMask, final int offset) { | 921 private void insertProposal(ICompletionProposal p, char trigger, int stateMask, final int offset) { |
922 | 922 |
923 fInserting= true; | 923 fInserting= true; |
924 IRewriteTarget target= null; | 924 IRewriteTarget target= null; |
925 IEditingSupport helper= new IEditingSupport() { | 925 IEditingSupport helper= new class() IEditingSupport { |
926 | 926 |
927 public bool isOriginator(DocumentEvent event, IRegion focus) { | 927 public bool isOriginator(DocumentEvent event, IRegion focus) { |
928 return focus.getOffset() <= offset && focus.getOffset() + focus.getLength() >= offset; | 928 return focus.getOffset() <= offset && focus.getOffset() + focus.getLength() >= offset; |
929 } | 929 } |
930 | 930 |
1193 if (fContentAssistant.addContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR)) { | 1193 if (fContentAssistant.addContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR)) { |
1194 | 1194 |
1195 ensureDocumentListenerInstalled(); | 1195 ensureDocumentListenerInstalled(); |
1196 | 1196 |
1197 if (fFocusHelper is null) { | 1197 if (fFocusHelper is null) { |
1198 fFocusHelper= new IEditingSupport() { | 1198 fFocusHelper= new class() IEditingSupport { |
1199 | 1199 |
1200 public bool isOriginator(DocumentEvent event, IRegion focus) { | 1200 public bool isOriginator(DocumentEvent event, IRegion focus) { |
1201 return false; // this helper just covers the focus change to the proposal shell, no remote editions | 1201 return false; // this helper just covers the focus change to the proposal shell, no remote editions |
1202 } | 1202 } |
1203 | 1203 |
1238 * | 1238 * |
1239 * @since 3.2 | 1239 * @since 3.2 |
1240 */ | 1240 */ |
1241 private void ensureDocumentListenerInstalled() { | 1241 private void ensureDocumentListenerInstalled() { |
1242 if (fDocumentListener is null) { | 1242 if (fDocumentListener is null) { |
1243 fDocumentListener= new IDocumentListener() { | 1243 fDocumentListener= new class() IDocumentListener { |
1244 public void documentAboutToBeChanged(DocumentEvent event) { | 1244 public void documentAboutToBeChanged(DocumentEvent event) { |
1245 if (!fInserting) | 1245 if (!fInserting) |
1246 fDocumentEvents.add(event); | 1246 fDocumentEvents.add(event); |
1247 } | 1247 } |
1248 | 1248 |
1561 fKeyListener= new ProposalSelectionListener(); | 1561 fKeyListener= new ProposalSelectionListener(); |
1562 | 1562 |
1563 if (!Helper.okToUse(fProposalShell) && !control.isDisposed()) | 1563 if (!Helper.okToUse(fProposalShell) && !control.isDisposed()) |
1564 fContentAssistSubjectControlAdapter.addKeyListener(fKeyListener); | 1564 fContentAssistSubjectControlAdapter.addKeyListener(fKeyListener); |
1565 | 1565 |
1566 BusyIndicator.showWhile(control.getDisplay(), new Runnable() { | 1566 BusyIndicator.showWhile(control.getDisplay(), new class() Runnable { |
1567 public void run() { | 1567 public void run() { |
1568 | 1568 |
1569 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x; | 1569 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x; |
1570 fFilterOffset= fInvocationOffset; | 1570 fFilterOffset= fInvocationOffset; |
1571 fLastCompletionOffset= fFilterOffset; | 1571 fLastCompletionOffset= fFilterOffset; |