本文整理匯總了Java中com.intellij.lang.javascript.JavaScriptSupportLoader.ECMA_SCRIPT_L4屬性的典型用法代碼示例。如果您正苦於以下問題:Java JavaScriptSupportLoader.ECMA_SCRIPT_L4屬性的具體用法?Java JavaScriptSupportLoader.ECMA_SCRIPT_L4怎麽用?Java JavaScriptSupportLoader.ECMA_SCRIPT_L4使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.intellij.lang.javascript.JavaScriptSupportLoader
的用法示例。
在下文中一共展示了JavaScriptSupportLoader.ECMA_SCRIPT_L4屬性的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findPackageForMxml
public static String findPackageForMxml(final PsiElement expression)
{
String s = null;
final PsiFile containingFile = expression.getContainingFile();
if(containingFile.getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4 && containingFile.getContext() != null)
{
final PsiFile contextContainigFile = containingFile.getContext().getContainingFile();
VirtualFile file = contextContainigFile.getVirtualFile();
if(file == null && contextContainigFile.getOriginalFile() != null)
{
file = contextContainigFile.getOriginalFile().getVirtualFile();
}
s = getExpectedPackageNameFromFile(file, containingFile.getProject(), true);
}
return s;
}
示例2: process
private static void process(final JSNamedElement node, final ProblemsHolder holder)
{
if(node.getContainingFile().getLanguage() != JavaScriptSupportLoader.ECMA_SCRIPT_L4)
{
return;
}
PsiElement nameIdentifier = node.getNameIdentifier();
if(nameIdentifier != null &&
JSPsiImplUtils.getTypeFromDeclaration(node) == null &&
(!(node instanceof JSParameter) || !((JSParameter) node).isRest()))
{
holder.registerProblem(nameIdentifier, JavaScriptBundle.message(node instanceof JSFunction ? "js.untyped.function.problem" : "js.untyped" +
".variable.problem", nameIdentifier.getText()), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new AddTypeToDclFix());
}
}
示例3: doGenerateDoc
private static String doGenerateDoc(final JSFunction function)
{
StringBuilder builder = new StringBuilder();
final JSParameterList parameterList = function.getParameterList();
final PsiFile containingFile = function.getContainingFile();
final boolean ecma = containingFile.getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4;
if(parameterList != null)
{
for(JSParameter parameter : parameterList.getParameters())
{
builder.append("* @param ").append(parameter.getName());
//String s = JSPsiImplUtils.getTypeFromDeclaration(parameter);
//if (s != null) builder.append(" : ").append(s);
builder.append("\n");
}
}
if(ecma)
{
String s = JSPsiImplUtils.getTypeFromDeclaration(function);
if(s != null && !"void".equals(s))
{
builder.append("* @return ");
//builder.append(s);
builder.append("\n");
}
}
return builder.toString();
}
示例4: getQNameToStartHierarchySearch
public static String getQNameToStartHierarchySearch(final JSFunction node)
{
PsiElement parentNode = node.getParent();
parentNode = getClassReferenceForXmlFromContext(parentNode);
if(parentNode instanceof JSClass)
{
final JSAttributeList attributeList = node.getAttributeList();
if(attributeList == null ||
!attributeList.hasModifier(JSAttributeList.ModifierType.OVERRIDE) ||
attributeList.hasModifier(JSAttributeList.ModifierType.STATIC) ||
attributeList.getAccessType() == JSAttributeList.AccessType.PRIVATE)
{
return null;
}
if(parentNode instanceof JSClass)
{
return ((JSClass) parentNode).getQualifiedName();
}
}
else if(node instanceof JSFunctionExpression && parentNode.getContainingFile().getLanguage() != JavaScriptSupportLoader.ECMA_SCRIPT_L4)
{
final ContextResolver resolver = new ContextResolver(node.getFirstChild());
return resolver.getQualifierAsString();
}
else if(parentNode instanceof JSFile && parentNode.getContainingFile().getLanguage() != JavaScriptSupportLoader.ECMA_SCRIPT_L4)
{
return node.getName();
}
return null;
}
示例5: getSignatureForParameter
public static String getSignatureForParameter(final JSParameter p, boolean skipType)
{
final String s = skipType ? null : p.getTypeString();
if(s != null && s.length() > 0)
{
final boolean ecmal4 = p.getContainingFile().getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4;
String result;
if(ecmal4)
{
if(p.isRest())
{
result = "...";
}
else
{
result = p.getName() + ":" + s;
}
}
else
{
result = "[" + s + "] " + p.getName();
}
final String initializerText = p.getInitializerText();
if(initializerText != null)
{
result += " = " + initializerText;
}
return result;
}
return p.getName();
}
示例6: getExceptionVarTypeBasedOnContext
protected static String getExceptionVarTypeBasedOnContext(@NotNull PsiElement context)
{
if(context.getContainingFile().getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4)
{
return ":Error";
}
return "";
}
示例7: update
@Override
public void update(final AnActionEvent e)
{
final VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE);
boolean status = false;
if(file != null)
{
if(file.getFileType() == JavaScriptFileType.INSTANCE)
{
final Editor editor = e.getData(PlatformDataKeys.EDITOR);
final PsiFile psifile = e.getData(LangDataKeys.PSI_FILE);
if(editor != null && psifile != null)
{
status = psifile.getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4;
}
}
else if(JavaScriptSupportLoader.isFlexMxmFile(file))
{
status = true;
}
}
e.getPresentation().setEnabled(status);
e.getPresentation().setVisible(status);
}
示例8: getHighlightTypeForTypeOrSignatureProblem
private static ProblemHighlightType getHighlightTypeForTypeOrSignatureProblem(@NotNull PsiElement node)
{
if(node.getContainingFile().getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4)
{
return ProblemHighlightType.GENERIC_ERROR;
}
return ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
}
示例9: findIntroducedExpression
@Override
protected JSExpression findIntroducedExpression(final PsiFile file, final int start, final int end, Editor editor)
{
if(file.getLanguage() != JavaScriptSupportLoader.ECMA_SCRIPT_L4)
{
CommonRefactoringUtil.showErrorHint(file.getProject(), editor, JavaScriptBundle.message("javascript.introduce.field.error.not.available.in.javascript" +
".code"), getRefactoringName(), null);
return null;
}
return super.findIntroducedExpression(file, start, end, editor);
}
示例10: processIntention
@Override
public void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
assert (element instanceof JSVarStatement);
final JSVarStatement varStatement = (JSVarStatement) element;
StringBuilder declarationBuffer = new StringBuilder();
List<String> initializations = new ArrayList<String>();
for (JSVariable variable : varStatement.getVariables()) {
declarationBuffer.append((declarationBuffer.length() == 0) ? VAR_KEYWORD : ",")
.append(variable.getName());
String s = JSPsiImplUtils.getTypeFromDeclaration(variable);
final PsiFile containingFile = element.getContainingFile();
if (s == null && containingFile.getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4) {
s = JSResolveUtil.getExpressionType(variable.getInitializer(), containingFile);
}
if (s != null) {
declarationBuffer.append(":").append(s);
}
if (variable.hasInitializer()) {
initializations.add(variable.getName() + '=' + variable.getInitializer().getText() + ';');
}
}
declarationBuffer.append(';');
// Do replacement.
JSStatement newStatement = JSElementFactory.replaceStatement(varStatement, declarationBuffer.toString());
for (final String initialization : initializations) {
newStatement = JSElementFactory.addStatementAfter(newStatement, initialization);
}
}
開發者ID:consulo,項目名稱:consulo-javascript,代碼行數:35,代碼來源:JSSplitDeclarationAndInitializationIntention.java
示例11: ResolveProcessor
public ResolveProcessor(final String name, PsiElement _place)
{
myName = name;
place = _place;
final boolean b = place instanceof JSReferenceExpression && ((JSReferenceExpression) place).getQualifier() == null;
allowUnqualifiedStaticsFromInstance = b;
if(myName != null && place instanceof JSReferenceExpression)
{
final ASTNode node = place.getNode().findChildByType(JSTokenTypes.COLON_COLON);
String explicitNs = null;
// TODO: e.g. protected is also ns
if(node != null)
{
final JSExpression expression = ((JSReferenceExpression) place).getQualifier();
if(expression instanceof JSReferenceExpression)
{
anyNsAllowed = ((JSReferenceExpression) expression).resolve() instanceof JSVariable;
}
explicitNs = expression != null ? expression.getText() : null;
}
else
{
final JSExpression qualifier = ((JSReferenceExpression) place).getQualifier();
if(qualifier instanceof JSReferenceExpression && qualifier.getNode().findChildByType(JSTokenTypes.COLON_COLON) != null)
{
anyNsAllowed = ((JSReferenceExpression) qualifier).resolve() instanceof JSVariable;
explicitNs = ((JSReferenceExpression) qualifier).getReferencedName();
}
}
if(explicitNs != null && !anyNsAllowed)
{
openedNses = new THashSet<String>();
openedNses.add(explicitNs);
defaultNsIsNotAllowed = true;
}
}
if(myName == null && place instanceof JSReferenceExpression)
{
PsiElement parent = place.getParent();
if(parent instanceof JSReferenceList)
{
if(parent.getNode().getElementType() == JSElementTypes.EXTENDS_LIST)
{
final PsiElement element = parent.getParent();
if(element instanceof JSClass)
{
if(((JSClass) element).isInterface())
{
myAcceptOnlyClasses = false;
myAcceptOnlyInterfaces = true;
}
else
{
myAcceptOnlyClasses = true;
myAcceptOnlyInterfaces = false;
}
}
}
else
{
myAcceptOnlyClasses = false;
myAcceptOnlyInterfaces = true;
}
}
}
ecma = place != null && place.getContainingFile().getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4;
}
示例12: getUnresolveReferenceHighlightType
static ProblemHighlightType getUnresolveReferenceHighlightType(final @Nullable JSExpression qualifier, @NotNull JSExpression node)
{
JSClass jsClass;
final PsiFile containingFile = node.getContainingFile();
if(qualifier != null)
{
jsClass = JSResolveUtil.findClassOfQualifier(qualifier, containingFile);
if(jsClass == null && (qualifier instanceof JSReferenceExpression))
{
ResolveResult[] results = ((JSReferenceExpression) qualifier).multiResolve(false);
if(results.length != 0)
{
PsiElement resultElement = results[0].getElement();
String type = null;
if(resultElement instanceof JSVariable)
{
type = ((JSVariable) resultElement).getTypeString();
}
else if(resultElement instanceof JSFunction)
{
type = ((JSFunction) resultElement).getReturnTypeString();
}
if("*".equals(type))
{
return ProblemHighlightType.LIKE_UNKNOWN_SYMBOL;
}
jsClass = JSResolveUtil.getClassOfContext(resultElement);
}
}
}
else
{
jsClass = JSResolveUtil.getClassOfContext(node);
}
final boolean ecmaL4File = containingFile.getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4;
if(jsClass != null && ecmaL4File &&
(!(jsClass instanceof XmlBackedJSClassImpl) || jsClass.getContainingFile().getFileType() == XmlFileType.INSTANCE))
{
final JSAttributeList attributeList = jsClass.getAttributeList();
if(attributeList == null || !attributeList.hasModifier(JSAttributeList.ModifierType.DYNAMIC))
{
return ProblemHighlightType.ERROR;
}
}
if(ecmaL4File && jsClass == null && node.getParent() instanceof JSReferenceList)
{
return ProblemHighlightType.ERROR;
}
return ProblemHighlightType.LIKE_UNKNOWN_SYMBOL;
}
示例13: supports
@Override
public boolean supports(PsiFile file)
{
return file.getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4 || JavaScriptSupportLoader.isFlexMxmFile(file);
}
示例14: getProblemHighlightType
@Override
protected ProblemHighlightType getProblemHighlightType(PsiElement location) {
return location.getContainingFile().getLanguage() == JavaScriptSupportLoader.ECMA_SCRIPT_L4 ?
ProblemHighlightType.GENERIC_ERROR:super.getProblemHighlightType(location);
}