Eclipse Indigo generating HTML5 warnings in HTML4 snippets - eclipse

I work for a company who's primary clients still use Internet Explorer 7 (NHS etc).
In our code we generate snippets of HTML in various places and Eclipse is generating lots of warnings relating to markup that is obsolete in HTML5.
I know that setting a valid doctype of HTML4 fixes the problem on flat html files but as we build the code over several PHP files we can't set a doctype in the snippets.
Is there a way to change the 'default' doctype to HTML4 globally or by project as I do not want to turn off the warnings as that may cause me to miss actual issues.

Drove me nuts too until I found the answer...
http://www.eclipse.org/forums/index.php/t/219788/
Steps:
Select an HTML file in the PHP Explorer. If there are no HTML files, create a new one.
Right-click > Properties > Web Content Settings.
Choose preferred doctype in the Document type list.
Click OK and exit Eclipse.
Open {your_workspace}/{your_project}/.settings/org.eclipse.wst.html.core.prefs with a text editor.
Replace document-type/{your_file_name}=... by document-type/<project>=... (do not modify <project>, paste it as-is)
Start Eclipse.

Related

JBoss tools for JSP: Make content assist work for Bootstrap "class" as in HTML Editor

I am working in JBoss Tools editors for HTML and JSP pages in Eclipse Luna.
One interesting thing I found about the different way these two editors work, is that some time they can auto-complete, but sometimes JBoss JSP editors fails. More precisely, when it comes to the "class" attribute which come with Bootstrap 3, the HTML editor works while JSP editor fails. Even though I can open the .jsp file with JBoss HTML editor, the problem persists.
Is there some way to fix this?? They work consistently in some other cases, like this:
When I have a <form>, and I type enctype=" or even enc, in both editors when you press alt + /, you will have enctype="application/x-www-form-urlencoded", which is amazing.
I attach GIF to show this strange behaviour:
Thanks to #Alexey Kazakov I have checked my login.jsp page and I found that bootstrap.css is not introduced in this page, but in other pages, jsp as well as html, this file is introduced in <head> part. So the editor is not working wrongly, it's my fault.
So JBoss Tools stay to be fantastic. ;)

Aptana's css autocomplete doesn't update itself

I'm doing an web project and all pages have the .php suffix. I started with a single css (style-default.css) file and the auto-complete worked perfectly. Now I changed that css filename (to custom.css) and added some more css files (Foundation 3 framework).
The strange thing is when typing class="..." the autocomplete only shows me options for the custom.css although it displays the name "style-default.css" and no suggestions at all for the "foundation.min.css". I checked and both files are included in the build despite I can't build a web project. Is there any way to refresh the auto-complete?
I even tried removing the project and importing it again, but it didn't worked.
Ok I found out... Aptana auto-complete apparently can't read *.min.css. I included the *.css instead and the suggestions appeared. Still, the outdated filenames looks like a bug to me.

How do I make an editor the default editor for all unknown files in Eclipse?

I regularly open files of different types in Eclipse. For many types, Eclipse uses the system editor by default. I don't want this to happen. I want Eclipse to use the built-in Text Editor for unknown file types. However all I can find are options to set the default editor for a certain file type, but not for all unknown ones. Is there an option to do this?
I don't think you can do this in one swoop, however:
Windows > Preferences > General > Editors > File Association.
If you don't have a LOT of unknown file types, just type *.junk, *.punk, *.clunck and add Text Editor as the default editor.
Sadly you can't use *.* here.
This issue with file associations is something that has always annoyed me with Eclipse. It is specially frustrating if you are trying to use Eclipse to edit files that don't have a file extension because then you can't even set a editor.
I searched over the Eclipse bug database and found my exact issue there. It was first reported in 2003 and up until now there is no solution for it. If you follow the long comment track over the years you will see that there is no way of setting a default editor for unknown file types. From what I gathered the problem boils down to eclipse not looking at the content of file to try to determine the type. Instead it fully depends on the file extension.
Some people have made suggestions for fixes but again nothing has come out of that. If you search the bug tracker DB you will find a lot more bugs created around this.
A clean solution to this is finally implemented in Eclipse.
On the Preferences > General > Editors > File Association page, you can now define an editor selection strategy for unassociated file types.
Source: https://www.eclipse.org/eclipse/news/4.6/platform.php#text-editor-selection-strategy
There is an Eclipse plugin that overrides the default behavior of the platform and opens text file of unknown type in the plain text editor of Eclipse instead in an external editor.
https://github.com/eclipselabs/default-text-editor

NetBeans. Disable error checking underline

How to disable error checking in NetBeans 6.9.1?
It is very annoying to have red line in the source code.
This is similar to NetBeans - Turn off - wavy red underlines - How?, but I want to disable underlines at all, not only when typing.
(It incorrectly parses PHP sources and omits syntax errors.)
Netbeans has a vast array of settings but this might do it. Try changing the drop down labelled "Wave Underlined" to "None":
Update:
Since I don't do PHP development I wasn't originally aware of the PHP plugin for Netbeans. You can find it listed in the plugins (Tools > Plugins) for Netbeans and should provide a much better environment for PHP work, with, I'm assuming, better PHP parsing and syntax highligting.
I would just click on the hint on the left side by the line numbers, it should create a pop-up, while that's still up click on the hint again. Now another pop-up will be there asking if you want to turn off the error check for either that single file, or for all files. Choose for that file, b/c it should be off by default.
I have no 6.9 at hands, but in 7.x (and believe so, for some time)
go to Options->Editor->Hints-> and uncheck
[ ] CSS (all those rules together)
[ ] HTML Validator (ditto)
Did the trick for me, when working with proprietary template files, 'coincidentally' named .html ...

How does Eclipse do code completion specific to third-party frameworks?

How does the Eclipse editor work to enable code completion? For example, within the XML editor for Hibernate property files, if I ctrl-space within a tag, a list of possible value relevant to hibernate will show up.
I understand that the XML editor is pre-configured to understand xml tag, but how about tag specific to a particular framework? How does Eclipse know about that?
I believe that the eclipse XML editor gets the content assist information from any referenced DTDs, or XMLSchema information it associates with the XML file. Try this experiment: Remove the DOCTYPE entry at the beginning of the file and see if content assist still works.
If you're interested in writing your own content assistants, you may want to start by reading the following:
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_contentassist.htm
In a nutshell, like most things in Eclipse, this is a platform hook. When you press the button, it queries all the registered assistants (I'm simplifying here), and they provide suggestions based on the current element or even the current content.
When writing a source editor or viewer for a particular language or document type, it is common to provide at least some rudimentary content assistants.
Removed the DOCTYPE entry at the beginning of the file and im now able to see the commands while typing ctrl+space...
To add to Uri's answer, you can define your own editor for your own language with XText as long as you have a simple EBNF grammar language for your DSL (domain specific language).
You will have:
syntax coloring,
model navigation (F3, etc.),
code completion,
outline view, and
code templates.
Here is a solution you can work. Actually I was facing a same problem with struts.xml file. I was not able to produce tags by cntrl+space
what i did was...
go to Preferences...Java...Editor...Content Assist...Advanced
check all the check-boxes ON and press OK.
sometimes the problem persists due to some false alarming in eclipse. If it happens, just delete your xml file and create a new one in same location.
I hope it will help.
I had the same issue while using the struts.xml file.
I got fix when I tried below...
Go to “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “Java Non Types Proposals” are ticked on both the places as shown in the image below then click Apply and OK button:-