Quick way to set custom syntax highlighting in Eclipse - eclipse

I know I'm not the first to need this. I am working on an in house created codebase and I would like to apply highlighting to it within Eclipse. In Notepad++ I can set language for the file I'm looking at. Is there any way to do this for Eclipse?
The code I'm working on would use the same syntax styling as C++.

Your best bet is to go to Preferences -> General -> Editors -> File associations. Add the file extension of the thing you are trying to open and add the C++ editor as the associated default editor.
If there is no file extension, then things are a little harder. Instead of double-clicking to open the file, right-click -> Open with... -> other -> C++ editor. This will remember your choice for that file only.

As Andrew Eisenberg said, go to Window --> Preferences --> General --> Editors --> File Associations and ensure your choices for editor for each file type are correct according to your desires.
However, for Eclipse CDT most of your file types are set in Preferences --> C/C++ --> File Types instead.
Also, like he said, you can use the right-click menu to choose your own editor, including an external system editor, such as Sublime Text 3, Atom, Visual Studio Code, Notepad++, etc.
Right click on the file --> Open With --> Other... --> choose an "Internal editor" or "External program" to your liking, optionally checking the box at the bottom to make this the default choice next time.

Related

How to indent any XML files with two spaces (instead of tab) in Eclipse

I know how to indent any Java files by using the "Source", "Correct
indentation" Menu.
How to indent any XML files with two spaces (instead of tab)?
When I am editing a java file, in the java perspective, the Source menu appear, but when
I change to an XML file in the same perspective, the Source menu disappear so I
don't know how to indent it.
I use the latest Eclipse for Windows 8.1.
Format XML code in Eclipse
This link seems to help - eclipse lets you autoformat code using Ctrl+Shift+F and you should be able to customise what the autoformat will actually do in Window -> Preferences -> XML -> XML Files -> Editor.

Changing default XML editor in Eclipse

Eclipse hangs when working with XML's ..
the default editor is too slow and gives lot problem
I read, it works fine if we change the editor so how to remove existing editor ??
You can customize them: Window -> Preferences -> General -> Editors -> File Associations
There, you'll have to either select a file extension,
or add one to the list and choose what editor eclipse should use
to open it with whenever it's needed.
To just open the file once,
Right Click - Open With
To change association,
Windows - Preferences - General - Editors - File Associations

Getting Eclipse to open .html in text-editor by default?

Eclipse Juno keeps opening my HTML files in a embedded web-browser, rather than in an embedded syntax-highlighting editor.
I have installed:
Web Page Editor
Eclipse Web Developer Tools
PyDev for Eclipse
Specifically see the screenshot of my install applications.
I need it to work with Django templates + any other Python templates with HTML + normal HTML+JS files.
How do I find this editor, and select it as default?
Select Window -> Preferences from the main Eclipse menu.
Select General -> Editors -> File Associations from the Preferences menu.
For .htm and .html, left click on the extension in the upper view. Left click on the Add button to the right of the lower view to add one or more HTML editors. Left click on your favorite HTML editor and left click on the Default button to make it the default editor.
If the extension you want is missing, left click on the Add button to the right of the upper view to add the extension.
If you want to add an HTML editor to Eclipse:
Go to Help -> Install New Software
Choose the site http://download.eclipse.org/releases/your_eclipse_version
Type the filter text Web Page Editor
There should be one result. Check off the box and press the Finish button.
Now you should have the option to choose the HTML editor when opening files by right-clicking, Open With -> HTML Editor.
If you want to always use the HTML editor to open HTML files then go to the Eclipse preferences -> General -> Editors -> File Associations. Select the extension up top (e.g. *.htm, *.html) then select the HTML editor in the bottom pane and press the Default button.
I had a similar problem.
Once I installed the html editor (thanks to CgodLEY), still my html files wouldnt show up with that editor.
Solution? Right click on the html/htm file, go to "open with" and select "HTML editor". Fortunately that solve everything...
For those still finding their way here, yes, do add an HTML editor to Eclipse as CgodLEY suggests, if you're having this problem. However, even if you already have an HTML editor in your Eclipse installation, consider installing CodeMix for a superlative HTML editing experience - take a look at the differences here.
Now, there's a Django-aware template editor available for free:
http://eclipse.kacprzak.org/
I installed it in Eclipse Kepler / Django 1.6, it's working fine for me.
Note: if you previously opened a specific .HTML file with some other editor, you need to go back to the project view, right click on the .HTML file, select 'open with...' and explicitly select Django editor.
To answer the opening of your question: Note that Eclipse will use the built-in web-browser to view html files if you are opening them outside of a project, as in "File->Open File ...", when that file isn't part of a project.
I just created a dummy project, and now the html files are correctly opened with the editor selected in my preferences. Success!
Nothing worked and I had begun getting an unrelated error on startup with a troubleshooting step requiring reinstall.
This time I downloaded Eclipse for Mobile Developers, and since then I have added my other packages and it's all working fine =).
None of the editors work the way I want them to though, however I have ended up with Django-Editor (which is slightly better than Aptana's one).

How to set default editor tab in Eclipse?

I'm using the HTML editor resp. the Structured Text Editor in Eclipse. It always opens in the tab Visual/Source:
Is it possible to tell Eclipse it should always open this editor in the Source tab?
You seem to use a plugin which associates with HTML files. For example Eclipse normally loads XML files for the first time with Design tab, and once you switch to source tab, it remembers the next time to open any document associated with XML Editor in Source tab. I don't know remembering is up to Eclipse or up to the plugin associated with the file, but a quick workaround would be:
to right click on the HTML file in package explorer > Open With > choose another editor (e.g. text editor). This only associates with current file. If you want to change file association for all HTMLs:
goto Preferences (under menu Window) > General > Editor > File Associations and change HTML file association there.
In Eclipse goto Windows-->Preferences-->Type Editors change the associated editors for File Types after that click on OK
You didn't say what version of Eclipse you're using. My HTML / Structured Text editors didn't have the tabs the same as yours. I'm using 3.4.2.
You can extend that editor by writing your own plug-in for Eclipse. Outside of the 'create a plug-in project' stuff, start by finding the extension points for the target editor. Then your plug-in can just register as an extension and add a new property instead of writing a whole editor. The property should show up on a preference page and then your code can take care of switching the active view of the editor to the 'Source' tab based on that property.
Right click the file and then "open with" and open it in another HTML or texteditor.
And then map this editor as the default editor for this filetype by right clicking the document and setting the file extension.
I always do this to get rid of the memory greedy WYSIWYG editors.

how to make a file to open in a particular editor in eclipse?

I have many types of file in my eclipse workspace, so i want some files to be open in a particular editor. say a war or a jar with winrar. sql with some eql developer, xml,s with xml editor etc how to set that? so that whenever i open them, they should open a assigned editor.
there is an entry in the eclipse preferences that associates file types with editors. You select your file type (e.g *.html) and assign it one of your installed editors.
On Mac OS, the preference you want is:
Preferences -> General -> Editors -> File Associations.
Goto
Window-Preferences
then
General->Editor->fileAssociations navigation
then
select or add the extension in the right top dialog
then click add on the right bottom dialog, select the appropriate application and save :-)
You want to add an entry in the Preferences for General->Editors->File Associations.