How to enable syntax highlighting in Eclipse Indigo? - java

How to enable syntax highlighting in Eclipe Indigo? I write in Java. I installed this plugins for more comfortable usage on small screens, but even if I turn it off - all the words in editor are black:(

You may set your coloring preferences by
Window->Preferences-> Java->Editor->Syntax Coloring

Make sure you are using the Java perspective (or Java EE) as well. You should be able to see the name of the active perspective and/or editor in the title bar.
To be 100% sure, you can always right click on the file in question and Open With->Java Editor to ensure that it is the Java editor that is open for your file.

Eclipse remembers which editor you last used to open a file and keeps opening it with that editor, even if you've installed a better one later. Right-click on the file and force it to open with the Java Editor using the "Open With..." menu. If you're not getting any coloring at all, you might just be using the wrong editor.

Related

Netbeans why does some text appear bold in roboticket?

i downloaded the xml file for roboticket from http://www.eclipsecolorthemes.org/, then i went to the http://svenspruijt.nl/themebuilder/ imported this xml file and saved it as a zip. then i imported this zip file in my eclipse. But some text appears to be lighter than usual (like function calls). so it is the same theme but why different appearances in different IDEs? I even checked in preferences fonts and colors tab -> syntax tab -> in language list java, went off each item and made sure it doesn't have anything bold in it
Possibly a bug but a quick workaround would be turning everything that appears light to bold. Now it looks much more like eclipse and of even thickness. Still unsure whether those semicolons are bold or not

Is it possible to override default code formatt of Eclipse

I have java code style formatter of Eclipse (for that matter it can be formatter of the other language also). When I import he format then it is saved in the workspace and that is applicable for that workspace.
I want code format/style imported and saved in the Eclipse setting itself so that this Eclipse used by anyone gets the format whatever workspace they use.
Is it possible to override the default format? Do I have to write my own plugin?
Thanks,
I can suggest the following in the Java perspective, Eclipse version Indigo...
click Window -> Preferences
expand Java -> Code Style
click Formatter
This will get you to the Formatter screen below. Follow the link on the top right
and see if this provides you with what you are requesting.
Configure Project Specific Settings screen
I wanted settings to be present in the eclipse packaging itself so that these settings (code format, template, spacing strategy etc.) are not repeated at every project and workspace level.
I got a way (at least it works on Linux with neon version). Here are the steps
Open eclipse with some workspace location
Apply all the settings like code formatting, template, Editor
preferences and all other preferred settings present in Window ->
Preferences Press OK. it will save the preferences.
Go to File -> Export -> General -> Preferences and press Next
Make sure Export all is checked and then provide the To
Preference File location and then Click Finish
Now open the exported file in you favorite editor
You will observe it is like a properties file with each property prefixed with /instance/ or /configuration/ (these are preference scopes). Remove all these prefixes (after that all the properties will look like org.* or net.* etc.). You will also see some workspace path related properties are present in this file, either remove them or change to appropriate one.
Save this file with some name say my-eclipse-preference.epf and copy
this file to your eclipse location (where eclipse start file is
present, say ECLIPSE_HOME)
Open $ECLIPSE_HOME/configuration/config.ini and add a line with
the property puluginCoustomization=my-eclipse-preference.epf at the end and save config.ini.
Restart the eclipse, you will find your settings are present even if you open with empty/new workspace. If you are starting from terminal then got to
the ECLIPSE_HOME directory first and then start.
If you want to start from the terminal but you want to avoid going
to the directory to start (i.e. starting from any location) then you should store the file my-eclipse-preference.epf at some standard location and have the value of puluginCoustomization with full path in config.ini.
Hope this helps.

Eclipse automatically opening some files in system editor

Was finding this problem with Eclipse(Kepler) over the last week, so downloaded Eclipse (Luna) and checked out the relevent project into an entirely new workspace.
I'm using *.str files for a particular project (they are standard editor files anyway - short for 'string'). But Eclipse wants to open such files as macVim files:
I have NO file associations set for *.str files:
...althought I do use macVim to open them in the underlying operating system. So I change the system editor to TextEdit and Eclipse happily now wants them to open in TextEdit - but I want to open them in the eclipse editor! (appart from anything else, I've got to develop an editor plugin for *.str files.
How can I convince Eclipse that it can open *.str in it's own editors without having to resort to the system editor?
EDIT - follow the answers - my understanding is this. If Eclipse doens't know what the file is, it will ask the system. If you ask it to open in a particular editor it will overlay that information on that particular file, and to make it happen in general (and change the icon) you need to add a file association.
You can add a a File Associations for '*.str' and set the Associated Editor to 'Text Editor'. Eclipse will use this for files that you have not yet opened.
For files that you have already opened Eclipse will be remembering the editor you last used, so for these right click on the file and use 'Open With > Text Editor'. You should only have to do this once.
Right click on the file, select open with, and there should be three options (Text Editor/System Editor/Default). Selecting text editor should associate it with eclipse (from within eclipse only) in future.

show the swt tabs on java file

I'm new to Eclipse and SWT, just found that WindowBuilder is a good tool for UI design.
However, when I download the sample Phonebook and opened it, it doesn't show the normal
Source | Design | Bindings
tabs at the bottom of the file. The file was treated as a normal java file. Is there anything I can do to let them show as they are when I create an SWT designer file?
Right-click on the Java file and choose Open with... to select the WindowBuilder editor.
if the file is not appearing in the windowbuilder then there is somehting wrong with the content of file and windowbuilder is unable to parse the file. I would suggest you to create a new file and view in the window builder.

How get a list of all open files in Eclipse editors?

In my RCP application is editor, almost like in Eclipse. Class editor extends from org.eclipse.ui.texteditor.AbstractTextEditor and it is added in extension in plugin.xml -> org.eclipse.ui.editors. I would like to do view which contains open in editor files. The question is, how do I get a list of all open files?
Screen shot:
I haven't tested it, but you should be able to get it starting from the PlatformUI class.
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()
In your workspace the following file contains your workbench information:
.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml
It is possible to delete it (or edit it but that requires some fiddling around I suppose) without breaking your workspace, the file gets regenerated by Eclipse. When you delete it all workbench related settings are lost (ie all editors are closed), but your projects of that workspace stay intact.
from that you can get the list of file..

Categories