Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » [HELP] add template formatting in javaeditor exemple(always)
[HELP] add template formatting in javaeditor exemple(always) [message #328500] Mon, 26 May 2008 13:34 Go to next message
Eclipse UserFriend
hi all

always trying to put template formatting (grrrrr, I lost my mind), I
decided to put that on the
java editor example and surprise,... that doesnt work.


What I ve done is

in the TemplatesPreferencePage I added

private String FORMATTER_PREFERENCE_KEY = "my.formatter.preference.key";


protected String getFormatterPreferenceKey() {
return FORMATTER_PREFERENCE_KEY;
}

protected boolean isShowFormatterSetting() {
return true;
}

and that add the button in the preference page (and sauvegarde it). but
that doesn't change anything in the editor.


in the XMLConfiguration I put the following code


public IAutoEditStrategy[] getAutoEditStrategies(
ISourceViewer sourceViewer, String contentType) {

return new IAutoEditStrategy[]{new
DefaultIndentLineAutoEditStrategy() };
}


and that doesn't anything.


in fact, the getAutoEditStrategies serve to nothing. iether the
getAutoEditStrategies is implemented or not, I have the indented line .



So if there any otherthing to implement to get the templtate formatting.

thanks

a+++
Re: [HELP] add template formatting in javaeditor exemple(always) [message #328637 is a reply to message #328500] Thu, 29 May 2008 04:53 Go to previous messageGo to next message
Eclipse UserFriend
julien wrote:
> hi all
>
> always trying to put template formatting (grrrrr, I lost my mind), I
> decided to put that on the
> java editor example and surprise,... that doesnt work.
Surprise. This is only the preference. You have to read that preference
and then do the formatting yourself.

Dani
>
>
> What I ve done is
>
> in the TemplatesPreferencePage I added
>
> private String FORMATTER_PREFERENCE_KEY =
> "my.formatter.preference.key";
>
>
> protected String getFormatterPreferenceKey() {
> return FORMATTER_PREFERENCE_KEY;
> }
>
> protected boolean isShowFormatterSetting() {
> return true;
> }
>
> and that add the button in the preference page (and sauvegarde it).
> but that doesn't change anything in the editor.
>
>
> in the XMLConfiguration I put the following code
>
>
> public IAutoEditStrategy[] getAutoEditStrategies(
> ISourceViewer sourceViewer, String contentType) {
>
> return new IAutoEditStrategy[]{new
> DefaultIndentLineAutoEditStrategy() };
> }
>
>
> and that doesn't anything.
>
>
> in fact, the getAutoEditStrategies serve to nothing. iether the
> getAutoEditStrategies is implemented or not, I have the indented line .
>
>
>
> So if there any otherthing to implement to get the templtate formatting.
>
> thanks
>
> a+++
>
>
>
>
>
>
Re: [HELP] add template formatting in javaeditor exemple(always) [message #328948 is a reply to message #328637] Sat, 07 June 2008 13:26 Go to previous message
Eclipse UserFriend
Daniel Megert a écrit :
> julien wrote:
>> hi all
>>
>> always trying to put template formatting (grrrrr, I lost my mind), I
>> decided to put that on the
>> java editor example and surprise,... that doesnt work.
> Surprise. This is only the preference. You have to read that preference
> and then do the formatting yourself.

sorry for the time response, but make two things in a same time is not a
good idea.

So ok, I have to make the indent myself but where???

I ll suppose I have two do that in the subclasses of
TemplateCompletionProcessor

but is there any methods who do specialy that or have to do that in the

protected Template[] getTemplates(String contextTypeId) {}

..


thnaks

a+++

>
> Dani
>>
>>
>> What I ve done is
>>
>> in the TemplatesPreferencePage I added
>>
>> private String FORMATTER_PREFERENCE_KEY =
>> "my.formatter.preference.key";
>> protected String getFormatterPreferenceKey() {
>> return FORMATTER_PREFERENCE_KEY;
>> }
>>
>> protected boolean isShowFormatterSetting() {
>> return true;
>> }
>>
>> and that add the button in the preference page (and sauvegarde it).
>> but that doesn't change anything in the editor.
>>
>>
>> in the XMLConfiguration I put the following code
>>
>>
>> public IAutoEditStrategy[] getAutoEditStrategies(
>> ISourceViewer sourceViewer, String contentType) {
>> return new
>> IAutoEditStrategy[]{new
>> DefaultIndentLineAutoEditStrategy() };
>> }
>>
>>
>> and that doesn't anything.
>>
>>
>> in fact, the getAutoEditStrategies serve to nothing. iether the
>> getAutoEditStrategies is implemented or not, I have the indented line .
>>
>>
>>
>> So if there any otherthing to implement to get the templtate formatting.
>>
>> thanks
>>
>> a+++
>>
>>
>>
>>
>>
>>
Previous Topic:surcharge the open file
Next Topic:IProjectNature.configure never called when project is created with nature
Goto Forum:
  


Current Time: Thu Mar 13 13:17:41 EDT 2025

Powered by FUDForum. Page generated in 0.03840 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top