Java Code Examples for com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler#getGotoDeclarationTargets()
The following examples show how to use
com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler#getGotoDeclarationTargets() .
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: AnnotationLightCodeInsightFixtureTestCase.java From idea-php-generics-plugin with MIT License | 6 votes |
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())); }
Example 2
Source File: AnnotationLightCodeInsightFixtureTestCase.java From idea-php-annotation-plugin with MIT License | 6 votes |
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())); }
Example 3
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-symfony2-plugin with MIT License | 6 votes |
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())); }
Example 4
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-toolbox with MIT License | 6 votes |
public void assertNavigationMatch(LanguageFileType languageFileType, String configureByText, ElementPattern<?> pattern) { myFixture.configureByText(languageFileType, configureByText); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); Set<String> targetStrings = new HashSet<>(); 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())); }
Example 5
Source File: LaravelLightCodeInsightFixtureTestCase.java From idea-php-laravel-plugin with MIT License | 6 votes |
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())); }
Example 6
Source File: AnnotationLightCodeInsightFixtureTestCase.java From idea-php-annotation-plugin with MIT License | 5 votes |
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())); } }
Example 7
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-symfony2-plugin with MIT License | 5 votes |
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())); } } }
Example 8
Source File: DrupalLightCodeInsightFixtureTestCase.java From idea-php-drupal-symfony2-bridge with MIT License | 5 votes |
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())); } } }
Example 9
Source File: DrupalLightCodeInsightFixtureTestCase.java From idea-php-drupal-symfony2-bridge with MIT License | 5 votes |
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())); } }
Example 10
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-toolbox with MIT License | 5 votes |
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<>(); 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)); }
Example 11
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-symfony2-plugin with MIT License | 5 votes |
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())); } }
Example 12
Source File: ShopwareLightCodeInsightFixtureTestCase.java From idea-php-shopware-plugin with MIT License | 5 votes |
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())); } } }
Example 13
Source File: ShopwareLightCodeInsightFixtureTestCase.java From idea-php-shopware-plugin with MIT License | 5 votes |
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())); } }
Example 14
Source File: LaravelLightCodeInsightFixtureTestCase.java From idea-php-laravel-plugin with MIT License | 5 votes |
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)); }
Example 15
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-toolbox with MIT License | 5 votes |
public void assertNavigationContains(PsiElement psiElement, String targetShortcut) { if(!targetShortcut.startsWith("\\")) { targetShortcut = "\\" + targetShortcut; } Set<String> classTargets = new HashSet<>(); 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())); } }
Example 16
Source File: LaravelLightCodeInsightFixtureTestCase.java From idea-php-laravel-plugin with MIT License | 5 votes |
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())); } }
Example 17
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-toolbox with MIT License | 5 votes |
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<>(); 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)); }
Example 18
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-toolbox with MIT License | 5 votes |
public void assertNavigationContains(PsiElement psiElement, String targetShortcut) { if(!targetShortcut.startsWith("\\")) { targetShortcut = "\\" + targetShortcut; } Set<String> classTargets = new HashSet<>(); 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())); } }
Example 19
Source File: SymfonyLightCodeInsightFixtureTestCase.java From idea-php-symfony2-plugin with MIT License | 5 votes |
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)); }
Example 20
Source File: AnnotationLightCodeInsightFixtureTestCase.java From idea-php-generics-plugin with MIT License | 5 votes |
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())); } } }