当前位置: 首页>>代码示例>>Java>>正文


Java PhpFileType类代码示例

本文整理汇总了Java中com.jetbrains.php.lang.PhpFileType的典型用法代码示例。如果您正苦于以下问题:Java PhpFileType类的具体用法?Java PhpFileType怎么用?Java PhpFileType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PhpFileType类属于com.jetbrains.php.lang包,在下文中一共展示了PhpFileType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCompletionField

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testCompletionField() {

        myFixture.configureByText(PhpFileType.INSTANCE,   "<?php \n" +
                " use yii\\base\\Model; \n" +
                " class ContactForm extends Model {\n" +
                "        public $name;\n" +
                "        public $email;\n" +
                "        public $address;\n" +
                "        public function rules() {\n" +
                "            return [\n" +
                "                [\n" +
                "                    ['name', 'email', 'subject', 'body'], 'required'],\n" +
                "                    ['<caret>']\n" +
                "                ];\n" +
                "        }\n" +
                "    }");
        myFixture.completeBasic();
        assertEquals(3, myFixture.getLookupElementStrings().size());
    }
 
开发者ID:nvlad,项目名称:yii2support,代码行数:20,代码来源:ValidationTests.java

示例2: testCompletionField2

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testCompletionField2() {

        myFixture.configureByText(PhpFileType.INSTANCE,   "<?php \n" +
                " use yii\\base\\Model; \n" +
                " class ContactForm extends Model {\n" +
                "        public $name;\n" +
                "        public $email;\n" +
                "        public $address;\n" +
                "        public function rules() {\n" +
                "            return [\n" +
                "                [\n" +
                "                    ['name', 'email', 'subject', 'body'], 'required'],\n" +
                "                    [['name', '<caret>']]\n" +
                "                ];\n" +
                "        }\n" +
                "    }");
        myFixture.completeBasic();
        assertEquals(3, myFixture.getLookupElementStrings().size());
    }
 
开发者ID:nvlad,项目名称:yii2support,代码行数:20,代码来源:ValidationTests.java

示例3: testCompletionValidators

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testCompletionValidators() {

        myFixture.configureByText(PhpFileType.INSTANCE,   "<?php \n" +
                " use yii\\base\\Model; \n" +
                " class ContactForm extends Model {\n" +
                "        public $name;\n" +
                "        public $email;\n" +
                "        public function rules() {\n" +
                "            return [\n" +
                "                [\n" +
                "                    ['name', 'email', 'subject', 'body'], 'required'],\n" +
                "                    [['name'], '<caret>']\n" +
                "                ];\n" +
                "        }\n" +
                "       function validateCompany() {" +
                        "}" +
                "    }");
        myFixture.completeBasic();
        assertEquals(2, myFixture.getLookupElementStrings().size());
    }
 
开发者ID:nvlad,项目名称:yii2support,代码行数:21,代码来源:ValidationTests.java

示例4: testCompletionValidatorParams

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testCompletionValidatorParams() {

        myFixture.configureByText(PhpFileType.INSTANCE,   "<?php \n" +
                " use yii\\base\\Model; \n" +
                " class ContactForm extends Model {\n" +
                "        public $name;\n" +
                "        public $email;\n" +
                "        public function rules() {\n" +
                "            return [\n" +
                "                [\n" +
                "                    ['name', 'email', 'subject', 'body'], 'required'],\n" +
                "                    [['name'], 'test', '<caret>']\n" +
                "                ];\n" +
                "        }\n" +
                "       function validateCompany() {" +
                "}" +
                "    }");
        myFixture.completeBasic();
        assertEquals(5, myFixture.getLookupElementStrings().size());
    }
 
开发者ID:nvlad,项目名称:yii2support,代码行数:21,代码来源:ValidationTests.java

示例5: fromTemplate

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
/**
 * @param templateFile        Name of the generated file
 * @param destinationPath     Relative path to the target file system entry
 * @param extensionDefinition Extension definition containing all relevant metadata
 * @param context             Template Context variables
 * @param project             Project in context
 */
public static PsiElement fromTemplate(@NotNull String templateFile, @NotNull String destinationPath, @NotNull String destinationFileName, @NotNull TYPO3ExtensionDefinition extensionDefinition, @NotNull Map<String, String> context, Project project) {
    String template = readTemplateToString(templateFile, context);

    VirtualFile targetDirectory = getOrCreateDestinationPath(extensionDefinition.getRootDirectory(), destinationPath);

    LanguageFileType fileType = FileTypes.PLAIN_TEXT;
    if (templateFile.endsWith(".php")) {
        fileType = PhpFileType.INSTANCE;
    }

    PsiFile fileFromText = PsiFileFactory.getInstance(project).createFileFromText(destinationFileName, fileType, template);
    CodeStyleManager.getInstance(project).reformat(fileFromText);
    return PsiDirectoryFactory
            .getInstance(project)
            .createDirectory(targetDirectory)
            .add(fileFromText);
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:25,代码来源:ExtensionFileGenerationUtil.java

示例6: collectServices

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
private void collectServices(Project project) {
    FileBasedIndex index = FileBasedIndex.getInstance();
    Collection<VirtualFile> containingFiles = index.getContainingFiles(
            FileTypeIndex.NAME,
            PhpFileType.INSTANCE,
            GlobalSearchScope.allScope(project)
    );
    containingFiles.removeIf(virtualFile -> !(virtualFile.getName().contains("ext_localconf.php")));

    for (VirtualFile projectFile : containingFiles) {
        PsiFile psiFile = PsiManager.getInstance(project).findFile(projectFile);
        if (psiFile != null) {
            psiFile.accept(new CoreServiceDefinitionParserVisitor(serviceMap));
        }
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:17,代码来源:CoreServiceParser.java

示例7: testReferenceCanResolveDefinition

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testReferenceCanResolveDefinition() {
    PsiFile file = myFixture.configureByText(PhpFileType.INSTANCE, "<?php \n" +
            "class ActionController {" +
            "public function action() {" +
            "  $this->forward('<caret>baz');" +
            "}" +
            "}"
    );

    PsiElement elementAtCaret = file.findElementAt(myFixture.getCaretOffset()).getParent();
    PsiReference[] references = elementAtCaret.getReferences();
    for (PsiReference reference : references) {
        if (reference instanceof ControllerActionReference) {
            ResolveResult[] resolveResults = ((ControllerActionReference) reference).multiResolve(false);
            for (ResolveResult resolveResult : resolveResults) {
                assertInstanceOf(resolveResult.getElement(), Method.class);

                return;
            }
        }
    }

    fail("No TranslationReference found");
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:25,代码来源:ControllerActionReferenceTest.java

示例8: testCanCreateTranslationReferencesOnPhpStrings

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testCanCreateTranslationReferencesOnPhpStrings() {
    PsiFile file = myFixture.configureByText(PhpFileType.INSTANCE, "<?php \n" +
            "class ActionController {" +
            "public function action() {" +
            "  $this->forward('<caret>baz');" +
            "}" +
            "}"
    );

    PsiElement elementAtCaret = file.findElementAt(myFixture.getCaretOffset()).getParent();
    PsiReference[] references = elementAtCaret.getReferences();
    for (PsiReference reference : references) {
        if (reference instanceof ControllerActionReference) {
            return;
        }
    }

    fail("No ControllerActionReference found");
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:20,代码来源:ControllerActionReferenceProviderTest.java

示例9: testResourcesAreIndexed

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testResourcesAreIndexed() {
    myFixture.addFileToProject("typo3conf/ext/foo/bar.php", "");
    myFixture.addFileToProject("typo3/sysext/baz/bar.png", "");
    myFixture.configureByText(PhpFileType.INSTANCE, "<?php \n" +
            "echo 'EXT:<caret>';");
    myFixture.completeBasic();

    List<String> lookupElementStrings = myFixture.getLookupElementStrings();

    if (lookupElementStrings == null) {
        fail("Could not complete");
    }

    assertContainsElements(lookupElementStrings, "EXT:foo/bar.php");
    assertContainsElements(lookupElementStrings, "EXT:baz/bar.png");
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:17,代码来源:PathResourceCompletionContributorTest.java

示例10: testResourceReferencesAreCreated

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testResourceReferencesAreCreated() {
    myFixture.addFileToProject("foo/ext_emconf.php", "");

    myFixture.configureByText(PhpFileType.INSTANCE, "<?php \n" +
            "'EXT:foo/ext_emconf.php<caret>';");

    PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent();

    PsiReference[] references = elementAtCaret.getReferences();
    for (PsiReference ref : references) {
        if (ref instanceof ResourceReference) {
            return;
        }
    }

    fail("No resource reference.");
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:18,代码来源:ResourceReferenceContributorTest.java

示例11: testReferenceCanResolveDefinition

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testReferenceCanResolveDefinition() {
    PsiFile file = myFixture.configureByText(PhpFileType.INSTANCE, "<?php \n" +
            "\"LLL:EXT:foo/sample.xlf:sys_<caret>language.language_isocode.ab\";");

    PsiElement elementAtCaret = file.findElementAt(myFixture.getCaretOffset()).getParent();
    PsiReference[] references = elementAtCaret.getReferences();
    for (PsiReference reference : references) {
        if (reference instanceof TranslationReference) {
            ResolveResult[] resolveResults = ((TranslationReference) reference).multiResolve(false);
            for (ResolveResult resolveResult : resolveResults) {
                assertInstanceOf(resolveResult.getElement(), XmlTag.class);

                return;
            }
        }
    }

    fail("No TranslationReference found");
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:20,代码来源:TranslationReferenceTest.java

示例12: testReferenceCanResolveVariants

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public void testReferenceCanResolveVariants() {
    PsiFile file = myFixture.configureByText(PhpFileType.INSTANCE, "<?php \n" +
            "\"LLL:EXT:foo/sample.xlf:sys_<caret>language.language_isocode.ab\";");

    PsiElement elementAtCaret = file.findElementAt(myFixture.getCaretOffset()).getParent();
    PsiReference[] references = elementAtCaret.getReferences();
    for (PsiReference reference : references) {
        if (reference instanceof TranslationReference) {
            Object[] variants = reference.getVariants();
            for (Object variant : variants) {
                if (variant instanceof LookupElement) {
                    String lookupString = ((LookupElement) variant).getLookupString();
                    assertEquals("LLL:EXT:foo/sample.xlf:sys_language.language_isocode.ab", lookupString);
                    return;
                }
            }

        }
    }

    fail("No TranslationReference found");
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:23,代码来源:TranslationReferenceTest.java

示例13: findViewVfsByModuleName

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public static Collection<VirtualFile> findViewVfsByModuleName(String moduleName, Project project)
{
    Collection<VirtualFile> viewVfs = new ArrayList<>();

    Pattern pattern = Pattern.compile(RegExUtil.Magento.MODULE_NAME);
    Matcher matcher = pattern.matcher(moduleName);
    if (!matcher.find()) {
        return viewVfs;
    }

    Collection<VirtualFile> moduleVfs =
            FileBasedIndex.getInstance().getContainingFiles(ModuleNameIndex.KEY, moduleName,
                GlobalSearchScope.getScopeRestrictedByFileTypes(
                    GlobalSearchScope.allScope(project),
                    PhpFileType.INSTANCE
            )
    );

    for (VirtualFile moduleVf : moduleVfs) {
        viewVfs.addAll(getValues(moduleName, moduleVf, project));
    }
    return viewVfs;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:24,代码来源:FileBasedIndexUtil.java

示例14: getReferencesByElement

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
    String value = StringUtil.unquoteString(element.getText());
    Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance()
        .getContainingFiles(EventNameIndex.KEY, value,
                GlobalSearchScope.getScopeRestrictedByFileTypes(
                        GlobalSearchScope.allScope(element.getProject()),
                        PhpFileType.INSTANCE
                )
        );

    PsiManager psiManager = PsiManager.getInstance(element.getProject());
    for (VirtualFile virtualFile: containingFiles) {
        PhpFile phpFile = (PhpFile) psiManager.findFile(virtualFile);
        if (phpFile != null) {
            List<PsiElement> psiElements = new ArrayList<>();
            recursiveFill(psiElements, phpFile, value);
            if (psiElements.size() > 0) {
                return new PsiReference[] {new PolyVariantReferenceBase(element, psiElements)};
            }
        }
    }
    return PsiReference.EMPTY_ARRAY;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:26,代码来源:EventNameReferenceProvider.java

示例15: attachMetadataExtends

import com.jetbrains.php.lang.PhpFileType; //导入依赖的package包/类
public static void attachMetadataExtends(@NotNull final StringLiteralExpression psiElement, final @NotNull Collection<PsiElement> psiElements) {

        final String contents = getPathFormattedString(psiElement);
        if (contents == null) {
            return;
        }

        ModuleUtil.visitModuleFile(psiElement.getContainingFile(), new ModuleUtil.ModuleFileVisitor() {
            @Override
            public void visit(@NotNull VirtualFile virtualFile, @NotNull String relativePath) {

                if (virtualFile.getFileType() != PhpFileType.INSTANCE || !relativePath.toLowerCase().endsWith(".php") || !contents.equalsIgnoreCase(relativePath.substring(0, relativePath.length() - 4))) {
                    return;
                }

                PsiFile file = PsiManager.getInstance(psiElement.getProject()).findFile(virtualFile);
                if(file != null) {
                    psiElements.add(file);
                }

            }
        });

    }
 
开发者ID:Haehnchen,项目名称:idea-php-oxid-plugin,代码行数:25,代码来源:PhpGoToHandler.java


注:本文中的com.jetbrains.php.lang.PhpFileType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。