Java 类com.intellij.lang.javascript.psi.JSElementFactory 实例源码

项目:eslint-plugin    文件:NoNewBaseActionFix.java   
@Override
public void invoke(@NotNull Project project, @NotNull PsiFile psiFile, @Nullable("is null when called from inspection") Editor editor, @NotNull PsiElement element, @NotNull PsiElement end) throws IncorrectOperationException {
    PsiElement parent = element.getParent();
    if (!(parent instanceof JSNewExpression)) return;
    final JSExpressionCodeFragment useStrict = JSElementFactory.createExpressionCodeFragment(project, getNewExp(), parent);
    PsiElement child = useStrict.getFirstChild();
    parent.replace(child);
}
项目:consulo-javascript    文件:JSDebuggerSupportUtils.java   
public static Document createDocument(final String text, final Project project, @Nullable VirtualFile contextVirtualFile, int contextOffset)
{
    PsiElement context = null;
    if(contextVirtualFile != null)
    {
        context = getContextElement(contextVirtualFile, contextOffset, project);
    }
    JSFile file = JSElementFactory.createExpressionCodeFragment(project, text, context, true);
    return PsiDocumentManager.getInstance(project).getDocument(file);
}
项目:consulo-javascript    文件:JavaScriptEditorsProvider.java   
@Override
protected PsiFile createExpressionCodeFragment(@NotNull Project project, @NotNull String text, @Nullable PsiElement element, boolean isPhysical)
{
    return JSElementFactory.createExpressionCodeFragment(project, text, element, isPhysical);
}