[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Changing color of text in editor

Shane wrote:

Hi everyone,

At the moment I'm using the following code to allow a user to change a highlighted piece of text (in the standard Java editor) to uppercase:

IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
		ISelectionProvider selectionProvider = editor.getSelectionProvider();
	    ITextSelection selection = (ITextSelection) selectionProvider.getSelection();
	    String text = selection.getText();
	    String newText = text.toUpperCase();
document.replace(selection.getOffset(), selection.getLength(), newText);

What i really want to do however, is change the color of the selected text, instead of the case.

When should it change?

Dani

Does anyone know how I might do this?

Cheers.