Java – is there any way to create a shortcut in eclipse and move the cursor to column n of the current row?

I have to follow some strict indentation rules for Java code

In many cases, I have to jump to column 26 or 28 of the current row The character between my original position and column 26 / 28 should be a space (not tab)

Is there any way to do this with some keyboard shortcuts (or other methods) in eclipse? 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 a large number of spaces Is there any way to easily implement it in eclipse?

Solution

This is not a good practice, but you can use this

Create template in eclipse window – > preferences – > java – > Edit – > template – > New

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

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

.

.

.

Name : 26
Pattern :${cursor}<give 26 space>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>