本文整理汇总了Java中com.intellij.lang.javascript.psi.JSProperty类的典型用法代码示例。如果您正苦于以下问题:Java JSProperty类的具体用法?Java JSProperty怎么用?Java JSProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSProperty类属于com.intellij.lang.javascript.psi包,在下文中一共展示了JSProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSubCompletions
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
private List<LookupElement> getSubCompletions(PsiElement psiElement)
{
JSProperty property = PsiTreeUtil.getParentOfType(psiElement, JSProperty.class);
if (property == null)
{
return Collections.emptyList();
}
String name = property.getQualifiedName();
if (name == null)
{
return Collections.emptyList();
}
Setting setting = CompletionPreloader
.getCompletions()
.getSetting(name);
return setting != null ? setting.getSubCompletionVariants() : Collections.emptyList();
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:23,代码来源:RocSettingsProvider.java
示例2: visitJSProperty
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Override
public void visitJSProperty(JSProperty node)
{
if (done.contains(node.getQualifiedName()))
{
return;
}
if (!CompletionPreloader.isRocConfigFile(node.getContainingFile()))
{
this.stopWalking();
return;
}
inspectProperty(node);
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:17,代码来源:SettingVisitor.java
示例3: literalInProperty
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
private static PsiElementPattern.Capture<JSLiteralExpression> literalInProperty(final String propertyName) {
return PlatformPatterns.psiElement(JSLiteralExpression.class).and(new FilterPattern(new ElementFilter() {
@Override
public boolean isAcceptable(Object element, @Nullable PsiElement context) {
if (element instanceof JSLiteralExpression) {
final JSLiteralExpression literal = (JSLiteralExpression)element;
if (literal.isQuotedLiteral()) {
final PsiElement parent = literal.getParent();
if (parent instanceof JSProperty && propertyName.equals(((JSProperty)parent).getName())) {
return EmberIndexUtil.hasEmberJS(literal.getProject());
}
}
}
return false;
}
@Override
public boolean isClassAcceptable(Class hintClass) {
return true;
}
}));
}
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:23,代码来源:EmberJSReferencesContributor.java
示例4: processDeclarations
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull final PsiScopeProcessor processor, @NotNull final ResolveState state, final PsiElement lastParent,
@NotNull final PsiElement place)
{
if(lastParent == null || !(place instanceof JSProperty))
{
return true;
}
final JSProperty[] props = getProperties();
for(JSProperty property : props)
{
if(!processor.execute(property, state))
{
return false;
}
}
return true;
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:21,代码来源:JSObjectLiteralExpressionImpl.java
示例5: isReferenceTo
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Override
@RequiredReadAction
public boolean isReferenceTo(PsiElement element)
{
final PsiElement element2 = resolve();
boolean proxyExpanded = false;
if(element instanceof JSDefinitionExpression)
{
final JSExpression expression = ((JSDefinitionExpression) element).getExpression();
if(expression instanceof JSReferenceExpression)
{
return ((JSReferenceExpression) expression).isReferenceTo(element2);
}
}
if(element != element2 && element instanceof JSProperty && element2 instanceof JSProperty)
{
return ((JSProperty) element).getName().equals(((JSProperty) element2).getName());
}
return proxyExpanded && element == element2;
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:23,代码来源:JSPropertyNameReference.java
示例6: invoke
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Override
@RequiredReadAction
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
String propertyName = JomUtil.getJsonGetPropertyName(method);
if(propertyName != null)
{
JSProperty jsProperty = findProperty(myObjectLiteralExpression, propertyName);
if(jsProperty == null)
{
return JomValueConverter.getDefaultValueForType(method.getReturnType());
}
else
{
try
{
return JomValueConverter.convertToObject(method.getReturnType(), method.getGenericReturnType(), jsProperty.getValue());
}
catch(JomBadValueExpressionException e)
{
return JomValueConverter.getDefaultValueForType(method.getReturnType());
}
}
}
return null;
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:27,代码来源:JomProxyInvocationHandler.java
示例7: findProperty
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Nullable
private static JSProperty findProperty(@Nullable JSObjectLiteralExpression objectLiteralExpression, String name)
{
if(objectLiteralExpression == null)
{
return null;
}
for(JSProperty property : objectLiteralExpression.getProperties())
{
if(Comparing.equal(property.getName(), name))
{
return property;
}
}
return null;
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:17,代码来源:JomProxyInvocationHandler.java
示例8: buildCompletions
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
static List<SettingLookupElement> buildCompletions(CompletionParameters parameters, String prefix)
{
PsiElement position = parameters.getPosition();
JSProperty property = PsiTreeUtil.getParentOfType(position, JSProperty.class);
// Unable to determine where in roc.settings.js we are.
if (property == null)
{
return Collections.emptyList();
}
String namespace = property
.getJSNamespace()
.toString();
// Wrong file, or wrong structure.
if (!namespace.startsWith(SettingContainer.ROOT_NAMESPACE)) {
return Collections.emptyList();
}
SettingContainer settingContainer = CompletionPreloader.getCompletions();
Map<String, JSProperty> existingSettings = findExistingSettings(parameters, prefix);
List<Setting> settings = settingContainer.getSettings(namespace, existingSettings);
return settings
.stream()
.map(setting -> new SettingLookupElement(setting, namespace))
.collect(Collectors.toCollection(ArrayList::new));
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:31,代码来源:SettingCompletionBuilder.java
示例9: findExistingSettings
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
static private Map<String, JSProperty> findExistingSettings(CompletionParameters parameters, String prefix)
{
PsiFile file = parameters.getOriginalFile();
StringBuffer buffer;
// User was typing and probably screwed up the syntax in the process :-/
if (parameters.isAutoPopup())
{
PsiElement position = parameters.getPosition();
Integer startOffset = position.getTextOffset();
Integer endOffset = startOffset + prefix.length();
buffer = new StringBuffer(file.getText());
buffer = buffer.replace(startOffset, endOffset, "");
file = PsiFileFactory
.getInstance(position.getProject())
.createFileFromText(position.getLanguage(), buffer.toString());
}
try
{
RecursivePropertyWalker walker = new RecursivePropertyWalker();
walker.visitFile(file);
return walker.getExistingProperties();
}
catch (Exception e)
{
return Collections.emptyMap();
}
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:34,代码来源:SettingCompletionBuilder.java
示例10: getTargetProperty
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
private JSProperty getTargetProperty(PsiFile configFile)
{
// Braaaaaaiiins!!!
RecursivePropertyWalker walker = new RecursivePropertyWalker();
walker.visitFile(configFile);
Map<String, JSProperty> existingProperties = walker.getExistingProperties();
ArrayList<String> parts = Lists.newArrayList(setting.getNamespace().split("\\."));
JSProperty property;
// Begin at the bottom and locate the nearest property.
while (true)
{
String propertyNamespace = String.join(".", parts);
property = existingProperties.get(propertyNamespace);
if (property != null || parts.size() == 0)
{
break;
}
parts.remove(parts.size() - 1);
}
return property;
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:28,代码来源:SettingLookupElement.java
示例11: getUrlFor
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Nullable
@Override
public List<String> getUrlFor(PsiElement psiElement, PsiElement originalElement)
{
List<String> urls = new ArrayList<>();
if (!CompletionPreloader.isRocConfigFile(psiElement.getContainingFile()))
{
return urls;
}
try
{
JSProperty property = (JSProperty)psiElement;
String namespace = property
.getJSNamespace()
.toString();
if (!namespace.startsWith(SettingContainer.ROOT_NAMESPACE))
{
return urls;
}
urls.add(property.getQualifiedName());
}
catch (Exception ignored) {}
return urls;
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:31,代码来源:RocDocumentationProvider.java
示例12: shouldSkipAutopopup
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset)
{
// Wrong file.
if (!CompletionPreloader.isRocConfigFile(psiFile))
{
return ThreeState.UNSURE;
}
JSProperty property = PsiTreeUtil.getParentOfType(contextElement, JSProperty.class);
// Wrong place in file.
if (property == null)
{
return ThreeState.UNSURE;
}
Setting setting = CompletionPreloader
.getCompletions()
.getSetting(property.getQualifiedName());
// Not a roc-setting.
if (setting == null)
{
return ThreeState.UNSURE;
}
return setting.getSubCompletionVariants().size() > 1 ? ThreeState.NO : ThreeState.UNSURE;
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:30,代码来源:SubCompletionConfidence.java
示例13: toRelativeJsNotation
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
public String toRelativeJsNotation(JSProperty property, String quote)
{
String remainder = getNamespace().replaceFirst(property.getQualifiedName() + ".", "");
// This is the js-properties we need to create.
List<String> remainderParts = Lists.newArrayList(remainder.split("\\."));
String jsObject = "%s";
// Create all needed object-levels.
for (int i = 0; i < remainderParts.size() - 1; i++)
{
String remainderPart = getFormattedRemainderPart(remainderParts, i, quote);
String jsPart = remainderPart + ": { %s }";
jsObject = String.format(jsObject, jsPart);
}
String valueName = getFormattedRemainderPart(remainderParts, remainderParts.size() - 1, quote);
// Insert an "intelligent" default-value.
String valuePart = String.format("%s: %s,", valueName, defaultValue.getTargetValue(quote));
jsObject = String.format(jsObject, valuePart);
// If we needed to create additional levels, odds are we need a comma.
if (remainderParts.size() > 1)
{
jsObject += ",";
}
return jsObject;
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:30,代码来源:Setting.java
示例14: getSettings
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
public List<Setting> getSettings(String namespace, Map<String, JSProperty> existingSettings)
{
return flatList
.subMap(namespace, namespace + Character.MAX_VALUE)
.values()
.stream()
.filter(setting -> !existingSettings.containsKey(setting.getNamespace()))
.collect(Collectors.toList());
}
开发者ID:whitefire,项目名称:roc-completion,代码行数:10,代码来源:SettingContainer.java
示例15: getProperty
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Nullable
public static JSProperty getProperty(@NotNull PsiElement position) {
JSProperty property = PsiTreeUtil.getParentOfType(position, JSProperty.class, false);
if (property != null) {
JSObjectLiteralExpression objectLiteralExpression = ObjectUtils.tryCast(property.getParent(), JSObjectLiteralExpression.class);
if (objectLiteralExpression != null) {
return property;
}
}
return null;
}
开发者ID:idok,项目名称:react-templates-plugin,代码行数:12,代码来源:RTFileUtil.java
示例16: getStringLiteral
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Nullable
public static PsiElement getStringLiteral(@NotNull JSProperty property) {
PsiElement firstElement = property.getFirstChild();
if (firstElement != null && isStringLiteral(firstElement)) {
return firstElement;
}
return null;
}
开发者ID:idok,项目名称:react-templates-plugin,代码行数:9,代码来源:RTFileUtil.java
示例17: getProperties
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Override
public JSProperty[] getProperties()
{
List<JSProperty> props = new ArrayList<JSProperty>();
for(Map.Entry<String, String> entry : properties.entrySet())
{
JSProperty property = mock(JSProperty.class); // TODO
props.add(property);
}
return props.toArray(new JSProperty[0]);
}
开发者ID:cefolger,项目名称:needsmoredojo,代码行数:14,代码来源:MockJSObjectLiteralExpression.java
示例18: getProperties
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Override
public JSProperty[] getProperties()
{
final ASTNode[] nodes = getNode().getChildren(PROPERTIES_FILTER);
final JSProperty[] properties = new JSProperty[nodes.length];
for(int i = 0; i < properties.length; i++)
{
properties[i] = (JSProperty) nodes[i].getPsi();
}
return properties;
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:12,代码来源:JSObjectLiteralExpressionImpl.java
示例19: getReference
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public PsiReference getReference(@NotNull JSProperty property)
{
PsiElement nameIdentifier = property.getNameIdentifier();
assert nameIdentifier != null;
return new JSPropertyNameReference(property, nameIdentifier);
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:10,代码来源:DefaultJSPropertyNameReferenceProvider.java
示例20: isSafeDeleteAvailable
import com.intellij.lang.javascript.psi.JSProperty; //导入依赖的package包/类
@Override
public boolean isSafeDeleteAvailable(PsiElement element)
{
boolean simpleElement = element instanceof JSFunction || element instanceof JSVariable || element instanceof JSDefinitionExpression ||
element instanceof JSProperty || element instanceof JSClass;
return simpleElement && ((JSNamedElement) element).getName() != null;
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:9,代码来源:JavascriptRefactoringSupportProvider.java
注:本文中的com.intellij.lang.javascript.psi.JSProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论