Package net.sf.rej.java

Examples of net.sf.rej.java.LocalVariable


                        genType.getBaseType().dropDimension();
                        renderGenericJavaType(sd, ia, genType);
                      }

                      sd.drawDefault(" ... ");
                      LocalVariable lv = null;
                      if (lvs != null) {
                        lv = lvs.getLocalVariable(paramLVDefOffset + i, 0);
                      }
                      if (lv != null) {
                        sd.drawDefault(lv.getName());
                      } else {
                        sd.drawDefault("p" + i);
                      }
                     
                    } else {
                      if (methodSig == null) {
                        if (item.isPrimitive()) {
                          sd.drawKeyword(item.getType());
                        } else {
                          sd.drawDefault(ia.getShortName(item.getType()));
                        }
                        sd.drawDefault(item.getDimensions());
                      } else {
                        renderGenericJavaType(sd, ia, genParams.get(i));
                      }
                      sd.drawDefault(" ");
                      LocalVariable lv = null;
                      if (lvs != null) {
                        lv = lvs.getLocalVariable(paramLVDefOffset + i, 0);
                      }
                      if (lv != null) {
                        sd.drawDefault(lv.getName());
                      } else {
                        sd.drawDefault("p" + i);
                      }
                    }
                }

                sd.drawDefault(")");
                List exc = m.getExceptions();
                for (int i = 0; i < exc.size(); i++) {
                    if (i == 0) {
                        sd.drawKeyword(" throws ");
                    } else {
                        sd.drawDefault(", ");
                    }
                    sd.drawDefault(ia.getShortName(((ExceptionDescriptor) exc.get(i)).getName()));
                }
                if (mdr.hasBody()) {
                  sd.drawDefault(" {");
                } else {
                  sd.drawDefault(";");
                }
            }
        } else if (er instanceof LocalVariableDefRow) {
            LocalVariableDefRow lvdr = (LocalVariableDefRow)er;
            LocalVariable lv = lvdr.getLocalVariable();
            JavaType ret = lv.getDescriptor().getReturn();
          sd.drawIndent();
          sd.drawIndent();

            if (ret.isPrimitive()) {
                sd.drawKeyword(ret.getType());
            } else {
                sd.drawDefault(ia.getShortName(ret.getType()));
            }
            sd.drawDefault(ret.getDimensions() + " " + lv.getName() + " (#" + lv.getIndex() + " " + lv.getStartPc() + " - " + lv.getEndPc() + ")");
        } else if (er instanceof LabelRow) {
            LabelRow lr = (LabelRow)er;
          sd.drawIndent();
          sd.drawIndent();
            sd.drawDefault(lr.getLabel().getId() + ":");
        } else if (er instanceof CodeRow) {
            CodeRow cr = (CodeRow)er;
           
            // execution row
            if (cr.isExecutionRow()) {
              sd.setExecutionBackground();
            }
            // breakpoint
            if (cr.getBreakpoint() != null) {
              sd.drawBreakpoint();
            }
           
            // line identifier
            LineIdentifierMode mode = EditorFacade.getInstance().getLineIdentifierMode();
            switch (mode.getMode()) {
                case LineIdentifierMode.MODE_OFF:
                    break;
                case LineIdentifierMode.MODE_PC:
                    sd.drawSmall(String.valueOf(cr.getPosition()), 15);
                    break;
                case LineIdentifierMode.MODE_SOURCELINE:
                    if (cr.hasLineNumber()) {
                        sd.drawSmall(String.valueOf(cr.getLineNumber()), 0);
                    }
                    break;
            }

            sd.setOffset(0);

            Instruction inst = cr.getInstruction();
            DecompilationContext dc = cr.getDecompilationContext();
            LocalVariableTableAttribute lvs = dc.getLocalVariableTable();
            ConstantPool pool = dc.getConstantPool();
          sd.drawIndent();
          sd.drawIndent();
            sd.drawInstruction(inst.getMnemonic());
            Parameters params = inst.getParameters();
            for (int i = 0; i < params.getCount(); i++) {
                try {
                    switch (params.getType(i)) {
                        case TYPE_LOCAL_VARIABLE:
                        case TYPE_LOCAL_VARIABLE_WIDE:
                        case TYPE_LOCAL_VARIABLE_READONLY:
                            if (lvs == null) {
                                sd.drawDefault(" " + params.getInt(i));
                            } else {
                                LocalVariable lv = lvs.getLocalVariable(params.getInt(i), cr.getPosition());
                                if (lv == null) {
                                    sd.drawDefault(" " + params.getInt(i));
                                } else {
                                    sd.drawDefault(" " + lv.getName());
                                }
                            }
                            break;
                        case TYPE_CONSTANT_POOL_METHOD_REF: {
                          int index = params.getInt(i);
View Full Code Here


          }
          if (lvs != null) {
            List locals = lvs
                .getLocalVariable(dc.getPosition());
            for (int k = 0; k < locals.size(); k++) {
              LocalVariable lv = (LocalVariable) locals
                  .get(k);
              LocalVariableDefRow lvdr = new LocalVariableDefRow(
                  lv, mdr);
              list.add(lvdr);
              mdr.addLocalVariable(lvdr);
View Full Code Here

        }
        if (lvs != null) {
          List locals = lvs
              .getLocalVariable(dc.getPosition());
          for (int k = 0; k < locals.size(); k++) {
            LocalVariable lv = (LocalVariable) locals
                .get(k);
            LocalVariableDefRow lvdr = new LocalVariableDefRow(
                lv, mdr);
            list.add(lvdr);
            mdr.addLocalVariable(lvdr);
View Full Code Here

      if (selected == null) {
        return null;
      } else if (selected instanceof String) {
        return Integer.valueOf((String)selected);
      } else {
        LocalVariable lv = (LocalVariable) selected;
        return Integer.valueOf(lv.getIndex());
      }
    }
View Full Code Here

    public void setPayload(byte[] data) {
        ByteParser parser = new ByteArrayByteParser(data);
        parser.setBigEndian(true);
        int length = parser.getShortAsInt();
        for (int i = 0; i < length; i++) {
            LocalVariable lv = new LocalVariable(parser, pool);
            this.localVariables.add(lv);
        }
    }
View Full Code Here

            switch (params.getType(i)) {
            case TYPE_LOCAL_VARIABLE_WIDE:
            case TYPE_LOCAL_VARIABLE: {
                LocalVariableChooser chooser = new LocalVariableChooser();
                this.choosers.add(chooser);
                 LocalVariable lv = null;
                if (lvTable != null) {
                  chooser.setLocalVariable(this.lvTable);
                   lv = lvTable.getLocalVariable(params.getInt(i), this.position);
                 }
                 if (lv != null) {
                   chooser.setSelected(lv);
                 } else {
                   chooser.setSelected(String.valueOf(params.getInt(i)));
                 }
                chooser.setEditable(true);
                addToPanel(this.paramPanel, chooser, i);
                break;
            }
            case TYPE_LOCAL_VARIABLE_READONLY: {
                LocalVariableChooser chooser = new LocalVariableChooser();
                this.choosers.add(chooser);
                if (this.lvTable != null) {
                    chooser.setLocalVariable(this.lvTable);
                    LocalVariable lv = this.lvTable.getLocalVariable(params.getInt(i), this.position);
                     if (lv != null) {
                       chooser.setSelected(lv);
                     } else {
                       chooser.setSelected(String.valueOf(params.getInt(i)));
                     }
View Full Code Here

            }
            if (lvs != null) {
              List locals = lvs
                  .getLocalVariable(dc.getPosition());
              for (int k = 0; k < locals.size(); k++) {
                LocalVariable lv = (LocalVariable) locals
                    .get(k);
                LocalVariableDefRow lvdr = new LocalVariableDefRow(
                    lv, mdr);
                this.rows.add(lvdr);
                mdr.addLocalVariable(lvdr);
View Full Code Here

                break;
            }
            case TYPE_LOCAL_VARIABLE:
            case TYPE_LOCAL_VARIABLE_READONLY:
            case TYPE_LOCAL_VARIABLE_WIDE: {
                LocalVariable lv = null;
                if (dc.getLocalVariableTable() != null)
                    lv = dc.getLocalVariableTable().getLocalVariable(getInt(i),
                            dc.getPosition());
                if (lv == null) {
                    sb.append(getInt(i));
                } else {
                    sb.append(lv.getName());
                }
                break;
            }
            case TYPE_CONSTANT_WIDE:
            case TYPE_CONSTANT_READONLY:
View Full Code Here

TOP

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

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.