fr.adrienbrault.idea.symfony2plugin.Symfony2ProjectComponent Java Examples
The following examples show how to use
fr.adrienbrault.idea.symfony2plugin.Symfony2ProjectComponent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceToolboxProvider.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public Collection<PsiElement> getPsiTargets(@NotNull PhpToolboxDeclarationHandlerParameter parameter) { if(!Symfony2ProjectComponent.isEnabled(parameter.getProject())) { return Collections.emptyList(); } final PhpClass serviceClass = ServiceUtil.getServiceClass(parameter.getProject(), parameter.getContents()); if(serviceClass == null) { return Collections.emptyList(); } return new ArrayList<PsiElement>() {{ add(serviceClass); }}; }
Example #2
Source File: DoctrineRepositoryClassConstantIntention.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement psiElement) { if(!Symfony2ProjectComponent.isEnabled(psiElement.getProject())) { return false; } PsiElement parent = psiElement.getParent(); if(!(parent instanceof StringLiteralExpression)) { return false; } String contents = ((StringLiteralExpression) parent).getContents(); if(StringUtils.isBlank(contents)) { return false; } return null != new MethodMatcher.StringParameterMatcher(parent, 0) .withSignature(SymfonyPhpReferenceContributor.REPOSITORY_SIGNATURES) .withSignature("Doctrine\\Persistence\\ObjectManager", "find") .withSignature("Doctrine\\Common\\Persistence\\ObjectManager", "find") // @TODO: missing somewhere .match(); }
Example #3
Source File: FormOptionGotoCompletionRegistrar.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Nullable @Override public GotoCompletionProvider getProvider(@NotNull PsiElement psiElement) { if (!Symfony2ProjectComponent.isEnabled(psiElement)) { return null; } ArrayCreationExpression arrayCreationExpression = PhpElementsUtil.getCompletableArrayCreationElement(psiElement.getParent()); if(arrayCreationExpression != null) { PsiElement parameterList = arrayCreationExpression.getParent(); if (parameterList instanceof ParameterList) { PsiElement context = parameterList.getContext(); if(context instanceof MethodReference) { ParameterBag currentIndex = PsiElementUtils.getCurrentParameterIndex(arrayCreationExpression); if(currentIndex != null && currentIndex.getIndex() == 2) { if (PhpElementsUtil.isMethodReferenceInstanceOf((MethodReference) context, FormUtil.PHP_FORM_BUILDER_SIGNATURES)) { return getMatchingOption((ParameterList) parameterList, psiElement); } } } } } return null; }
Example #4
Source File: SymfonyBundleFileCompletionProvider.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Override protected void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext processingContext, @NotNull CompletionResultSet completionResultSet) { if(!Symfony2ProjectComponent.isEnabled(completionParameters.getPosition())) { return; } SymfonyBundleUtil symfonyBundleUtil = new SymfonyBundleUtil(completionParameters.getPosition().getProject()); List<BundleFile> bundleFiles = new ArrayList<>(); for(SymfonyBundle symfonyBundle : symfonyBundleUtil.getBundles()) { for(String path: this.paths) { visitPath(completionParameters, bundleFiles, symfonyBundle, path); } } for(BundleFile bundleFile : bundleFiles) { completionResultSet.addElement(new SymfonyBundleFileLookupElement(bundleFile, ResourceFileInsertHandler.getInstance())); } }
Example #5
Source File: DoctrineMetadataLineMarkerProvider.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Override public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> results) { // we need project element; so get it from first item if(psiElements.size() == 0) { return; } Project project = psiElements.get(0).getProject(); if(!Symfony2ProjectComponent.isEnabled(project)) { return; } for(PsiElement psiElement: psiElements) { if(psiElement.getNode().getElementType() != XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) { continue; } PsiElement xmlAttributeValue = psiElement.getParent(); if(xmlAttributeValue instanceof XmlAttributeValue && (DoctrineMetadataPattern.getXmlTargetDocumentClass().accepts(xmlAttributeValue) || DoctrineMetadataPattern.getXmlTargetEntityClass().accepts(xmlAttributeValue) || DoctrineMetadataPattern.getEmbeddableNameClassPattern().accepts(xmlAttributeValue))) { attachXmlRelationMarker(psiElement, (XmlAttributeValue) xmlAttributeValue, results); } } }
Example #6
Source File: TemplateAnnotationReferences.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Nullable @Override public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) { if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression) || !PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), TwigUtil.TEMPLATE_ANNOTATION_CLASS)) { return new PsiReference[0]; } if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.DEFAULT) { // @Foo("template.html.twig") return new PsiReference[]{ new TemplateReference((StringLiteralExpression) annotationPropertyParameter.getElement()) }; } else if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE || "template".equals(annotationPropertyParameter.getPropertyName())) { // @Foo(template="template.html.twig") return new PsiReference[]{ new TemplateReference((StringLiteralExpression) annotationPropertyParameter.getElement()) }; } return new PsiReference[0]; }
Example #7
Source File: SymfonyWebDeploymentDownloadAction.java From idea-php-symfony2-plugin with MIT License | 6 votes |
public void actionPerformed(AnActionEvent e) { final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); if (project == null) { return; } Deployable server = WebDeploymentDataKeys.DEPLOYABLE.getData(e.getDataContext()); if(server == null || !PublishConfig.getInstance(project).isDefault(server)) { return; } new Task.Backgroundable(project, "Symfony: Downloading Files", false) { @Override public void run(@NotNull ProgressIndicator indicator) { Symfony2ProjectComponent.getLogger().info("Running webDeployment dev download"); RemoteWebServerUtil.collectRemoteFiles(project); } }.queue(); }
Example #8
Source File: DoctrineAnnotationTargetEntityReferences.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Nullable @Override public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) { if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression) || !PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\Doctrine\\ORM\\Mapping\\ManyToOne", "\\Doctrine\\ORM\\Mapping\\ManyToMany", "\\Doctrine\\ORM\\Mapping\\OneToOne", "\\Doctrine\\ORM\\Mapping\\OneToMany") ) { return new PsiReference[0]; } // @Foo(targetEntity="Foo\Class") if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE && "targetEntity".equals(annotationPropertyParameter.getPropertyName())) { return new PsiReference[]{ new EntityReference((StringLiteralExpression) annotationPropertyParameter.getElement(), true) }; } return new PsiReference[0]; }
Example #9
Source File: YamlDuplicateServiceKeyInspection.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { PsiFile psiFile = holder.getFile(); if(!Symfony2ProjectComponent.isEnabled(psiFile.getProject())) { return super.buildVisitor(holder, isOnTheFly); } return new PsiElementVisitor() { @Override public void visitFile(PsiFile file) { visitRoot(file, "services", holder); } }; }
Example #10
Source File: TwigMacroFunctionStubIndex.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public DataIndexer<String, TwigMacroTagIndex, FileContent> getIndexer() { return inputData -> { final Map<String, TwigMacroTagIndex> map = new THashMap<>(); PsiFile psiFile = inputData.getPsiFile(); if(!Symfony2ProjectComponent.isEnabledForIndex(psiFile.getProject())) { return map; } if(!(psiFile instanceof TwigFile)) { return map; } TwigUtil.visitMacros(psiFile, pair -> map.put(pair.getFirst().getName(), new TwigMacroTagIndex(pair.getFirst().getName(), pair.getFirst().getParameters()))); return map; }; }
Example #11
Source File: EventMethodCallInspection.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { if(!Symfony2ProjectComponent.isEnabled(holder.getProject())) { return super.buildVisitor(holder, isOnTheFly); } return new PsiElementVisitor() { @Override public void visitFile(PsiFile psiFile) { if(psiFile instanceof XmlFile) { visitXmlFile(psiFile, holder, new ContainerCollectionResolver.LazyServiceCollector(holder.getProject())); } else if(psiFile instanceof YAMLFile) { visitYamlFile(psiFile, holder, new ContainerCollectionResolver.LazyServiceCollector(holder.getProject())); } else if(psiFile instanceof PhpFile) { visitPhpFile((PhpFile) psiFile, holder); } } }; }
Example #12
Source File: TwigTemplateMissingInspection.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { if(!Symfony2ProjectComponent.isEnabled(holder.getProject())) { return super.buildVisitor(holder, isOnTheFly); } return new PsiElementVisitor() { @Override public void visitElement(PsiElement element) { if((TwigPattern.getTemplateFileReferenceTagPattern().accepts(element) || TwigPattern.getPrintBlockOrTagFunctionPattern("include", "source").accepts(element)) && TwigUtil.isValidStringWithoutInterpolatedOrConcat(element)) { invoke(element, holder); } super.visitElement(element); } }; }
Example #13
Source File: XmlReferenceContributor.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) { if(!Symfony2ProjectComponent.isEnabled(psiElement) || !(psiElement instanceof XmlAttributeValue)) { return new PsiReference[0]; } PsiElement parent = psiElement.getParent(); if(!(parent instanceof XmlAttribute) && YamlHelper.isClassServiceId(parent.getText())) { return new PsiReference[0]; } // invalidate on class attribute PsiElement xmlTag = parent.getParent(); if(!(xmlTag instanceof XmlTag) || ((XmlTag) xmlTag).getAttribute("class") != null) { return new PsiReference[0]; } return new PsiReference[] { new ServiceIdWithoutParameterReference((XmlAttributeValue) psiElement) }; }
Example #14
Source File: YamlParameterInspection.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { if (!Symfony2ProjectComponent.isEnabled(holder.getProject())) { return super.buildVisitor(holder, isOnTheFly); } return new PsiElementVisitor() { @Override public void visitElement(PsiElement psiElement) { if(YamlElementPatternHelper.getServiceParameterDefinition().accepts(psiElement) && YamlElementPatternHelper.getInsideServiceKeyPattern().accepts(psiElement)) { invoke(psiElement, holder); } super.visitElement(psiElement); } }; }
Example #15
Source File: TwigTemplateCompletionContributor.java From idea-php-symfony2-plugin with MIT License | 6 votes |
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) { PsiElement position = parameters.getOriginalPosition(); if(!Symfony2ProjectComponent.isEnabled(position)) { return; } // wtf: need to prefix the block tag itself. remove this behavior and strip for new Matcher // Find first Identifier "b" char or fallback to empty: // "{% block b", "{% block" String blockNamePrefix = resultSet.getPrefixMatcher().getPrefix(); int spacePos = blockNamePrefix.lastIndexOf(' '); blockNamePrefix = spacePos > 0 ? blockNamePrefix.substring(spacePos + 1) : ""; CompletionResultSet myResultSet = resultSet.withPrefixMatcher(blockNamePrefix); // collect blocks in all related files Pair<Collection<PsiFile>, Boolean> scopedContext = TwigUtil.findScopedFile(position); myResultSet.addAllElements(TwigUtil.getBlockLookupElements( position.getProject(), TwigFileUtil.collectParentFiles(scopedContext.getSecond(), scopedContext.getFirst()) )); }
Example #16
Source File: ContainerSettingDeprecatedInspection.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { if (!Symfony2ProjectComponent.isEnabled(holder.getProject())) { return super.buildVisitor(holder, isOnTheFly); } return new PsiElementVisitor() { @Override public void visitElement(PsiElement element) { if(element instanceof XmlAttribute) { registerXmlAttributeProblem(holder, (XmlAttribute) element); } else if(element instanceof YAMLKeyValue) { registerYmlRoutePatternProblem(holder, (YAMLKeyValue) element); } super.visitElement(element); } }; }
Example #17
Source File: XmlServiceInstanceInspection.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { if (!Symfony2ProjectComponent.isEnabled(holder.getProject())) { return super.buildVisitor(holder, isOnTheFly); } return new PsiElementVisitor() { @Override public void visitElement(PsiElement psiElement) { if(XmlHelper.getArgumentServiceIdPattern().accepts(psiElement)) { annotateServiceInstance(psiElement, holder); } super.visitElement(psiElement); } }; }
Example #18
Source File: EventAnnotationStubIndex.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public DataIndexer<String, DispatcherEvent, FileContent> getIndexer() { return inputData -> { Map<String, DispatcherEvent> map = new HashMap<>(); PsiFile psiFile = inputData.getPsiFile(); if(!Symfony2ProjectComponent.isEnabledForIndex(psiFile.getProject())) { return map; } psiFile.accept(new MyPsiRecursiveElementWalkingVisitor(map)); return map; }; }
Example #19
Source File: XmlLineMarkerProvider.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Override public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> lineMarkerInfos) { if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) { return; } for(PsiElement psiElement: psiElements) { if(XmlHelper.getXmlTagNameLeafStartPattern().accepts(psiElement)) { attachRouteActions(psiElement, lineMarkerInfos); } else if(psiElement instanceof XmlFile) { RelatedItemLineMarkerInfo<PsiElement> lineMarker = FileResourceUtil.getFileImplementsLineMarker((PsiFile) psiElement); if(lineMarker != null) { lineMarkerInfos.add(lineMarker); } } } }
Example #20
Source File: XmlReferenceContributor.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) { if(!Symfony2ProjectComponent.isEnabled(psiElement) || !(psiElement instanceof XmlAttributeValue)) { return new PsiReference[0]; } String method = ((XmlAttributeValue) psiElement).getValue(); if(StringUtils.isBlank(method)) { return new PsiReference[0]; } PhpClass phpClass = XmlHelper.getPhpClassForClassFactory((XmlAttributeValue) psiElement); if(phpClass == null) { return new PsiReference[0]; } Method classMethod = phpClass.findMethodByName(method); if(classMethod == null) { return new PsiReference[0]; } return new PsiReference[]{ new ClassMethodStringPsiReference(psiElement, phpClass.getFQN(), classMethod.getName()), }; }
Example #21
Source File: TwigTemplateCompletionContributor.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Override protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext processingContext, @NotNull CompletionResultSet resultSet) { PsiElement position = parameters.getPosition(); if(!Symfony2ProjectComponent.isEnabled(position)) { return; } TwigUtil.visitTokenParsers(position.getProject(), pair -> resultSet.addElement(LookupElementBuilder.create(pair.getFirst()).withIcon(Symfony2Icons.SYMFONY)) ); // add special tag ending, provide a static list. there no suitable safe way to extract them // search able via: "return $token->test(array('end" for (String s : new String[]{"endtranschoice", "endtrans"}) { resultSet.addElement(LookupElementBuilder.create(s).withIcon(Symfony2Icons.SYMFONY)); } }
Example #22
Source File: TwigTemplateCompletionContributor.java From idea-php-symfony2-plugin with MIT License | 6 votes |
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) { if(!Symfony2ProjectComponent.isEnabled(parameters.getPosition())) { return; } // move this stuff to pattern fixed event stopping by phpstorm PsiElement currElement = parameters.getPosition().getOriginalElement(); PsiElement prevElement = currElement.getPrevSibling(); if ((prevElement != null) && ((prevElement instanceof PsiWhiteSpace))) prevElement = prevElement.getPrevSibling(); if ((prevElement != null) && (prevElement.getNode().getElementType() == TwigTokenTypes.FILTER)) { for(Map.Entry<String, TwigExtension> entry : TwigExtensionParser.getFilters(parameters.getPosition().getProject()).entrySet()) { resultSet.addElement(new TwigExtensionLookupElement(currElement.getProject(), entry.getKey(), entry.getValue())); } } }
Example #23
Source File: RouteXmlReferenceContributor.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( XmlHelper.getRouteControllerPattern(), new PsiReferenceProvider() { @NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) { if(!Symfony2ProjectComponent.isEnabled(psiElement)) { return new PsiReference[0]; } return new PsiReference[] { new RouteActionReference(psiElement) }; } } ); }
Example #24
Source File: JavascriptServiceNameStrategy.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Nullable @Override public String getServiceName(@NotNull ServiceNameStrategyParameter parameter) { String serviceJsNameStrategy = Settings.getInstance(parameter.getProject()).serviceJsNameStrategy; if(serviceJsNameStrategy == null || StringUtils.isBlank(serviceJsNameStrategy)) { return null; } try { Object eval = run(parameter.getProject(), parameter.getClassName(), serviceJsNameStrategy); if(!(eval instanceof String)) { return null; } return StringUtils.isNotBlank((String) eval) ? (String) eval : null; } catch (ScriptException e) { Symfony2ProjectComponent.getLogger().error(String.format("ScriptException: '%s' - Script: '%s'", e.getMessage(), serviceJsNameStrategy)); } return null; }
Example #25
Source File: YamlCompletionProvider.java From idea-php-symfony2-plugin with MIT License | 6 votes |
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) { if(!Symfony2ProjectComponent.isEnabled(parameters.getPosition())) { return; } if(this.lookupList != null) { resultSet.addAllElements(this.lookupList); } else if(lookupMap != null) { for (Map.Entry<String, String> lookup : lookupMap.entrySet()) { LookupElementBuilder lookupElement = LookupElementBuilder.create(lookup.getKey()).withTypeText(lookup.getValue(), true).withIcon(Symfony2Icons.SYMFONY); if(lookup.getValue() != null && lookup.getValue().contains("deprecated")) { lookupElement = lookupElement.withStrikeoutness(true); } resultSet.addElement(lookupElement); } } }
Example #26
Source File: PhpGotoRelatedProvider.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public List<? extends GotoRelatedItem> getItems(@NotNull PsiElement psiElement) { if(!Symfony2ProjectComponent.isEnabled(psiElement)) { return Collections.emptyList(); } if(psiElement.getLanguage() != PhpLanguage.INSTANCE) { return Collections.emptyList(); } Method method = PsiTreeUtil.getParentOfType(psiElement, Method.class); if(method == null || !method.getName().endsWith("Action")) { return Collections.emptyList(); } return ControllerMethodLineMarkerProvider.getGotoRelatedItems(method); }
Example #27
Source File: XmlReferenceContributor.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext context) { if(!Symfony2ProjectComponent.isEnabled(psiElement)) { return new PsiReference[0]; } // check for valid xml file and services container if(!XmlPatterns.psiElement().inside(XmlHelper.getInsideTagPattern("services")).inFile(XmlHelper.getXmlFilePattern()).accepts(psiElement)) { return new PsiReference[0]; } String serviceDefinitionClass = XmlHelper.getServiceDefinitionClass(psiElement); if(serviceDefinitionClass == null) { return new PsiReference[0]; } return new PsiReference[] { new ClassPublicMethodReference(psiElement, serviceDefinitionClass)}; }
Example #28
Source File: WebDeploymentUtil.java From idea-php-symfony2-plugin with MIT License | 5 votes |
public static boolean isEnabled(@Nullable Project project) { if(!Symfony2ProjectComponent.isEnabled(project)) { return false; } if(PLUGIN_ENABLED == null) { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.jetbrains.plugins.webDeployment")); PLUGIN_ENABLED = plugin != null && plugin.isEnabled(); } return PLUGIN_ENABLED; }
Example #29
Source File: ServicesDefinitionStubIndex.java From idea-php-symfony2-plugin with MIT License | 5 votes |
public static boolean isValidForIndex(FileContent inputData, PsiFile psiFile) { String fileName = psiFile.getName(); if(fileName.startsWith(".") || fileName.endsWith("Test")) { return false; } // container file need to be xml file, eg xsd filetypes are not valid String extension = inputData.getFile().getExtension(); if(extension == null || !(extension.equalsIgnoreCase("xml") || extension.equalsIgnoreCase("yml") || extension.equalsIgnoreCase("yaml") || extension.equalsIgnoreCase("php"))) { return false; } // possible fixture or test file // to support also library paths, only filter them on project files String relativePath = VfsUtil.getRelativePath(inputData.getFile(), ProjectUtil.getProjectDir(inputData.getProject()), '/'); if(relativePath != null && (relativePath.contains("/Test/") || relativePath.contains("/Tests/") || relativePath.contains("/Fixture/") || relativePath.contains("/Fixtures/"))) { return false; } // dont add configured service paths Collection<File> settingsServiceFiles = psiFile.getProject().getComponent(Symfony2ProjectComponent.class).getContainerFiles(); for(File file: settingsServiceFiles) { if(VfsUtil.isAncestor(VfsUtil.virtualToIoFile(inputData.getFile()), file, false)) { return false; } } // dont index files larger then files; use 5 MB here if(inputData.getFile().getLength() > MAX_FILE_BYTE_SIZE) { return false; } return true; }
Example #30
Source File: SymfonyAnnotationReferences.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@Nullable @Override public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) { if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression)) { return new PsiReference[0]; } if("service".equals(annotationPropertyParameter.getPropertyName()) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Route")) { return new PsiReference[]{ new ServiceReference((StringLiteralExpression) annotationPropertyParameter.getElement(), false) }; } // JMSDiExtraBundle; @TODO: provide config if((annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.DEFAULT || "id".equals(annotationPropertyParameter.getPropertyName())) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\JMS\\DiExtraBundle\\Annotation\\Service")) { return new PsiReference[]{ new ServiceReference((StringLiteralExpression) annotationPropertyParameter.getElement(), false) }; } if((annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.DEFAULT) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\JMS\\DiExtraBundle\\Annotation\\Inject")) { return new PsiReference[]{ new ServiceReference((StringLiteralExpression) annotationPropertyParameter.getElement(), false) }; } if("class".equals(annotationPropertyParameter.getPropertyName()) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ParamConverter")) { return new PsiReference[]{ new PhpClassReference((StringLiteralExpression) annotationPropertyParameter.getElement(), true).setUseClasses(true).setUseInterfaces(true) }; } return new PsiReference[0]; }