Java 类com.intellij.psi.impl.source.xml.behavior.DefaultXmlPsiPolicy 实例源码

项目:intellij-ce-playground    文件:XmlTagValueImpl.java   
private void setText(String value, boolean defaultPolicy) {
  try {
    XmlText text = null;
    if (value != null) {
      final XmlText[] texts = getTextElements();
      if (texts.length == 0) {
        text = (XmlText)myTag.add(XmlElementFactory.getInstance(myTag.getProject()).createDisplayText("x"));
      } else {
        text = texts[0];
      }
      if (StringUtil.isEmpty(value)) {
        text.delete();
      }
      else {
        if (defaultPolicy && text instanceof XmlTextImpl) {
          ((XmlTextImpl)text).doSetValue(value, new DefaultXmlPsiPolicy());
        } else {
          text.setValue(value);
        }
      }
    }

    if(myElements.length > 0){
      for (final XmlTagChild child : myElements) {
        if (child != text) {
          child.delete();
        }
      }
    }
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
  }
}
项目:intellij-ce-playground    文件:XmlTextImpl.java   
@Override
public PsiLanguageInjectionHost updateText(@NotNull final String text) {
  try {
    doSetValue(text, new DefaultXmlPsiPolicy());
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
  }
  return this;
}
项目:tools-idea    文件:XmlTagValueImpl.java   
private void setText(String value, boolean defaultPolicy) {
  try {
    XmlText text = null;
    if (value != null) {
      final XmlText[] texts = getTextElements();
      if (texts.length == 0) {
        text = (XmlText)myTag.add(XmlElementFactory.getInstance(myTag.getProject()).createDisplayText("x"));
      } else {
        text = texts[0];
      }
      if (StringUtil.isEmpty(value)) {
        text.delete();
      }
      else {
        if (defaultPolicy && text instanceof XmlTextImpl) {
          ((XmlTextImpl)text).doSetValue(value, new DefaultXmlPsiPolicy());
        } else {
          text.setValue(value);
        }
      }
    }

    if(myElements.length > 0){
      for (final XmlTagChild child : myElements) {
        if (child != text) {
          child.delete();
        }
      }
    }
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
  }
}
项目:tools-idea    文件:XmlTextImpl.java   
public PsiLanguageInjectionHost updateText(@NotNull final String text) {
  try {
    doSetValue(text, new DefaultXmlPsiPolicy());
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
  }
  return this;
}
项目:consulo-xml    文件:XmlTextImpl.java   
@Override
public PsiLanguageInjectionHost updateText(@NotNull final String text)
{
    try
    {
        doSetValue(text, new DefaultXmlPsiPolicy());
    }
    catch(IncorrectOperationException e)
    {
        LOG.error(e);
    }
    return this;
}