use of org.jkiss.dbeaver.model.struct.DBSObjectContainer in project dbeaver by dbeaver.
the class SQLCompletionProposal method apply.
@Override
public void apply(IDocument document) {
try {
String replaceOn = replacementString;
if (replacementAfter != null) {
replaceOn += replacementAfter;
}
if (dataSource != null) {
if (dataSource.getContainer().getPreferenceStore().getBoolean(SQLPreferenceConstants.INSERT_SPACE_AFTER_PROPOSALS)) {
boolean insertTrailingSpace;
if (object instanceof DBSObjectContainer) {
// Do not append trailing space after schemas/catalogs/etc.
} else {
int docLen = document.getLength();
if (docLen <= replacementOffset + replacementLength + 2) {
insertTrailingSpace = true;
} else {
insertTrailingSpace = document.getChar(replacementOffset + replacementLength) != ' ';
}
if (insertTrailingSpace) {
replaceOn += " ";
}
cursorPosition++;
}
}
}
document.replace(replacementOffset, replacementLength, replaceOn);
} catch (BadLocationException e) {
// ignore
log.debug(e);
}
}
Aggregations