Package net.sf.rej.gui.editor.row

Examples of net.sf.rej.gui.editor.row.CodeRow


      return;
    }

    Object row = this.list.getSelectedValue();
    if (row instanceof CodeRow) {
      CodeRow cr = (CodeRow) row;
      DecompilationContext dc = cr.getDecompilationContext();
      int pos = cr.getPosition();
      if (!before) {
        dc.setPosition(pos);
        pos += cr.getInstruction().getSize(dc);
      }
      insertInstruction(cr.getEnclosingMethodDef(), pos, dc.getLocalVariableTable(), cr.getEnclosingMethodDef().getMethod().getAttributes().getCode().getCode());
    }

  }
View Full Code Here


    // then, add all the instructions that aren't in the methods that were
    // removed(because there is no point in creating a remove for the
    // instruction since it's going to be removed anyway
    for (Object o : this.list.getSelectedValues()) {
      if (o instanceof CodeRow) {
        CodeRow cr = (CodeRow) o;
        if (!removeList.contains(cr.getEnclosingMethodDef())) {
          removeList.add(cr);
        }
      }
    }
View Full Code Here

  }

  void modifyRow() {
    Object o = this.list.getSelectedValue();
    if (o instanceof CodeRow) {
      CodeRow cr = (CodeRow) o;
      modifyInstruction(cr.getPosition(), cr.getInstruction(), cr.getDecompilationContext().getLocalVariableTable());
      this.list.repaint();
    } else if (o instanceof MethodDefRow) {
      MethodDefRow mdr = (MethodDefRow) o;
      Method method = mdr.getMethod();
      CodeAttribute code = method.getAttributes().getCode();
View Full Code Here

  public void remove(List list) {
    GroupAction ga = new GroupAction();
    for (int i = list.size() - 1; i >= 0; i--) {
      Object obj = list.get(i);
      if (obj instanceof CodeRow) {
        CodeRow cr = (CodeRow) obj;
        RemoveInstructionAction ria = new RemoveInstructionAction(cr
            .getParentCode(), cr.getInstruction());
        ga.add(ria);
      } else if (obj instanceof MethodDefRow) {
        MethodDefRow mdr = (MethodDefRow) obj;
        RemoveMethodAction rma = new RemoveMethodAction(mdr
            .getClassFile(), mdr.getMethod());
View Full Code Here

      }
    }

  public Color getBackgroundColor(EditorRow er) {
    if (er instanceof CodeRow) {
      CodeRow cr = (CodeRow) er;
      if (cr.isExecutionRow()) {
        return new Color(255, 190, 190);
      }
    } else if (er instanceof MethodDefRow) {
      MethodDefRow mdr = (MethodDefRow) er;
      if (mdr.isExecutionRow()) {
View Full Code Here

            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());
                                }
View Full Code Here

TOP

Related Classes of net.sf.rej.gui.editor.row.CodeRow

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.