當前位置: 首頁>>代碼示例>>Java>>正文


Java Extensions.getExtensions方法代碼示例

本文整理匯總了Java中com.intellij.openapi.extensions.Extensions.getExtensions方法的典型用法代碼示例。如果您正苦於以下問題:Java Extensions.getExtensions方法的具體用法?Java Extensions.getExtensions怎麽用?Java Extensions.getExtensions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.extensions.Extensions的用法示例。


在下文中一共展示了Extensions.getExtensions方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assertNavigationMatch

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
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()));
    }
 
開發者ID:adelf,項目名稱:idea-php-dotenv-plugin,代碼行數:24,代碼來源:DotEnvLightCodeInsightFixtureTestCase.java

示例2: getFindUsagesHandler

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
public static FindUsagesHandler getFindUsagesHandler(PsiElement element, Project project) {
    FindUsagesHandlerFactory[] arrs = (FindUsagesHandlerFactory[]) Extensions.getExtensions(FindUsagesHandlerFactory.EP_NAME, project);
    FindUsagesHandler handler = null;
    int length = arrs.length;
    for (int i = 0; i < length; i++) {
        FindUsagesHandlerFactory arr = arrs[i];
        if (arr.canFindUsages(element)) {
            handler = arr.createFindUsagesHandler(element, false);
            if(handler == FindUsagesHandler.NULL_HANDLER) {
                return null;
            }

            if(handler != null) {
                return handler;
            }
        }
    }
    return null;
}
 
開發者ID:niorgai,項目名稱:Android-Resource-Usage-Count,代碼行數:20,代碼來源:FindUsageUtils.java

示例3: addFilteringActions

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
public void addFilteringActions(@NotNull DefaultActionGroup group) {
  final JComponent component = getComponent();

  if (getPresentation().isMergeDupLinesAvailable()) {
    final MergeDupLines mergeDupLines = new MergeDupLines();
    mergeDupLines.registerCustomShortcutSet(mergeDupLines.getShortcutSet(), component, this);
    group.add(mergeDupLines);
  }

  final UsageFilteringRuleProvider[] providers = Extensions.getExtensions(UsageFilteringRuleProvider.EP_NAME);
  for (UsageFilteringRuleProvider provider : providers) {
    AnAction[] actions = provider.createFilteringActions(this);
    for (AnAction action : actions) {
      group.add(action);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:UsageViewImpl.java

示例4: createUnusedSymbolInfo

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
@Nullable
public static HighlightInfo createUnusedSymbolInfo(@NotNull PsiElement element,
                                                   @NotNull String message,
                                                   @NotNull final HighlightInfoType highlightInfoType) {
  HighlightInfo info = HighlightInfo.newHighlightInfo(highlightInfoType).range(element).descriptionAndTooltip(message).create();
  if (info == null) {
    return null; //filtered out
  }

  UnusedDeclarationFixProvider[] fixProviders = Extensions.getExtensions(UnusedDeclarationFixProvider.EP_NAME);
  for (UnusedDeclarationFixProvider provider : fixProviders) {
    IntentionAction[] fixes = provider.getQuickFixes(element);
    for (IntentionAction fix : fixes) {
      QuickFixAction.registerQuickFixAction(info, fix);
    }
  }
  return info;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:UnusedSymbolUtil.java

示例5: performRefactoring

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
protected void performRefactoring(@NotNull UsageInfo[] usages) {
  final PsiMigration psiMigration = PsiMigrationManager.getInstance(myProject).startMigration();
  LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());

  try {
    for (int i = 0; i < myMigrationMap.getEntryCount(); i++) {
      MigrationMapEntry entry = myMigrationMap.getEntryAt(i);
      if (entry.getType() == MigrationMapEntry.PACKAGE) {
        MigrationUtil.doPackageMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
      if (entry.getType() == MigrationMapEntry.CLASS) {
        MigrationUtil.doClassMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
    }

    for(RefactoringHelper helper: Extensions.getExtensions(RefactoringHelper.EP_NAME)) {
      Object preparedData = helper.prepareOperation(usages);
      //noinspection unchecked
      helper.performOperation(myProject, preparedData);
    }
  }
  finally {
    a.finish();
    psiMigration.finish();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:MigrationProcessor.java

示例6: isAvailableForElement

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
public static boolean isAvailableForElement(PsiElement element) {
  if (Extensions.getExtensions(TestFramework.EXTENSION_NAME).length == 0) return false;

  if (element == null) return false;

  PsiClass psiClass = getContainingClass(element);

  if (psiClass == null) return false;

  Module srcModule = ModuleUtilCore.findModuleForPsiElement(psiClass);
  if (srcModule == null) return false;

  if (psiClass.isAnnotationType() ||
      psiClass instanceof PsiAnonymousClass) {
    return false;
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:CreateTestAction.java

示例7: assertNavigationContains

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
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()));
        }

    }
 
開發者ID:adelf,項目名稱:idea-php-dotenv-plugin,代碼行數:37,代碼來源:DotEnvLightCodeInsightFixtureTestCase.java

示例8: assertNavigationIsEmpty

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
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()));
        }
    }
}
 
開發者ID:adelf,項目名稱:idea-php-dotenv-plugin,代碼行數:10,代碼來源:DotEnvLightCodeInsightFixtureTestCase.java

示例9: assertNavigationContainsFile

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
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));
}
 
開發者ID:adelf,項目名稱:idea-php-dotenv-plugin,代碼行數:29,代碼來源:DotEnvLightCodeInsightFixtureTestCase.java

示例10: getHybrisProjectImportProvider

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
private HybrisProjectImportProvider getHybrisProjectImportProvider() {
    for (ProjectImportProvider provider : Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER)) {
        if (provider instanceof HybrisProjectImportProvider) {
            return (HybrisProjectImportProvider) provider;
        }
    }
    return null;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:9,代碼來源:ProjectRefreshAction.java

示例11: getBundledCourses

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
@Nullable
public List<Course> getBundledCourses() {
  final ArrayList<Course> courses = new ArrayList<>();
  final LanguageExtensionPoint<EduPluginConfigurator>[] extensions = Extensions.getExtensions(EduPluginConfigurator.EP_NAME, null);
  for (LanguageExtensionPoint<EduPluginConfigurator> extension : extensions) {
    final EduPluginConfigurator configurator = extension.getInstance();
    final List<String> paths = configurator.getBundledCoursePaths();
    for (String path : paths) {
      courses.add(getCourse(path));
    }
  }
  return courses;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:14,代碼來源:StudyProjectGenerator.java

示例12: afterCheck

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
@Override
public void afterCheck(@NotNull Project project, @NotNull Task task) {
  for (StudyTwitterPluginConfigurator twitterPluginConfigurator : Extensions.getExtensions(StudyTwitterPluginConfigurator.EP_NAME)) {
    if (twitterPluginConfigurator.askToTweet(project, task, myStatusBeforeCheck)) {
      StudyTwitterUtils.createTwitterDialogAndShow(project, twitterPluginConfigurator, task);
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:9,代碼來源:StudyTwitterAction.java

示例13: canBeOpened

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
static boolean canBeOpened(RemoteCourse courseInfo) {
  final ArrayList<String> supportedLanguages = new ArrayList<>();
  final LanguageExtensionPoint[] extensions = Extensions.getExtensions(EduPluginConfigurator.EP_NAME, null);
  for (LanguageExtensionPoint extension : extensions) {
    String languageId = extension.getKey();
    supportedLanguages.add(languageId);
  }

  if (courseInfo.isAdaptive()) {
    return supportedLanguages.contains(courseInfo.getLanguageID());
  }

  String courseType = courseInfo.getType();
  final List<String> typeLanguage = StringUtil.split(courseType, " ");
  String prefix = typeLanguage.get(0);
  if (!supportedLanguages.contains(courseInfo.getLanguageID())) return false;
  if (typeLanguage.size() < 2 || !prefix.startsWith(PYCHARM_PREFIX)) {
    return false;
  }
  String versionString = prefix.substring(PYCHARM_PREFIX.length());
  if (versionString.isEmpty()) {
    return true;
  }
  try {
    Integer version = Integer.valueOf(versionString);
    return version <= CURRENT_VERSION;
  }
  catch (NumberFormatException e) {
    LOG.info("Wrong version format", e);
    return false;
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:33,代碼來源:EduStepicConnector.java

示例14: actionPerformed

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  EduUsagesCollector.taskChecked();
  Project project = e.getProject();
  if (project == null) {
    return;
  }
  if (DumbService.isDumb(project)) {
    StudyCheckUtils
      .showTestResultPopUp("Checking is not available while indexing is in progress", MessageType.WARNING.getPopupBackground(), project);
    return;
  }
  StudyCheckUtils.hideTestResultsToolWindow(project);
  FileDocumentManager.getInstance().saveAllDocuments();
  Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
  if (editor == null) {
    return;
  }
  VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
  if (virtualFile == null) {
    return;
  }
  Task task = StudyUtils.getTaskForFile(project, virtualFile);
  if (task == null) {
    return;
  }
  for (StudyCheckListener listener : Extensions.getExtensions(StudyCheckListener.EP_NAME)) {
    listener.beforeCheck(project, task);
  }
  ProgressManager.getInstance().run(new StudyCheckTask(project, task));
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:32,代碼來源:StudyCheckAction.java

示例15: modifySettingsStep

import com.intellij.openapi.extensions.Extensions; //導入方法依賴的package包/類
@Nullable
@Override
public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) {
  ModuleWizardStep javaSettingsStep =
    ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, this, Conditions.alwaysTrue());
  Function<JTextField, String> getValue = JTextComponent::getText;
  getWizardInputField("ccname", "", "Name:", myPanel.getNameField(), getValue).addToSettings(settingsStep);
  getWizardInputField("ccauthor", "", "Author:", myPanel.getAuthorField(), getValue).addToSettings(settingsStep);

  myLanguageComboBox.removeAllItems();
  for (LanguageExtensionPoint extension : Extensions.<LanguageExtensionPoint>getExtensions(EduPluginConfigurator.EP_NAME, null)) {
    String languageId = extension.getKey();
    Language language = Language.findLanguageByID(languageId);
    if (language == null) {
      LOG.info("Language with id " + languageId + " not found");
      continue;
    }
    myLanguageComboBox.addItem(new LanguageWrapper(language));
  }
  getWizardInputField("cclang", "", "Language:", myLanguageComboBox, comboBox -> (String) comboBox.getSelectedItem())
    .addToSettings(settingsStep);
  JTextArea descriptionField = myPanel.getDescriptionField();
  descriptionField.setRows(4);
  descriptionField.setBorder(null);
  descriptionField.invalidate();
  JBScrollPane scrollPane = new JBScrollPane(descriptionField);
  scrollPane.setMinimumSize(scrollPane.getUI().getPreferredSize(descriptionField));
  getWizardInputField("ccdescr", "", "Description:", scrollPane, pane -> descriptionField.getText()).addToSettings(settingsStep);
  return javaSettingsStep;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:31,代碼來源:EduCCModuleBuilder.java


注:本文中的com.intellij.openapi.extensions.Extensions.getExtensions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。