Ticket #1243 (new enhancement)

Opened 13 months ago

Last modified 8 months ago

Enable developers to click on UI to find the addComponent call/line in source code

Reported by: Sami Ekblad Owned by: Jani Laakso
Priority: major Milestone: IT Mill Sponsored Backlog
Component: undefined Version:
Keywords: debug source code find addcomponent Cc:
Known Issue description:
Hours estimate: 14 Deadline (dd.mm.yyyy):
Known Issue version (since): Known Issue title:
Hours done: Depends to:
Affects documentation: no
Known Issue workaround:
Affects release notes: yes Contract:

Description

To debug applications that have complex UI it is currently hard to find the Java source code that constructs it.

To help developers find the relevant source code line a generic debug feature into addComponent is suggested:

  • Application debug mode
  • Find out the code calling the addComponent function in a ComponentContainer?
  • Add a button (or similar) to component/windget UI that developer can select it
  • When selected, output the formatted src line into stdout, so that Eclipse creates an active link out of it
  • Developers can then click the button and and the line in console output to find the code that added the component

Change History

Changed 13 months ago by Marc Englund

I recall having a working prototype of this at some point... Some thoughts: - stack trace needed - both component instantiation and addComponent() stack traces would be nice

Changed 10 months ago by Jani Laakso

This is quite straightforward to implement, code like below could be called for each instantiation code for every component:

StackTraceElement[] st = new Throwable().fillInStackTrace()
                .getStackTrace();
        try {
            String key = "";
            // Class fromCallerClass = Class.forName(st[4].getClassName());
            // String fromMethodName = st[4].getMethodName();
            // Class callerClass = Class.forName(st[3].getClassName());
            String methodName = st[3].getMethodName();
            int line = st[3].getLineNumber();

            String clazz = st[3].getClassName() + ".java";
            // String clazz = st[3].getClassName().substring(
            // st[3].getClassName().lastIndexOf('.') + 1)
            // + ".java";
            key = "(" + clazz + ":" + line + ")" + " " + methodName;
            Integer value = (Integer) classMethodCallCounter.get(key);
            if (value == null)
                value = new Integer(1);
            else
                value = new Integer(value.intValue() + 1);
            classMethodCallCounter.put(key, value);
            return value.intValue() + ": " + key;
        } catch (Exception e) {
            return "unknown class.method";
        }

Changed 10 months ago by Jani Laakso

  • hours_left changed from 30 to 14

Changed 10 months ago by Jani Laakso

Eclipse automatically creates links to source code when using specific format to standard streams (err/out);

Changed 8 months ago by Joonas Lehtinen

  • milestone set to IT Mill Sponsored Backlog
Note: See TracTickets for help on using tickets.