本文整理了Java中com.intellij.openapi.extensions.Extensions.getExtensions()
方法的一些代码示例,展示了Extensions.getExtensions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Extensions.getExtensions()
方法的具体详情如下:
包路径:com.intellij.openapi.extensions.Extensions
类名称:Extensions
方法名:getExtensions
暂无
代码示例来源:origin: JetBrains/ideavim
@Override
public void valueChange(OptionChangeEvent event) {
for (VimExtension extension : Extensions.getExtensions(VimExtension.EP_NAME)) {
if (name.equals(extension.getName())) {
if (Options.getInstance().isSet(name)) {
extension.init();
logger.info("IdeaVim extension '" + name + "' initialized");
}
else {
extension.dispose();
}
}
}
}
});
代码示例来源:origin: JetBrains/ideavim
private void registerExtensionOptions() {
for (VimExtension extension : Extensions.getExtensions(VimExtension.EP_NAME)) {
final String name = extension.getName();
final ToggleOption option = new ToggleOption(name, name, false);
option.addOptionChangeListener(new OptionChangeListener() {
@Override
public void valueChange(OptionChangeEvent event) {
for (VimExtension extension : Extensions.getExtensions(VimExtension.EP_NAME)) {
if (name.equals(extension.getName())) {
if (Options.getInstance().isSet(name)) {
extension.init();
logger.info("IdeaVim extension '" + name + "' initialized");
}
else {
extension.dispose();
}
}
}
}
});
addOption(option);
}
}
代码示例来源:origin: hsz/idea-gitignore
debouncedStatusesChanged.run();
for (AbstractProjectViewPane pane : Extensions.getExtensions(AbstractProjectViewPane.EP_NAME, myProject)) {
if (pane.getTreeBuilder() != null) {
pane.getTreeBuilder().queueUpdate();
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void assertNavigationContains(PsiElement psiElement, String targetShortcut) {
if(!targetShortcut.startsWith("\\")) {
targetShortcut = "\\" + targetShortcut;
}
Set<String> classTargets = new HashSet<String>();
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if(gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) {
for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) {
if(gotoDeclarationTarget instanceof Method) {
String meName = ((Method) gotoDeclarationTarget).getName();
String clName = ((Method) gotoDeclarationTarget).getContainingClass().getPresentableFQN();
if(!clName.startsWith("\\")) {
clName = "\\" + clName;
}
classTargets.add(clName + "::" + meName);
} else if(gotoDeclarationTarget instanceof Function) {
classTargets.add("\\" + ((Function) gotoDeclarationTarget).getName());
}
}
}
}
if(!classTargets.contains(targetShortcut)) {
fail(String.format("failed that PsiElement (%s) navigate to %s on %s", psiElement.toString(), targetShortcut, classTargets.toString()));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void assertNavigationIsEmpty() {
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if(gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) {
fail(String.format("failed that PsiElement (%s) navigate is empty; found target in '%s'", psiElement.toString(), gotoDeclarationHandler.getClass()));
}
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void assertNavigationMatch(ElementPattern<?> pattern) {
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
Set<String> targetStrings = new HashSet<String>();
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if(gotoDeclarationTargets == null || gotoDeclarationTargets.length == 0) {
continue;
}
for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) {
targetStrings.add(gotoDeclarationTarget.toString());
if(pattern.accepts(gotoDeclarationTarget)) {
return;
}
}
}
fail(String.format("failed that PsiElement (%s) navigate matches one of %s", psiElement.toString(), targetStrings.toString()));
}
代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin
private HybrisProjectImportProvider getHybrisProjectImportProvider() {
for (ProjectImportProvider provider : Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER)) {
if (provider instanceof HybrisProjectImportProvider) {
return (HybrisProjectImportProvider) provider;
}
}
return null;
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
public AndroidUiFacade() {
this.messageExtenders = Extensions.getExtensions(GoogleLoginMessageExtender.EP_NAME);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void assertNavigationContainsFile(LanguageFileType languageFileType, String configureByText, String targetShortcut) {
myFixture.configureByText(languageFileType, configureByText);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
Set<String> targets = new HashSet<String>();
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if (gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) {
for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) {
if(gotoDeclarationTarget instanceof PsiFile) {
targets.add(((PsiFile) gotoDeclarationTarget).getVirtualFile().getUrl());
}
}
}
}
// its possible to have memory fields,
// so simple check for ending conditions
// temp:///src/interchange.en.xlf
for (String target : targets) {
if(target.endsWith(targetShortcut)) {
return;
}
}
fail(String.format("failed that PsiElement (%s) navigate to file %s", psiElement.toString(), targetShortcut));
}
代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin
@NotNull
public static HybrisWritingAccessProvider getInstance(@NotNull final Project project) {
return Arrays.stream(Extensions.getExtensions(EP_NAME, project))
.map(o -> ObjectUtils.tryCast(o, HybrisWritingAccessProvider.class))
.filter(Objects::nonNull)
.findAny()
.orElseThrow(IllegalStateException::new);
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
@NotNull
@Override
public List<DeploymentSource> getAvailableDeploymentSources() {
AppEngineDeploymentSourceProvider[] deploymentSourceProviders =
Extensions.getExtensions(AppEngineDeploymentSourceProvider.EP_NAME);
return Stream.of(deploymentSourceProviders)
.flatMap(
deploymentSourceProvider ->
deploymentSourceProvider.getDeploymentSources(project).stream())
.collect(Collectors.toList());
}
代码示例来源:origin: dhleong/intellivim
static boolean hasJunitExtensionPoint() {
try {
Extensions.getExtensions(JUNIT_EP_NAME);
return true;
} catch (IllegalArgumentException e) {
// e.printStackTrace();
return false;
}
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
private List<RunnerAndConfigurationSettings> getAllRunConfigurations() {
if (runtimeConfigurationProviders == null) {
// build initial map of providers to list of their configurations.
runtimeConfigurationProviders =
Stream.of(Extensions.getExtensions(CloudApiRunConfigurationProvider.EP_NAME))
.collect(
Collectors.toMap(
Function.identity(),
configProvider -> configProvider.getRunConfigurationsForCloudApis(project)));
}
// return flat list of all runtime configurations for UI table model.
return runtimeConfigurationProviders
.values()
.stream()
.flatMap(Collection::stream)
.collect(Collectors.toList());
}
代码示例来源:origin: com.github.adedayo.intellij.sdk/java-psi-api
@NotNull
public static <Psi extends PsiElement> List<Psi> collectAugments(@NotNull final PsiElement element, @NotNull final Class<Psi> type) {
List<Psi> result = Collections.emptyList();
for (PsiAugmentProvider provider : DumbService.getInstance(element.getProject()).filterByDumbAwareness(Extensions.getExtensions(EP_NAME))) {
List<Psi> augments = provider.getAugments(element, type);
if (!augments.isEmpty()) {
if (result.isEmpty()) result = new ArrayList<Psi>(augments.size());
result.addAll(augments);
}
}
return result;
}
代码示例来源:origin: com.github.adedayo.intellij.sdk/java-psi-api
@Nullable
private static TestFramework computeFramework(PsiClass psiClass) {
for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
if (framework.isTestClass(psiClass)) {
return framework;
}
}
for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
if (framework.findSetUpMethod(psiClass) != null || framework.findTearDownMethod(psiClass) != null) {
return framework;
}
}
return null;
}
}
代码示例来源:origin: BashSupport/BashSupport
public static InspectionProfileEntry findInspectionProfileEntry(Class<? extends LocalInspectionTool> clazz) {
LocalInspectionEP[] extensions = Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION);
for (LocalInspectionEP extension : extensions) {
if (extension.implementationClass.equals(clazz.getCanonicalName())) {
extension.enabledByDefault = true;
return extension.instantiateTool();
}
}
throw new IllegalStateException("Unable to find inspection profile entry for " + clazz);
}
代码示例来源:origin: BashSupport/BashSupport
private void enableInspections() {
Class[] inspectionClasses = new BashTestInspections().getInspectionClasses();
ArrayList<InspectionProfileEntry> inspections = new ArrayList<InspectionProfileEntry>();
LocalInspectionEP[] extensions = Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION);
for (LocalInspectionEP extension : extensions) {
for (Class inspectionClass : inspectionClasses) {
if (extension.implementationClass.equals(inspectionClass.getCanonicalName())) {
extension.enabledByDefault = true;
inspections.add(extension.instantiateTool());
}
}
}
myFixture.enableInspections(inspections.toArray(new InspectionProfileEntry[inspections.size()]));
}
代码示例来源:origin: BashSupport/BashSupport
private void doRename(PsiFile psiElement, String newName) {
final RenameProcessor processor = new RenameProcessor(myProject, psiElement, newName, false, false);
for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
processor.addRenamerFactory(factory);
}
processor.run();
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
}
}
代码示例来源:origin: Microsoft/azure-devops-intellij
private void notifyCheckoutListeners(final File directory, final boolean checkoutCompleted) {
final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(directory);
final AddModuleWizard wizard = ImportModuleAction.createImportWizard(null, null, file,
ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions());
if (wizard == null) return;
ImportModuleAction.createFromWizard(null, wizard);
if (!checkoutCompleted) {
final VcsAwareCheckoutListener[] vcsAwareExtensions = Extensions.getExtensions(VcsAwareCheckoutListener.EP_NAME);
for (VcsAwareCheckoutListener extension : vcsAwareExtensions) {
boolean processingCompleted = extension.processCheckedOutDirectory(myProject, directory, myVcsKey);
if (processingCompleted) break;
}
}
newProject = findProjectByBaseDirLocation(directory);
}
代码示例来源:origin: protostuff/protobuf-jetbrains-plugin
public void testRenameImportedProtoAtCaretPosition() {
PsiFile[] files = myFixture.configureByFiles(
"rename/import/source.proto",
"rename/import/import.proto"
);
PsiElement elementAtCaret = myFixture.getElementAtCaret();
Project project = myFixture.getProject();
RenameProcessor processor = new RenameProcessor(project, elementAtCaret, "renamed.proto", false, false);
for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
processor.addRenamerFactory(factory);
}
processor.run();
Assert.assertEquals("renamed.proto", files[1].getName());
Assert.assertEquals("import \"rename/import/renamed.proto\";",
((ProtoPsiFileRoot) files[0]).getProtoRoot().getImports().get(0).getText());
}
内容来源于网络,如有侵权,请联系作者删除!