Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to create a shortcut in Eclipse that would jump the cursor to the nth column in the current row?

I have to follow some strict indentation rules of Java code.

In many cases I have to jump to the 26th or 28th column of the current row. The characters between my original location and the 26th/28th column should be space characters (not TABs).

Is there a way to do this in Eclipse with some keyboard shortcuts (or some other way)? I checked all the available code style rules and couldn't find anything to help me.

Example :

    package                    com.companyname.something;

    import                     java.io.*;

    public                     class Something
                               extends SomethingElse
                               implements AnotherThing
    {
      public static final String
        SOME_NAME            = "SomeValue";

      private int              _var;

    }

As you can see, following these standards requires typing a lot of spaces. Is there a way to do it easily in Eclipse?

like image 593
Eran Avatar asked Feb 27 '13 22:02

Eran


1 Answers

This is not a good practices but you can use this

Create Templates in eclipse Window -> Preferences -> Java -> Editor -> Templates -> New...

Name : 1
Pattern :${cursor}<give one space>

-

Name :2
Pattern :${cursor}<give two space>

.

.

.

Name : 26
Pattern :${cursor}<give 26 space>
like image 116
Srinivasu Avatar answered Oct 23 '22 08:10

Srinivasu