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


Java PreviewFormAction类代码示例

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


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

示例1: loadForm

import com.intellij.uiDesigner.actions.PreviewFormAction; //导入依赖的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

示例2: generateStubClass

import com.intellij.uiDesigner.actions.PreviewFormAction; //导入依赖的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

示例3: generateStubClass

import com.intellij.uiDesigner.actions.PreviewFormAction; //导入依赖的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");
  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:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:PreviewNestedFormLoader.java

示例4: generateStubClass

import com.intellij.uiDesigner.actions.PreviewFormAction; //导入依赖的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:consulo,项目名称:consulo-ui-designer,代码行数:38,代码来源:PreviewNestedFormLoader.java


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