mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ability to create of editors with usage preview + editor settings customizability
This commit is contained in:
@@ -45,9 +45,17 @@ import java.util.List;
|
||||
public class UsagePreviewPanel extends UsageContextPanelBase {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.usages.impl.UsagePreviewPanel");
|
||||
private Editor myEditor;
|
||||
private final boolean myIsEditor;
|
||||
|
||||
public UsagePreviewPanel(@NotNull Project project, @NotNull UsageViewPresentation presentation) {
|
||||
this(project, presentation, false);
|
||||
}
|
||||
|
||||
public UsagePreviewPanel(@NotNull Project project,
|
||||
@NotNull UsageViewPresentation presentation,
|
||||
boolean isEditor) {
|
||||
super(project, presentation);
|
||||
myIsEditor = isEditor;
|
||||
}
|
||||
|
||||
public static class Provider implements UsageContextPanel.Provider {
|
||||
@@ -153,18 +161,22 @@ public class UsagePreviewPanel extends UsageContextPanelBase {
|
||||
if (isDisposed) return null;
|
||||
Project project = psiFile.getProject();
|
||||
|
||||
Editor editor = EditorFactory.getInstance().createEditor(document, project, psiFile.getVirtualFile(), true);
|
||||
Editor editor = EditorFactory.getInstance().createEditor(document, project, psiFile.getVirtualFile(), !myIsEditor);
|
||||
|
||||
EditorSettings settings = editor.getSettings();
|
||||
customizeEditorSettings(settings);
|
||||
|
||||
editor.putUserData(PREVIEW_EDITOR_FLAG, this);
|
||||
return editor;
|
||||
}
|
||||
|
||||
protected void customizeEditorSettings(EditorSettings settings) {
|
||||
settings.setLineMarkerAreaShown(false);
|
||||
settings.setIndentGuidesShown(false);
|
||||
settings.setFoldingOutlineShown(false);
|
||||
settings.setAdditionalColumnsCount(0);
|
||||
settings.setAdditionalLinesCount(0);
|
||||
settings.setVirtualSpace(true);
|
||||
|
||||
editor.putUserData(PREVIEW_EDITOR_FLAG, this);
|
||||
return editor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user