Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Eclipse editor problem

Options
  • 29-08-2007 9:30am
    #1
    Registered Users Posts: 3,594 ✭✭✭


    Not exactly a programming question but its related to programming.

    I tend to indent my code and can't seem how to figure out how to get it to indent in Eclipse ... I've had a look online ... and can't find anything that helps solve my problem

    I've gone to Windows -> Preferences -> General -> Keys and set the binding ...

    Its there as CTRL + i ... this works to a certain degree ... it'll only indent once

    I've used other editors before and they've allowed me to indent and "dedent" ? and set up number of spaces for each ... as well as selecting blocks of code to indent

    Anyways any help greatly appreciated

    James


Comments

  • Closed Accounts Posts: 888 ✭✭✭themole


    If you just want to indent one space, use tab.

    CTRL+i is automatic indentation but it only works on the selected code. You can use CTRL+a to select all of the file then CTRL+i to correct the indentation.

    If you want to change the way eclipse automatically indents then you will have to change the workspace/project settings. Not sure exactly where the style setting is but if you dig around window->preferences you may find something.


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    cheers for the response ... actually hadn't realised tab would indent blocks of text :) ... and I've set the tab to spaces

    Now to figure out how to remove spaces at the start :)


  • Closed Accounts Posts: 888 ✭✭✭themole


    No worries.

    You shouldn't need to tab anyway. I find the default indenting good. You know i presume that if you start a new { and press return that it automatically creates the closing } and indents appropriatly.

    What default indenting do you not like?


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    I guess I'm just not used to having default indenting ... :) having used various plain text editors for the most part ... didn't really like previous versions of eclipse as I found them a bit unstable on a windows platform.. and I've just installed it again recently after reading a good article on it and am kinda going wow :)

    I don't like 4 spaces for an tab indent ... hence I use 2 spaces ...I also prefer spaces to tabs


  • Closed Accounts Posts: 888 ✭✭✭themole


    forbairt wrote:
    I don't like 4 spaces for an tab indent ... hence I use 2 spaces ...I also prefer spaces to tabs
    Go into window->preferences

    Then select java->code style-> formatter

    You should be able to create a new formatter profile in which you change the indenting to 2 spaces instead of a tab.

    Then stop using the tab button :p


  • Advertisement
  • Registered Users Posts: 3,594 ✭✭✭forbairt


    ok thats powerful ... thats nice ... thats shiny ...

    you've made my day, well so to speak :) thanks for the help


  • Closed Accounts Posts: 888 ✭✭✭themole


    No worries.


Advertisement