Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize Java editor in Eclipse

I was wondering if there was a simple way to extend the features of the Java Editor in Eclipse for some custom project.

Example : When I write in eclipse :

@Deprecated
public void foo();

foo will be automatically crossed-out and thus easy to notice. In some projects I would like to do the same with custom annotations like @Untested or @Verified to have a better dev environment (but of course, there are plenty of examples like this (special class colours, etc...).

I wanted to create a simple eclipse bundle that extend this kinds of rules but I am unable to find an adequate extension point for this. Do I have to create a new text editor from scratch ?

Thanks for any help or comments,

like image 886
ThR37 Avatar asked Jul 20 '12 15:07

ThR37


People also ask

How do I change the editor in Eclipse?

Tip. You can set which Eclipse editor or external program to use to open a specific type of file based on its file extension. Just select Window→ Preferences→ Workbench→ File Associations, select the file type, and associate an editor or program with it (if nothing else, you can use Eclipse's default text editor).

How do I open Java editor in Eclipse?

Step 1: Open Eclipse and click File > New > Java Project. Step 2: Provide the Project Name and click on the Finish button. Step 3: In the Package Explorer (left-hand side of the window) select the project which you have created. Step 4: Right-click on the src folder, select New > Class from the submenu.


1 Answers

You will likely need to subclass and modify the JDT editor. Have a look at the JDT source (org.eclipse.jdt.ui.* packages). You can easily work in these with the classic Eclipse SDK as the JDT sources are provided. Use the Plugins view to pull these projects into your workspace so that you can edit them. I don't think there is much documentation on working on the JDT source. Do have a look at the parts of the Eclipse Help related to JDT though.

like image 130
Francis Upton IV Avatar answered Oct 22 '22 13:10

Francis Upton IV