Package net.sf.rej.gui.action

Examples of net.sf.rej.gui.action.ModifyClassInfoAction


      ClassInfo ci = (ClassInfo)cpi;
      JavaType jt = new JavaType(ci.getName());
      String newClassName = this.advisor.newClassNameFor(jt.getType());
      if(newClassName != null) {
        this.oldClassNames.put(newClassName, jt.getType());
        Undoable u = new ModifyClassInfoAction(ic.getCf().getPool(), ci, newClassName + jt.getDimensions());
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());
        }
      }
    } if(cpi.getType() == ConstantPoolInfo.NAME_AND_TYPE) {
      NameAndTypeInfo nati = (NameAndTypeInfo)cpi;
      Descriptor desc = nati.getDescriptor();
      JavaType ret = desc.getReturn();
      boolean match = false;
      String newClassName = this.advisor.newClassNameFor(ret.getType());
      if (newClassName != null) {
        this.oldClassNames.put(newClassName, ret.getType());
        match = true;
        desc.setReturn(new JavaType(newClassName, ret.getDimensionCount()));
      }
     
      List params = desc.getParamList();
      List<JavaType> newParams = new ArrayList<JavaType>();
      for (int i=0; i < params.size(); i++) {
        JavaType param = (JavaType)params.get(i);
        newClassName = this.advisor.newClassNameFor(param.getType());
        if (newClassName != null) {
          this.oldClassNames.put(newClassName, param.getType());
          match = true;
          newParams.add(new JavaType(newClassName, param.getDimensionCount()));
        } else {
          newParams.add(param);
        }
      }
     
      if (match) {
        desc.setParamList(newParams);
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, desc);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());
        }
      }
    } if(cpi.getType() == ConstantPoolInfo.FIELD_REF) {
      RefInfo ri = (RefInfo)cpi;
      String className = ri.getClassName();
      String newFieldName = this.advisor.newFieldNameFor(className, ri.getTargetName(), ri.getDescriptor());
      if (newFieldName != null) {
        NameAndTypeInfo nati = ri.getNameAndTypeInfo();
       
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, newFieldName);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());         
        }
      }
    } else if(cpi.getType() == ConstantPoolInfo.METHOD_REF || cpi.getType() == ConstantPoolInfo.INTERFACE_METHOD_REF) {
      RefInfo ri = (RefInfo)cpi;
      String className = ri.getClassName();
      String newMethodName = this.advisor.newMethodNameFor(className, ri.getTargetName(), ri.getDescriptor());
      if (newMethodName != null) {
        NameAndTypeInfo nati = ri.getNameAndTypeInfo();
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, newMethodName);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());         
        }
      }
    }
View Full Code Here

TOP

Related Classes of net.sf.rej.gui.action.ModifyClassInfoAction

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.