public void navigateToSource(final GoalNode pNode) {
navigateToSource(pNode.getUserObject());
}
public void navigateToSource(final Goal pGoal) {
final PsiDocumentManager psiMgr = PsiDocumentManager.getInstance(project);
final FileEditorManager fileMgr = FileEditorManager.getInstance(project);
final VirtualFile script = getGoalContainerFile(pGoal.getContainer());
if (script == null)
return;
final OpenFileDescriptor desc = new OpenFileDescriptor(project, script);
if (desc.canNavigateToSource()) {
desc.navigate(true);
final FileEditor fileEditor = fileMgr.getSelectedEditor(script);
if (fileEditor instanceof TextEditor) {
final Editor editor = ((TextEditor) fileEditor).getEditor();
final Document document = editor.getDocument();
final PsiFile psiFile = psiMgr.getPsiFile(document);
if (!(psiFile instanceof XmlFile))
return;
final XmlFile xmlFile = (XmlFile) psiFile;
final XmlDocument xmlDoc = xmlFile.getDocument();