Formatting a complete project in NetBeans - netbeans

To format a file in the editor, you press Alt+Shift+F. Is there a way for formatting the complete project(s) in NetBeans (6.8, if that makes any difference)?

Select the folder you want to indent.
Then, go (in netbeans menu) to source / format

Mass formatting is supported since NetBeans 7.2. See
https://blogs.oracle.com/geertjan/entry/mass_format_in_netbeans_ide
https://www.youtube.com/watch?v=EeU_KZC5lI0

Select project or subfolder node in Projects window and press Alt+Shift+F.

Related

The option to save a file is greyed out in Eclipse

I'm using Eclipse 3.7 on Ubuntu. Often, after editing a file, I cannot save it - the "save" option is greyed out in the menu and Ctrl+s seems to do nothing, even though the file has just been modified and the editor displays the asterisk before the file name in the tab header.
Changing the active tab to another file and then coming back to the first file "unlocks" the save option, which I can then choose.
What causes this behavior, and how can I fix it?
This is a reported bug in Eclipse. You can follow up and bring more information in the bug report in Eclipse's bugzilla.
The easiest workaround I could find was to just restart eclipse. Worked for me.
That can also happen when the Project Explorer view has focus (bug 211520)
The new Eclipse 2019-09 has fixed that issue
You can now save the active editor even when the Project Explorer has focus.
In cases where an extension contributes Saveables to the Project Explorer, the extension is honored and the save action on the Project Explorer will save the provided saveable item instead of the active editor.

How do you set the encoding to utf-8 in NetBeans 6.9?

I'm running NetBeans 6.9, can't seem to figure out where to set the encoding. I found some guides on google but all of them were for older versions.
The method by Mr. LordofFatality doesn't work for out-of-project files that you open via 'open file' menu.
In order to accomplish that, find a netbeans.conf file in you netbeans installation\etc\, find there a netbeans_default_options line and add there -J-Dfile.encoding=UTF-8 string.
If you don't find the "netbeans_default_options" option there, add a whole new line as following:
netbeans_default_options="-J-Dfile.encoding=UTF-8"
Relevant to NetBeans 7.2, also works in 7.4
In 6.9.1:
open the project pane if you don't see it already (Window > Projects);
right-click on the name of your project in the tree-view;
click properties;
make sure the menu item "sources" on the left is highlighted;
you should see "Encoding:" and a select-box next to it;
click OK. Done.
It SHOULD work that way and does work for anyone on the internet except me. On my Windows XP dev system files are still not saved as UTF-8. Still wondering why ...
open the project pane if you don't see it already (Window > Projects)
Right-click on the name of your project in the tree-view click
properties make sure the menu item "sources" on the left is
highlighted you should see "Encoding:" and a select-box next to it.
click ok. done.
it SHOULD work that way and does work for anyone on the internet
except me. on my windows xp dev system files are still not saved as
utf-8. still wondering why...
Your file should content one or more non-latin chars, this is why.
its bug always the editor saving my files as utf-8 without bom
See here !!!

Search and Replace only in open files (netbeans)

Anyone know if it's possible to search and replace in all opened files in netbeans? Can't seem to find the option if there even is one.
I'm using the Netbeans 6.9 PHP IDE
CTRL+SHIFT+H
This will open the Replace in Projects, where-in you can search and replace on files on all open projects, or on the selected project only.
Open the file you want the replacements.
Press Ctrl + H
And them at the bottom you will see
It's available in builds >= 7.4 from NetBeans. Not available in 7.3. I just got a status update message from NetBeans that they've added this feature.
Use Replace in Projects. Shortcut = CTRL+SHIFT+H
Select Open Documents
To search in open files press CTRL+SHIFT+F and in section scope select Open Documents.
Sure you can ... or at least you can do something very similar ...
Go to projects view and select multiple files (the files you have opened in this case). Then press CTRL+F and start searching in the selected nodes. It's not exactly 'opened files' but I think it's your best choice.
Hope that helps!
PD: CTRL + CLICK is a good method to select multiple files on Windows.
This seems impossible in netbeans 6.9 and it hasn't been introduced in Netbeans 7 either.
This is possible just the Rule mentioned.
Check Uncheck the files and hit replace button on left hand side.
Select your files you want to find and replace in Project view ( Window > Projects )
Go to Edit > Replace In Projects...
In Replace in Projects window select "Selection" from "Scope" dropdown menu
Find and replace will be committed on your selected files in Projects view.
This is the way I found.

Displaying full path of filename in tabs ~ Netbeans 6.8

I can't seem to find a way in the options to display the full path of the file at the title of the tab. I can hover over it to see it, but it would be nice to see it at a glance.
There is a SU question about it also, https://superuser.com/questions/88637/netbeans-how-to-view-file-full-path-in-window-title-or-somewhere-else
Does anyone have a solution for this to actually display it? I can see there is a custom .jar for it in the RC2 Netbeans, but that's probably way old now.
PS, I should mention that a path relative to the project would be ideal, as well as a full path. Either really :)
NetBeans 8.0.2
Tools > Options > Appearance > Document Tabs > Show full file path
The full path will appear only for the active tab (under the tabs), but you can also check "Show parent folder name in tab title" if you want to see the parent folder for every tab:
Try to use following netbeans plugin.
In Netbeans 6.9.1 (at least) you can open the Window/Properties window and pin it under the editor; this will contain the full path in the "All Files" property which is then visible at all times and always contains the current editor file's properties.
Starting from NetBeans 6.9 you can use the NetBeans extention "show path in title":
http://plugins.netbeans.org/plugin/42000/show-path-in-title
it's very helpful :D
You can also 'Select in --> [Project|Files|Favorites]. This opens the exposes the node for the file in the Projects, Files or Favorites explorer.
To do this, right click in the text editor for the file you are interested in; the 'Select in' item is near the bottom of the menu that appears.
Try using CTRL+TAB, you can find the path in status bar. This is not complete solution for your question but using keyboard (without using mouse atleast) you can find the path of the open file(s).

How to link opened file with project tree in NetBeans

I feel dumb asking this question, but I can't find solution to this myself.
When I open several files in editor and switch between them, I have problem finding currently opened file in project or files tree.
I used Eclipse before and every time I changed a tab with file, the project tree set focus for the same file. Is there a way to do something like this in NetBeans?
Just thought of adding what ax said:
The keyboard shortcuts in Windows are:
Select in Projects : Ctrl+Shift+1
Select in Files : Ctrl+Shift+2
The keyboard shortcuts in OS X are:
Select in Projects : CMD+Shift+1
Select in Files : CMD+Shift+2
As described in NetBeans "link with editor" feature, if you want the link to be permanent or persistent, use View | Synchronize Editor with Views. (In NetBeans >= 6.7.1, at least.)
from http://forums.netbeans.org/topic3732.html :
You can do this from the navigate menu, I believe. There are entries for
going to the file in the project tab or the file tab. I didn't see an
option that allows you to do this automatically, like there is in
Eclipse, but this menu entry allows you to do it upon request.
[edit]: also working: in the file > right mouse button > select in > projects | files | classes | favourites
[edit 2]: http://forums.netbeans.org/topic8420.html : This feature is not available till NetBeans IDE 6.5. This feature is added in the new version and may be available in NetBeans IDE 7.0M1 and after and you can find it in the View Menu.
Navigate->Select in Files or Projects