Results 1 to 5 of 5
  1. #1
    asterix5 is offline Member
    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Default Feature Location

    Hello everyone.
    Can somebody provide me a good way of implementing feature location in programs.

    Let's say that I am developing a simple Java GUI application. I want to find the corresponding code when I point out with the mouse to one of the objects in the GUI, ex there is a Save button, and I want to get the code where the button does something.

    I would appreciate if somebody knows any implementation of a tool that does this. Thank you for your consideration.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default Re: Feature Location

    ex there is a Save button, and I want to get the code where the button does something.
    There is, in general, no way of knowing.

    Java Code:
    // in some class
    JButton saveBut = new JButton("Save");
    public JButton getBut() {return saveBut;}
    
    // in some other class *not even written yet*
    someClass.getBut().addActionListener(foo);
    What the save button actually does will depend on the details of foo's actionPerformed() method. As mentioned this other class may not have been written yet, or its source may not be available. In addition there may be many such event handlers so that "the code where the button does something" is not straight forward.

    Some IDEs offer a feature like this, but they do it by constraining the code to fit a predetermined - "do not edit below this line" - pattern.

  3. #3
    asterix5 is offline Member
    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Default Re: Feature Location

    Probably the example with the button was not a good one.
    Let's say that there is a label that displays some text and by pointing to the label I want to find the code that writes a text to that label.

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default Re: Feature Location

    It's the same deal: the label exposes a setText() method, and that method can be called from anywhere that has a reference to the label.

  5. #5
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Feature Location

    Using an IDE you can click on the variable name and everywhere in your code that variable will be highlighted. Is this what you want? It might not be a standard feature, it may be something you have to "turn on".

Similar Threads

  1. Java Feature Location
    By asterix5 in forum Advanced Java
    Replies: 1
    Last Post: 10-30-2011, 03:50 AM
  2. need to copy file from one location to another location
    By naveen.dpt2007 in forum New To Java
    Replies: 4
    Last Post: 02-28-2010, 04:53 PM
  3. location provider returns no location
    By sandeeprao.techno in forum CLDC and MIDP
    Replies: 0
    Last Post: 09-24-2009, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •