コード例 #1
0
  /** Returns the ClassMemberSpecification currently represented in this dialog. */
  public ClassMemberSpecification getClassMemberSpecification() {
    String name = nameTextField.getText();
    String type = typeTextField.getText();
    String arguments = argumentsTextField.getText();

    if (name.equals("") || name.equals("*")) {
      name = null;
    }

    if (type.equals("") || type.equals("*")) {
      type = null;
    }

    if (name != null || type != null) {
      if (isField) {
        if (type == null) {
          type = ClassConstants.EXTERNAL_TYPE_INT;
        }

        type = ClassUtil.internalType(type);
      } else {
        if (type == null) {
          type = ClassConstants.EXTERNAL_TYPE_VOID;
        }

        type = ClassUtil.internalMethodDescriptor(type, ListUtil.commaSeparatedList(arguments));
      }
    }

    ClassMemberSpecification classMemberSpecification =
        new ClassMemberSpecification(0, 0, name, type);

    // Also get the access radio button settings.
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PUBLIC, publicRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PRIVATE, privateRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PROTECTED, protectedRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_STATIC, staticRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_FINAL, finalRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_VOLATILE, volatileRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_TRANSIENT, transientRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification,
        ClassConstants.INTERNAL_ACC_SYNCHRONIZED,
        synchronizedRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_NATIVE, nativeRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_ABSTRACT, abstractRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_STRICT, strictRadioButtons);

    return classMemberSpecification;
  }
コード例 #2
0
  /** Sets the ClassMemberSpecification to be represented in this dialog. */
  public void setClassMemberSpecification(ClassMemberSpecification classMemberSpecification) {
    String name = classMemberSpecification.name;
    String descriptor = classMemberSpecification.descriptor;

    // Set the access radio buttons.
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PUBLIC, publicRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PRIVATE, privateRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PROTECTED, protectedRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_STATIC, staticRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_FINAL, finalRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_VOLATILE, volatileRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_TRANSIENT, transientRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification,
        ClassConstants.INTERNAL_ACC_SYNCHRONIZED,
        synchronizedRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_NATIVE, nativeRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_ABSTRACT, abstractRadioButtons);
    setClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_STRICT, strictRadioButtons);

    // Set the class name text fields.
    nameTextField.setText(name == null ? "" : name);

    if (isField) {
      typeTextField.setText(descriptor == null ? "" : ClassUtil.externalType(descriptor));
    } else {
      typeTextField.setText(
          descriptor == null ? "" : ClassUtil.externalMethodReturnType(descriptor));
      argumentsTextField.setText(
          descriptor == null ? "" : ClassUtil.externalMethodArguments(descriptor));
    }
  }