Java Code Examples for com.intellij.ui.EditorTextField#setFont()
The following examples show how to use
com.intellij.ui.EditorTextField#setFont() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DocumentIntention.java From weex-language-support with MIT License | 5 votes |
private void openSample(Project project, Editor editor) { EditorTextField field = new EditorTextField(editor.getDocument(), project, WeexFileType.INSTANCE, true, false) { @Override protected EditorEx createEditor() { EditorEx editor1 = super.createEditor(); editor1.setVerticalScrollbarVisible(true); editor1.setHorizontalScrollbarVisible(true); return editor1; } }; field.setFont(editor.getContentComponent().getFont()); JBPopup jbPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(field, null) .createPopup(); jbPopup.setSize(new Dimension(500, 500)); jbPopup.showInBestPositionFor(editor); }
Example 2
Source File: XDebuggerExpressionEditor.java From consulo with Apache License 2.0 | 5 votes |
public XDebuggerExpressionEditor(Project project, @Nonnull XDebuggerEditorsProvider debuggerEditorsProvider, @Nullable @NonNls String historyId, @Nullable XSourcePosition sourcePosition, @Nonnull XExpression text, final boolean multiline, boolean editorFont, boolean showEditor) { super(project, debuggerEditorsProvider, multiline ? EvaluationMode.CODE_FRAGMENT : EvaluationMode.EXPRESSION, historyId, sourcePosition); myExpression = XExpressionImpl.changeMode(text, getMode()); myEditorTextField = new EditorTextField(createDocument(myExpression), project, debuggerEditorsProvider.getFileType(), false, !multiline) { @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); editor.setVerticalScrollbarVisible(multiline); editor.getColorsScheme().setEditorFontName(getFont().getFontName()); editor.getColorsScheme().setEditorFontSize(getFont().getSize()); return editor; } @Override public Object getData(@Nonnull Key dataId) { if (LangDataKeys.CONTEXT_LANGUAGES == dataId) { return new Language[]{myExpression.getLanguage()}; } else if (CommonDataKeys.PSI_FILE == dataId) { return PsiDocumentManager.getInstance(getProject()).getPsiFile(getDocument()); } return super.getData(dataId); } }; if (editorFont) { myEditorTextField.setFontInheritedFromLAF(false); myEditorTextField.setFont(EditorUtil.getEditorFont()); } myComponent = decorate(myEditorTextField, multiline, showEditor); }