Some days ago my Eclipse was working fine and a +/- appeared in every block that could be collapsed (functions, classes, etc.)... but now it does appear, and I don't know how to activate that feature again.
It's Eclipse Helios, running on a Gentoo Linux box.
Preferences -> C++ -> Editor -> Folding ?
Make a right click in the editor window and go to preferences there, then only the editor-relevant section of the preferences dialog will appear. This works for JDT, CDT etc...
You can do ( Ctrl + Numpad_Divide ) to enable folding.
Also if you Right Click on the area where the + or - was supposed to be, you can see there is a folding option.
Try this option: Preferences > Java > Editor > Folding > Enable folding
To collapse all code blocks
Ctrl + Shift+ /
To expand all code blocks
Ctrl + Shift+ *
pydev:
To collapse all code blocks :
Ctrl + 0
To collapse all code blocks :
Ctrl + 9
Is there a way to collapse all code blocks in Eclipse?
by #partizanos and #bummi
For Python it is as follows:
collapse all 1 level: Ctrl+9
expand all 1 level: Ctrl+0
collapse current: Ctrl+-
expand current: Ctrl++
Hope that helps.
In Preferences, you'll find General > Keys. It's for setting your keyboard shortcuts.
What I use it for more often, though, is to find stuff in Eclipse. You should see an input box labelled "type filter text." It's as close as Eclipse comes to a search feature for every Eclipse command.
I assume you are using Java, but look under the settings for your particular language.
Under the Window menu, select Preferences.
Under Java->Editor->Folding. Select "Enable Folding".
If you want folding an all your editors, I found you can enable Folding in
Preferences > Editors > Structured Text Editors
Enable Folding
For windows eclipse using java: Windows -> Preferences -> Java -> Editor -> Folding
Unfortunately this will not allow for collapsing code, however if it turns off you can re-enable it to get rid of long comments and imports.
Here you go!
Right Click on + button appeared on numbering strip on left most side --> Folding --> Expand All
Right Click on + button appeared on numbering strip on left most side --> Folding --> Collapse All
This way you can expand and collapse all the methods on the file.
Plus Buttons on numbering strip
Context Menu:
Context Menu
In CFEclipse:
Preferences > CFEclipse > Editor > Code Folding > Initially Collapse column, you can uncheck to see all expanded when opening, or check all boxes to close all when opening a file.
I was using salesforce apex classes with Eclipse Neon 3.3 for Java. I found an option "define folding region" on right click in the editor, I selected the block of code i wanted to collapse and selected this property for that code. Now I am seeing + and - symbol to expand and collapse that block of code
Related
In "Java" perspective I can see Java code (between "Package Explorer" and "Outline" - depends on your settings, however it's a kind of default I think).
Then I add "DDMS" perspective and I can't see Java code. I have only "Devices" and "Threads", "Heap" etc. No Java editor in between.
How to show Java code in DDMS perspective?
You can simply switch the editor by setting up a keyboard shortcut to really toggle the editor area visibility. Open the Preferences and navigate to General > Keys *(or press Ctrl/Cmd + Shift + L )* twice to jump right to the Keys preferences).
Search the commands for area and then assign a keyboard shortcut to the Toggle Editor Area Visibility command.
I tried using the Toggle mark occurrences (Alt + Shift + O) button and also in Preferences -> General -> Editors -> Text Editor -> Annotations and setting the C/C++ Occurrences and C/C++ Write occurrences. But still when I select a word it won't highlight all occurrences of that specific word.
What I am using is Eclipse Indigo Service Release 2 in XP, with a C++ project.
You can try to activate Toggle Mark Occurrences with icon on Toolbar:
Preferences --> Java --> Editor --> Mark Occurrences
In General > Editors > Text Editors > Annotations
Check out options that are checked in Preferences -> Java -> Editor -> Mark occurrences. Then restart Eclipse.
Find the Preferences under Window,
In General > Editors > Text Editors > Annotations(1)
(5) is to select the color and press apply.
The standard "Mark Occurrences" functionality included in Eclipse that everyone recommends only highlights identifiers in editors of whatever language. For example, it won't highlight int in C editors, and it won't help at all in the Console pane.
So if you want to highlight ALL occurrences on ANY word in ANY Eclipse pane (kinda like Notepad++ does), try the Glance plug-in for Eclipse.
As of November 2017 Glance works for Eclipse Neon and Oxygen. There was a period of time in which Neon was unsupported, and a fork appeared, but it seems unnecessary now (and abandoned).
There are two ways to highlight all occurences. First is using Eclipse options, which is not very reliable, because in many versions of Eclipse it is not supported.
Second is using a plugin called Glance which is available in Eclipse marketplace. This is supereasy and effective.
First Method
In the toolbar, there is button for Toggling Mark Occurrences. So, once you selected the text/word whose occurences you wish to highlight, then click this toggle button.
Let's say this step doesn't work for you. Then, Follow this step:
Goto: Window ==> Preferences ==> General ==> Editors ==> Text Editors ==> Annotations ==> On right Annotations types box: Occurrences ==> Select all check boxes.
You can also go to Window ==> Preferences ==> Java ==> Editor==> Mark Occurrences ==> Check all the checkboxes.
Restart Eclipse and check if highlighting works.
If still doesn't work, then Go to Second Method
Second Method
From Eclipse marketplace, install Glance. Once installed, restart Eclipse.
Now select any word in your eclipse editor
Move focus to component where you want to search
Open Glance using Ctrl + Cmd + F shortcut on Mac or Ctrl + Alt + F on other platforms
Enter text you want to search
Use Enter or **Shift + Enter** to find next/previous match
Close search box using Esc
You can also customize Glance from Window ==> Preferences ==> Glance
For Eclipse Mars:
Window --> Preferences --> Check (Mark occurrences of the selected element in the current file.)
As shown if figure:
Go
Java> Editor > Mark Occurrences
Uncheck "Keep Marks when the section changes" then click Ok
Restart Eclipse.
This work for me.
If you go into the window-prefrences, select the language you want/are working with. Select the editor under this specific language and then there is a mark occurrences there that has some options. Where it says keep marks when the selection changes, for me this was checked. When I unchecked it the system started highlighting correctly.
For folks who are using a dark background with light font colors, you may want to check out the highlight color in Preferences -> General -> Editors -> Text Editor -> Annotations. Mine was defaulted to black, which does not stand out on a black background.
Glance does not work anymore, but in current Eclipse Versions (Eclipse 2020) you can
highlight any word by selecting the word and pressing CTRL+F. The word is now highlighted. In the small search input, you can toggle 'match whole word' and case sensitivity.
I'd like to complement the other answers - which work in Java editor only or require plugins - with a way to highlight all occurrences of any text (not just a word or identifier) in any editor of text files (e.g. SQL, CSV, HTML, TXT, Java, etc ...).
There is a standard/built in command called Find Text in File (under Window -> Preferences -> Keys)
By default it has no keyboard shortcut assigned. Simply give it a shortcut (e.g. Ctrl+Alt+S) select some text (not necessarily a word) and it will find and highlight all occurrences of that selected text.
It can also be invoked from the menu as Search -> Text -> File.
Enjoy 🙂
Click the word and hold until a popup appears as shown in the figure.
On the popup, there is a little right arrow, after clicking it, a new icon shows up.
Click that link to open preferences.
Once in preferences, select C/C++ Occurrences (it will be language specific) and select Include in next/previous navigation with Text as Highlighted.
This should enable the feature of highlighting all occurences of the selected word in the opened file.
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.
I think I'm missing the elephant in the room but for the life of me I can't find the keyboard shortcut to setting a breakpoint in eclipse when using the pydev plugin.
Things that I've already tried:
Ctrl + Shift + B: does nothing.
Ctrl + F10: brings up the breakpoint context menu where you can select to add breakpoint, remove etc... I don't want to have to scroll through a menu every time I want to use a keyboard shortcut.. .kinda defeats the purpose of a shortcut.
Clicking on the strip on the left hand side of the code: this is the only way that I'm setting it atm, but I'm rather avoid using the mouse if I can.
I'm using pydev 1.6.1 on eclipse 3.6
EDIT (31/08): In light of the two answers by codedevour and Tao, I've tried editing the shortcut but have had no luck with the new shortcut Ctrl + Shift + Alt + B either. Other shortcuts work. I've also tried changing the "When" drop down from In Windows to 'Pydev editor scope' with no effects.
From what the editor is telling me, there is no conflicts with the breakpoint shortcut.
This is a fresh install on two machines, both windows 7 and it's happened on both machines.
Finally found it!
The answer is here:
http://www.mail-archive.com/pydev-users#lists.sourceforge.net/msg04234.html
In short, shortcuts are not set for all perspectives of eclipse.
Whilst in the pydev perspective, go to Window > Customize perspective > Command Groups Availability > Check breakpoints.
That's it!
I was using the pydev perspective (which is what it switches to when you first create a pydev project) however, breakpoint shortcuts are only available in the debug perspective by default so you need to turn the shortcut on... wow that was so NOT obvious!
Ctrl + Shift + B
If this refuses to work, have a look at Window > Preferences > General > Keys and look for overlayed keys which may shadow this shortcut.
Ctrl + Shift + B works for me and I am using pydev 1.6.1 with eclipse 3.6.
Perhaps, you have a conflict with another program? Try change it under menu Window > Preference > General > Keys > Toggle Breakpoint to another keyboard shortcut.
On recent pydev versions:
Go to Window > Perspective > customize perspective...
And in tab "Action Set Availability", check "Breakpoints"
Somehow I've turned on hidden characters in Eclipse. It's not the "whitespace" characters in the general editor preferences. When turned on, it adds another layer of hidden characters over the existing ones.
Then I have things like
\r\n
Does anyone know what these are and how to remove them?
It is under Preferences > General > Editors > Text Editors. There is a checkbox labeled "Show whitespace characters". If you uncheck this the editor switches back to normal.
If you click on the link (whitespace characters) (<= v3.6) or (configure visibility) (>= v3.7) in this line you will get a popup window, in which you can define which characters eclipse is supposed to consider as whitespace characters.
In this popup window you also get the option to define the transparency in which each whitespace character is displayed in the editor, which you can use to (indirectly) change their foreground colour. I'm just mentioning it here, because it took me about half an hour to find this setting! ;-)
There is a toggle button 'Show Whitespace Chars' on the Eclipse toolbar
A great tip about using 'quick access' from eclipse forum:
CTRL+3 swc
Allows to turn them on and off
The right shortcut is Ctrl + N
UPDATE From Eclipse 3.7 version, something is changed... Now you have to go to:
Window > Preferences > General > Editors > Text Editors
CTRL + . does the job.
For Aptana Users
To toggle hidden characters in Aptana on and off, use the following keyboard shortcut:
Ctrl+Alt+W
I am using Eclipse Oxygen and can see this option to toggle whitespace characters:
It is actually in two places...
Sandkastenliga points out the obvious one, but you can also show white space with a shortcut key combination. The key combination is separate from the text editor preferences and will superimpose additional characters when active (it uses \r and \n for carriage return an line feed respectively instead of the symbols used by the text editor preference.)
Go to preferences > general > keys and look for the binding for the 'Show Whitespace' command.
I have the text editor preference turned on, so I removed the binding for this command altogether (it was set to Ctrl+. in my profile) to prevent accidental activation as it doesn't affect the other preference.
Go to Window > Preferences > General > Editors > Text Editors
Uncheck the "Show whitespace characters" option on the right side of the page, then click "Apply" at the bottom of the page.
Since this is not a standard setting, it could be the result of one of your extra plugin.
Did you try starting your eclipse with the -clean parameter?
Do you reproduce the issue with a fresh Eclipse installation?
Go to Preferences > General > Editors > Text Editors and restore defaults.
I have done this several times by accidentally hitting some keystrokes.
If you go to Windows/Preferences/General/Keys you will see all the keyboard shortcuts you have.
Mine is set to Control + .
I had to place my cursor inside the document and do it a couple of times to make it work because there is also a keyboard shortcut for Control +
Hope that helps.
You can add "Show Whitespace Characters" button in toolbar by customizing your perspective.
It also contains buttons to toggle word wrap, and toggle selection mode.
Go to Window > Perspective > Customize Perspective > Action Set Availability, then select "Editor Presentation" action set:
This works in Eclipse Neon.
You can also add a key binding for this action.
Go to Preferences > General > Keys > "Show Whitespace Characters"
Sorry this is a bit vague but it's a while since i used Eclipse and i do not have it installed. I think this is it ..... in one of the menus you will find the Eclipse settings, there are two set's of settings, current project and overall Eclipse, you mat need to check them both. In there are various menus in tree form that allow you control the actions and look and feel. But some of them are nested so there is an overall control but some packages have their own options in a sub menu set. The menu's will expand when you click them and i'm afraid you need to walk through them all.
Eclipse > Preference > General > Editors > Text Editors > Show WhiteSpace characters.