use of com.intellij.openapi.editor.impl.EditorImpl in project intellij-community by JetBrains.
the class CodeInsightTestCase method createEditor.
protected Editor createEditor(@NotNull VirtualFile file) {
final FileEditorManager instance = FileEditorManager.getInstance(myProject);
if (file.getFileType().isBinary())
return null;
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
Editor editor = instance.openTextEditor(new OpenFileDescriptor(myProject, file, 0), false);
((EditorImpl) editor).setCaretActive();
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
DaemonCodeAnalyzer.getInstance(getProject()).restart();
return editor;
}
use of com.intellij.openapi.editor.impl.EditorImpl in project intellij-community by JetBrains.
the class EventLogConsole method installNotificationsFont.
private void installNotificationsFont(@NotNull final EditorEx editor) {
final DelegateColorScheme globalScheme = new DelegateColorScheme(EditorColorsManager.getInstance().getGlobalScheme()) {
@Override
public String getEditorFontName() {
return getConsoleFontName();
}
@Override
public int getEditorFontSize() {
return getConsoleFontSize();
}
@Override
public String getConsoleFontName() {
return NotificationsUtil.getFontName();
}
@Override
public int getConsoleFontSize() {
Pair<String, Integer> data = NotificationsUtil.getFontData();
return data == null ? super.getConsoleFontSize() : data.second;
}
@Override
public void setEditorFontName(String fontName) {
}
@Override
public void setConsoleFontName(String fontName) {
}
@Override
public void setEditorFontSize(int fontSize) {
}
@Override
public void setConsoleFontSize(int fontSize) {
}
};
ApplicationManager.getApplication().getMessageBus().connect(myProjectModel).subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
@Override
public void globalSchemeChange(EditorColorsScheme scheme) {
globalScheme.setDelegate(EditorColorsManager.getInstance().getGlobalScheme());
editor.reinitSettings();
}
});
editor.setColorsScheme(ConsoleViewUtil.updateConsoleColorScheme(editor.createBoundColorSchemeDelegate(globalScheme)));
if (editor instanceof EditorImpl) {
((EditorImpl) editor).setUseEditorAntialiasing(false);
}
}
use of com.intellij.openapi.editor.impl.EditorImpl in project intellij-community by JetBrains.
the class SoftWrapApplianceOnDocumentModificationTest method testLeadingTabWithShiftedWidth.
public void testLeadingTabWithShiftedWidth() throws IOException {
// Inspired by IDEA-76353. The point is that we need to consider cached information about tab symbols width during logical
// position to offset mapping
String text = "\t test";
init(15, text);
((EditorImpl) myEditor).setPrefixTextAndAttributes(" ", new TextAttributes());
myEditor.getCaretModel().moveToOffset(text.length());
}
use of com.intellij.openapi.editor.impl.EditorImpl in project intellij-plugins by JetBrains.
the class SwfHighlightingTest method testLineMarkersInSwf.
@JSTestOptions({ JSTestOption.WithFlexFacet, JSTestOption.WithLineMarkers })
public void testLineMarkersInSwf() throws Exception {
final String testName = getTestName(false);
myAfterCommitRunnable = () -> FlexTestUtils.addLibrary(myModule, "lib", getTestDataPath() + getBasePath() + "/", testName + ".swc", null, null);
// actual test data is in library.swf; this file is here just because we need any file
configureByFile("/" + testName + ".as");
VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + ".swc");
vFile = JarFileSystem.getInstance().getJarRootForLocalFile(vFile).findChild("library.swf");
myEditor = FileEditorManager.getInstance(myProject).openTextEditor(new OpenFileDescriptor(myProject, vFile, 0), false);
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
myFile = myPsiManager.findFile(vFile);
((EditorImpl) myEditor).setCaretActive();
vFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + ".as");
final String verificationText = StreamUtil.convertSeparators(VfsUtilCore.loadText(vFile));
checkHighlighting(new ExpectedHighlightingData(new DocumentImpl(verificationText), false, false, true, myFile));
}
use of com.intellij.openapi.editor.impl.EditorImpl in project intellij-plugins by JetBrains.
the class SwfHighlightingTest method testProtectSwf.
public void testProtectSwf() throws Exception {
configureByFiles((String) null);
VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + getTestName(false) + ".swf");
myEditor = FileEditorManager.getInstance(myProject).openTextEditor(new OpenFileDescriptor(myProject, vFile, 0), false);
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
myFile = myPsiManager.findFile(vFile);
((EditorImpl) myEditor).setCaretActive();
assertFalse(FileDocumentManager.getInstance().requestWriting(myEditor.getDocument(), myProject));
}
Aggregations