本文整理匯總了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()));
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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()));
}
}
示例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()));
}
}
}
示例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));
}
示例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;
}
示例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);
}
}
}
示例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;
}
}
示例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));
}
示例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;
}