コード例 #1
0
ファイル: View.java プロジェクト: suiaing/gwtp-eclipse-plugin
  public IMethod createConstructor(boolean useUiBinder) throws JavaModelException {
    SourceWriter sw = sourceWriterFactory.createForNewClassBodyComponent();

    String parameters = "";
    if (isPopupView) {
      workingCopy.createImport(C_EVENT_BUS, null, new NullProgressMonitor());
      parameters += "final EventBus eventBus";
      if (useUiBinder) {
        parameters += ", ";
      }
    }
    if (useUiBinder) {
      parameters += "final Binder binder";
    }

    workingCopy.createImport(A_INJECT, null, new NullProgressMonitor());
    sw.writeLines(
        "@Inject", "public " + workingCopyType.getElementName() + "(" + parameters + ") {");

    if (isPopupView) {
      sw.writeLine("  super(eventBus);");
    }
    if (useUiBinder) {
      sw.writeLine("  widget = binder.createAndBindUi(this);");
    }
    sw.writeLine("}");

    return createMethod(sw);
  }
コード例 #2
0
ファイル: View.java プロジェクト: suiaing/gwtp-eclipse-plugin
  public IType createBinderInterface() throws JavaModelException {
    workingCopy.createImport(I_UI_BINDER, null, new NullProgressMonitor());

    SourceWriter sw = sourceWriterFactory.createForNewClassBodyComponent();
    sw.writeLine(
        "public interface Binder extends UiBinder<Widget, "
            + workingCopyType.getElementName()
            + "> { }");

    return workingCopyType.createType(sw.toString(), null, false, new NullProgressMonitor());
  }
コード例 #3
0
ファイル: View.java プロジェクト: suiaing/gwtp-eclipse-plugin
 public IField createWidgetField() throws JavaModelException {
   workingCopy.createImport(C_WIDGET, null, new NullProgressMonitor());
   SourceWriter sw = sourceWriterFactory.createForNewClassBodyComponent();
   sw.writeLine("private final Widget widget;");
   return createField(sw);
 }