@Override protected void closeProposalPopup() { // workaround to keep popup open String content = getControlContentAdapter().getControlContents(getControl()); int pos = getControlContentAdapter().getCursorPosition(getControl()); if( content.length() == 0 || pos == 0 ) { super.closeProposalPopup(); return; } String prefix = content.substring(0, pos); if( prefix.length() == 0 || prefix.endsWith(" ") ) { super.closeProposalPopup(); return; } }
private void insertControlContent(String text, int cursorPosition) { if (isValid()) { // should already be false, but just in case. watchModify = false; // Not all controls preserve their selection index when they lose // focus, so we must set it explicitly here to what it was before // the popup opened. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 if (controlContentAdapter instanceof IControlContentAdapter2 && selectionRange.x != -1) { ((IControlContentAdapter2) controlContentAdapter).setSelection( control, selectionRange); } else if (insertionPos != -1) { controlContentAdapter.setCursorPosition(control, insertionPos); } controlContentAdapter.insertControlContents(control, text, cursorPosition); } }
private void setControlContent(String text, int cursorPosition) { if (isValid()) { // should already be false, but just in case. watchModify = false; controlContentAdapter.setControlContents(control, text, cursorPosition); } }
private boolean shouldPopupRemainOpen() { // If we always autoactivate or never autoactivate, it should remain open if (autoActivateString == null || autoActivateString.length() == 0) return true; String content = getControlContentAdapter().getControlContents(getControl()); for (int i=0; i<autoActivateString.length(); i++) { if (content.indexOf(autoActivateString.charAt(i)) >= 0) return true; } return false; }
private void recordCursorPosition() { if (isValid()) { IControlContentAdapter adapter = getControlContentAdapter(); insertionPos = adapter.getCursorPosition(control); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 if (adapter instanceof IControlContentAdapter2) { selectionRange = ((IControlContentAdapter2) adapter) .getSelection(control); } } }
.getInsertionBounds(control); initialX = initialX + insertionBounds.x; initialY = location.y + insertionBounds.y
private boolean shouldPopupRemainOpen() { // If we always autoactivate or never autoactivate, it should remain open if (autoActivateString == null || autoActivateString.length() == 0) return true; String content = getControlContentAdapter().getControlContents(getControl()); for (int i=0; i<autoActivateString.length(); i++) { if (content.indexOf(autoActivateString.charAt(i)) >= 0) return true; } return false; }
private void recordCursorPosition() { if (isValid()) { IControlContentAdapter adapter = getControlContentAdapter(); insertionPos = adapter.getCursorPosition(control); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 if (adapter instanceof IControlContentAdapter2) { selectionRange = ((IControlContentAdapter2) adapter) .getSelection(control); } } }
.getInsertionBounds(control); initialX = initialX + insertionBounds.x; initialY = location.y + insertionBounds.y
private IContentProposal[] getProposals() { if (proposalProvider == null || !isValid()) { return null; } if (DEBUG) { System.out.println(">>> obtaining proposals from provider"); //$NON-NLS-1$ } int position = insertionPos; if (position == -1) { position = getControlContentAdapter().getCursorPosition( getControl()); } String contents = getControlContentAdapter().getControlContents( getControl()); IContentProposal[] proposals = proposalProvider.getProposals(contents, position); return proposals; }
private void insertControlContent(String text, int cursorPosition) { if (isValid()) { // should already be false, but just in case. watchModify = false; // Not all controls preserve their selection index when they lose // focus, so we must set it explicitly here to what it was before // the popup opened. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 if (controlContentAdapter instanceof IControlContentAdapter2 && selectionRange.x != -1) { ((IControlContentAdapter2) controlContentAdapter).setSelection( control, selectionRange); } else if (insertionPos != -1) { controlContentAdapter.setCursorPosition(control, insertionPos); } controlContentAdapter.insertControlContents(control, text, cursorPosition); } }
private boolean shouldPopupRemainOpen() { // If we always autoactivate or never autoactivate, it should remain open if (autoActivateString == null || autoActivateString.length() == 0) { return true; } String content = getControlContentAdapter().getControlContents(getControl()); for (int i=0; i<autoActivateString.length(); i++) { if (content.indexOf(autoActivateString.charAt(i)) >= 0) { return true; } } return false; }
private void recordCursorPosition() { if (isValid()) { IControlContentAdapter adapter = getControlContentAdapter(); insertionPos = adapter.getCursorPosition(control); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 if (adapter instanceof IControlContentAdapter2) { selectionRange = ((IControlContentAdapter2) adapter) .getSelection(control); } } }
private void setControlContent(String text, int cursorPosition) { if (isValid()) { // should already be false, but just in case. watchModify = false; controlContentAdapter.setControlContents(control, text, cursorPosition); } }
.getInsertionBounds(control); initialX = initialX + insertionBounds.x; initialY = location.y + insertionBounds.y
private IContentProposal[] getProposals() { if (proposalProvider == null || !isValid()) { return null; } if (DEBUG) { System.out.println(">>> obtaining proposals from provider"); //$NON-NLS-1$ } int position = insertionPos; if (position == -1) { position = getControlContentAdapter().getCursorPosition( getControl()); } String contents = getControlContentAdapter().getControlContents( getControl()); IContentProposal[] proposals = proposalProvider.getProposals(contents, position); return proposals; }
private void insertControlContent(String text, int cursorPosition) { if (isValid()) { // should already be false, but just in case. watchModify = false; // Not all controls preserve their selection index when they lose // focus, so we must set it explicitly here to what it was before // the popup opened. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 if (controlContentAdapter instanceof IControlContentAdapter2 && selectionRange.x != -1) { ((IControlContentAdapter2) controlContentAdapter).setSelection( control, selectionRange); } else if (insertionPos != -1) { controlContentAdapter.setCursorPosition(control, insertionPos); } controlContentAdapter.insertControlContents(control, text, cursorPosition); } }
private boolean isControlContentEmpty() { return getControlContentAdapter().getControlContents(getControl()) .length() == 0; }
private void setControlContent(String text, int cursorPosition) { if (isValid()) { // should already be false, but just in case. watchModify = false; controlContentAdapter.setControlContents(control, text, cursorPosition); } }
private IContentProposal[] getProposals() { if (proposalProvider == null || !isValid()) { return null; } if (DEBUG) { System.out.println(">>> obtaining proposals from provider"); //$NON-NLS-1$ } int position = insertionPos; if (position == -1) { position = getControlContentAdapter().getCursorPosition( getControl()); } String contents = getControlContentAdapter().getControlContents( getControl()); IContentProposal[] proposals = proposalProvider.getProposals(contents, position); return proposals; }