本文整理汇总了Java中com.intellij.uiDesigner.compiler.Utils.getRootContainer方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.getRootContainer方法的具体用法?Java Utils.getRootContainer怎么用?Java Utils.getRootContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.uiDesigner.compiler.Utils
的用法示例。
在下文中一共展示了Utils.getRootContainer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RadNestedForm
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
public RadNestedForm(final ModuleProvider module, final String formFileName, final String id) throws Exception {
super(module, JPanel.class, id);
myFormFileName = formFileName;
LOG.debug("Loading nested form " + formFileName);
VirtualFile formFile = ResourceFileUtil.findResourceFileInDependents(getModule(), formFileName);
if (formFile == null) {
throw new IllegalArgumentException("Couldn't find virtual file for nested form " + formFileName);
}
Document doc = FileDocumentManager.getInstance().getDocument(formFile);
final ClassLoader classLoader = LoaderFactory.getInstance(getProject()).getLoader(formFile);
final LwRootContainer rootContainer = Utils.getRootContainer(doc.getText(), new CompiledClassPropertiesProvider(classLoader));
myRootContainer = XmlReader.createRoot(module, rootContainer, classLoader, null);
if (myRootContainer.getComponentCount() > 0) {
getDelegee().setLayout(new BorderLayout());
JComponent nestedFormDelegee = myRootContainer.getComponent(0).getDelegee();
getDelegee().add(nestedFormDelegee, BorderLayout.CENTER);
setRadComponentRecursive(nestedFormDelegee);
}
if (isCustomCreateRequired()) {
setCustomCreate(true);
}
}
示例2: getBoundClassName
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
public String getBoundClassName(final VirtualFile formFile) throws Exception
{
File file = VfsUtil.virtualToIoFile(formFile);
String classToBind = getSavedBinding(file);
if(classToBind == null)
{
final Document doc = FileDocumentManager.getInstance().getDocument(formFile);
final LwRootContainer rootContainer = Utils.getRootContainer(doc.getText(), null);
classToBind = rootContainer.getClassToBind();
}
if(classToBind != null)
{
updateCache(file, classToBind);
}
return classToBind;
}
示例3: saveNestedForm
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
private boolean saveNestedForm() {
VirtualFile formFile = ResourceFileUtil.findResourceFileInProject(myProject, myTfNestedForm.getText());
if (formFile == null) {
Messages.showErrorDialog(getWindow(), UIDesignerBundle.message("add.component.cannot.load.form", myTfNestedForm.getText()), CommonBundle.getErrorTitle());
return false;
}
LwRootContainer lwRootContainer;
try {
lwRootContainer = Utils.getRootContainer(formFile.getInputStream(), null);
}
catch (Exception e) {
Messages.showErrorDialog(getWindow(), e.getMessage(), CommonBundle.getErrorTitle());
return false;
}
if (lwRootContainer.getClassToBind() == null) {
Messages.showErrorDialog(getWindow(), UIDesignerBundle.message("add.component.form.not.bound"), CommonBundle.getErrorTitle());
return false;
}
if (lwRootContainer.getComponent(0).getBinding() == null) {
Messages.showErrorDialog(getWindow(), UIDesignerBundle.message("add.component.root.not.bound"),
CommonBundle.getErrorTitle());
return false;
}
PsiClass psiClass =
JavaPsiFacade.getInstance(myProject).findClass(lwRootContainer.getClassToBind(), GlobalSearchScope.projectScope(myProject));
if (psiClass != null) {
myItemToBeEdited.setClassName(getClassOrInnerName(psiClass));
}
else {
myItemToBeEdited.setClassName(lwRootContainer.getClassToBind());
}
return true;
}
示例4: checkFile
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
@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;
}
示例5: loadForm
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
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;
}
示例6: getBoundClassName
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
public String getBoundClassName(final VirtualFile formFile) throws Exception {
String classToBind = getSavedBinding(formFile);
if (classToBind == null) {
final Document doc = FileDocumentManager.getInstance().getDocument(formFile);
final LwRootContainer rootContainer = Utils.getRootContainer(doc.getText(), null);
classToBind = rootContainer.getClassToBind();
}
if (classToBind != null) {
updateCache(formFile, classToBind);
}
return classToBind;
}
示例7: checkFile
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
@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;
}
示例8: loadForm
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
private LwRootContainer loadForm(String formFileName, InputStream resourceStream) throws Exception {
final LwRootContainer container = Utils.getRootContainer(resourceStream, null);
myCache.put(formFileName, container);
return container;
}
示例9: loadFormData
import com.intellij.uiDesigner.compiler.Utils; //导入方法依赖的package包/类
private LwRootContainer loadFormData(final String formPath) throws Exception {
String formData = FileUtil.loadFile(new File(formPath));
final CompiledClassPropertiesProvider provider = new CompiledClassPropertiesProvider(getClass().getClassLoader());
return Utils.getRootContainer(formData, provider);
}