use of com.intellij.openapi.editor.EditorSettings in project intellij-community by JetBrains.
the class StudyToolWindow method enterEditingMode.
public void enterEditingMode(VirtualFile taskFile, Project project) {
final EditorFactory factory = EditorFactory.getInstance();
Document document = FileDocumentManager.getInstance().getDocument(taskFile);
if (document == null) {
return;
}
WebBrowserManager.getInstance().setShowBrowserHover(false);
final EditorEx createdEditor = (EditorEx) factory.createEditor(document, project, taskFile, false);
Disposer.register(project, new Disposable() {
public void dispose() {
factory.releaseEditor(createdEditor);
}
});
JComponent editorComponent = createdEditor.getComponent();
editorComponent.setBorder(new EmptyBorder(10, 20, 0, 10));
editorComponent.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
EditorSettings editorSettings = createdEditor.getSettings();
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
mySplitPane.setFirstComponent(editorComponent);
mySplitPane.repaint();
StudyTaskManager.getInstance(project).setToolWindowMode(StudyToolWindowMode.EDITING);
}
use of com.intellij.openapi.editor.EditorSettings in project intellij-community by JetBrains.
the class EditVarConstraintsDialog method createEditor.
private static Editor createEditor(final Project project, final String text, final String fileName) {
final FileType fileType = getFileType(fileName);
final Document doc = createDocument(fileName, fileType, text);
final Editor editor = EditorFactory.getInstance().createEditor(doc, project);
((EditorEx) editor).setEmbeddedIntoDialogWrapper(true);
final EditorSettings settings = editor.getSettings();
settings.setLineNumbersShown(false);
settings.setFoldingOutlineShown(false);
settings.setRightMarginShown(false);
settings.setLineMarkerAreaShown(false);
settings.setIndentGuidesShown(false);
((EditorEx) editor).setHighlighter(HighlighterFactory.createHighlighter(fileType, DefaultColorSchemesManager.getInstance().getFirstScheme(), project));
return editor;
}
use of com.intellij.openapi.editor.EditorSettings in project intellij-community by JetBrains.
the class UIUtil method createEditor.
@NotNull
public static Editor createEditor(@NotNull Document doc, final Project project, boolean editable, boolean addToolTipForVariableHandler, @Nullable TemplateContextType contextType) {
final Editor editor = editable ? EditorFactory.getInstance().createEditor(doc, project) : EditorFactory.getInstance().createViewer(doc, project);
EditorSettings editorSettings = editor.getSettings();
editorSettings.setVirtualSpace(false);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setIndentGuidesShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
editorSettings.setCaretRowShown(false);
if (!editable) {
final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
Color c = globalScheme.getColor(EditorColors.READONLY_BACKGROUND_COLOR);
if (c == null) {
c = globalScheme.getDefaultBackground();
}
((EditorEx) editor).setBackgroundColor(c);
} else {
((EditorEx) editor).setEmbeddedIntoDialogWrapper(true);
}
TemplateEditorUtil.setHighlighter(editor, contextType);
if (addToolTipForVariableHandler) {
SubstitutionShortInfoHandler handler = new SubstitutionShortInfoHandler(editor);
editor.addEditorMouseMotionListener(handler);
editor.getDocument().addDocumentListener(handler);
editor.getCaretModel().addCaretListener(handler);
editor.putUserData(LISTENER_KEY, handler);
}
return editor;
}
use of com.intellij.openapi.editor.EditorSettings in project intellij-community by JetBrains.
the class CvsTabbedWindow method createOutputEditor.
@NotNull
private static Editor createOutputEditor(Project project) {
final Editor result = EditorFactory.getInstance().createViewer(EditorFactory.getInstance().createDocument(""), project);
final EditorSettings editorSettings = result.getSettings();
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setIndentGuidesShown(false);
editorSettings.setFoldingOutlineShown(false);
return result;
}
use of com.intellij.openapi.editor.EditorSettings in project intellij-community by JetBrains.
the class EditorActionTest method testPageDownWithSelectionWhenCaretsAreAllowedInsideTabs.
public void testPageDownWithSelectionWhenCaretsAreAllowedInsideTabs() throws Exception {
init("<caret>line 1\n" + "line 2", TestFileType.TEXT);
setEditorVisibleSize(100, 100);
final EditorSettings editorSettings = myEditor.getSettings();
final boolean old = editorSettings.isCaretInsideTabs();
try {
editorSettings.setCaretInsideTabs(true);
executeAction("EditorPageDownWithSelection");
checkResultByText("<selection>line 1\n" + "line 2<caret></selection>");
} finally {
editorSettings.setCaretInsideTabs(old);
}
}
Aggregations