@Nullable public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (file.getFileType().equals(StdFileTypes.GUI_DESIGNER_FORM)) { final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) { return null; } final Module module = ModuleUtil.findModuleForFile(virtualFile, file.getProject()); if (module == null) { return null; } final LwRootContainer rootContainer; try { rootContainer = Utils.getRootContainer(file.getText(), new PsiPropertiesProvider(module)); } catch (Exception e) { return null; } if (rootContainer.isInspectionSuppressed(getShortName(), null)) { return null; } final FormFileErrorCollector collector = new FormFileErrorCollector(file, manager, isOnTheFly); startCheckForm(rootContainer); FormEditingUtil.iterate(rootContainer, new FormEditingUtil.ComponentVisitor() { public boolean visit(final IComponent component) { if (!rootContainer.isInspectionSuppressed(getShortName(), component.getId())) { checkComponentProperties(module, component, collector); } return true; } }); doneCheckForm(rootContainer); return collector.result(); } return null; }
public LwRootContainer loadForm(String formFileName) throws Exception { if (myFormCache.containsKey(formFileName)) { return myFormCache.get(formFileName); } VirtualFile formFile = ResourceFileUtil.findResourceFileInDependents(myModule, formFileName); if (formFile == null) { throw new Exception("Could not find nested form file " + formFileName); } final LwRootContainer container = Utils.getRootContainer(formFile.getInputStream(), new PsiPropertiesProvider(myModule)); myFormCache.put(formFileName, container); return container; }
@Nullable public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (file.getFileType().equals(GuiFormFileType.INSTANCE)) { final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) { return null; } final Module module = ModuleUtil.findModuleForFile(virtualFile, file.getProject()); if (module == null) { return null; } final LwRootContainer rootContainer; try { rootContainer = Utils.getRootContainer(file.getText(), new PsiPropertiesProvider(module)); } catch (Exception e) { return null; } if (rootContainer.isInspectionSuppressed(getShortName(), null)) { return null; } final FormFileErrorCollector collector = new FormFileErrorCollector(file, manager, isOnTheFly); startCheckForm(rootContainer); FormEditingUtil.iterate(rootContainer, new FormEditingUtil.ComponentVisitor() { public boolean visit(final IComponent component) { if (!rootContainer.isInspectionSuppressed(getShortName(), component.getId())) { checkComponentProperties(module, component, collector); } return true; } }); doneCheckForm(rootContainer); return collector.result(); } return null; }