本文整理匯總了Java中com.intellij.psi.codeStyle.CodeStyleSettings.getRightMargin方法的典型用法代碼示例。如果您正苦於以下問題:Java CodeStyleSettings.getRightMargin方法的具體用法?Java CodeStyleSettings.getRightMargin怎麽用?Java CodeStyleSettings.getRightMargin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.codeStyle.CodeStyleSettings
的用法示例。
在下文中一共展示了CodeStyleSettings.getRightMargin方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testResultExceedsRightMargin
import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testResultExceedsRightMargin() {
final CodeStyleSettings settings = getCodeStyleSettings();
final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
final int oldRightMargin = settings.getRightMargin(PythonLanguage.getInstance());
final boolean oldWrapLongLines = commonSettings.WRAP_LONG_LINES;
settings.setRightMargin(PythonLanguage.getInstance(), 80);
commonSettings.WRAP_LONG_LINES = true;
try {
doTest();
}
finally {
commonSettings.WRAP_LONG_LINES = oldWrapLongLines;
settings.setRightMargin(PythonLanguage.getInstance(), oldRightMargin);
}
}
示例2: isBelowRightMargin
import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
@Override
protected boolean isBelowRightMargin(Project project, int lineLength) {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
return lineLength <= settings.getRightMargin(JavaLanguage.INSTANCE);
}
示例3: collectInformation
import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
@Nullable
@Override
public State collectInformation(@NotNull PsiFile file) {
VirtualFile vFile = file.getVirtualFile();
if (vFile == null || vFile.getFileType() != PythonFileType.INSTANCE) {
return null;
}
Sdk sdk = PythonSdkType.findLocalCPython(ModuleUtilCore.findModuleForPsiElement(file));
if (sdk == null) {
if (!myReportedMissingInterpreter) {
myReportedMissingInterpreter = true;
reportMissingInterpreter();
}
return null;
}
final String homePath = sdk.getHomePath();
if (homePath == null) {
if (!myReportedMissingInterpreter) {
myReportedMissingInterpreter = true;
LOG.info("Could not find home path for interpreter " + homePath);
}
return null;
}
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(file.getProject()).getInspectionProfile();
final HighlightDisplayKey key = HighlightDisplayKey.find(PyPep8Inspection.INSPECTION_SHORT_NAME);
if (!profile.isToolEnabled(key)) {
return null;
}
final PyPep8Inspection inspection = (PyPep8Inspection)profile.getUnwrappedTool(PyPep8Inspection.KEY.toString(), file);
final CodeStyleSettings currentSettings = CodeStyleSettingsManager.getInstance(file.getProject()).getCurrentSettings();
final List<String> ignoredErrors = Lists.newArrayList(inspection.ignoredErrors);
if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_AFTER_NUMBER_SIGN) {
ignoredErrors.add("E262"); // Block comment should start with a space
ignoredErrors.add("E265"); // Inline comment should start with a space
}
if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_BEFORE_NUMBER_SIGN) {
ignoredErrors.add("E261"); // At least two spaces before inline comment
}
final int margin = currentSettings.getRightMargin(file.getLanguage());
return new State(homePath, file.getText(), profile.getErrorLevel(key, file), ignoredErrors, margin);
}