本文整理汇总了Java中com.intellij.psi.impl.source.codeStyle.CodeEditUtil类的典型用法代码示例。如果您正苦于以下问题:Java CodeEditUtil类的具体用法?Java CodeEditUtil怎么用?Java CodeEditUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeEditUtil类属于com.intellij.psi.impl.source.codeStyle包,在下文中一共展示了CodeEditUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processText
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public void processText(Project project,
Template template,
Document document,
RangeMarker templateRange,
Editor editor) {
if (!template.isToReformat()) return;
PsiDocumentManager.getInstance(project).commitDocument(document);
PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);
if (!(file instanceof PsiJavaFile)) return;
CharSequence text = document.getImmutableCharSequence();
int prevChar = CharArrayUtil.shiftBackward(text, templateRange.getStartOffset() - 1, " \t");
int nextChar = CharArrayUtil.shiftForward(text, templateRange.getEndOffset(), " \t");
if (prevChar > 0 && text.charAt(prevChar) == '{' && nextChar < text.length() && text.charAt(nextChar) == '}') {
PsiCodeBlock codeBlock = PsiTreeUtil.findElementOfClassAtOffset(file, prevChar, PsiCodeBlock.class, false);
if (codeBlock != null && codeBlock.getTextRange().getStartOffset() == prevChar) {
PsiJavaToken rBrace = codeBlock.getRBrace();
if (rBrace != null && rBrace.getTextRange().getStartOffset() == nextChar) {
CodeEditUtil.markToReformat(rBrace.getNode(), true);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CodeBlockReformattingProcessor.java
示例2: createFileFromText
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
@NotNull
public PsiFile createFileFromText(@NotNull String name,
@NotNull FileType fileType,
@NotNull CharSequence text,
long modificationStamp,
final boolean eventSystemEnabled,
boolean markAsCopy) {
final LightVirtualFile virtualFile = new LightVirtualFile(name, fileType, text, modificationStamp);
if(fileType instanceof LanguageFileType){
final Language language =
LanguageSubstitutors.INSTANCE.substituteLanguage(((LanguageFileType)fileType).getLanguage(), virtualFile, myManager.getProject());
final PsiFile file = trySetupPsiForFile(virtualFile, language, eventSystemEnabled, markAsCopy);
if (file != null) return file;
}
final SingleRootFileViewProvider singleRootFileViewProvider =
new SingleRootFileViewProvider(myManager, virtualFile, eventSystemEnabled);
final PsiPlainTextFileImpl plainTextFile = new PsiPlainTextFileImpl(singleRootFileViewProvider);
if(markAsCopy) CodeEditUtil.setNodeGenerated(plainTextFile.getNode(), true);
return plainTextFile;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PsiFileFactoryImpl.java
示例3: postponeFormatting
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
private void postponeFormatting(@NotNull FileViewProvider viewProvider, @NotNull ASTNode child) {
if (!CodeEditUtil.isNodeGenerated(child) && child.getElementType() != TokenType.WHITE_SPACE) {
final int oldIndent = CodeEditUtil.getOldIndentation(child);
LOG.assertTrue(oldIndent >= 0,
"for not generated items old indentation must be defined: element=" + child + ", text=" + child.getText());
}
List<ASTNode> list = getContext().myReformatElements.get(viewProvider);
if (list == null) {
list = new ArrayList<ASTNode>();
getContext().myReformatElements.put(viewProvider, list);
if (Holder.STORE_REFORMAT_ORIGINATOR_STACKTRACE) {
viewProvider.putUserData(REFORMAT_ORIGINATOR, new Throwable());
}
}
list.add(child);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PostprocessReformattingAspect.java
示例4: handleReformatMarkers
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
private static void handleReformatMarkers(@NotNull final FileViewProvider key, @NotNull final Set<PostprocessFormattingTask> rangesToProcess) {
final Document document = key.getDocument();
if (document == null) {
return;
}
for (final FileElement fileElement : ((SingleRootFileViewProvider)key).getKnownTreeRoots()) {
fileElement.acceptTree(new RecursiveTreeElementWalkingVisitor() {
@Override
protected void visitNode(TreeElement element) {
if (CodeEditUtil.isMarkedToReformatBefore(element)) {
CodeEditUtil.markToReformatBefore(element, false);
rangesToProcess.add(new ReformatWithHeadingWhitespaceTask(
document.createRangeMarker(element.getStartOffset(), element.getStartOffset()))
);
}
else if (CodeEditUtil.isMarkedToReformat(element)) {
CodeEditUtil.markToReformat(element, false);
rangesToProcess.add(new ReformatWithHeadingWhitespaceTask(
document.createRangeMarker(element.getStartOffset(), element.getStartOffset() + element.getTextLength()))
);
}
super.visitNode(element);
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PostprocessReformattingAspect.java
示例5: setName
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public PsiElement setName(@NotNull final String nameText) throws IncorrectOperationException {
final ASTNode name = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(this);
final String oldName = name.getText();
final PomModel model = PomManager.getModel(getProject());
final XmlAttribute attribute = XmlElementFactory.getInstance(getProject()).createXmlAttribute(nameText, "");
final ASTNode newName = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild((ASTNode)attribute);
final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
model.runTransaction(new PomTransactionBase(getParent(), aspect) {
@Override
public PomModelEvent runInner() {
final PomModelEvent event = new PomModelEvent(model);
PsiFile file = getContainingFile();
XmlChangeSet xmlAspectChangeSet = new XmlAspectChangeSetImpl(model, file instanceof XmlFile ? (XmlFile)file : null);
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), oldName, null));
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), nameText, getValue()));
event.registerChangeSet(model.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
CodeEditUtil.replaceChild(XmlAttributeImpl.this, name, newName);
return event;
}
});
return this;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:XmlAttributeImpl.java
示例6: testInsertAtOffset
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
public void testInsertAtOffset() throws Exception {
new WriteCommandAction(getProject()) {
@Override
protected void run(@NotNull final Result result) throws Throwable {
String xml = "<root>0123456789</root>";
XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject())
.createFileFromText("foo.xml", StdFileTypes.XML, xml, (long)1, true, false);
//System.out.println(DebugUtil.psiToString(file, false));
XmlTag root = file.getDocument().getRootTag();
final XmlText text1 = root.getValue().getTextElements()[0];
assertFalse(CodeEditUtil.isNodeGenerated(root.getNode()));
final XmlText text = text1;
final XmlElement element = text.insertAtOffset(XmlElementFactory.getInstance(getProject()).createTagFromText("<bar/>"), 5);
assertNotNull(element);
assertTrue(element instanceof XmlText);
assertEquals("01234", element.getText());
assertEquals("<root>01234<bar/>56789</root>", text.getContainingFile().getText());
}
}.execute();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:XmlTextTest.java
示例7: subtreeChanged
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public void subtreeChanged() {
super.subtreeChanged();
// We want to reformat method call arguments on method name change because there is a possible situation that they are aligned
// and method change breaks the alignment.
// Example:
// test(1,
// 2);
// Suppose we're renaming the method to test123. We get the following if parameter list is not reformatted:
// test123(1,
// 2);
PsiElement methodCallCandidate = getParent();
if (methodCallCandidate instanceof PsiMethodCallExpression) {
PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)methodCallCandidate;
CodeEditUtil.markToReformat(methodCallExpression.getArgumentList().getNode(), true);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:PsiReferenceExpressionImpl.java
示例8: replace
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public PsiElement replace(@NotNull PsiElement newElement) throws IncorrectOperationException {
PsiElement result = super.replace(newElement);
// We want to reformat method parameters on method name change as well because there is a possible situation that they are aligned
// and method name change breaks the alignment.
// Example:
// public void test(int i,
// int j) {}
// Suppose we're renaming the method to test123. We get the following if parameter list is not reformatted:
// public void test123(int i,
// int j) {}
PsiElement methodCandidate = result.getParent();
if (methodCandidate instanceof PsiMethod) {
PsiMethod method = (PsiMethod)methodCandidate;
CodeEditUtil.markToReformat(method.getParameterList().getNode(), true);
}
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:PsiIdentifierImpl.java
示例9: createFileFromText
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
@NotNull
public PsiFile createFileFromText(@NotNull String name,
@NotNull FileType fileType,
@NotNull CharSequence text,
long modificationStamp,
final boolean physical,
boolean markAsCopy) {
final LightVirtualFile virtualFile = new LightVirtualFile(name, fileType, text, modificationStamp);
if(fileType instanceof LanguageFileType){
final Language language =
LanguageSubstitutors.INSTANCE.substituteLanguage(((LanguageFileType)fileType).getLanguage(), virtualFile, myManager.getProject());
final PsiFile file = trySetupPsiForFile(virtualFile, language, physical, markAsCopy);
if (file != null) return file;
}
final SingleRootFileViewProvider singleRootFileViewProvider =
new SingleRootFileViewProvider(myManager, virtualFile, physical);
final PsiPlainTextFileImpl plainTextFile = new PsiPlainTextFileImpl(singleRootFileViewProvider);
if(markAsCopy) CodeEditUtil.setNodeGenerated(plainTextFile.getNode(), true);
return plainTextFile;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:PsiFileFactoryImpl.java
示例10: handleReformatMarkers
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
private static void handleReformatMarkers(final FileViewProvider key, final TreeSet<PostprocessFormattingTask> rangesToProcess) {
final Document document = key.getDocument();
if (document == null) {
return;
}
for (final FileElement fileElement : ((SingleRootFileViewProvider)key).getKnownTreeRoots()) {
fileElement.acceptTree(new RecursiveTreeElementWalkingVisitor() {
@Override
protected void visitNode(TreeElement element) {
if (CodeEditUtil.isMarkedToReformatBefore(element)) {
CodeEditUtil.markToReformatBefore(element, false);
rangesToProcess.add(new ReformatWithHeadingWhitespaceTask(
document.createRangeMarker(element.getStartOffset(), element.getStartOffset()))
);
}
else if (CodeEditUtil.isMarkedToReformat(element)) {
CodeEditUtil.markToReformat(element, false);
rangesToProcess.add(new ReformatWithHeadingWhitespaceTask(
document.createRangeMarker(element.getStartOffset(), element.getStartOffset() + element.getTextLength()))
);
}
super.visitNode(element);
}
});
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:PostprocessReformattingAspect.java
示例11: setName
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
public PsiElement setName(@NotNull final String nameText) throws IncorrectOperationException {
final ASTNode name = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(this);
final String oldName = name.getText();
final PomModel model = PomManager.getModel(getProject());
final XmlAttribute attribute = XmlElementFactory.getInstance(getProject()).createXmlAttribute(nameText, "");
final ASTNode newName = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild((ASTNode)attribute);
final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
model.runTransaction(new PomTransactionBase(getParent(), aspect) {
public PomModelEvent runInner() {
final PomModelEvent event = new PomModelEvent(model);
final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(model, (XmlFile)getContainingFile());
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), oldName, null));
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), nameText, getValue()));
event.registerChangeSet(model.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
CodeEditUtil.replaceChild(XmlAttributeImpl.this, name, newName);
return event;
}
});
return this;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:XmlAttributeImpl.java
示例12: testInsertAtOffset
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
public void testInsertAtOffset() throws Exception {
new WriteCommandAction(getProject()) {
@Override
protected void run(final Result result) throws Throwable {
String xml = "<root>0123456789</root>";
XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject())
.createFileFromText("foo.xml", StdFileTypes.XML, xml, (long)1, true, false);
//System.out.println(DebugUtil.psiToString(file, false));
XmlTag root = file.getDocument().getRootTag();
final XmlText text1 = root.getValue().getTextElements()[0];
assertFalse(CodeEditUtil.isNodeGenerated(root.getNode()));
final XmlText text = text1;
final XmlElement element = text.insertAtOffset(XmlElementFactory.getInstance(getProject()).createTagFromText("<bar/>"), 5);
assertNotNull(element);
assertTrue(element instanceof XmlText);
assertEquals("01234", element.getText());
assertEquals("<root>01234<bar/>56789</root>", text.getContainingFile().getText());
}
}.execute();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:XmlTextTest.java
示例13: createFileFromText
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
@Nonnull
public PsiFile createFileFromText(@Nonnull String name,
@Nonnull FileType fileType,
@Nonnull CharSequence text,
long modificationStamp,
final boolean physical,
boolean markAsCopy) {
final LightVirtualFile virtualFile = new LightVirtualFile(name, fileType, text, modificationStamp);
if (fileType instanceof LanguageFileType) {
final Language language =
LanguageSubstitutors.INSTANCE.substituteLanguage(((LanguageFileType)fileType).getLanguage(), virtualFile, myManager.getProject());
final PsiFile file = trySetupPsiForFile(virtualFile, language, LanguageVersionUtil.findDefaultVersion(language), physical, markAsCopy);
if (file != null) return file;
}
final SingleRootFileViewProvider singleRootFileViewProvider = new SingleRootFileViewProvider(myManager, virtualFile, physical);
final PsiPlainTextFileImpl plainTextFile = new PsiPlainTextFileImpl(singleRootFileViewProvider);
if (markAsCopy) CodeEditUtil.setNodeGenerated(plainTextFile.getNode(), true);
return plainTextFile;
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:PsiFileFactoryImpl.java
示例14: handleReformatMarkers
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
private static void handleReformatMarkers(@Nonnull final FileViewProvider key, @Nonnull final Set<PostprocessFormattingTask> rangesToProcess) {
final Document document = key.getDocument();
if (document == null) {
return;
}
for (final FileElement fileElement : ((AbstractFileViewProvider)key).getKnownTreeRoots()) {
fileElement.acceptTree(new RecursiveTreeElementWalkingVisitor() {
@Override
protected void visitNode(TreeElement element) {
if (CodeEditUtil.isMarkedToReformatBefore(element)) {
CodeEditUtil.markToReformatBefore(element, false);
rangesToProcess.add(new ReformatWithHeadingWhitespaceTask(document.createRangeMarker(element.getStartOffset(), element.getStartOffset())));
}
else if (CodeEditUtil.isMarkedToReformat(element)) {
CodeEditUtil.markToReformat(element, false);
rangesToProcess.add(new ReformatWithHeadingWhitespaceTask(document.createRangeMarker(element.getStartOffset(), element.getStartOffset() + element.getTextLength())));
}
super.visitNode(element);
}
});
}
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:PostprocessReformattingAspect.java
示例15: setName
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public PsiElement setName(@NotNull final String nameText) throws IncorrectOperationException
{
final ASTNode name = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(this);
final String oldName = name.getText();
final PomModel model = PomManager.getModel(getProject());
final XmlAttribute attribute = XmlElementFactory.getInstance(getProject()).createXmlAttribute(nameText, "");
final ASTNode newName = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild((ASTNode) attribute);
final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
model.runTransaction(new PomTransactionBase(getParent(), aspect)
{
@Override
public PomModelEvent runInner()
{
final PomModelEvent event = new PomModelEvent(model);
PsiFile file = getContainingFile();
XmlChangeSet xmlAspectChangeSet = new XmlAspectChangeSetImpl(model, file instanceof XmlFile ? (XmlFile) file : null);
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), oldName, null));
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), nameText, getValue()));
event.registerChangeSet(model.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
CodeEditUtil.replaceChild(XmlAttributeImpl.this, name, newName);
return event;
}
});
return this;
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:27,代码来源:XmlAttributeImpl.java
示例16: deleteChildRange
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public void deleteChildRange(PsiElement first, PsiElement last) throws IncorrectOperationException
{
CheckUtil.checkWritable(this);
if(first == null)
{
LOG.assertTrue(last == null);
return;
}
ASTNode firstElement = SourceTreeToPsiMap.psiElementToTree(first);
ASTNode lastElement = SourceTreeToPsiMap.psiElementToTree(last);
CompositeElement treeElement = calcTreeElement();
LOG.assertTrue(firstElement.getTreeParent() == treeElement);
LOG.assertTrue(lastElement.getTreeParent() == treeElement);
CodeEditUtil.removeChildren(treeElement, firstElement, lastElement);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:JavaStubPsiElement.java
示例17: createTypeElement
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@NotNull
@Override
public PsiTypeElement createTypeElement(@NotNull final PsiType psiType) {
final LightTypeElement element = new LightTypeElement(myManager, psiType);
CodeEditUtil.setNodeGenerated(element.getNode(), true);
return element;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PsiElementFactoryImpl.java
示例18: deleteChildRange
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public void deleteChildRange(PsiElement first, PsiElement last) throws IncorrectOperationException {
CheckUtil.checkWritable(this);
if (first == null) {
LOG.assertTrue(last == null);
return;
}
ASTNode firstElement = SourceTreeToPsiMap.psiElementToTree(first);
ASTNode lastElement = SourceTreeToPsiMap.psiElementToTree(last);
CompositeElement treeElement = calcTreeElement();
LOG.assertTrue(firstElement.getTreeParent() == treeElement);
LOG.assertTrue(lastElement.getTreeParent() == treeElement);
CodeEditUtil.removeChildren(treeElement, firstElement, lastElement);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaStubPsiElement.java
示例19: normalizeDeclaration
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
@Override
public void normalizeDeclaration() throws IncorrectOperationException{
CheckUtil.checkWritable(this);
final PsiTypeElement type = getTypeElement();
PsiElement modifierList = getModifierList();
ASTNode field = SourceTreeToPsiMap.psiElementToTree(type.getParent());
while(true){
ASTNode comma = PsiImplUtil.skipWhitespaceAndComments(field.getTreeNext());
if (comma == null || comma.getElementType() != JavaTokenType.COMMA) break;
ASTNode nextField = PsiImplUtil.skipWhitespaceAndComments(comma.getTreeNext());
if (nextField == null || nextField.getElementType() != JavaElementType.FIELD) break;
TreeElement semicolon = Factory.createSingleLeafElement(JavaTokenType.SEMICOLON, ";", 0, 1, null, getManager());
CodeEditUtil.addChild(field, semicolon, null);
CodeEditUtil.removeChild(comma.getTreeParent(), comma);
PsiElement typeClone = type.copy();
CodeEditUtil.addChild(nextField, SourceTreeToPsiMap.psiElementToTree(typeClone), nextField.getFirstChildNode());
PsiElement modifierListClone = modifierList.copy();
CodeEditUtil.addChild(nextField, SourceTreeToPsiMap.psiElementToTree(modifierListClone), nextField.getFirstChildNode());
field = nextField;
}
JavaSharedImplUtil.normalizeBrackets(this);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PsiFieldImpl.java
示例20: appendField
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil; //导入依赖的package包/类
public static PsiField appendField(final PsiClass destClass,
final PsiField psiField,
final PsiElement anchorMember,
final PsiField forwardReference) {
final PsiClass parentClass = PsiTreeUtil.getParentOfType(anchorMember, PsiClass.class);
if (anchorMember instanceof PsiField &&
anchorMember.getParent() == parentClass &&
destClass == parentClass &&
((PsiField)anchorMember).hasModifierProperty(PsiModifier.STATIC) == psiField.hasModifierProperty(PsiModifier.STATIC)) {
return (PsiField)destClass.addBefore(psiField, anchorMember);
}
else if (anchorMember instanceof PsiClassInitializer &&
anchorMember.getParent() == parentClass &&
destClass == parentClass) {
PsiField field = (PsiField)destClass.addBefore(psiField, anchorMember);
destClass.addBefore(CodeEditUtil.createLineFeed(field.getManager()), anchorMember);
return field;
}
else {
if (forwardReference != null ) {
return forwardReference.getParent() == destClass ?
(PsiField)destClass.addAfter(psiField, forwardReference) :
(PsiField)forwardReference.getParent().addAfter(psiField, forwardReference);
} else {
return (PsiField)destClass.add(psiField);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:BaseExpressionToFieldHandler.java
注:本文中的com.intellij.psi.impl.source.codeStyle.CodeEditUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论