本文整理汇总了Java中com.intellij.psi.codeStyle.CommonCodeStyleSettings.IndentOptions方法的典型用法代码示例。如果您正苦于以下问题:Java CommonCodeStyleSettings.IndentOptions方法的具体用法?Java CommonCodeStyleSettings.IndentOptions怎么用?Java CommonCodeStyleSettings.IndentOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.codeStyle.CommonCodeStyleSettings
的用法示例。
在下文中一共展示了CommonCodeStyleSettings.IndentOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveIndents
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public void saveIndents(final FormattingModel model, final TextRange affectedRange,
IndentInfoStorage storage,
final CodeStyleSettings settings,
final CommonCodeStyleSettings.IndentOptions indentOptions) {
try {
validateModel(model);
final Block block = model.getRootBlock();
final FormatProcessor processor = buildProcessorAndWrapBlocks(
model.getDocumentModel(), block, settings, indentOptions, new FormatTextRanges(affectedRange, true)
);
LeafBlockWrapper current = processor.getFirstTokenBlock();
while (current != null) {
WhiteSpace whiteSpace = current.getWhiteSpace();
if (!whiteSpace.isReadOnly() && whiteSpace.containsLineFeeds()) {
storage.saveIndentInfo(current.calcIndentFromParent(), current.getStartOffset());
}
current = current.getNextBlock();
}
}
catch (FormattingModelInconsistencyException e) {
LOG.error(e);
}
}
示例2: getCodeStyleIntent
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@NotNull
public static String getCodeStyleIntent(InsertionContext insertionContext) {
final CodeStyleSettings currentSettings =
CodeStyleSettingsManager.getSettings(insertionContext.getProject());
final CommonCodeStyleSettings.IndentOptions indentOptions =
currentSettings.getIndentOptions(insertionContext.getFile().getFileType());
return indentOptions.USE_TAB_CHARACTER ?
"\t" :
StringUtil.repeatSymbol(' ', indentOptions.INDENT_SIZE);
}
示例3: getDefaultCommonSettings
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
CommonCodeStyleSettings defaultSettings = new CommonCodeStyleSettings(getLanguage());
CommonCodeStyleSettings.IndentOptions indentOptions = defaultSettings.initIndentOptions();
indentOptions.INDENT_SIZE = 2;
indentOptions.CONTINUATION_INDENT_SIZE = 4;
indentOptions.TAB_SIZE = 2;
return defaultSettings;
}
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:10,代码来源:AppleScriptLanguageCodeStyleSettingsProvider.java
示例4: testSmartTabsInFileWithoutBinaryExpressionMultilineAlignment
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
public void testSmartTabsInFileWithoutBinaryExpressionMultilineAlignment() {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
final CommonCodeStyleSettings.IndentOptions options = settings.getIndentOptions(JavaFileType.INSTANCE);
options.USE_TAB_CHARACTER = true;
options.SMART_TABS = true;
doTest("class X {{\n" +
"\tSystem.out.println(\"asdf\" +\n" +
"\t\t\t \"asdf\");\n" +
"}}");
}
示例5: getIndentOptionsToUse
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Nullable
@Override
public CommonCodeStyleSettings.IndentOptions getIndentOptionsToUse(@NotNull PsiFile file,
@NotNull FormatTextRanges ranges,
@NotNull CodeStyleSettings settings) {
return null;
}
示例6: getIndentOptions
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
public CommonCodeStyleSettings.IndentOptions getIndentOptions() {
if (myIndentOptions == null) {
CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
myIndentOptions = codeStyleSettings.getIndentOptions(file.getFileType());
}
return myIndentOptions;
}
示例7: getIndentOptionsToUse
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Nullable
@Override
public CommonCodeStyleSettings.IndentOptions getIndentOptionsToUse(@NotNull PsiFile file,
@NotNull FormatTextRanges ranges,
@NotNull CodeStyleSettings settings)
{
return null;
}
示例8: getDefaultCommonSettings
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Nullable
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
CommonCodeStyleSettings defaultSettings =
new CommonCodeStyleSettings(BuildFileLanguage.INSTANCE);
CommonCodeStyleSettings.IndentOptions indentOptions = defaultSettings.initIndentOptions();
indentOptions.TAB_SIZE = 2;
indentOptions.INDENT_SIZE = 2;
indentOptions.CONTINUATION_INDENT_SIZE = 4;
return defaultSettings;
}
示例9: reset
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public void reset(@NotNull final CodeStyleSettings settings, @NotNull final CommonCodeStyleSettings.IndentOptions options) {
super.reset(settings, options);
myContinuationIndentField.setText(String.valueOf(options.CONTINUATION_INDENT_SIZE));
myCbSmartTabs.setSelected(options.SMART_TABS);
myCbKeepIndentsOnEmptyLines.setSelected(options.KEEP_INDENTS_ON_EMPTY_LINES);
}
示例10: setUp
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
ExtensionPoint<FileIndentOptionsProvider> extensionPoint =
Extensions.getRootArea().getExtensionPoint(FileIndentOptionsProvider.EP_NAME);
extensionPoint.registerExtension(TEST_FILE_INDENT_OPTIONS_PROVIDER);
myTestIndentOptions = new CommonCodeStyleSettings.IndentOptions();
}
示例11: setCodeStyleOption
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
private void setCodeStyleOption(@NotNull CodeStyleSettings settings, @NotNull String key, @NotNull String value)
throws SchemeImportException {
EclipseImportMap.ImportDescriptor importDescriptor = myImportMap.getImportDescriptor(key);
if (importDescriptor != null) {
try {
if (importDescriptor.isLanguageSpecific()) {
CommonCodeStyleSettings languageSettings = settings.getCommonSettings(importDescriptor.getLanguage());
if (languageSettings != null) {
if (importDescriptor.isIndentOptions()) {
CommonCodeStyleSettings.IndentOptions indentOptions = languageSettings.getIndentOptions();
if (indentOptions != null) {
setValue(indentOptions, key, importDescriptor.getFieldName(), value);
}
}
else {
setValue(languageSettings, key, importDescriptor.getFieldName(), value);
}
}
}
else {
setValue(settings, key, importDescriptor.getFieldName(), value);
}
}
catch (Exception e) {
throw new SchemeImportException(e);
}
}
}
示例12: prepareToBuildBlocksSequentially
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
protected static InitialInfoBuilder prepareToBuildBlocksSequentially(Block root,
FormattingDocumentModel model,
@Nullable final FormatTextRanges affectedRanges,
@NotNull CodeStyleSettings settings,
final CommonCodeStyleSettings.IndentOptions options,
int interestingOffset,
@NotNull FormattingProgressCallback progressCallback)
{
InitialInfoBuilder builder = new InitialInfoBuilder(root, model, affectedRanges, settings, options, interestingOffset, progressCallback);
builder.buildFrom(root, 0, null, null, null, true);
return builder;
}
示例13: getWhiteSpaceBefore
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public IndentInfo getWhiteSpaceBefore(final FormattingDocumentModel model,
final Block block,
final CodeStyleSettings settings,
final CommonCodeStyleSettings.IndentOptions indentOptions,
final TextRange affectedRange, final boolean mayChangeLineFeeds)
{
disableFormatting();
try {
final FormatProcessor processor = buildProcessorAndWrapBlocks(
model, block, settings, indentOptions, new FormatTextRanges(affectedRange, true)
);
final LeafBlockWrapper blockBefore = processor.getBlockAtOrAfter(affectedRange.getStartOffset());
LOG.assertTrue(blockBefore != null);
WhiteSpace whiteSpace = blockBefore.getWhiteSpace();
LOG.assertTrue(whiteSpace != null);
if (!mayChangeLineFeeds) {
whiteSpace.setLineFeedsAreReadOnly();
}
processor.setAllWhiteSpacesAreReadOnly();
whiteSpace.setReadOnly(false);
processor.formatWithoutRealModifications();
return new IndentInfo(whiteSpace.getLineFeeds(), whiteSpace.getIndentOffset(), whiteSpace.getSpaces());
}
finally {
enableFormatting();
}
}
示例14: getDefaultCommonSettings
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的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;
}
示例15: createWhiteSpace
import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
private void createWhiteSpace(final int whiteSpaceLength, StringBuilder buffer) {
if (whiteSpaceLength < 0) return;
final CommonCodeStyleSettings.IndentOptions indentOptions = getIndentOptions();
if (indentOptions.USE_TAB_CHARACTER) {
int tabs = whiteSpaceLength / indentOptions.TAB_SIZE;
int spaces = whiteSpaceLength - tabs * indentOptions.TAB_SIZE;
StringUtil.repeatSymbol(buffer, '\t', tabs);
StringUtil.repeatSymbol(buffer, ' ', spaces);
}
else {
StringUtil.repeatSymbol(buffer, ' ', whiteSpaceLength);
}
}