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 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 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); } }