本文整理汇总了Java中com.intellij.psi.formatter.FormattingDocumentModelImpl类的典型用法代码示例。如果您正苦于以下问题:Java FormattingDocumentModelImpl类的具体用法?Java FormattingDocumentModelImpl怎么用?Java FormattingDocumentModelImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FormattingDocumentModelImpl类属于com.intellij.psi.formatter包,在下文中一共展示了FormattingDocumentModelImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTemplateLanguageBlock
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
public TemplateLanguageBlock createTemplateLanguageBlock(
@NotNull ASTNode node,
@Nullable Wrap wrap,
@Nullable Alignment alignment,
@Nullable List<DataLanguageBlockWrapper> foreignChildren,
@NotNull CodeStyleSettings codeStyleSettings) {
final FormattingDocumentModelImpl documentModel =
FormattingDocumentModelImpl.createOn(node.getPsi().getContainingFile());
if (node.getPsi() instanceof TagElement) {
return new SoyTagBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
} else if(node.getPsi() instanceof TagBlockElement) {
return new SoyTagBlockBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
} else if (node.getPsi() instanceof SoyStatementList) {
return new SoyStatementListBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
} else {
return new SoyBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
}
}
开发者ID:google,项目名称:bamboo-soy,代码行数:40,代码来源:SoyFormattingModelBuilder.java
示例2: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final FileElement fileElement = TreeUtil.getFileElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(element));
LOG.assertTrue(fileElement != null, "File element should not be null for " + element);
CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
JavaCodeStyleSettings customJavaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
Block block = AbstractJavaBlock.newJavaBlock(fileElement, commonSettings, customJavaSettings);
FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile());
return new PsiBasedFormatterModelWithShiftIndentInside (element.getContainingFile(), block, model);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaFormattingModelBuilder.java
示例3: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final PsiFile psiFile = element.getContainingFile();
final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
return new XmlFormattingModel(psiFile,
new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile),
null, null,
new HtmlPolicy(settings, documentModel), null, null, false),
documentModel);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:XhtmlFormattingModelBuilder.java
示例4: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final ASTNode root = TreeUtil.getFileElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(element));
final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(element.getContainingFile());
return new XmlFormattingModel(element.getContainingFile(), createBlock(settings, root, documentModel), documentModel);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:XmlFormattingModelBuilder.java
示例5: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final PsiFile psiFile = element.getContainingFile();
final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
return new XmlFormattingModel(psiFile,
new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile),
null, null, new HtmlPolicy(settings, documentModel), null, null, false),
documentModel);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:HtmlFormattingModelBuilder.java
示例6: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final FileElement fileElement = TreeUtil.getFileElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(element));
LOG.assertTrue(fileElement != null, "File element should not be null for " + element);
CommonCodeStyleSettings javaSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
Block block = AbstractJavaBlock.createJavaBlock(fileElement, javaSettings);
FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile());
return new PsiBasedFormatterModelWithShiftIndentInside (element.getContainingFile(), block, model);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:JavaFormattingModelBuilder.java
示例7: assertInvalidRanges
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
public static void assertInvalidRanges(final int startOffset, final int newEndOffset, FormattingDocumentModel model, String message) {
@NonNls final StringBuilder buffer = new StringBuilder();
buffer.append("Invalid formatting blocks:").append(message).append("\n");
buffer.append("Start offset:");
buffer.append(startOffset);
buffer.append(" end offset:");
buffer.append(newEndOffset);
buffer.append("\n");
int minOffset = Math.max(Math.min(startOffset, newEndOffset) - 20, 0);
int maxOffset = Math.min(Math.max(startOffset, newEndOffset) + 20, model.getTextLength());
buffer.append("Affected text fragment:[").append(minOffset).append(",").append(maxOffset).append("] - '")
.append(model.getText(new TextRange(minOffset, maxOffset))).append("'\n");
final StringBuilder messageBuffer = new StringBuilder();
messageBuffer.append("Invalid ranges during formatting");
if (model instanceof FormattingDocumentModelImpl) {
messageBuffer.append(" in ").append(((FormattingDocumentModelImpl)model).getFile().getLanguage());
}
buffer.append("File text:(").append(model.getTextLength()).append(")\n'");
buffer.append(model.getText(new TextRange(0, model.getTextLength())).toString());
buffer.append("'\n");
buffer.append("model (").append(model.getClass()).append("): ").append(model);
if (model instanceof FormattingDocumentModelImpl) {
final FormattingDocumentModelImpl modelImpl = (FormattingDocumentModelImpl)model;
buffer.append("Psi Tree:\n");
final PsiFile file = modelImpl.getFile();
final List<PsiFile> roots = file.getViewProvider().getAllFiles();
for (PsiFile root : roots) {
buffer.append("Root ");
DebugUtil.treeToBuffer(buffer, root.getNode(), 0, false, true, true, true);
}
buffer.append('\n');
}
LogMessageEx.error(LOG, messageBuffer.toString(), buffer.toString());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:InitialInfoBuilder.java
示例8: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final PsiFile psiFile = element.getContainingFile();
final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
return new XmlFormattingModel(psiFile,
new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile),
null, null,
new HtmlPolicy(settings, documentModel), null, null, false),
documentModel);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:XhtmlFormattingModelBuilder.java
示例9: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final ASTNode root = TreeUtil.getFileElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(element));
final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(element.getContainingFile());
return new XmlFormattingModel(element.getContainingFile(),
new XmlBlock(root, null, null, new XmlPolicy(settings, documentModel), null, null, false),
documentModel);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:XmlFormattingModelBuilder.java
示例10: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final PsiFile psiFile = element.getContainingFile();
final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
return new XmlFormattingModel(psiFile,
new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile),
null, null, new HtmlPolicy(settings, documentModel), null, null, false),
documentModel);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:HtmlFormattingModelBuilder.java
示例11: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings)
{
final PsiFile file = element.getContainingFile();
FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile());
Block rootBlock = new CSharpFormattingBlock(file.getNode(), null, null, settings);
return new PsiBasedFormattingModel(file, rootBlock, model);
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:10,代码来源:CSharpFormattingModelBuilder.java
示例12: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings codeStyleSettings)
{
final PsiFile file = element.getContainingFile();
FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile());
Block rootBlock = new CssFormattingBlock(element.getNode(), null, null);
return new PsiBasedFormattingModel(file, rootBlock, model);
}
开发者ID:consulo,项目名称:consulo-css,代码行数:10,代码来源:CssFormattingModelBuilder.java
示例13: createModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
@NotNull
@RequiredReadAction
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings)
{
final FileElement fileElement = TreeUtil.getFileElement((TreeElement) SourceTreeToPsiMap.psiElementToTree(element));
LOG.assertTrue(fileElement != null, "File element should not be null for " + element);
CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
JavaCodeStyleSettings customJavaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
Block block = AbstractJavaBlock.newJavaBlock(fileElement, commonSettings, customJavaSettings);
FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile());
return new PsiBasedFormatterModelWithShiftIndentInside(element.getContainingFile(), block, model);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:JavaFormattingModelBuilder.java
示例14: PsiBasedFormatterModelWithShiftIndentInside
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
public PsiBasedFormatterModelWithShiftIndentInside(final PsiFile file,
@NotNull final Block rootBlock,
final FormattingDocumentModelImpl documentModel)
{
super(file, rootBlock, documentModel);
myProject = file.getProject();
}
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:PsiBasedFormatterModelWithShiftIndentInside.java
示例15: AppleScriptFormattingModel
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
AppleScriptFormattingModel(PsiFile file, @NotNull Block rootBlock, FormattingDocumentModelImpl documentModel) {
super(file, rootBlock, documentModel);
}
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:4,代码来源:AppleScriptFormattingModelBuilder.java
示例16: ImportsFormatter
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
public ImportsFormatter(@NotNull CodeStyleSettings settings, @NotNull PsiFile file) {
myPostProcessor = new PostFormatProcessorHelper(settings);
myDocumentModel = FormattingDocumentModelImpl.createOn(file);
myIndentOptions = settings.getIndentOptionsByFile(file);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ImportsFormatter.java
示例17: PsiBasedFormatterModelWithShiftIndentInside
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
public PsiBasedFormatterModelWithShiftIndentInside(final PsiFile file,
@NotNull final Block rootBlock,
final FormattingDocumentModelImpl documentModel) {
super(file, rootBlock, documentModel);
myProject = file.getProject();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:PsiBasedFormatterModelWithShiftIndentInside.java
示例18: createFormattingModelForPsiFile
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
@Override
public FormattingModel createFormattingModelForPsiFile(final PsiFile file,
@NotNull final Block rootBlock,
final CodeStyleSettings settings) {
return new PsiBasedFormattingModel(file, rootBlock, FormattingDocumentModelImpl.createOn(file));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:FormatterImpl.java
示例19: assertInvalidRanges
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
public static void assertInvalidRanges(final int startOffset, final int newEndOffset, FormattingDocumentModel model, String message) {
@NonNls final StringBuilder buffer = new StringBuilder();
buffer.append("Invalid formatting blocks:").append(message).append("\n");
buffer.append("Start offset:");
buffer.append(startOffset);
buffer.append(" end offset:");
buffer.append(newEndOffset);
buffer.append("\n");
int minOffset = Math.max(Math.min(startOffset, newEndOffset) - 20, 0);
int maxOffset = Math.min(Math.max(startOffset, newEndOffset) + 20, model.getTextLength());
buffer.append("Affected text fragment:[").append(minOffset).append(",").append(maxOffset).append("] - '")
.append(model.getText(new TextRange(minOffset, maxOffset))).append("'\n");
final StringBuilder messageBuffer = new StringBuilder();
messageBuffer.append("Invalid ranges during formatting");
if (model instanceof FormattingDocumentModelImpl) {
messageBuffer.append(" in ").append(((FormattingDocumentModelImpl)model).getFile().getLanguage());
}
buffer.append("File text:(").append(model.getTextLength()).append(")\n'");
buffer.append(model.getText(new TextRange(0, model.getTextLength())).toString());
buffer.append("'\n");
buffer.append("model (").append(model.getClass()).append("): ").append(model);
Throwable currentThrowable = new Throwable();
if (model instanceof FormattingDocumentModelImpl) {
final FormattingDocumentModelImpl modelImpl = (FormattingDocumentModelImpl)model;
buffer.append("Psi Tree:\n");
final PsiFile file = modelImpl.getFile();
final List<PsiFile> roots = file.getViewProvider().getAllFiles();
for (PsiFile root : roots) {
buffer.append("Root ");
DebugUtil.treeToBuffer(buffer, root.getNode(), 0, false, true, true, true);
}
buffer.append('\n');
currentThrowable = makeLanguageStackTrace(currentThrowable, file);
}
LogMessageEx.error(LOG, messageBuffer.toString(), currentThrowable, buffer.toString());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:InitialInfoBuilder.java
示例20: createBlock
import com.intellij.psi.formatter.FormattingDocumentModelImpl; //导入依赖的package包/类
protected XmlBlock createBlock(CodeStyleSettings settings, ASTNode root, FormattingDocumentModelImpl documentModel) {
return new XmlBlock(root, null, null, new XmlPolicy(settings, documentModel), null, null, false);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:XmlFormattingModelBuilder.java
注:本文中的com.intellij.psi.formatter.FormattingDocumentModelImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论