Word wrapping in Eclipse Java?

I already have word wrap for Eclipse PHP ( How can I make word wrap work in Eclipse PDT for PHP files? ). What about Eclipse Java? Is there a similar tool for wrapping lines of Java code?

+43
java eclipse eclipse-plugin word-wrap lines
Dec 31 '10 at 17:58
source share
5 answers

Ctrl + Shift + F will format the file in Eclipse, breaking long lines into several lines and nicely placing comments. You can also select only text and text format.

I understand that this is not an automatic soft / hard word wrap, but I do not think the question asked for anything fantastic.

+30
Jul 20 2018-11-21T00:
source share

As well as indicating that word wrapping is a terrible idea in code. I suppose everyone has their own style, but usually you need to reorganize or rethink blocks of code that take up much more than one medium horizontal screen. (about 1280 pixels)

Of course, there are always exceptions ... for example, for example, detailed exceptions, but they are not critical for understanding the code.

Scanning a line that goes beyond a single horizontal screen, or reading a thought that flows on several lines, will make your code a lot harder to understand.

In addition, line counting will be strange since word wrapping will make one line look as if it takes 2, 3 or shudders in thought ... 4 lines of code.

As for comments, returning lines should not be a big problem for everyone.

Also keep in mind that word wrapping code is not common practice, and you are essentially saying that everyone who reads your code should include word wrapping, which, unfortunately, is unnecessarily painful to make others work with your code does ....

If nesting necessitates word wrap ... well, that is also a very bad smell of code.

What are my two cents.

+6
Dec 31 '10 at 18:19
source share

This is for those who have the following problem with the Word-wrap plugin "Ahtik" in Texlipse: the plugin installs fine, but selects the word-wrap option using the context menu (or pressing ctrl + alt + w) causes the text to turn around instantly, and then just drop it back to unpacking (this probably includes everyone who uses Windows 7).

Here's the fix ... right from the developer himself! I emailed Ahti Kitsik in my last attempt to find a way, and was amazed when he really found a solution and sent it to me the next day. He suggested that in return I could just make this information widely available.

So, the way to fix this is as follows:

Find the location of the texlipse plugin. It will probably be in the Eclipse folder, and the address will probably end: ... \ eclipse \ plugins \ net.sourceforge.texlipse_1.5.0.

Save the plugin.xml file there just in case, and then edit the original by deleting the following code snippets:

- Firstly, the β€œaction” (starting at line 843):

Act

class="net.sourceforge.texlipse.actions.TexWordWrapAction" definitionId="net.sourceforge.texlipse.commands.texWordWrap" icon="icons/wrap.gif" id="net.sourceforge.texlipse.actions.texWordWrap" label="W&rap text" menubarPath="net.sourceforge.texlipse.menus.latex/latexGroup" style="toggle" toolbarPath="latexGroup" tooltip="Use word wrap" 

-Always a β€œteam” (starting at line 972):

Team

  categoryId="net.sourceforge.texlipse.latexEditingCategory" name="Wrap text" id="net.sourceforge.texlipse.commands.texWordWrap" 

(When you did this, the file should have a length of 1257 lines instead of 1271).

Finally, Ahti says: "Launch eclipse with the -clean command line argument to force reload plugin.xml." (Personally, I had no idea how to do this, so I just uninstalled and reinstalled its plugin, then exited Eclipse and edited the code before restarting it).

Now the function should work fine. Hope this helps someone. And thanks again Ahti!

+6
Oct 11 '12 at 15:58
source share

At the same time, there is a plug for the Ahtik word wrap plugin, which, I must say, works very well and corrects the line offset error: Eclipse Word-Wrap Plug-In

+6
Jul 07 '13 at 19:25
source share

Open Eclipse β†’ Help β†’ Install New Software β†’ Click the Add .. button and copy this line β€œ http://dev.cdhq.de/eclipse/updatesite/luna/ ” into the Name and Location field β†’ Click OK

Check β†’ Linear linear number and Word Wrap function β†’ Next β†’ Next β†’ Finish β†’ Restore Eclipse!

enter image description here

+2
Mar 06 '15 at 9:16
source share



All Articles