Vertical line between matching curly braces for java in eclipse

26,177

Solution 1

The closest solution I can suggest is:

  1. Click on Eclipse IDE > Window > Preferences > General > Editors > Text Editors

  2. Then click on the link "whitespace characters" to specify what should be shown.

  3. Then enable tick box "Leading and Enclosed" for Tab only and leave the rest unchecked.

This is not perfect solution, but it might be useful.

Example

Solution 2

There are useful plugins. Try: IndentGuide or EditBox

Solution 3

You can identify the matching curly braces in eclipse by position the cursor right after of the curly brace (the opening or the closing one) and the matching one will be automatically enclosed in a rectangle. You can't do what you said. After you position the cursor as I said , you can press CTRL + SHIFT + P to jump to the matching brace.

Solution 4

To my understanding this is not possible. Eclipse does have functionality that will help you work with brackets however, and it is actually a little more refined and user friendly then the Notepad++ style you are looking for.

  1. First, it has a feature for matching brackets highlighting under Preferences->Java->Editor. When your cursor is on a bracket it will highlight the matching bracket.
  2. Along these same lines, if your cursor is on a bracket and you press ctrl + shift + p it will jump to the matching bracket.
  3. It has line folding that can be toggled in Preferences->Java->Editor->Folding for brackets, comments, etc.
  4. Double clicking after an open or close bracket will highlight everything in that code block.
  5. Eclipse supports automatic indentation as well. This should be a visual queue as to which chunk of code belongs to which bracket.

Hope this helps! Happy Coding!

Solution 5

Eclipse's structured editors (including the Java editor) provide a highlight of whatever structural element the cursor is within. The highlight is in the left border of the editor. For example, in the screen shot below, the cursor is in the listIterator() method, and the highlight (pointed out with arrows) is highlighting the structural element, in this case, the Java method.

Unfortunately, I don't think the color or appearance of that highlight can be configured.

enter image description here

Share:
26,177
Jagdev Singh
Author by

Jagdev Singh

Passionate software engineer and performance tuning expert.

Updated on July 09, 2022

Comments

  • Jagdev Singh
    Jagdev Singh almost 2 years

    I am new to eclipse IDE.
    Can we do following in eclipse for java editor?

    {
    |
    |
    }
    

    How it is configured in eclipse to show vertical lines between matching curly braces in java editor? Is it possible?

  • Jagdev Singh
    Jagdev Singh almost 12 years
    I know these.Thanks for your answer.I am asking something like notepad++.
  • Xairoo
    Xairoo almost 12 years
    You can add that double clicking after an open brace will actually highlight everything within the braces. Really lets you see what is included. Same for perentheses.
  • Jagdev Singh
    Jagdev Singh almost 12 years
    At the time of code review or writing some complex code we need to check which part of code is related to some other part.Specially when fixing a bug in others code.If this kind of feature is available then it will be very helpful.
  • Tim Bender
    Tim Bender almost 12 years
    With code formatting enabled and a good set of style rules it should be fairly obvious what code belongs to a particular code block.
  • Jagdev Singh
    Jagdev Singh almost 12 years
    Thanks to all for yours answers.I think it is not possible.I will go for CTRL+SHIFT+P option.
  • Jagdev Singh
    Jagdev Singh about 11 years
    Thanks for reply.It is really useful.
  • mibrahim
    mibrahim about 11 years
    IndentGuide does the trick. Select Help->Install Software and add the URL to "work with" atlanto.github.com/IndentGuide/update
  • Admin
    Admin over 10 years
    Dammit i hate it when people say "You can't". Thanks for this.
  • Milan
    Milan over 10 years
    Thanks for this! The IndentGuide adds vertical lines (Notepad++ like) to all indents and works in Eclipse PHP environment. FYI I had to restart Eclipse 2 times before it took effect.
  • Vipin
    Vipin about 10 years
    @mibrahim update url for IntentGuide is http://atlanto.github.com/IndentGuide/update
  • ladieu
    ladieu almost 10 years
    installed it, but it didn't do anything, perhaps it's out of date and doesn't work with the latest
  • Nenad Bulatović
    Nenad Bulatović about 9 years
    @ladieu You have to go to the Window -> Preferences -> General -> Editors -> Text Editors -> Indent Guide, thene there 'Enable the indent guide', then 'Drawing options' select 'Draw guide on column 1' and 'Draw guide on blank lines', then 'Content types' check Text (and double check if all types of files that you ant are checked. Then close tab with Java code and when you reopen it you will have indent guides. I use it with every flavor (Java, EE, CDT, ADT) and editions (Luna, Kepler, Juno, Indigo) and it ALWAYS works. New url for update site is sschaef.github.io/IndentGuide
  • Alex Fainshtein
    Alex Fainshtein over 5 years
    As of October 2018, IndentGuide plugin is not available anymore; there is a frozen repository, in case somebody wants to clone and revive it: link. EditBox is still available, but looks quite heavy. It is much more than just indent guides. It does not seem there is any working indent guide plugin for Eclipse available...