Java 类com.intellij.psi.formatter.java.AbstractJavaBlock 实例源码
项目:intellij-ce-playground
文件:JavaFormattingModelBuilder.java
@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);
}
项目:tools-idea
文件:JavaFormattingModelBuilder.java
@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);
}
项目:consulo-java
文件:JavaFormattingModelBuilder.java
@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);
}
项目:consulo-java
文件:JavaChildWrapArranger.java
private static void putPreferredWrapInParentBlock(@NotNull AbstractJavaBlock block, @NotNull Wrap preferredWrap)
{
AbstractJavaBlock parentBlock = block.getParentBlock();
if(parentBlock != null)
{
parentBlock.setReservedWrap(preferredWrap, JavaElementType.MODIFIER_LIST);
}
}
项目:intellij-ce-playground
文件:JavaChildWrapArranger.java
private static void putPreferredWrapInParentBlock(@NotNull AbstractJavaBlock block, @NotNull Wrap preferredWrap) {
AbstractJavaBlock parentBlock = block.getParentBlock();
if (parentBlock != null) {
parentBlock.setReservedWrap(preferredWrap, JavaElementType.MODIFIER_LIST);
}
}
项目:intellij-ce-playground
文件:JavaWrapManager.java
/**
* Tries to define the wrap to use for the {@link Block block} for the given <code>'child'</code> node. It's assumed that
* given <code>'child'</code> node is descendant (direct or indirect) of the given <code>'parent'</code> node.
* I.e. <code>'parent'</code> node defines usage context for the <code>'child'</code> node.
*
* @param child child node which {@link Wrap wrap} is to be defined
* @param parent direct or indirect parent of the given <code>'child'</code> node. Defines usage context
* of <code>'child'</code> node processing
* @param settings code style settings to use during wrap definition
* @param suggestedWrap wrap suggested to use by clients of current class. I.e. those clients offer wrap to
* use based on their information about current processing state. However, it's possible
* that they don't know details of fine-grained wrap definition algorithm encapsulated
* at the current class. Hence, this method takes suggested wrap into consideration but
* is not required to use it all the time node based on the given parameters
* @param reservedWrapsProvider reserved {@code 'element type -> wrap instance'} mappings provider. <b>Note:</b> this
* argument is considered to be a part of legacy heritage and is intended to be removed as
* soon as formatting code refactoring is done
* @return wrap to use for the given <code>'child'</code> node if it's possible to define the one;
* <code>null</code> otherwise
*/
@Nullable
public Wrap arrangeChildWrap(ASTNode child,
ASTNode parent,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
Wrap suggestedWrap,
AbstractJavaBlock reservedWrapsProvider)
{
return myChildArranger.arrange(child, parent, settings, javaSettings, suggestedWrap, reservedWrapsProvider);
}
项目:consulo-java
文件:JavaWrapManager.java
/**
* Tries to define the wrap to use for the {@link Block block} for the given {@code 'child'} node. It's assumed that
* given {@code 'child'} node is descendant (direct or indirect) of the given {@code 'parent'} node.
* I.e. {@code 'parent'} node defines usage context for the {@code 'child'} node.
*
* @param child child node which {@link Wrap wrap} is to be defined
* @param parent direct or indirect parent of the given {@code 'child'} node. Defines usage context
* of {@code 'child'} node processing
* @param settings code style settings to use during wrap definition
* @param suggestedWrap wrap suggested to use by clients of current class. I.e. those clients offer wrap to
* use based on their information about current processing state. However, it's possible
* that they don't know details of fine-grained wrap definition algorithm encapsulated
* at the current class. Hence, this method takes suggested wrap into consideration but
* is not required to use it all the time node based on the given parameters
* @param reservedWrapsProvider reserved {@code 'element type -> wrap instance'} mappings provider. <b>Note:</b> this
* argument is considered to be a part of legacy heritage and is intended to be removed as
* soon as formatting code refactoring is done
* @return wrap to use for the given {@code 'child'} node if it's possible to define the one;
* {@code null} otherwise
*/
@Nullable
public Wrap arrangeChildWrap(ASTNode child, ASTNode parent, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, Wrap suggestedWrap, AbstractJavaBlock reservedWrapsProvider)
{
return myChildArranger.arrange(child, parent, settings, javaSettings, suggestedWrap, reservedWrapsProvider);
}