Use an external editor for some file types with Netbeans - netbeans

So with eclipse I would instruct it to open html/css/js files in textmate, and pretty much just use if for the php side of things.
Would like to do a similar thing with nb if possible.
Any thoughts?
Best,
Bob

There exists a Path Tools plugin for Netbeans. It has a command "Edit path...". With this you can select a file in the tree, click "Edit path..." and the file will be opened in an external editor.
You can customize the external program which is called under "Tools" -> "Options" -> "Miscellaneous" -> "Path Tools" -> "Edit Commands For File" .
You can't assign it to specific file types, but at least you can open files without leaving Netbeans.
The webpage of the Path Tools plugin looks not very active, but it works in Netbeans 6.9.1 without problems (Works on My Machine).
It also has other useful actions:
Copy Paths Action Copy the full paths of the files/folder of selected node to the clipboard.
Explore Action Launch the OS File Explorer
Shell On Path Action Launch the OS shell
Edit Action Launch the editor
This plugin should be integrated to Netbeans.

Thank you for the help on this.
Here is a way for the Path Tools 'Edit' toolbar button to pop up the Windows 'Open With...' dialog box for the selected file.
In Options, Path Tools... 'Edit Commands' 'For File' - change the command to this:
rundll32.exe C:\WINDOWS\system32\shell32.dll,OpenAs_RunDLL {path}
(Edit: I forgot to say this is for XP - idea is the same for newer Windows)

If you don't want to deal with manipulating plugins and configs, you can do it this way (valid for version 8.2):
Go to Tools > Options > Kepmap
search for "path"
It defaults to Alt + Shift + L
use that command in any editor window to get the path for the file, then simply open that path in whichever editor.
I agree it's not as smooth and savvy as having a readily-available "open in external editor" command, but it's almost there.

Related

How to open BAT (windows batch) file in Eclipse?

How to open BAT (windows batch) file in Eclipse? When I am doing Open File... the file runs, not opens. How to open it in editor?
Dragging file on Eclipse also runs it.
The ShellEd plugin doesn't seem to be for Windows BAT files--only Linux/Unix shell languages.
Going to Preferences->General->Editors->File Associations is how to have Eclipse open BAT files in a text editor, though.
try with this plugin:
http://sourceforge.net/apps/trac/shelled/
And also I think you chould go to preferences->general -> editors->file associoations and add bat to the list
Theres is a new open source plugin called Batch-Editor available on eclipse market place. It has syntax color support for dark and white theme included and has an outline view + quick outline for labels.
Here an example screenshot:
.
It supports also echo and escaping:
PS: I am the author of the mentioned plugin.

How to go to specific folder in Eclipse?

From Eclipse, how to go to the specific folder? I mean in windows, how to open a command line which corresponding to the folder or direct open the file explorer to open the corresponding folder?
You have to create an external tool with location ${env_var:SystemRoot}\explorer.exe (or cmd.exe) and arguments /select,${resource_loc} . Any selected file or directory can now be shown in the windows explorer.
Create an External tool
Go into the external tool configuration (you can find it into the corresponding toolbar icon) :
Then you can create your own external tool :
Create a new Program (select Program in the tree)
Name it shell
Set the location to ${env_var:SystemRoot}\explorer.exe
Set the arguments to /select,${resource_loc}
Run the external tool
Once created you can run the external tool from the context menu or from the toolbar ...
I have been using an Eclipse plugin called PathTools for sometime now, and am happy with it.
It adds a number of buttons to the Eclipse toolbar which allow you to :
Directly open a cmd prompt at the selected folder.
Open an Explorer window for the selected folder.
Update site : http://pathtools.googlecode.com/svn/trunk/PathToolsUpdateSite/site.xml
Sample screenshots
Installing the `Path Tools Feature`
I chose to install only the Path Tools Feature
Opening a terminal
Opening a terminal directly at the Folder Path :
(The above snapshot is that for OSX but works in Windows as well)
Opening Explorer
Opening a folder directly in Explorer/Finder :
Great simple plugin for this:
http://basti1302.github.com/startexplorer/
2019 update (no plugins required):
Right click the desired folder in the Project Explorer, go to Show In, choose either Terminal or System Explorer. See below screenshot:
Right click the file (in left pane).. then use Win Goodies -> Open file in Explorer

Copy path/file name in Eclipse to clipboard

Is there a shortcut to copy the current path/file to the clipboard?
Just select the file tab and hit Ctrl+C to copy file basename into clipboard.
Hit Alt+Enter to bring up the file properties with absolute path and copy it manually.
Additionally you can use an Eclipse macro plugin that can do the steps in one go:
http://sourceforge.net/projects/practicalmacro/files/
There is Copy Qualified Name function in Eclipse, it will copy the full name of the element you select (or element on cursor).
For example :
/MyProject/src/app/Application.java : when you select Application.java in Package Explorer
java.util.HashSet<String> : when you copy while cursor at HashSet<String>
However, it required you to select the element you want.
So, here is what I do.
Make your Package Explorer link with editor, you can active this by click the double-arrow icon at top-right corner.
Set up a hot-key for Show View (Package Explorer) ex : Alt + 1
Set up a hot-key for Copy Qualified Name ex : Alt + Ctrl + Shift + c
Whenever I need these information in current file, I just press the hot-key to call my Package Explorer Since it links with editor and will always select the file in current editor, you can just copy with the hot-key. Then you can use F12 back to your editor, or simply ESC if you use fast view.
Not perfect, but it works :D
There is yet another plugin that supports copying the path along with a number of other related functions:
http://code.google.com/p/pathtools/
Just search Eclipse Marketplace within Eclipse for 'pathtools'.
You can do it with a single keystroke by configuring an Eclipse external tool (a much underused tool in my opinion). Takes about a minute to configure the first time you use it but then it's always available. Here's a YouTube video demonstrating the technique.
An alternative to the answer of Rangi Lin, which provides some additional functionality: The StartExplorer plugin for Eclipse. The solution mentioned by Rangi Lin doesn't work in all cases. It doesn't work in my case e.g. in the Team Synchronizing perspective in the Synchronize view. However, the StartExplorer's context menu command "Copy Resource Path To Clipboard", as well as the default keyboard shortcut for it (Ctrl+Alt+C) works also there.
The advantage of this plugin is that it additionally allows you to open the file manager at the location of the selected file etc.
Another option is EasyShell. It has a single entry in the context menu, under which you'll find copying of the path, opening explorer, a dos box and others (configurable).
Alt+Enter - open properties
Alt+L - go to path location
Shift+End - select path
Ctrl+C - copy
Go to Project Explorer View in Eclipse which is at the left panel.
Click on link with editor.
After linking, your opened file will get selected.
Right-click on the selected file. You will get the option 'Copy Qualified Name' which is just below 'Copy' option.
Open the directory where your project resides. e.g. if your project is 'abc' and it's in the directory 'project', go to the 'project' directory.
In the folders address bar, the address will be like this: D:\project.
Paste in front of this address like: D:\project/abc/source/com/connect.java
Delete the java file name(connect.java) and press enter.
You will be in folder 'com'.
The video demonstrating the technique was prepared for Eclipse in Windows. In Linux you have to change:
External Tools Configurations - Location: /home/username/path/to/script.sh
External Tools Configurations - Arguments: ${selected_resource_loc}
External Tools Configurations - Standard Input and Output - CHECK "Allocate console (necessary for input)"
Create a script /home/username/path/to/script.sh as follows
echo $1
echo $1 > /home/username/clipboard_tmp.txt
xclip -in -selection clipboard /home/username/clipboard_tmp.txt
xclip -selection clipboard -o
I don't know why, but following command echo $1 | xsel --clipboard doesn't work in the script.
It was checked in Ubuntu 12.04 LTS and Eclipse IDE for C/C++ Developers (Version: Kepler Service Release 2, Build id: 20140224-0627)
In Eclipse Version: 2020-03 (4.15.0)
In Project Explorer
Select your file> right Click> Copy Qualified Name

Open directory containing a source file via Eclipse

In Visual Studio, or MyEclipse, you have a button which is able to locate a source file on disk, and open the containing directory in Windows explorer.
This is useful, for example, to browse images, or to use an other tool when a conflict occurs in CVS or SVN.
What would be the way to do it in Eclipse with a free plugin, or without any plugin ?
I found it :
"In eclipse, it is common requirement to open the folder containing source file but there is no direct method to do that like in Visual studio of Microsoft."
http://shivasoft.in/blog/others/tips/locate-source-file-on-local-disc-in-eclipse-external-tool/
An actual plugin can be found at http://blog.samsonis.me/2009/02/open-explorer-plugin-for-eclipse/
And version 1.5 can be found here http://blog.samsonis.me/2011/08/openexplorer-eclipse-plugin-1-5-0/
One that I've since upgraded to & find more useful
http://basti1302.github.io/startexplorer/
I always do this:
right click on file/folder, show in..., system explorer. Done.
I guess we don't need a plugin to do that, or I am misunderstanding the question?? I am using Luna 4.4.2 on Windows 7.
On Mac you can follow this steps to add it without a plug-in:
Click the disclosure icon to the right of the External Tools icon:
Select External Tools Configuration:
The External Tools Configuration window will appear. Select Programs and then click New Launch Configuration:
This will create a new launch configuration. Enter a name of the configuration in the name field:
In the Location field enter the path to the Open Finder, "/usr/bin/open" without quotes:
In the Arguments field enter the following argument, "${container_loc}" with quotes:
Click Apply. It should look like the following:
Switch to the build tab and deselect Build before launch:
Switch to the Common tab and select the External Tools checkbox in Favorites. Click Apply again and close out of the window.
You are done. Now to use:
Select a file or folder in Eclipse Package Explorer.
Click the disclosure icon to the right of the External Tools icon:
Select the Open Containing Folder from the drop down menu:
You're file or folder should open in Finder.
PRO TIP: After you use the external tool once you can click the External Tools icon again and it will run the last used external tool. In other words, you won't need to select it from the pop up menu each time.
You can also look up the source directory by right clicking on the project, going to properties, and looking at "Location: ... "

Is it possible to add external command line tools to Netbeans?

Is it possible to use external command line tools in Netbeans?
Thank you.
After searching and searching and searching, this feature is just missing in netbeans although it would absolutely straightforward to implement and has been ask by user for 2 more than years...
Regards,
Stéphane
There is a Terminal window in NetBeans 7:
Open the menu, Window -> Output -> Terminal
What about using an Ant target? Ant files are quite comfortable to run from Netbeans.
<exec executable="${executable-full-path}" ...
The best option I've found is to use jmarsault's plugin that he calls NetBeans Command Shortcuts. This give you an icon in the command line where you can add command and terminal scripts to run. The display shows in the output window.
Installation files are available here and he has kept it up to date with the newest versions of NetBeans.
NetBeans Command Shortcut plugin
Installation:
Download the .nbm file for your version of NetBeans
Open Tools / Plugins / Downloaded / Add Plugins...
Select the .nbm file and allow the installation of the plugin.
In since at least version 9.0, there are two decent options:
Just create a script file. (I think you need the C++ plugin for this. Otherwise you have to create it outside NetBeans or as a text file.) In my case I created a JLinkGDBServer.sh that just executes JLinkGDBServer as a prerequisite to start an embedded debug session. This automatically sends the executable's output to a NetBeans terminal.
Add a tool to Tools/Options/Miscellaneous/SendTo. SendTo is a pop-up menu item for certain project entities, for example files but not the project. In my case, I could add a SendTo running the executable and use it by right-clicking on for example the .elf file (although for the GDB server I don't need any file name as an argument).