Package net.sf.rej.gui.editor

Examples of net.sf.rej.gui.editor.MethodChooser


                LocalVariableChooser chooser = (LocalVariableChooser) choosers.get(i);
                group.add(new ParamModifyAction(instruction, i, chooser.getValue()));
                break;
            }
            case TYPE_CONSTANT_POOL_METHOD_REF: {
                MethodChooser chooser = (MethodChooser) choosers.get(i);
                Object obj = chooser.getValue();
                if(obj instanceof Integer) {
                    group.add(new ParamModifyAction(instruction, i, chooser.getValue()));
                } else {
                    MethodLocator ml = (MethodLocator)obj;
                    String className = ml.getClassLocator().getFullName();
                    String methodName = ml.getMethod().getName();
                    String typeName = ml.getMethod().getDescriptor().getRawDesc();
                    int index = this.cf.getPool().indexOfMethodRef(className, methodName, typeName);
                    // TODO: verify that this makes sense.
                    // The logic could be in the action?
                    if (index != -1) {
                        group.add(new ParamModifyAction(instruction, i, Integer.valueOf(index)));
                    } else {
                        group.add(new AddMethodRefAction(className, methodName, typeName, instruction, i, this.cf.getPool()));
                    }
                }
                break;
            }
            case TYPE_CONSTANT_POOL_FIELD_REF: {
                FieldChooser chooser = (FieldChooser) choosers.get(i);
                Object obj = chooser.getValue();
                if(obj instanceof Integer) {
                    group.add(new ParamModifyAction(instruction, i, chooser.getValue()));
                } else {
                    FieldLocator fl = (FieldLocator)obj;
                    String className = fl.getClassLocator().getFullName();
                    String fieldName = fl.getField().getName();
                    String typeName = fl.getField().getDescriptor().getRawDesc();
                    int index = this.cf.getPool().indexOfFieldRef(className, fieldName, typeName);
                    // TODO: verify that this makes sense.
                    // The logic could be in the action?
                    if (index != -1) {
                        group.add(new ParamModifyAction(instruction, i, Integer.valueOf(index)));
                    } else {
                        group.add(new AddFieldRefAction(className, fieldName, typeName, instruction, i, this.cf.getPool()));
                    }
                }
                break;
            }
            case TYPE_CONSTANT_POOL_CLASS: {
                ClassChooser chooser = (ClassChooser) choosers.get(i);
                Object obj = chooser.getValue();
                if (obj instanceof Integer) {
                    //params.setValue(i, obj);
                    group.add(new ParamModifyAction(instruction, i, obj));
                } else {
                    String className = (String)obj;
                    int index = this.cf.getPool().indexOfClassRef(className);
                    if(index != -1) {
                        group.add(new ParamModifyAction(instruction, i, Integer.valueOf(index)));
                    } else {
                        group.add(new AddClassRefAction(className, instruction, i, this.cf.getPool()));
                    }
                }
                break;
            }
            case TYPE_CONSTANT: {
                ConstantChooser chooser = (ConstantChooser) choosers.get(i);
                Integer value = (Integer)chooser.getValue();
                if(value.intValue() < -128 || value.intValue() > 127) {
                    throw new RuntimeException("Constant value out of range.");
                }
                group.add(new ParamModifyAction(instruction, i, chooser.getValue()));
                break;
            }
            case TYPE_CONSTANT_WIDE: {
                ConstantChooser chooser = (ConstantChooser) choosers.get(i);
                /* @TODO range check? */
                group.add(new ParamModifyAction(instruction, i, chooser.getValue()));
                break;
            }
            case TYPE_ARRAYTYPE: {
                ArrayTypeChooser chooser = (ArrayTypeChooser) choosers.get(i);
                group.add(new ParamModifyAction(instruction, i, chooser.getValue()));
                break;
            }
            case TYPE_CONSTANT_POOL_CONSTANT: {
                ConstantpoolConstantChooser chooser = (ConstantpoolConstantChooser) choosers.get(i);
                group.add(new ParamModifyAction(instruction, i, chooser.getValue()));
                break;
            }
            case TYPE_LOCAL_VARIABLE_READONLY:
                // no action required
                break;
View Full Code Here

TOP

Related Classes of net.sf.rej.gui.editor.MethodChooser

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.