本文整理汇总了Java中com.jetbrains.php.lang.PhpLangUtil类的典型用法代码示例。如果您正苦于以下问题:Java PhpLangUtil类的具体用法?Java PhpLangUtil怎么用?Java PhpLangUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhpLangUtil类属于com.jetbrains.php.lang包,在下文中一共展示了PhpLangUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fillRelatedTags
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
private static void fillRelatedTags(String classFqn, XmlTag parentTag, List<XmlTag> tagsReferences) {
for (XmlTag childTag: parentTag.getSubTags()) {
String tagName = childTag.getName();
String attribute = TAG_ATTRIBUTE_RELATION.get(tagName);
if (attribute != null) {
String className = childTag.getAttributeValue(attribute);
if (className != null && PhpLangUtil.toPresentableFQN(className).equals(classFqn)) {
tagsReferences.add(getLineMarkerDecorator(childTag));
}
}
// type tag has plugin tags
if (tagName.equals(TYPE_TAG)) {
fillRelatedTags(classFqn, childTag, tagsReferences);
}
if (tagName.equals("event")) {
fillRelatedTags(classFqn, childTag, tagsReferences);
}
}
}
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:22,代码来源:TypeConfigurationIndex.java
示例2: isTestClass
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
public static boolean isTestClass(@NotNull PhpClass phpClass) {
if (phpClass.isAbstract() || phpClass.isInterface() || phpClass.isTrait()) {
return false;
}
final Ref<Boolean> isTestCase = new Ref<>(false);
PhpClassHierarchyUtils.processSuperClasses(phpClass, true, true, phpClass1 -> {
String superFQN = phpClass1.getSuperFQN();
if (superFQN != null && PhpLangUtil.equalsClassNames("\\Tester\\TestCase", superFQN)) {
isTestCase.set(true);
}
return !isTestCase.get();
});
return isTestCase.get();
}
开发者ID:jiripudil,项目名称:intellij-nette-tester,代码行数:18,代码来源:TesterUtil.java
示例3: fillRelatedTags
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
private static void fillRelatedTags(String classFqn, XmlTag parentTag, List<XmlTag> tagsReferences) {
for (XmlTag childTag: parentTag.getSubTags()) {
String tagName = childTag.getName();
String attribute = TAG_ATTRIBUTE_RELATION.get(tagName);
if (attribute == null) {
continue;
}
String className = childTag.getAttributeValue(attribute);
if (className != null && PhpLangUtil.toPresentableFQN(className).equals(classFqn)) {
tagsReferences.add(getLineMarkerDecorator(childTag));
}
// type tag has plugin tags
if (tagName.equals(XmlHelper.TYPE_TAG)) {
fillRelatedTags(classFqn, childTag, tagsReferences);
}
}
}
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:20,代码来源:TypeConfigurationFileBasedIndex.java
示例4: getImplementedMethods
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
private static ArrayList<Method> getImplementedMethods(@Nullable PhpClass phpClass, @NotNull Method method, ArrayList<Method> implementedMethods) {
if (phpClass == null) {
return implementedMethods;
}
Method[] methods = phpClass.getOwnMethods();
for (Method ownMethod : methods) {
if (PhpLangUtil.equalsMethodNames(ownMethod.getName(), method.getName())) {
implementedMethods.add(ownMethod);
}
}
for(PhpClass interfaceClass: phpClass.getImplementedInterfaces()) {
getImplementedMethods(interfaceClass, method, implementedMethods);
}
getImplementedMethods(phpClass.getSuperClass(), method, implementedMethods);
return implementedMethods;
}
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:21,代码来源:PhpDocUtil.java
示例5: addCompletions
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
if(!Symfony2ProjectComponent.isEnabled(parameters.getPosition())) {
return;
}
PhpIndex phpIndex = PhpIndex.getInstance(parameters.getOriginalFile().getProject());
Map<String, String> entityNamespaces = ServiceXmlParserFactory.getInstance(parameters.getOriginalFile().getProject(), EntityNamesServiceParser.class).getEntityNameMap();
// copied from PhpCompletionUtil::addClassesInNamespace looks the official way to find classes in namespaces
// its a really performance nightmare
Collection<String> names = phpIndex.getAllClassNames(new CamelHumpMatcher(resultSet.getPrefixMatcher().getPrefix()));
for (String name : names) {
Collection<PhpClass> classes = phpIndex.getClassesByName(name);
for(Map.Entry<String, String> entry: entityNamespaces.entrySet()) {
String namespaceFqn = PhpLangUtil.toFQN(entry.getValue());
Collection<PhpClass> filtered = PhpCompletionUtil.filterByNamespace(classes, namespaceFqn);
for (PhpClass phpClass : filtered) {
resultSet.addElement(new PhpClassLookupElement(phpClass, true, PhpClassReferenceInsertHandler.getInstance()));
}
}
}
}
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:26,代码来源:PhpEntityClassCompletionProvider.java
示例6: getQualifiedName
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
/**
* Get class path on "use" path statement
*/
@Nullable
public static String getQualifiedName(@NotNull PsiElement psiElement, @NotNull String fqn) {
PhpPsiElement scopeForUseOperator = PhpCodeInsightUtil.findScopeForUseOperator(psiElement);
if (scopeForUseOperator == null) {
return null;
}
PhpReference reference = PhpPsiUtil.getParentByCondition(psiElement, false, PhpReference.INSTANCEOF);
String qualifiedName = PhpCodeInsightUtil.createQualifiedName(scopeForUseOperator, fqn, reference, false);
if (!PhpLangUtil.isFqn(qualifiedName)) {
return qualifiedName;
}
// @TODO: remove full fqn fallback
if(qualifiedName.startsWith("\\")) {
qualifiedName = qualifiedName.substring(1);
}
return qualifiedName;
}
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:25,代码来源:AnnotationBackportUtil.java
示例7: getPropertyValueCompletions
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Override
public void getPropertyValueCompletions(AnnotationPropertyParameter annotationPropertyParameter, AnnotationCompletionProviderParameter completionParameter) {
String propertyName = annotationPropertyParameter.getPropertyName();
if(propertyName == null) {
return;
}
if(propertyName.equals("type") && PhpLangUtil.equalsClassNames(annotationPropertyParameter.getPhpClass().getPresentableFQN(), "Doctrine\\ORM\\Mapping\\Column")) {
completionParameter.getResult().addAllElements(DoctrineUtil.getTypes(annotationPropertyParameter.getProject()));
}
if(propertyName.equals("onDelete") && PhpLangUtil.equalsClassNames(annotationPropertyParameter.getPhpClass().getPresentableFQN(), "Doctrine\\ORM\\Mapping\\JoinColumn")) {
for(String s: Arrays.asList("CASCADE", "SET NULL")) {
completionParameter.getResult().addElement(LookupElementBuilder.create(s));
}
}
}
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:20,代码来源:DoctrineAnnotationStaticCompletionProvider.java
示例8: getPropertyValueCompletions
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Override
public void getPropertyValueCompletions(AnnotationPropertyParameter annotationPropertyParameter, AnnotationCompletionProviderParameter completionParameter) {
String propertyName = annotationPropertyParameter.getPropertyName();
if(propertyName == null) {
return;
}
if(propertyName.equals("name") && PhpLangUtil.equalsClassNames(annotationPropertyParameter.getPhpClass().getPresentableFQN(), "Doctrine\\ORM\\Mapping\\Column")) {
PhpDocComment phpDocComment = PsiTreeUtil.getParentOfType(annotationPropertyParameter.getElement(), PhpDocComment.class);
if(phpDocComment != null) {
PhpPsiElement classField = phpDocComment.getNextPsiSibling();
if(classField != null && classField.getNode().getElementType() == PhpElementTypes.CLASS_FIELDS) {
Field field = PsiTreeUtil.getChildOfType(classField, Field.class);
if(field != null) {
String name = field.getName();
if(StringUtils.isNotBlank(name)) {
completionParameter.getResult().addElement(LookupElementBuilder.create(underscore(name)));
}
}
}
}
}
}
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:26,代码来源:ColumnNameCompletionProvider.java
示例9: getPropertyReferences
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter referencesByElementParameter) {
if(annotationPropertyParameter.getType() != AnnotationPropertyParameter.Type.PROPERTY_VALUE) {
return null;
}
String propertyName = annotationPropertyParameter.getPropertyName();
if(propertyName == null || !propertyName.equals("repositoryClass")) {
return null;
}
String presentableFQN = annotationPropertyParameter.getPhpClass().getPresentableFQN();
if(!PhpLangUtil.equalsClassNames("Doctrine\\ORM\\Mapping\\Entity", presentableFQN)) {
return null;
}
return new PsiReference[] {
new DoctrineRepositoryReference((StringLiteralExpression) annotationPropertyParameter.getElement())
};
}
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:24,代码来源:DoctrineAnnotationTypeProvider.java
示例10: getIndexer
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Void, FileContent> getIndexer() {
return inputData -> {
Map<String, Void> map = new HashMap<>();
PsiFile psiFile = inputData.getPsiFile();
if (!Settings.isEnabled(psiFile.getProject())) {
return map;
}
if (!(psiFile instanceof XmlFile)) {
return map;
}
XmlDocument document = ((XmlFile) psiFile).getDocument();
if (document == null) {
return map;
}
XmlTag xmlTags[] = PsiTreeUtil.getChildrenOfType(psiFile.getFirstChild(), XmlTag.class);
if (xmlTags == null) {
return map;
}
for (XmlTag xmlTag : xmlTags) {
if (xmlTag.getName().equals("routes")) {
for (XmlTag routeNode : xmlTag.findSubTags("route")) {
for (XmlTag serviceNode : routeNode.findSubTags("service")) {
String typeName = serviceNode.getAttributeValue("class");
if (typeName != null) {
map.put(PhpLangUtil.toPresentableFQN(typeName), null);
}
}
}
}
}
return map;
};
}
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:41,代码来源:WebApiTypeIndex.java
示例11: getProperties
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@NotNull
@Override
public Properties getProperties(@NotNull PsiDirectory directory) {
Properties properties = super.getProperties(directory);
String fqn = PhpLangUtil.toName(testTargetTextField.getText());
String testedName = PhpLangUtil.toShortName(fqn);
if (StringUtil.isNotEmpty(testedName)) {
properties.setProperty("TESTED_NAME", testedName);
}
String namespace = PhpLangUtil.getParentQualifiedName(fqn);
if (!PhpLangUtil.isGlobalNamespaceName(namespace)) {
properties.setProperty("TESTED_NAMESPACE", namespace);
}
// bootstrap
TesterProjectSettings settings = TesterProjectSettingsManager.getInstance(getProject()).getState();
if (settings != null && settings.getBootstrapFile() != null) {
VirtualFile bootstrapFile = LocalFileSystem.getInstance().findFileByPath(settings.getBootstrapFile());
if (bootstrapFile != null && getDirectory() != null) {
Path bootstrapFilePath = Paths.get(bootstrapFile.getPath());
Path testDirectoryPath = Paths.get(directoryComboBox.getSelectedPath());
Path bootstrapRelativePath = testDirectoryPath.relativize(bootstrapFilePath);
properties.setProperty("BOOTSTRAP_RELATIVE_PATH", bootstrapRelativePath.toString());
}
}
return properties;
}
开发者ID:jiripudil,项目名称:intellij-nette-tester,代码行数:32,代码来源:TesterNewTestCaseDialog.java
示例12: multiResolve
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {
PhpIndex phpIndex = PhpIndex.getInstance(getElement().getProject());
List<String> parts = StringUtil.split(
PhpLangUtil.toFQN(
StringUtil.unquoteString(getElement().getText())
),
"::"
);
if (parts.size() != 2) {
return new ResolveResult[0];
}
String className = parts.get(0);
String constantName = parts.get(1);
List<ResolveResult> fields = new ArrayList<ResolveResult>();
Collection<PhpClass> classesAndInterfaces = new ArrayList<>();
classesAndInterfaces.addAll(phpIndex.getClassesByFQN(className));
classesAndInterfaces.addAll(phpIndex.getInterfacesByFQN(className));
for (PhpClass phpClass: classesAndInterfaces) {
for(Field field: phpClass.getFields()) {
if (field.isConstant() && field.getName().equals(constantName)) {
fields.add(new PsiElementResolveResult(field));
}
}
}
return fields.toArray(new ResolveResult[fields.size()]);
}
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:34,代码来源:ConstantReference.java
示例13: fillResolveResults
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Override
public void fillResolveResults(PsiElement psiElement, List<ResolveResult> results, String typeName) {
PhpIndex phpIndex = PhpIndex.getInstance(psiElement.getProject());
for (PhpClass phpClass : phpIndex.getInterfacesByFQN(PhpLangUtil.toFQN(typeName))) {
results.add(new PsiElementResolveResult(phpClass));
}
}
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:9,代码来源:InterfacesResultsFiller.java
示例14: fillResolveResults
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Override
public void fillResolveResults(PsiElement psiElement, List<ResolveResult> results, String typeName) {
PhpIndex phpIndex = PhpIndex.getInstance(psiElement.getProject());
for (PhpClass phpClass : phpIndex.getClassesByFQN(PhpLangUtil.toFQN(typeName))) {
addResult(results, phpClass);
}
}
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:9,代码来源:ClassesResultsFiller.java
示例15: fillResultMap
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
private void fillResultMap(XmlTag parentTag, Map<String, Void> resultMap) {
for (XmlTag childTag: parentTag.getSubTags()) {
if (indexTag.equals(childTag.getName())) {
String attributeValue = childTag.getAttributeValue(this.indexAttribute);
if (attributeValue != null) {
resultMap.put(PhpLangUtil.toPresentableFQN(attributeValue), null);
}
}
fillResultMap(childTag, resultMap);
}
}
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:12,代码来源:LayoutDataIndexer.java
示例16: getPropertyValueCompletions
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Override
public void getPropertyValueCompletions(AnnotationPropertyParameter parameter, AnnotationCompletionProviderParameter completion) {
if(parameter.getType() != AnnotationPropertyParameter.Type.PROPERTY_ARRAY) {
return;
}
if("methods".equals(parameter.getPropertyName()) && PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Symfony\\Component\\Routing\\Annotation\\Route")) {
for (String s : new String[]{"HEAD", "GET", "POST", "PUT", "PATCH", "DELETE", "PURGE", "OPTIONS", "TRACE", "CONNECT"}) {
completion.getResult().addElement(LookupElementBuilder.create(s));
}
}
}
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:13,代码来源:SymfonyCompletionProvider.java
示例17: supports
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Override
boolean supports(AnnotationPropertyParameter parameter) {
return
parameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE &&
"class".equals(parameter.getPropertyName()) &&
PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Doctrine\\ORM\\Mapping\\CustomIdGenerator");
}
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:8,代码来源:DoctrineCustomIdGenerator.java
示例18: supports
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@Override
boolean supports(AnnotationPropertyParameter parameter) {
return
parameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE &&
"class".equals(parameter.getPropertyName()) &&
PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Doctrine\\ORM\\Mapping\\Embedded");
}
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:8,代码来源:EmbeddedClassCompletionProvider.java
示例19: getNamespace
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@NotNull
protected final String getNamespace() {
return PhpLangUtil.toName(this.myNamespaceCombobox.getSelectedNamespace().trim());
}
开发者ID:aurimasniekis,项目名称:idea-php-class-templates,代码行数:5,代码来源:PhpNewClassDialog.java
示例20: getIndexer
import com.jetbrains.php.lang.PhpLangUtil; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Void, FileContent> getIndexer() {
return new LayoutDataIndexer("block", "class", PhpLangUtil::toPresentableFQN);
}
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:6,代码来源:BlockClassNameIndex.java
注:本文中的com.jetbrains.php.lang.PhpLangUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论