private boolean isApplicableEditor(TextEditor textEditor) { final Document document = textEditor.getEditor().getDocument(); final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document); // In theory, we should just check // LayoutDomFileDescription.isLayoutFile((XmlFile)psiFile); // here, but there are problems where files don't show up with layout preview // at startup, presumably because the resource directories haven't been properly // initialized yet. return isInResourceFolder(psiFile); }
@Override @NotNull public Editor getEditor() { final TextEditor fileEditor = myPanel.getFileEditor(); if (fileEditor != null) { return fileEditor.getEditor(); } if (myMockTextEditor == null) { myMockTextEditor = EditorFactory.getInstance().createViewer(new DocumentImpl(""), myProject); } return myMockTextEditor; }