RE: Eclipse Debugger Plugin: Determination of Values of Variables?

      Hello,

      I want to write an little Debugger Plugin for the Abap in Eclipse.

      The Debugger Plugin should determine some Variables, match the values, and show the results.

      My Problem is: How can i get the value of an Variable. (e.g. ZCL_CLASS=>GV_MESSAGE )

      I tried something but i didn’t find a solution.

      For Example:
      In the ADT i found the Package: com.sap.adt.debugger.variables

      In this Package are Interfaces like: “IAbapVariable“.

      But i didn’t find a documentation about this package and this interfaces.

      My Question: How can i get Instances to these Interfaces??

      In the Internet i found a Solution to get the Values of the Variables which are current shown in the VariablesView of the Debugger.

      This is the Coding:

      VariablesView variablesView = (VariablesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow()

                      .getActivePage().findView(IDebugUIConstants.ID_VARIABLE_VIEW );

             

              IVariable[] variables = null;

              Object input;

              if (variablesView != null) {

                  input = (variablesView.getViewer()).getInput();

                  if (input instanceof IStackFrame) {

                      try {

                          variables = ((IStackFrame) input).getVariables();

                          for (IVariable iVariable : variables) {

                             

                              IValue value = iVariable.getValue();

                              System.out.println(iVariable.getName() + “—–” + value.getValueString());

      }

                      catch (DebugException e) {

                          e.printStackTrace();

                      }

                  }

      My Problem: My Variables which i need are not always shown in the Variables View. (e.g. Static Class Attributes)

      When i use this way, someone have to enter the Variables in the Variables View before he can use my debugger plugin. Thats not really nice. .

      I didn’t find a way, to add some Variables in the VariablesView via coding of my Plugin?

      I hope someone can give me some hints.

      Thank you very much.

      Regards

      Stefan

      Hello,   I found the solution to determine the Values/References to IAbapVariable.   My code above determines already the StackFrame. stefan_volkmer wrote:   This is the Coding:   VariablesView variablesView = (VariablesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().findView(IDebugUIConstants.ID_VARIABLE_VIEW );   IVariable[] variables = null; Object input; if (variablesView != null) { input = (variablesView.getViewer()).getInput(); if (input instanceof IStackFrame) {   try { variables = ((IStackFrame) input).getVariables();   This StackFrame can be cast to com.sap.adt.debugger.IAbapStackFrame With the coding: com.sap.adt.debugger.IAbapStackFrame frame = (com.sap.adt.debugger.IAbapStackFrame)input; com.sap.adt.debugger.variables.IAbapVariable ivariable = frame.findVariable("ZCL_CLASS=>GV_MESSAGE");   you can get the instance to an IAbapVariable....   ---------------------------------------------------------------------------------------------------------------   My Second Problem: "Add an Variable to…

      User Rating: Be the first one !
      Marc Gravell Reviewer Asked on November 2, 2016 in eclipse.
      Add Comment
      1 Answers

        Hello,

         

        I found the solution to determine the Values/References to IAbapVariable.

         

        My code above determines already the StackFrame.

        stefan_volkmer wrote:

         

        This is the Coding:

         

        VariablesView variablesView = (VariablesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow()

        .getActivePage().findView(IDebugUIConstants.ID_VARIABLE_VIEW );

         

        IVariable[] variables = null;

        Object input;

        if (variablesView != null) {

        input = (variablesView.getViewer()).getInput();

        if (input instanceof IStackFrame) {

         

        try {

        variables = ((IStackFrame) input).getVariables();

         

        This StackFrame can be cast to com.sap.adt.debugger.IAbapStackFrame With the coding: com.sap.adt.debugger.IAbapStackFrame frame = (com.sap.adt.debugger.IAbapStackFrame)input;

        com.sap.adt.debugger.variables.IAbapVariable ivariable = frame.findVariable(“ZCL_CLASS=>GV_MESSAGE”);

         

        you can get the instance to an IAbapVariable….

         

        —————————————————————————————————————

         

        My Second Problem: “Add an Variable to the Variables View via Plugin” seems not possible.

        The Class AbapDebugStackFrame has a method: “addCustomVariable”. But the class is in an Internal Package: “com.sap.adt.debugger.internal.model”.

        The Interface IAbapStackFrame (which is not in an internal package) doesn’t have this method…

         

        My prototyping continues. When i have enough, i will write a little how to.

         

        Regards

        Stefan

        Add Comment

        Your Answer

        By posting your answer, you agree to the privacy policy and terms of service.