本文整理汇总了Java中com.jetbrains.python.PythonLanguage.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java PythonLanguage.getInstance方法的具体用法?Java PythonLanguage.getInstance怎么用?Java PythonLanguage.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jetbrains.python.PythonLanguage
的用法示例。
在下文中一共展示了PythonLanguage.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableCellEditorComponent
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,
final int rowIndex, final int vColIndex) {
myEditor = new MyTableEditor(myProject, new PyDebuggerEditorsProvider(), "numpy.array.table.view", null,
new XExpressionImpl(value.toString(), PythonLanguage.getInstance(), "", EvaluationMode.CODE_FRAGMENT),
getActionsAdapter(rowIndex, vColIndex));
myLastValue = value;
return myEditor.getComponent();
}
示例2: getDefaultCommonSettings
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
CommonCodeStyleSettings defaultSettings = new CommonCodeStyleSettings(PythonLanguage.getInstance());
CommonCodeStyleSettings.IndentOptions indentOptions = defaultSettings.initIndentOptions();
indentOptions.INDENT_SIZE = 4;
defaultSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
defaultSettings.KEEP_BLANK_LINES_IN_DECLARATIONS = 1;
defaultSettings.KEEP_BLANK_LINES_IN_CODE = 1;
return defaultSettings;
}
示例3: allButLambda
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
private static TokenSet allButLambda() {
final PythonLanguage pythonLanguage = PythonLanguage.getInstance();
return TokenSet.create(IElementType.enumerate(new IElementType.Predicate() {
@Override
public boolean matches(@NotNull IElementType type) {
return type != LAMBDA_KEYWORD && type.getLanguage().isKindOf(pythonLanguage);
}
}));
}
示例4: PythonConsoleView
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
public PythonConsoleView(final Project project, final String title, final Sdk sdk) {
super(project, title, PythonLanguage.getInstance());
getVirtualFile().putUserData(LanguageLevel.KEY, PythonSdkType.getLanguageLevelForSdk(sdk));
// Mark editor as console one, to prevent autopopup completion
getConsoleEditor().putUserData(PythonConsoleAutopopupBlockingHandler.REPL_KEY, new Object());
setPrompt(PyConsoleUtil.ORDINARY_PROMPT);
setUpdateFoldingsEnabled(false);
//noinspection ConstantConditions
myPyHighlighter = new PyHighlighter(
sdk != null && sdk.getVersionString() != null ? LanguageLevel.fromPythonVersion(sdk.getVersionString()) : LanguageLevel.getDefault());
myScheme = getConsoleEditor().getColorsScheme();
}
示例5: getTemplateDataLanguage
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
@Override
@NotNull
public Language getTemplateDataLanguage() {
return PythonLanguage.getInstance();
}
示例6: PyiLanguageDialect
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
protected PyiLanguageDialect() {
super(PythonLanguage.getInstance(), ID);
}
示例7: PyCodeStyleMainPanel
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
protected PyCodeStyleMainPanel(CodeStyleSettings currentSettings, CodeStyleSettings settings) {
super(PythonLanguage.getInstance(), currentSettings, settings);
}
示例8: getLanguage
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
@NotNull
@Override
public Language getLanguage() {
return PythonLanguage.getInstance();
}
示例9: isEngagedToFormat
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
public boolean isEngagedToFormat(PsiElement context) {
PsiFile file = context.getContainingFile();
return file != null && file.getLanguage() == PythonLanguage.getInstance();
}
示例10: PyDocstringLanguageDialect
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
protected PyDocstringLanguageDialect() {
super(PythonLanguage.getInstance(), "PyDocstring");
putUserData(QuickEditAction.EDIT_ACTION_AVAILABLE, false);
}
示例11: PydevConsoleElement
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
public PydevConsoleElement(final PsiManager manager, final String name, final String description) {
super(manager, PythonLanguage.getInstance(), name);
myDescription = description;
}
示例12: PyFileImpl
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
public PyFileImpl(FileViewProvider viewProvider) {
this(viewProvider, PythonLanguage.getInstance());
}
示例13: preprocessOnPaste
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
@NotNull
@Override
public String preprocessOnPaste(Project project,
PsiFile file,
Editor editor,
String text,
RawText rawText) {
if (!CodeInsightSettings.getInstance().INDENT_TO_CARET_ON_PASTE || file.getLanguage() != PythonLanguage.getInstance()) {
return text;
}
final CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(project);
final boolean useTabs = codeStyleSettings.useTabCharacter(PythonFileType.INSTANCE);
final int indentSize = codeStyleSettings.getIndentSize(PythonFileType.INSTANCE);
CharFilter NOT_INDENT_FILTER = new CharFilter() {
public boolean accept(char ch) {
return useTabs? ch != '\t' : ch != ' ';
}
};
final String indentChar = useTabs ? "\t" : " ";
final CaretModel caretModel = editor.getCaretModel();
final SelectionModel selectionModel = editor.getSelectionModel();
final Document document = editor.getDocument();
final int caretOffset = selectionModel.getSelectionStart() != selectionModel.getSelectionEnd() ?
selectionModel.getSelectionStart() : caretModel.getOffset();
final int lineNumber = document.getLineNumber(caretOffset);
final int lineStartOffset = getLineStartSafeOffset(document, lineNumber);
final int lineEndOffset = document.getLineEndOffset(lineNumber);
final PsiElement element = file.findElementAt(caretOffset);
if (PsiTreeUtil.getParentOfType(element, PyStringLiteralExpression.class) != null) return text;
text = addLeadingSpaces(text, NOT_INDENT_FILTER, indentSize, indentChar);
int firstLineIndent = StringUtil.findFirst(text, NOT_INDENT_FILTER);
final String indentText = getIndentText(file, document, caretOffset, lineNumber, firstLineIndent);
int toRemove = calculateIndentToRemove(text, NOT_INDENT_FILTER);
final String toString = document.getText(TextRange.create(lineStartOffset, lineEndOffset));
if (StringUtil.isEmptyOrSpaces(indentText) && isApplicable(file, text, caretOffset)) {
caretModel.moveToOffset(lineStartOffset);
if (StringUtil.isEmptyOrSpaces(toString)) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
document.deleteString(lineStartOffset, lineEndOffset);
}
});
}
editor.getSelectionModel().setSelection(lineStartOffset, selectionModel.getSelectionEnd());
}
final List<String> strings = StringUtil.split(text, "\n", false);
String newText = "";
if (StringUtil.isEmptyOrSpaces(indentText)) {
for (String s : strings) {
newText += indentText + StringUtil.trimStart(s, StringUtil.repeat(indentChar, toRemove));
}
}
else {
newText = text;
}
if (addLinebreak(text, toString, useTabs) && selectionModel.getSelectionStart() == selectionModel.getSelectionEnd())
newText += "\n";
return newText;
}
示例14: isPythonUsage
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
private static boolean isPythonUsage(UsageInfo info) {
final PsiElement element = info.getElement();
if (element == null) return false;
return element.getLanguage() == PythonLanguage.getInstance();
}
示例15: IpnbPyLanguageDialect
import com.jetbrains.python.PythonLanguage; //导入方法依赖的package包/类
protected IpnbPyLanguageDialect() {
super(PythonLanguage.getInstance(), "IpnbPython");
}