jEdit Community - Resources for users of the jEdit Text Editor
How to open a open a class's source file from a variable of the class's type?
Submitted by blowfish on Tuesday, 19 October, 2004 - 00:13
Hi

When I use other editors like IDEA from IntelliJ, there is a facility by which, if I select a variable name or a Class name in an open buffer, I can choose an option to directly open the source code of the Class file, so long as it is in the project. I can also go to the declaration of the variable.

Is there a similar facility in jEdit? I have been searching if this facility is available, but I have not been able to locate it. Please let me know if you are aware as to how this can be done? Or is it a new feature altogether?

Rgds.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Open Java File from Class Name
by Anonymous on Tue, 19/10/2004 - 15:29
Here's one Macro which can help you Open Java source file from class name. I also did a key binding to this macro for ease of use.

Here's the link http://community.jedit.org/?q=filestore/download/1322

==Macro Doc===
Highlight a class name within java source code and it will automatically open the selected class source file.
Very useful when browsing source code.

Source code for the highlighted class will be opened if:

The cursor is on a class name in any part of the file AND
there is a import for the class OR
there is a wildcard import contaning the class OR
the class is in the current package (current directory) OR
the class is in the java.lang source directory (searchPath must be set)
the class is in a different project than current project (searchPath must be set)
The cursor is on a line with an import statement
A fully qualified class is highlighted (not necessarily an import statment)

Limitations:
It cannot open a file if the package cannot be appended to any part of the
current file's directory structure.
It only works with java files, other languages are not supported.
Will only find (scroll to) inner clsses if it is in an import.

-yogesh
 
Open Java File from Class Name
by Anonymous on Tue, 19/10/2004 - 23:27
Thanks for the help Yogesh. Is it possible to improve the macro to navigate to methods in other src, as well as to open the src of a variable? Can I also try to modify the macro though I don't much about bsh?

Rgds
 
It is possible to modify the
by Anonymous on Fri, 29/10/2004 - 05:01
It is possible to modify the macro to navigate methods in other sources, as long as you can somehow examine/find these other sources. That is why limitations exist in the macro, as this is not easy to do for say "MySourceFileInSomeObscureDirectory.java"...to do this the macro might have to, for instance, search thru files and directories to find the definition of the type...this might make the macro too slow.

Perhaps other plugins might be helpful like ProjectViewer or JBrowse. Or if you want to just find a keyword or something try a HyperSearch...

Lastly, macros in jedit are typically written in BeanShell. Which is a small scripting language written in (and designed to use) Java. It is very easy to use, and if you know java...should be easy to pick up.

Hope this was helpful,

-dg
User login
Browse archives
« November 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300