I use Netbeans 7.2.1, when I type private String a(Java code), the IDE shows a tip window aString which asks me to name a variable with its type as postfix. In addition, when I continue to type ;, it completes the code with private String aString;. Actually, I do not like this naming style, so, how to change the settings?
For windows :
Go to Tools > Options > Editor > Code Completion
Select Language Java from dropdown
Auto pop-up on typing any Java identifier part
You can take help from the images below:
Under Preferences -> Editor -> Code Completion is where you can find the auto complete properties. You can disable the 'Auto Popup Completion Window' to keep it from automatically popping.
You can bring up the auto complete popup with the hotkey: control+space
Also while the completion window is displayed, pressing the esc will close it without inserting an autocomplete value.
Go to: Preferences -> Editor -> Formatting.
In the drop-down box "Language", choose "Java".
There are many other categories you can choose from and you can customize your code formatting style there.
Related
As described in this question one can have auto complete (Content Assist) appear automatically as you type. There is, however, a problem with this setup.
Eclipse figures it's a good idea to accept the first suggested completion when LOADS of different keys are pressed. Such as space, braces and other stuff you really need to type often without inserting a suggestion.
Any Eclipse wiz out there who knows how to turn this auto insertion off without disabling the suggestions?
Open Window --> Preferences. Type "Content Assist" in the filter, and disable it for your editor (or change activation preferences).
Go to Window -> Preferences -> Java -> Editor -> Content Assist -> Auto Activation -> Auto activation triggers for Java and type ".abcdefghijklmnopqrstuvwxyz" . You can add or remove any characters, on pressing which the auto-complete menu gets triggered.
In your case make sure that you do not have a whitespace, ( or < included in the Auto activation triggers for Java
Is there anyway to make Eclipse activate autocomplete after I type 2 characters without a space, sort of like Flash Develop?
Also is there a way to turn off variable name suggestions?
Thanks
What type of code are you autocompleting? If you go to Window -> Preferences in Eclipse and filter by Content Assist, you can get to the preferences that you can change for your autocompletion. The options available depend on which Eclipse editor you're using though. Also, hitting Ctrl + Space at any time should activate autocompletion.
How can I enable autocomplete in Eclipse? I can't find it!
If you would like to use autocomplete all the time without having to worry about hitting Ctrl + Spacebar or your own keyboard shortcut, you can make the following adjustment in the Eclipse preferences to trigger autocomplete simply by typing several different characters:
Eclipse > Preferences > Java > Editor > Content Assist
Auto Activation > Auto activation triggers for Java
Enter all the characters you want to trigger autocomplete, such as the following:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
Now any time that you type any of these characters, Eclipse will trigger autocomplete suggestions based on the context.
By default in Eclipse you only have to press Ctrl + space for autocomplete. Then select the desired method and wait 500ms for the javadoc info to pop up.
If this doesn't work go to the Eclipse Windows menu → Preferences → Java → Editor → Content assist and check your settings here
window->preferences->java->Editor->Contest Assist
Enter in Auto activation triggers for java:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
Apply and Close
other method:
type initial letter then ctrl+spacebar for auto-complete options.
For auto-completion triggers in Eclipse like IntelliJ, follow these steps,
Go to the Eclipse Windows menu -> Preferences -> Java -> Editor -> Content assist and check your settings here
Enter in Autocomplete activation string for java:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._#
Apply and Close the Dialog box.
Thanks.
For anyone having this problem with newer versions of Eclipse, head over to Window->Preferences->Java->Editor->Content assist->Advanced and mark Java Proposals and Chain Template Proposals as active.
I am not sure if this has to be explicitly enabled anywhere..but for this to work in the first place you need to include the javadoc jar files with the related jars in your project. Then when you do a Cntrl+Space it shows autocomplete and javadocs.
If you are only unfamiliar with the auto-complete while typing syntax or inbuilt methods in the eclipse you can simply type the desired syntax or method name and press Ctrl+Space that will display the list of desired options and you can select one of them.
If the auto-complete option is not enabled then you have to check your settings from Windows menu -> Preferences -> Java -> Editor -> Content assist
If the auto-complete option is not enabled then you have to check your settings from Windows menu -> Preferences -> Java -> Editor -> Content assist->Advanced and mark Java Proposals and Chain Template Proposals .
In Eclipse click Windows Drop-Down > Click Preferences > Navigate to Java > Editor > Content Assist
In order to Make the Auto suggestion/completion to work you have to set trigger that invoke the Auto Completion.
Now go to,
Auto Activation > Auto activation triggers for Java
Enter all the characters you want to trigger autocomplete to be
invoked in Eclipse IDE, such as the following:
Alpahabets: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
OR
Special Characters: ~!##$%^&*()_+=-:;'"|?/.,
OR
Any combination of Alpahabets & Special Characters.
Now based on the references, Eclipse will trigger autocomplete suggestions for you.
For me, it helped after I changed the theme to 'mac' since I am running on a MacOSX.
Eclipse: >Preferences > General > Appearance > Choose 'Mac' from the menu.
Does anybody know a shortcut to fold/unfold (collapse/expand) all classes/methods in a php file using netbeans?
To Collapse: Ctrl+Shift+Minus (on the keypad)
To Expand: Ctrl+Shift+Plus (on the keypad)
This works regardless of what language your using, (Tested on PHP, HTML, CSS & Javascript)
But you can find out the keyboard shortcuts easily yourself, and even change them:
Open the Options Dialog (Tools -> Options)
Then Select Keymap
Enter "Collapse" into the input field labelled "Search" and all shortcuts for that action are displayed. You can do the same for "Expand All"
I found the Collapse All function to be a pain because it even collapses the nested blocks inside of your methods. There seems to be no collapse methods shortcut.
If you are like me and just want the methods and comments collapsed by default this can be configured in the preferences.
Under Editor->Folding in your Preferences click on the language dropdown and select PHP.
Check the 'Functions and methods' checkbox.
Check the 'PHPDoc documentation' checkbox.
This will probably yield the result you are looking for.
I also like to uncheck the 'Show summary' checkbox to reduce visual noise.
You can still use the Expand All shortcut key as described in the other post if you wish to see everything.
I'm trying to disable the automatic closing of brackets in Eclipse, and while I've mostly succeeded, I can't stop the editor from inserting a closing parenthesis for a method call. The result is that when I type:
myBool.equals(true);
it inserts a closing parenthesis as soon as I type the opening parenthesis, and what I actually get is:
myBool.equals(true);)
I've disabled all of the auto-complete options in the Preferences -> Java -> Editor -> Typing menu, as well as Preferences -> Java -> Editor -> Content Assist -> Fill method arguments and show guessed arguments. I also disabled the smart insert mode option under the Edit menu. Is there another option somewhere else I need to use to stop Eclipse from doing this?
This is with Eclipse 3.5.2 (Build ID M20100211-1343) in case it matters.
Edited to add: I should also mention that this only happens if I wait for the "intellisense" pop-up with suggested method names to appear after I type the period. If I just continuously type the code without waiting for the suggestion box to appear, the closing parenthesis doesn't get inserted.
I don't know how to disable the method parenthesis auto-complete - so I'm not sure, if you'll be satisfied with my answer. But to avoid ending up with
myBool.equals(true);)
you can actually enable (Parenthesis, [square] and <angle> brackets in the Preferences -> Java -> Editor -> Typing menu. This inserts the parenthesis automatically (which you probably don't want), but you can just continue typing normally, as you would in an editor without "intelligence": Your closing parenthesis will simply overwrite the automatically inserted parenthesis, so you won't end up with );).
If I understand the problem correctly, here is the solution! I had the same problem.
Main Menu | Window | Preferences | <The language you are using> | Editor | Typing
In the section "Automatically close," uncheck the options you don't want.
I don't know if this functionality is new. I just started using Eclipse again and haven't ever used it much.
I found the answer on this stackoverflow page.
As you noticed, it only happens if you wait for the proposals ("intellisense") box to pop up.
The "solution" is to disable proposals under one or both of the following, although doing so is probably more of a hassle because of what you'll be giving up.
Preferences -> Java -> Editor -> Content Assist -> "Insert single proposals automatically"
Preferences -> Java -> Editor -> Content Assist -> Advanced