Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to use java syntax coloring for non java files
How to use java syntax coloring for non java files [message #336442] Thu, 11 June 2009 15:55
Eclipse User
Originally posted by:


I open a java source without extension, how programmatically to make the
editor highlight syntax? I don't want to register any extensions in
preferences. I need to do that programmatically for any extension.

My code for opening a file:

// Get id of java editor
String editorId =
PlatformUI.getWorkbench().getEditorRegistry().getDefaultEdit or(
"" ).getId( );
// Open a file
ITextEditor editor = ( ITextEditor ) IDE.openEditor( page,
fileToOpen.toURI( ), editorId, true );

Thanks in advance,
Sergey Klimov
Previous Topic:Commands and Toolbar and Toggle style buttons?
Next Topic:How to be notified of an editor being dragged and dropped
Goto Forum:

Current Time: Fri Aug 22 19:42:03 EDT 2014

Powered by FUDForum. Page generated in 0.08541 seconds