Package net.sf.rej.java

Examples of net.sf.rej.java.JavaType


    if (moveDownButton == null) {
      moveDownButton = new JButton();
      moveDownButton.setText("Move Down");
      moveDownButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
          JavaType jt = (JavaType)ParameterChooseDialog.this.paramList.getSelectedValue();
          if (jt != null) {
            int index = ParameterChooseDialog.this.paramList.getSelectedIndex();
            if (index < (ParameterChooseDialog.this.model.size()-1)) {
              ParameterChooseDialog.this.model.remove(index);
              ParameterChooseDialog.this.model.add(index+1, jt);
View Full Code Here


    if (moveUpButton == null) {
      moveUpButton = new JButton();
      moveUpButton.setText("Move Up");
      moveUpButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
          JavaType jt = (JavaType)ParameterChooseDialog.this.paramList.getSelectedValue();
          if (jt != null) {
            int index = ParameterChooseDialog.this.paramList.getSelectedIndex();
            if (index > 0) {
              ParameterChooseDialog.this.model.remove(index);
              ParameterChooseDialog.this.model.add(index-1, jt);
View Full Code Here

    if (editButton == null) {
      editButton = new JButton();
      editButton.setText("Edit..");
      editButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
          JavaType jt = (JavaType)ParameterChooseDialog.this.paramList.getSelectedValue();
          if (jt != null) {
            int index = ParameterChooseDialog.this.paramList.getSelectedIndex();
            TypeChooseDialog chooser = new TypeChooseDialog(ParameterChooseDialog.this);
            chooser.invoke(jt, false);
            if (!chooser.wasCancelled()) {
View Full Code Here

    if (removeButton == null) {
      removeButton = new JButton();
      removeButton.setText("Remove");
      removeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
          JavaType jt = (JavaType)ParameterChooseDialog.this.paramList.getSelectedValue();
          if (jt != null) {
            ParameterChooseDialog.this.model.removeElement(jt);
          }
        }
      });
View Full Code Here

      typeButton.setText("...");
      typeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
              TypeChooseDialog chooser = new TypeChooseDialog(FieldEditor.this);
              chooser.invoke(FieldEditor.this.desc.getReturn(), true);
              JavaType newRet = chooser.getType();
              FieldEditor.this.desc.setReturn(newRet);
                FieldEditor.this.typeField.setText(newRet.toString());
        }
      });
    }
    return typeButton;
  }
View Full Code Here

    this.typeArguments.add(arg);
  }

  public void setType(Types type, int dimensions, String typeStr) {
    this.type = type;
    this.baseType = new JavaType(typeStr, dimensions);
  }
View Full Code Here

    for (int i = 0; i < pool.size(); i++) {
      ConstantPoolInfo cpi = pool.get(i);
      if (cpi != null) {
        if (cpi.getType() == ConstantPoolInfo.CLASS) {
          // there can be array definitions here, too
          JavaType cls = new JavaType(cpi.getValue());
          imports.addType(cls.getType());
        } else if (cpi.getType() == ConstantPoolInfo.NAME_AND_TYPE) {
          NameAndTypeInfo nati = (NameAndTypeInfo) cpi;
          Descriptor desc = nati.getDescriptor();
          if (!desc.getReturn().isPrimitive()) {
            imports.addType(desc.getReturn().getType());
          }

          List al = desc.getParamList();
          for (int j = 0; j < al.size(); j++) {
            JavaType item = (JavaType) al.get(j);
            if (!item.isPrimitive()) {
              imports.addType(item.getType());
            }
          }
        }

      }
View Full Code Here

    return imports;
  }
   
    private static void getDescriptorImports(Imports imports, Descriptor desc) {
      JavaType retType = desc.getReturn();
      if (!retType.isPrimitive()) {
        imports.addType(retType.getType());
      }
     
      for (JavaType param : desc.getParamList()) {
        if (!param.isPrimitive()) {
          imports.addType(param.getType());
View Full Code Here

        }
      }
    }

    private static void getGenericJavaTypeImports(Imports imports, GenericJavaType type) {
    JavaType jt = type.getBaseType();
    if (!jt.isPrimitive()) {
      imports.addType(jt.getType());
    }
    for (TypeArgument arg : type.getTypeArguments()) {
      if (arg instanceof GenericJavaType) {
        getGenericJavaTypeImports(imports, (GenericJavaType) arg);
      } else if (arg instanceof BoundTypeArgument) {
View Full Code Here

     * @param methodName name of the method.
     * @return A String with the class names edited to reflect the imports.
     */
    public String getMethodString(Imports imports, Descriptor desc, String className, String methodName) {
        StringBuffer sb = new StringBuffer();
        JavaType ret = desc.getReturn();
        if (ret.isPrimitive()) {
            sb.append(ret);
        } else {
            sb.append(imports.getShortName(ret.getType()));
            sb.append(ret.getDimensions());
        }
        sb.append(" ");
        sb.append(imports.getShortName(className));
        sb.append(".");
        sb.append(methodName);
        sb.append("(");
        List al = desc.getParamList();
        for (int i = 0; i < al.size(); i++) {
            JavaType jt = (JavaType) al.get(i);
            if (i > 0) sb.append(", ");
            if (jt.isPrimitive()) {
                sb.append(jt.toString());
            } else {
                sb.append(imports.getShortName(jt.getType()));
                sb.append(jt.getDimensions());
            }
        }
        sb.append(")");
        return sb.toString();
    }
View Full Code Here

TOP

Related Classes of net.sf.rej.java.JavaType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.