Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Method Calls (eclipse)  (Read 1293 times)
0 Members and 1 Guest are viewing this topic.
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Posted 2011-08-23 19:27:28 »

I am in the process of converting some code, however due to the nature of the beast
I need to find out where the method is called from (cycle through all locations?)

Is there an easy way in Eclipse to find out wherever a particular method is called?(in other java/classes/files)(all in my 1 project though)  I am having trouble finding a search function for this


I was thinking it had to deal with Call Hierarchy or references or something but always come up short


"Experience is what you get when you did not get what you wanted"
Offline Cero
« Reply #1 - Posted 2011-08-23 19:32:24 »

well, if I understand correctly you want to know where a method call comes from.

When there are exception, this happens naturally -> Exception.printStackTrace();

so there are many ways to do this when there are no exceptions and you just want the StackTrace.

I guess the easiest way is to just use something like    new Exception("Something").printStackTrace();

Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #2 - Posted 2011-08-23 19:33:55 »

I meant I have something like

1  
2  
3  
4  
5  
....//Math.class
public double add(double X, double Y){
    return (x+y)
}
...



I want to find all locations that utilize this method
1  
2  
//MathGame.class
double Ans = add(5.2,2.6);

"Experience is what you get when you did not get what you wanted"
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Addictman

Senior Devvie


Medals: 3
Projects: 1


Java games rock!


« Reply #3 - Posted 2011-08-23 19:34:20 »

Right click on the method, and look for "References"
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #4 - Posted 2011-08-23 19:36:50 »

Addictman
That was it, It was that from the beginning, but I was overlooking something stupid :/ and it wasn't working before

All good now, thanks!

"Experience is what you get when you did not get what you wanted"
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #5 - Posted 2011-08-23 19:46:31 »

I guess the easiest way is to just use something like    new Exception("Something").printStackTrace();

Easier than Thread.currentThread().getStackTrace() ?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Cero
« Reply #6 - Posted 2011-08-23 20:22:12 »

I guess the easiest way is to just use something like    new Exception("Something").printStackTrace();

Easier than Thread.currentThread().getStackTrace() ?

well in most cases(questionable) you want to instantly print the stack trace
Thread.currentThread().getStackTrace() returns a stacktrace array, which you still have to print

just more lines of codes, not harder or anything.

obviously you could just create a method for it, to use every time you need a stack trace...

Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #7 - Posted 2011-08-23 20:24:45 »

Unforunantely I can't run it to call any functions/methods like Thread

I am converting some software from another language so it won't be compilable/runnable for a while :/

"Experience is what you get when you did not get what you wanted"
Offline BoBear2681

JGO Coder


Medals: 19



« Reply #8 - Posted 2011-08-24 03:32:01 »

Orangy perhaps was thinking of the shorter:

Thread.dumpStack()

?

Of course, Eclipse's finding references / opening call hierarchy are probably much slicker options.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (36 views)
2014-12-15 09:26:44

Mr.CodeIt (29 views)
2014-12-14 19:50:38

BurntPizza (61 views)
2014-12-09 22:41:13

BurntPizza (98 views)
2014-12-08 04:46:31

JscottyBieshaar (58 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (76 views)
2014-11-29 21:32:03

toopeicgaming1999 (137 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (37 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!