[ jEdit-users ] open files linked from the current file

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[ jEdit-users ] open files linked from the current file

Jarekczek
Administrator
I wonder if we have something like that in jedit or should it be a
feature request.

In c files there are #include directives. In patch files there are also
relative paths given. I would like to place the cursor inside the
filename and have a command to open it. The functionality should be
smart enough to search several directories for the file. The current
directory, directories specified in options.

Thanks
Jarek

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Users' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-users
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-users ] open files linked from the current file

Matthieu Casanova
Administrator
Hi,
we don't have this feature, but we have the api to do that.
The Hyperlinks plugin is made for that.

To do that you need an HyperlinkSource that will create Hyperlinks objects.
The HyperlinkSource is associated with an edit mode. And when you press control and move your mouse,
it is called with various information about the position of the cursor (buffer and offset)
From that you can compute an hyperlink or not (using regex, or use an AST if you have one) and return it.
The Hyperlink is an interface, and when you click on the link, the click() method is called.
Here you can do what you want, open a file, move the caret somewhere else, open a browser outside of jEdit.

The default hyperlink source parse the text looking for url and other plugins use the api:
XML plugin, RFC plugin (RFC plugin looks for RFC xxxx to open them, and allow click in content table too.

Matthieu

2012/8/27 Jarek Czekalski <[hidden email]>
I wonder if we have something like that in jedit or should it be a
feature request.

In c files there are #include directives. In patch files there are also
relative paths given. I would like to place the cursor inside the
filename and have a command to open it. The functionality should be
smart enough to search several directories for the file. The current
directory, directories specified in options.

Thanks
Jarek

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Users' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Users' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-users
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-users ] open files linked from the current file

Matthieu Casanova
Administrator
Hi,
in fact I just did it in Hyperlinks trunk.
It supports link for

#include "somefile.h"

but doesn't support links like

#include <linux/proc_fs.h>

because it would require some settings maybe in ProjectViewer

Matthieu

2012/8/27 Matthieu Casanova <[hidden email]>
Hi,
we don't have this feature, but we have the api to do that.
The Hyperlinks plugin is made for that.

To do that you need an HyperlinkSource that will create Hyperlinks objects.
The HyperlinkSource is associated with an edit mode. And when you press control and move your mouse,
it is called with various information about the position of the cursor (buffer and offset)
From that you can compute an hyperlink or not (using regex, or use an AST if you have one) and return it.
The Hyperlink is an interface, and when you click on the link, the click() method is called.
Here you can do what you want, open a file, move the caret somewhere else, open a browser outside of jEdit.

The default hyperlink source parse the text looking for url and other plugins use the api:
XML plugin, RFC plugin (RFC plugin looks for RFC xxxx to open them, and allow click in content table too.

Matthieu


2012/8/27 Jarek Czekalski <[hidden email]>
I wonder if we have something like that in jedit or should it be a
feature request.

In c files there are #include directives. In patch files there are also
relative paths given. I would like to place the cursor inside the
filename and have a command to open it. The functionality should be
smart enough to search several directories for the file. The current
directory, directories specified in options.

Thanks
Jarek

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Users' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-users



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Users' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-users
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-users ] open files linked from the current file

Jarekczek
Administrator
In reply to this post by Jarekczek
W dniu 08/29/2012 01:31 PM, daliborp pisze:
>
> Well, such macro would be useful in general and if you write it maybe
> you would share it?
>

It turned out to be possible to improve current Open_Selection.bsh macro
without the need to provide a configuration pane. A small improvement is
done and the macro is available in jedit repository:
http://jedit.svn.sourceforge.net/viewvc/jedit/jEdit/trunk/macros/Files/Open_Selection.bsh?view=log
The improved macro will be included in jEdit 5.1 (not soon).

Updated docs:
Opens the file named by the current buffer's selected text. Current VFS
browser directory is also tried as a parent of the filename, but only as
a local path.

The macro would be better if user could just place the caret inside the
filename, without being forced to highlight it. Maybe it will be a
subject of next improvement.

Thanks for encouragment, Daliborp :)

Jarek

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Users' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-users