• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GotoImplementationHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testMultipleImplsFromAbstractCall

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testMultipleImplsFromAbstractCall() throws Throwable {
  PsiFile file = myFixture.addFileToProject("Foo.java", "public abstract class Hello {\n" +
                                                        "    abstract void foo();\n" +
                                                        "\n" +
                                                        "    class A {\n" +
                                                        "        {\n" +
                                                        "            fo<caret>o();\n" +
                                                        "        }\n" +
                                                        "    }\n" +
                                                        "    class Hello1 extends Hello {\n" +
                                                        "        void foo() {}\n" +
                                                        "    }\n" +
                                                        "    class Hello2 extends Hello {\n" +
                                                        "        void foo() {}\n" +
                                                        "    }\n" +
                                                        "}\n" +
                                                        "\n");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

  final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
  assertEquals(2, impls.length);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GotoImplementationHandlerTest.java


示例2: testShowSelfNonAbstract

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testShowSelfNonAbstract() throws Throwable {
  //fails if groovy plugin is enabled: org.jetbrains.plugins.groovy.codeInsight.JavaClsMethodElementEvaluator
  PsiFile file = myFixture.addFileToProject("Foo.java", "public class Hello {\n" +
                                                        "    void foo(){}\n" +
                                                        "\n" +
                                                        "    class A {\n" +
                                                        "        {\n" +
                                                        "            fo<caret>o();\n" +
                                                        "        }\n" +
                                                        "    }\n" +
                                                        "    class Hello1 extends Hello {\n" +
                                                        "        void foo() {}\n" +
                                                        "    }\n" +
                                                        "    class Hello2 extends Hello {\n" +
                                                        "        void foo() {}\n" +
                                                        "    }\n" +
                                                        "}\n" +
                                                        "\n");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

  final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
  assertEquals(3, impls.length);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GotoImplementationHandlerTest.java


示例3: testMultipleImplsFromStaticCall

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testMultipleImplsFromStaticCall() throws Throwable {
  PsiFile file = myFixture.addFileToProject("Foo.java", "public abstract class Hello {\n" +
                                                        "    static void bar (){}\n" +
                                                        "    class Hello1 extends Hello {\n" +
                                                        "    }\n" +
                                                        "    class Hello2 extends Hello {\n" +
                                                        "    }\n" +
                                                        "class D {\n" +
                                                        "    {\n" +
                                                        "        He<caret>llo.bar();\n" +
                                                        "    }\n" +
                                                        "}");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

  final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
  assertEquals(2, impls.length);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GotoImplementationHandlerTest.java


示例4: testMethodReferences

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testMethodReferences() throws Throwable {
  PsiFile file = myFixture.addFileToProject("Foo.java", "interface I {void f();}\n" +
                                                        "class A implements I { public void f(){}}\n" +
                                                        "class B implements I { public void f(){}}\n" +
                                                        "class C {\n" +
                                                        "  void foo(java.util.List<I> l) {l.stream().forEach(I::<caret>f);}" +
                                                        "}");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

  final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
  assertEquals(2, impls.length);
  final PsiElement meth = impls[0];
  assertTrue(meth instanceof PsiMethod);
  final PsiClass aClass = ((PsiMethod)meth).getContainingClass();
  assertNotNull(aClass);
  assertEquals(aClass.getName(), "A");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GotoImplementationHandlerTest.java


示例5: testNoGotoImplementationOutsideSourceRoot

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testNoGotoImplementationOutsideSourceRoot() throws Throwable {
  final TempDirTestFixture dirFixture = new TempDirTestFixtureImpl();
  dirFixture.setUp();

  new WriteCommandAction(getProject()) {
    @Override
    protected void run(@NotNull Result result) throws Throwable {
      final VirtualFile outside = dirFixture.getFile("").createChildDirectory(this, "outside");
      PsiTestUtil.addContentRoot(myModule, outside);
      VirtualFile out = outside.createChildData(this, "Outside.groovy");
      VfsUtil.saveText(out, "class Bar {}\n class Goo extends Bar {}");
      PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
    }
  }.execute();

  try {
    PsiFile inProject = myFixture.addFileToProject("Foo.groovy", "class <caret>Foo {}\n class Bar extends Foo {}");
    myFixture.configureFromExistingVirtualFile(inProject.getVirtualFile());

    final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), inProject).targets;
    assertEquals(1, impls.length);
  }
  finally {
    dirFixture.tearDown();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GroovyGotoImplementationTest.java


示例6: testNoGotoImplementationOutsideSourceRoot

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testNoGotoImplementationOutsideSourceRoot() throws Throwable {
  final TempDirTestFixture dirFixture = new TempDirTestFixtureImpl();
  dirFixture.setUp();

  new WriteCommandAction(getProject()) {
    @Override
    protected void run(Result result) throws Throwable {
      final VirtualFile outside = dirFixture.getFile("").createChildDirectory(this, "outside");
      PsiTestUtil.addContentRoot(myModule, outside);
      VirtualFile out = outside.createChildData(this, "Outside.groovy");
      VfsUtil.saveText(out, "class Bar {}\n class Goo extends Bar {}");
    }
  }.execute();

  try {
    PsiFile inProject = myFixture.addFileToProject("Foo.groovy", "class <caret>Foo {}\n class Bar extends Foo {}");
    myFixture.configureFromExistingVirtualFile(inProject.getVirtualFile());

    final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), inProject).targets;
    assertEquals(1, impls.length);
  }
  finally {
    dirFixture.tearDown();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:GroovyGotoImplementationTest.java


示例7: doTest

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
private void doTest(int expectedLength) throws Throwable {
  myFixture.configureByFile(getTestName(false) + ".hx");

  GotoTargetHandler.GotoData data;
  if (IdeaTarget.IS_VERSION_17_COMPATIBLE) {
    // Version 17 changed the way that gotoImplementation runs on a background thread.
    MethodWrapper<GotoTargetHandler.GotoData> gti =
      new MethodWrapper(CodeInsightTestUtil.class, "gotoImplementation", Editor.class, PsiFile.class);
    data = gti.invoke(null, myFixture.getEditor(), myFixture.getFile());
  } else {
    GotoImplementationHandler gtiHandler = new GotoImplementationHandler();
    data = gtiHandler.getSourceAndTargetElements(myFixture.getEditor(), myFixture.getFile());
  }


  assertNotNull(myFixture.getFile().toString(), data);
  // TODO: listen updater task?
  assertEquals(expectedLength, data.targets.length);
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:20,代码来源:HaxeGoToImplementationTest.java


示例8: testToStringOnUnqualified

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testToStringOnUnqualified() throws Throwable {
  final PsiFile file = myFixture.addFileToProject("Foo.java", "public class Fix {\n" +
                                                              "    {\n" +
                                                              "        <caret>toString();\n" +
                                                              "    }\n" +
                                                              "}\n" +
                                                              "class FixImpl1 extends Fix {\n" +
                                                              "    @Override\n" +
                                                              "    public String toString() {\n" +
                                                              "        return \"Impl1\";\n" +
                                                              "    }\n" +
                                                              "}\n" +
                                                              "class FixImpl2 extends Fix {\n" +
                                                              "    @Override\n" +
                                                              "    public String toString() {\n" +
                                                              "        return \"Impl2\";\n" +
                                                              "    }\n" +
                                                              "}\n");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

   PlatformTestUtil.startPerformanceTest(getTestName(false), 50, new ThrowableRunnable() {
    @Override
    public void run() throws Exception {
      final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
      assertEquals(3, impls.length);
    }
  }).cpuBound().usesAllCPUCores().assertTiming();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GotoImplementationHandlerTest.java


示例9: testToStringOnQualified

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testToStringOnQualified() throws Throwable {
  final PsiFile file = myFixture.addFileToProject("Foo.java", "public class Fix {\n" +
                                                              "    {\n" +
                                                              "        Fix ff = new FixImpl1();\n" +
                                                              "        ff.<caret>toString();\n" +
                                                              "    }\n" +
                                                              "}\n" +
                                                              "class FixImpl1 extends Fix {\n" +
                                                              "    @Override\n" +
                                                              "    public String toString() {\n" +
                                                              "        return \"Impl1\";\n" +
                                                              "    }\n" +
                                                              "}\n" +
                                                              "class FixImpl2 extends Fix {\n" +
                                                              "    @Override\n" +
                                                              "    public String toString() {\n" +
                                                              "        return \"Impl2\";\n" +
                                                              "    }\n" +
                                                              "}\n");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

  PlatformTestUtil.startPerformanceTest(getTestName(false), 50, new ThrowableRunnable() {
    @Override
    public void run() throws Exception {
      final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
      assertEquals(3, impls.length);
    }
  }).cpuBound().usesAllCPUCores().assertTiming();
  
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GotoImplementationHandlerTest.java


示例10: testFilterOutImpossibleVariants

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testFilterOutImpossibleVariants() throws Throwable {
  PsiFile file = myFixture.addFileToProject("Foo.java", "interface A {\n" +
                                                        "    void save();\n" +
                                                        "}\n" +
                                                        "interface B extends A {\n" +
                                                        "    void foo();\n" +
                                                        "}\n" +
                                                        "class X implements B {\n" +
                                                        "    public void foo() { }\n" +
                                                        "    public void save(){}\n" +
                                                        "}\n" +
                                                        "class Y implements A {\n" +
                                                        "    public void save(){}\n" +
                                                        "}\n" +
                                                        "class App {\n" +
                                                        "    private B b;\n" +
                                                        "    private void some() {\n" +
                                                        "        b.sa<caret>ve();\n" +
                                                        "    }\n" +
                                                        "}");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

  final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
  assertEquals(1, impls.length);
  final PsiElement meth = impls[0];
  assertTrue(meth instanceof PsiMethod);
  final PsiClass aClass = ((PsiMethod)meth).getContainingClass();
  assertNotNull(aClass);
  assertEquals(aClass.getName(), "X");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GotoImplementationHandlerTest.java


示例11: testImplicitInheritance

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
public void testImplicitInheritance() throws Throwable {
  PsiFile file = myFixture.addFileToProject("Foo.java", "interface PackContainer {\n" +
                                                        "    void foo();\n" +
                                                        "}\n" +
                                                        "interface PsiPackage extends PackContainer {}\n" +
                                                        "class PsiPackageBase implements PackContainer {\n" +
                                                        "    public void foo() {}\n" +
                                                        "}\n" +
                                                        "class PsiPackageImpl extends PsiPackageBase implements PsiPackage {}\n" +
                                                        "\n" +
                                                        "class Foo {\n" +
                                                        "    class Bar {\n" +
                                                        "        void bar(PsiPackage i) {\n" +
                                                        "            i.fo<caret>o();\n" +
                                                        "        }\n" +
                                                        "    }\n" +
                                                        "}");
  myFixture.configureFromExistingVirtualFile(file.getVirtualFile());

  final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
  assertEquals(1, impls.length);
  final PsiElement meth = impls[0];
  assertTrue(meth instanceof PsiMethod);
  final PsiClass aClass = ((PsiMethod)meth).getContainingClass();
  assertNotNull(aClass);
  assertEquals(aClass.getName(), "PsiPackageBase");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GotoImplementationHandlerTest.java


示例12: doTest

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
private void doTest(int expectedLength) throws Throwable {
  myFixture.configureByFile(getTestName(false) + ".hx");
  final GotoTargetHandler.GotoData data =
    new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), myFixture.getFile());
  assertNotNull(myFixture.getFile().toString(), data);
  assertEquals(expectedLength, data.targets.length);
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:8,代码来源:HaxeGoToImplementationTest.java


示例13: getHandler

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
@NotNull
@Override
protected CodeInsightActionHandler getHandler(){
  return new GotoImplementationHandler();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:GotoImplementationAction.java


示例14: getHandler

import com.intellij.codeInsight.navigation.GotoImplementationHandler; //导入依赖的package包/类
@Nonnull
@Override
protected CodeInsightActionHandler getHandler(){
  return new GotoImplementationHandler();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:GotoImplementationAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FragmentChangeActivity类代码示例发布时间:2022-05-23
下一篇:
Java ATexture类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap