[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [cdt-dev] How to auto-indent inserted code
|
You can invoke the action itself programmatically.
Insert the code, selected the range of inserted lines and
trigger the "Correct Indentation" action in the following way:
ITextEditor editor = ...
IAction correctIndent = editor.getAction("Indent");
if (correctIndent != null) {
correctIndent.run();
}
HTH,
Toni
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Tamer
> Sent: Monday, May 31, 2010 7:14 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] How to auto-indent inserted code
>
> Hi,
>
> I am writing a plug-in that inserts code in the active CEditor. I
> would like the inserted code to be indented properly.
>
> The CEditor has a feature to "Correct Indentation". How can I reuse
> this functionality programmatically on the inserted code?
>
> Any pointers would be greatly appreciated.
>
> Best regards,
> Tamer
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>