コード例 #1
0
 public final <T extends DomElement> T createMockElement(
     final Class<T> aClass, final Module module, final boolean physical) {
   final XmlFile file =
       (XmlFile)
           PsiFileFactory.getInstance(myProject)
               .createFileFromText("a.xml", StdFileTypes.XML, "", (long) 0, physical);
   file.putUserData(MOCK_ELEMENT_MODULE, module);
   file.putUserData(MOCK, new Object());
   return getFileElement(
           file, aClass, "I_sincerely_hope_that_nobody_will_have_such_a_root_tag_name")
       .getRootElement();
 }
コード例 #2
0
 @NotNull
 public final <T extends DomElement> DomFileElementImpl<T> getFileElement(
     final XmlFile file, final Class<T> aClass, String rootTagName) {
   //noinspection unchecked
   if (file.getUserData(MOCK_DESCRIPTION) == null) {
     file.putUserData(MOCK_DESCRIPTION, new MockDomFileDescription<T>(aClass, rootTagName, file));
     mySemService.clearCache();
   }
   final DomFileElementImpl<T> fileElement = getFileElement(file);
   assert fileElement != null;
   return fileElement;
 }