@Test public void testNavigate_class() { handler.async(2); getComponent(EditSourceUtil.class)._setNavigator(new EditSourceUtil.Navigator() { @Override public void navigate(final NavigationItem item, final boolean requestFocus, final boolean useCurrentWindow) { handler.done(new Runnable() { @Override public void run() { Assert.assertEquals("PsiClass:Clazz", item.toString()); Assert.assertTrue(requestFocus); Assert.assertTrue(useCurrentWindow); } }); } }); final TextComponentEditor editor = new TextComponentEditor(getProject(), new JTextArea("1\n2\n3\n4\n5\n")); editor.getSelectionModel().setSelection(1, 2); final int line = 3; getComponent(FileEditorManager.class)._setSelector(new FileEditorManager.Selector() { @Override public Editor getSelectedTextEditor() { handler.done(); return editor; } }); createTestClazz(); boolean result = new ReadAction<Boolean>() { @Override protected void run(Result<Boolean> result) throws Throwable { String hyperlink = new ClassCandidate(1, 100, 10, 90, "test.Clazz", "Clazz", line, null).createLink(getProject()); result.setResult(new MyRecognizer().navigate(getProject(), hyperlink)); } }.execute().getResultObject(); Assert.assertTrue(result); Assert.assertEquals(new LogicalPosition(line - 1, 0), editor.getCaretModel().getLogicalPosition()); Assert.assertNull(editor.getSelectionModel().getSelectedText()); }
public boolean navigate(Project project, String hyperlink) { if(hyperlink.startsWith("goto:")) { openEditor(project, hyperlink.substring(5)); return true; } else { return false; } }
ClassRecognizer implements Recognizer { public boolean navigate(Project project, String hyperlink) { if(hyperlink.startsWith("goto:")) { openEditor(project, hyperlink.substring(5)); return true; } else { return false; } } }
ClassRecognizer implements Recognizer { public boolean navigate(Project project, String hyperlink) { if(hyperlink.startsWith("goto:")) { openEditor(project, hyperlink.substring(5)); return true; } else { return false; } }  }
ClassRecognizer implements Recognizer { public boolean navigate(Project project, String hyperlink) { if(hyperlink.startsWith("goto:")) { openEditor(project, hyperlink.substring(5)); return true; } else { return false; } }  boolean navigate(Project project, String hyperlink); }
ClassRecognizer implements Recognizer { public boolean navigate(Project project, String hyperlink) { if(hyperlink.startsWith("goto:")) { openEditor(project, hyperlink.substring(5)); return true; } else { return false; } }  boolean navigate(Project project, String hyperlink);  }