comparison dwtx/jface/fieldassist/ContentProposalAdapter.d @ 71:4878bef4a38e

Some fixing
author Frank Benoit <benoit@tionex.de>
date Thu, 22 May 2008 04:03:58 +0200
parents 46a6e0e6ccd4
children 5df4896124c7
comparison
equal deleted inserted replaced
70:46a6e0e6ccd4 71:4878bef4a38e
316 } else { 316 } else {
317 e.doit = true; 317 e.doit = true;
318 String contents = getControlContentAdapter() 318 String contents = getControlContentAdapter()
319 .getControlContents(getControl()); 319 .getControlContents(getControl());
320 // If there are no contents, changes in cursor 320 // If there are no contents, changes in cursor
321 // position have no effect. Note also that we do 321 // position have no effect. Note also that we do
322 // not affect the filter text on ARROW_LEFT as 322 // not affect the filter text on ARROW_LEFT as
323 // we would with BS. 323 // we would with BS.
324 if (contents.length > 0) { 324 if (contents.length > 0) {
325 asyncRecomputeProposals(filterText); 325 asyncRecomputeProposals(filterText);
326 } 326 }
327 } 327 }
509 // use the proposed bounds on the right 509 // use the proposed bounds on the right
510 proposedBounds = rightProposedBounds; 510 proposedBounds = rightProposedBounds;
511 } 511 }
512 getShell().setBounds(proposedBounds); 512 getShell().setBounds(proposedBounds);
513 } 513 }
514 514
515 /* 515 /*
516 * (non-Javadoc) 516 * (non-Javadoc)
517 * @see dwtx.jface.dialogs.PopupDialog#getForeground() 517 * @see dwtx.jface.dialogs.PopupDialog#getForeground()
518 */ 518 */
519 protected Color getForeground() { 519 protected Color getForeground() {
520 return control.getDisplay(). 520 return control.getDisplay().
521 getSystemColor(DWT.COLOR_INFO_FOREGROUND); 521 getSystemColor(DWT.COLOR_INFO_FOREGROUND);
522 } 522 }
523 523
524 /* 524 /*
525 * (non-Javadoc) 525 * (non-Javadoc)
526 * @see dwtx.jface.dialogs.PopupDialog#getBackground() 526 * @see dwtx.jface.dialogs.PopupDialog#getBackground()
527 */ 527 */
528 protected Color getBackground() { 528 protected Color getBackground() {
620 */ 620 */
621 protected Color getForeground() { 621 protected Color getForeground() {
622 return JFaceResources.getColorRegistry().get( 622 return JFaceResources.getColorRegistry().get(
623 JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR); 623 JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
624 } 624 }
625 625
626 /* 626 /*
627 * (non-Javadoc) 627 * (non-Javadoc)
628 * @see dwtx.jface.dialogs.PopupDialog#getBackground() 628 * @see dwtx.jface.dialogs.PopupDialog#getBackground()
629 */ 629 */
630 protected Color getBackground() { 630 protected Color getBackground() {
1106 public static const int FILTER_CHARACTER = 2; 1106 public static const int FILTER_CHARACTER = 2;
1107 1107
1108 /** 1108 /**
1109 * Indicates that a cumulative filter applies as keys are typed in the 1109 * Indicates that a cumulative filter applies as keys are typed in the
1110 * popup. That is, each character typed will be added to the filter. 1110 * popup. That is, each character typed will be added to the filter.
1111 * 1111 *
1112 * @deprecated As of 3.4, filtering that is sensitive to changes in the 1112 * @deprecated As of 3.4, filtering that is sensitive to changes in the
1113 * control content should be performed by the supplied 1113 * control content should be performed by the supplied
1114 * {@link IContentProposalProvider}, such as that performed by 1114 * {@link IContentProposalProvider}, such as that performed by
1115 * {@link SimpleContentProposalProvider} 1115 * {@link SimpleContentProposalProvider}
1116 */ 1116 */
1788 if (DEBUG) { 1788 if (DEBUG) {
1789 dump("Modify event triggers autoactivation", e); //$NON-NLS-1$ 1789 dump("Modify event triggers autoactivation", e); //$NON-NLS-1$
1790 } 1790 }
1791 watchModify = false; 1791 watchModify = false;
1792 // We don't autoactivate if the net change is no 1792 // We don't autoactivate if the net change is no
1793 // content. In other words, backspacing to empty 1793 // content. In other words, backspacing to empty
1794 // should never cause a popup to open. 1794 // should never cause a popup to open.
1795 if (!isControlContentEmpty()) { 1795 if (!isControlContentEmpty()) {
1796 autoActivate(); 1796 autoActivate();
1797 } 1797 }
1798 } 1798 }
1947 // Not all controls preserve their selection index when they lose 1947 // Not all controls preserve their selection index when they lose
1948 // focus, so we must set it explicitly here to what it was before 1948 // focus, so we must set it explicitly here to what it was before
1949 // the popup opened. 1949 // the popup opened.
1950 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108 1950 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108
1951 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 1951 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063
1952 if (controlContentAdapter instanceof IControlContentAdapter2 1952 if (null !is cast(IControlContentAdapter2)controlContentAdapter
1953 && selectionRange.x !is -1) { 1953 && selectionRange.x !is -1) {
1954 ((IControlContentAdapter2) controlContentAdapter).setSelection( 1954 (cast(IControlContentAdapter2) controlContentAdapter).setSelection(
1955 control, selectionRange); 1955 control, selectionRange);
1956 } else if (insertionPos !is -1) { 1956 } else if (insertionPos !is -1) {
1957 controlContentAdapter.setCursorPosition(control, insertionPos); 1957 controlContentAdapter.setCursorPosition(control, insertionPos);
1958 } 1958 }
1959 controlContentAdapter.insertControlContents(control, text, 1959 controlContentAdapter.insertControlContents(control, text,
1975 private void recordCursorPosition() { 1975 private void recordCursorPosition() {
1976 if (isValid()) { 1976 if (isValid()) {
1977 IControlContentAdapter adapter = getControlContentAdapter(); 1977 IControlContentAdapter adapter = getControlContentAdapter();
1978 insertionPos = adapter.getCursorPosition(control); 1978 insertionPos = adapter.getCursorPosition(control);
1979 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 1979 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063
1980 if (adapter instanceof IControlContentAdapter2) { 1980 if (null !is cast(IControlContentAdapter2)adapter ) {
1981 selectionRange = ((IControlContentAdapter2) adapter) 1981 selectionRange = (cast(IControlContentAdapter2) adapter)
1982 .getSelection(control); 1982 .getSelection(control);
1983 } 1983 }
1984 1984
1985 } 1985 }
1986 } 1986 }
2093 } 2093 }
2094 2094
2095 /** 2095 /**
2096 * Returns whether the content proposal popup has the focus. This includes 2096 * Returns whether the content proposal popup has the focus. This includes
2097 * both the primary popup and any secondary info popup that may have focus. 2097 * both the primary popup and any secondary info popup that may have focus.
2098 * 2098 *
2099 * @return <code>true</code> if the proposal popup or its secondary info 2099 * @return <code>true</code> if the proposal popup or its secondary info
2100 * popup has the focus 2100 * popup has the focus
2101 * @since 3.4 2101 * @since 3.4
2102 */ 2102 */
2103 public bool hasProposalPopupFocus() { 2103 public bool hasProposalPopupFocus() {