当前位置: 首页>>代码示例>>Java>>正文


Java LwRootContainer类代码示例

本文整理汇总了Java中com.intellij.uiDesigner.lw.LwRootContainer的典型用法代码示例。如果您正苦于以下问题:Java LwRootContainer类的具体用法?Java LwRootContainer怎么用?Java LwRootContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LwRootContainer类属于com.intellij.uiDesigner.lw包,在下文中一共展示了LwRootContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WizardData

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public WizardData(@NotNull final Project project, @NotNull final VirtualFile formFile) throws Generator.MyException {
  myProject = project;
  myFormFile = formFile;
  myBindToNewBean = true;
  myGenerateIsModified = true;

  final LwRootContainer[] rootContainer = new LwRootContainer[1];

  // Create initial bingings between form fields and bean's properties.
  // TODO[vova] ask Anton to not throw exception if form-field doesn't have corresponded field in the Java class
  final FormProperty[] formProperties = Generator.exposeForm(myProject, myFormFile, rootContainer);
  myBindings = new FormProperty2BeanProperty[formProperties.length];
  for(int i = formProperties.length - 1; i >= 0; i--){
    myBindings[i] = new FormProperty2BeanProperty(formProperties[i]);
  }

  final PsiManager manager = PsiManager.getInstance(myProject);
  final VirtualFile directory = formFile.getParent();
  LOG.assertTrue(directory.isDirectory());
  final PsiDirectory psiDirectory = manager.findDirectory(directory);
  LOG.assertTrue(psiDirectory != null);
  final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(psiDirectory);
  if(aPackage != null){
    myPackageName = aPackage.getQualifiedName();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:WizardData.java

示例2: RadNestedForm

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RadNestedForm.java

示例3: setPreviewBindings

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public static void setPreviewBindings(final LwRootContainer rootContainer, final String classToBindName) {
  // 1. Prepare form to preview. We have to change container so that it has only one binding.
  rootContainer.setClassToBind(classToBindName);
  FormEditingUtil.iterate(
    rootContainer,
    new FormEditingUtil.ComponentVisitor<LwComponent>() {
      public boolean visit(final LwComponent iComponent) {
        iComponent.setBinding(null);
        return true;
      }
    }
  );
  if (rootContainer.getComponentCount() == 1) {
    //noinspection HardCodedStringLiteral
    ((LwComponent)rootContainer.getComponent(0)).setBinding(PREVIEW_BINDING_FIELD);
  }
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:18,代码来源:PreviewFormAction.java

示例4: WizardData

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public WizardData(@NotNull final Project project, @NotNull final VirtualFile formFile) throws Generator.MyException {
  myProject = project;
  myFormFile = formFile;
  myBindToNewBean = true;
  myGenerateIsModified = true;

  final LwRootContainer[] rootContainer = new LwRootContainer[1];

  // Create initial bingings between form fields and bean's properties.
  // TODO[vova] ask Anton to not throw exception if form-field doesn't have corresponded field in the Java class
  final FormProperty[] formProperties = Generator.exposeForm(myProject, myFormFile, rootContainer);
  myBindings = new FormProperty2BeanProperty[formProperties.length];
  for(int i = formProperties.length - 1; i >= 0; i--){
    myBindings[i] = new FormProperty2BeanProperty(formProperties[i]);
  }

  final PsiManager manager = PsiManager.getInstance(myProject);
  final VirtualFile directory = formFile.getParent();
  LOG.assertTrue(directory.isDirectory());
  final PsiDirectory psiDirectory = manager.findDirectory(directory);
  LOG.assertTrue(psiDirectory != null);
  final PsiJavaPackage aPackage = JavaDirectoryService.getInstance().getPackage(psiDirectory);
  if(aPackage != null){
    myPackageName = aPackage.getQualifiedName();
  }
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:27,代码来源:WizardData.java

示例5: getBoundClassName

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的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;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:17,代码来源:BindingsCache.java

示例6: loadForm

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public LwRootContainer loadForm(String formFilePath) throws Exception {
  if (myFormCache.containsKey(formFilePath)) {
    return (LwRootContainer)myFormCache.get(formFilePath);
  }

  String lowerFormFilePath = formFilePath.toLowerCase();
  log("Searching for form " + lowerFormFilePath, Project.MSG_VERBOSE);
  for (Iterator iterator = myFormFiles.iterator(); iterator.hasNext();) {
    File file = (File)iterator.next();
    String name = file.getAbsolutePath().replace(File.separatorChar, '/').toLowerCase();
    log("Comparing with " + name, Project.MSG_VERBOSE);
    if (name.endsWith(lowerFormFilePath)) {
      return loadForm(formFilePath, new FileInputStream(file));
    }
  }

  if (myNestedFormPathList != null) {
    for (int i = 0; i < myNestedFormPathList.size(); i++) {
      PrefixedPath path = (PrefixedPath)myNestedFormPathList.get(i);
      File formFile = path.findFile(formFilePath);
      if (formFile != null) {
        return loadForm(formFilePath, new FileInputStream(formFile));
      }
    }
  }
  InputStream resourceStream = myLoader.getResourceAsStream(formFilePath);
  if (resourceStream != null) {
    return loadForm(formFilePath, resourceStream);
  }
  throw new Exception("Cannot find nested form file " + formFilePath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:Javac2.java

示例7: loadForm

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public LwRootContainer loadForm(String formFileName) throws Exception {
  if (myCache.containsKey(formFileName)) {
    return myCache.get(formFileName);
  }

  final String relPath = FileUtil.toSystemIndependentName(formFileName);

  for (Map.Entry<File, String> entry : mySourceRoots.entrySet()) {
    final File sourceRoot = entry.getKey();
    final String prefix = entry.getValue();
    String path = relPath;
    if (prefix != null && FileUtil.startsWith(path, prefix)) {
      path = path.substring(prefix.length());
    }
    final File formFile = new File(sourceRoot, path);
    if (formFile.exists()) {
      final BufferedInputStream stream = new BufferedInputStream(new FileInputStream(formFile));
      try {
        return loadForm(formFileName, stream);
      }
      finally {
        stream.close();
      }
    }
  }

  throw new Exception("Cannot find nested form file " + formFileName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:FormsInstrumenter.java

示例8: getClassToBindName

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public String getClassToBindName(LwRootContainer container) {
  final String className = container.getClassToBind();
  for (File outputRoot : myOutputRoots) {
    final String result = getJVMClassName(outputRoot, className.replace('.', '/'));
    if (result != null) {
      return result.replace('/', '.');
    }
  }
  return className;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FormsInstrumenter.java

示例9: saveNestedForm

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ComponentItemDialog.java

示例10: checkFile

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:BaseFormInspection.java

示例11: loadForm

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PsiNestedFormLoader.java

示例12: getClassToBindName

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public String getClassToBindName(LwRootContainer container) {
  PsiClass psiClass =
    JavaPsiFacade.getInstance(myModule.getProject()).findClass(container.getClassToBind(), myModule.getModuleWithDependenciesScope());
  if (psiClass != null) {
    return ClassUtil.getJVMClassName(psiClass);
  }

  return container.getClassToBind();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiNestedFormLoader.java

示例13: loadForm

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
public LwRootContainer loadForm(String formFileName) throws Exception {
  LwRootContainer rootContainer = super.loadForm(formFileName);
  if (!myGeneratedClasses.contains(formFileName)) {
    myGeneratedClasses.add(formFileName);
    String generatedClassName = "FormPreviewFrame" + myGeneratedClasses.size();
    PreviewFormAction.setPreviewBindings(rootContainer, generatedClassName);
    generateStubClass(rootContainer, generatedClassName);
  }
  return rootContainer;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PreviewNestedFormLoader.java

示例14: generateStubClass

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的package包/类
private void generateStubClass(final LwRootContainer rootContainer, final String generatedClassName) throws IOException,
                                                                                                            CodeGenerationException {
  @NonNls ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
  cw.visit(Opcodes.V1_1, Opcodes.ACC_PUBLIC, generatedClassName, null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY);

  cw.visitField(Opcodes.ACC_PUBLIC, PreviewFormAction.PREVIEW_BINDING_FIELD, "Ljavax/swing/JComponent;", null, null);

  @NonNls MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
  mv.visitCode();
  mv.visitVarInsn(Opcodes.ALOAD, 0);
  mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
  mv.visitInsn(Opcodes.RETURN);
  mv.visitMaxs(1, 1);
  mv.visitEnd();

  cw.visitEnd();

  ByteArrayInputStream bais = new ByteArrayInputStream(cw.toByteArray());
  AsmCodeGenerator acg = new AsmCodeGenerator(rootContainer, myFinder, this, true, new PsiClassWriter(myModule));
  byte[] data = acg.patchClass(bais);
  FormErrorInfo[] errors = acg.getErrors();
  if (errors.length > 0) {
    throw new CodeGenerationException(errors [0].getComponentId(), errors [0].getErrorMessage());
  }

  FileOutputStream fos = new FileOutputStream(new File(myTempPath, generatedClassName + ".class"));
  try {
    fos.write(data);
  }
  finally {
    fos.close();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:PreviewNestedFormLoader.java

示例15: getBoundClassName

import com.intellij.uiDesigner.lw.LwRootContainer; //导入依赖的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BindingsCache.java


注:本文中的com.intellij.uiDesigner.lw.LwRootContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。