IDEA-104500 Gradle: Allow to reuse common logic for other external systems

Correct editor painting in case when it contains only collapsed fold region (used to draw empty area because selection foreground for the standard colors scheme is the same as default background and selection background was not painted because of too restrictive 'if' condition)
This commit is contained in:
Denis.Zhdanov
2013-05-29 18:19:49 +04:00
parent f944741e7d
commit 4a15c6a012
2 changed files with 15 additions and 3 deletions
@@ -49,12 +49,24 @@ public class ExternalProjectPathLookupElement extends LookupElement {
@Override
public void handleInsert(InsertionContext context) {
Editor editor = context.getEditor();
final FoldingModel foldingModel = editor.getFoldingModel();
foldingModel.runBatchFoldingOperation(new Runnable() {
@Override
public void run() {
FoldRegion[] regions = foldingModel.getAllFoldRegions();
for (FoldRegion region : regions) {
foldingModel.removeFoldRegion(region);
}
}
});
final Document document = editor.getDocument();
final int startOffset = context.getStartOffset();
document.replaceString(startOffset, context.getTailOffset(), myProjectPath);
document.replaceString(startOffset, document.getTextLength(), myProjectPath);
final Project project = context.getProject();
PsiDocumentManager.getInstance(project).commitDocument(document);
final FoldingModel foldingModel = editor.getFoldingModel();
foldingModel.runBatchFoldingOperationDoNotCollapseCaret(new Runnable() {
@Override
public void run() {
@@ -2199,7 +2199,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
if (hEnd >= lEnd) {
FoldRegion collapsedFolderAt = myFoldingModel.getCollapsedRegionAtOffset(start);
if (collapsedFolderAt == null) {
if (collapsedFolderAt == null || collapsedFolderAt.getEndOffset() == lEnd) {
position.x = drawSoftWrapAwareBackground(g, backColor, text, start, lEnd - lIterator.getSeparatorLength(), position, fontType,
defaultBackground, clip, softWrapsToSkip, caretRowPainted);