A few days ago it was just fine. I haven't made any change to the IDE or anything else in the preferences.
Looks like random instability, but I hope I'm wrong, I don't want to go through the IDE setup again.......
Here are two screenshots to tell the story:
Before Ctrl+Shift+F (format):
After (format results):
What can I do about it?
I've tried comparing settings in another Eclipse setup that I have which has XML formatting working properly. (Window -> Preferences -> XML -> XML Files -> Editor). Also (Structured Text Editors).
Solved.
It looks like "Android Common XML Editor" took over, and the above crappy formatting belongs to it.
All I had to do is right click on the XML file and choose Open With -> XML Editor.
You can revert the default editor for XML files to be the original XML Editor at Preferences / General / Editors / File Associations:
Related
I want to associate any *.xml.dist file with the eclipse XML editor. I tried the following:
Preferences: General > Editors > File Associations, yet it only accepts one dot here, so *.xml.dist can't be added (at least not for me? is there a trick?)
Preferences: General > Content Types I located Text > XML and added .xml.dist and *.xml.dist yet neither of them worked.
For sure, I can right click any file and tell Open with > XML Editor but I'd rather have this as default.
PS. The same would be for *.ext.dist (generic example here)
Thanks for help.
It looks like quite an old bug (ouch!) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=168573
Wouldn't creating a mapping for *.dist help you?
I have also noticed that Eclipse appears to remember what was the editor used for given one file, so if the set of files you are working with is finite, it might be an useful crutch.
I've recently started developing with Kivy using Eclipse. I'd like to add some basic syntax coloring for .kv file-types. I've tried googling how to do this but nothing came up. This could also be handy for other filetypes not normally recognized by eclipse.
In my case I wanted that eclipse recognize .fo (Apache FOP, a XML FileType) extensions. It means use XML editor to open .fo
I use the next steps in eclipse-kleper:
Window -> Preferences -> General -> Editors -> Content Types
Then in fisrt box
Text -> XML -> XML Schema File -> Add... -> *.fo (in dialog box)
If Kivy files has a known structure by editor it should work.
I hope it helps you.
When opening JSF page (JSF + Apache Trinidad + facelet) in Eclipse (Helios), Eclipse freezes for a few seconds before the page is opened.
Also when editing the page, code complete / syntax verification is slow - for example I type <tr: and again I have to wait a few seconds before I can continue typing or tr tags are display.
It is very annoying that I have to wait each time when typing opening tag and slows me down a lot.
I am also using custom facelet tags.
What to do to avoid Eclipse freezing / slowing down? Do I have to change any configuration to speed it up?
I tried using the XHTML Editor instead of the JSF editor, and the freezing seems to have stopped.
I right clicked on my *.xhtml file and selected Open with->XHTML Designer
Also, you could change the way *.xhtml files are opened by going to Window->Preferences, then General->Editors->File Associations. Select the *.xhtml extension from the File types: pane, and then select XHTML Designer in the Associated editors: pane. To make the XHTML Editor the default editor for *.xhtml files, click the "Default" button next to the Associated editors: pane.
Turn off hyperlinks in your editor by going to the following path
Go to Window -> Preferences -> General -> Editors -> Text Editors -> Hyperlinking preference,
uncheck the option Open Declaration
I had this problems for weeks, and I've found a solution:
Install JBoss Tools > JBoss Web and Java EE Development > Visual Page
Editor (only this subpackage)
After you can edit XHTML files with:
Open with > JBoss Tools HTML Editor
It's faster and gives you a better page preview
Some profiling show that the slowness is due to
org/eclipse/jst/jsf/context/symbol/internal/impl/IJavaTypeDescriptor2Impl.class
Its related to org.eclipse.jst.jsf.common_1.2.2.v201101211220.jar of WebTool 1.2.2
The solution is to update to the last WebTool version
WebTool 3.6.2 update page
using Update Webtool Luna link
Adding metadata-complete=true to WEB-INF/faces-config.xml is a good way to prevent WebTool packages classes scanning, but AnnotationConfigurator.createFacesConfig must be modified !
For eclipse
Windows -> Preferences -> Editor -> File associations
then select XHtml.
After the selection there will be three options in the bottom window select HTML editor and click default. This solved the problem for me.
Please make sure to close all the opened XHtml pages and restart the eclipse.
Can some one suggest me a plugin to format HTML and JAVA code with proper indents etc ? Is there any built in option there in Eclipse ?
Use Source -> Format or CTRL+SHIFT+F
Eclipse does have built in Java formatting:
Preferences > Java > Code Style > Formatter
For HTML, you might try something like HTML Tidy. The Web Tools Platform project also includes formatting.
It's a combination of all the answers above, which suits me-
Go to Preferences > Java > Code Style > Formatter and set all the options you want by creating your own profile or using a default one. Personally I find the line-wrap limited to 80 a little too low. I set it to 200.
Save the 'custom' preferences by giving it a new profile name (export it for future restoration)
Select the code in your editor - then hit CTRL+SHIFT+F. That should format your code.
Worked wonders for me everytime.
Java code formatting is built in. Go to Window->Preferences->Java->Code Style->Formatter. There's a built in profile set up and you can make your own.
http://sourceforge.net/projects/jalopy/
Note that Jalopy has its settings under Window> Jalopy Preferences.
(This menu option appears only when all editor tabs are closed)
Eclipse doesn't have proper built-in code formatting. You might want to open your project in Idea IntelliJ or Netbeans and use their formatting to do a thorough job on it.
How do I get Aptana to recognize .jspf files?
I'd like to have syntax highlighting for .jspf files. I'm sure there's a preference/config option or an xml file to edit, but I'm not finding it.
I assume it's similar to the eclipse process, so I'm tagging eclipse, too. If it's not, I'll remove the tag.
I hope this is what you mean but you can set your file assosiations in Eclipse usually like this (and yes, Apatana is Eclipse based so it should work the same way):
Window -> Preferences
Then
General -> Editors -> File Associations
Select *.jspf and move or add the Aptana Editor you want to use by default.