Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » question about template (createActions, formatting)
question about template (createActions, formatting) [message #328209] Sun, 18 May 2008 09:24 Go to next message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
hello world,

I finally found how to create template (not without pain) but some
questions are mistic for me.

template work more or less but the biggest prob is
when I put CTRL+SPACE, and I put a template like that by example

FOR IN DO

END;

he is not formated and I have something like that
BEGIN
FOR IN DO
END;
etc...
tis is a very big problem


why in the editorclass (inherit from TextEditor)
I have to overight the createActions method what is this method exacly
(in the case of template)

protected void createActions() {
super.createActions();

IAction action = new ContentAssistAction(new EmptyResourceBundle(),
"ContentAssistProposal.", this);

action.setActionDefinitionId(ITextEditorActionDefinitionIds. CONTENT_ASSIST_PROPOSALS);
setAction("ContentAssistProposal", action);
markAsStateDependentAction("ContentAssistProposal", true);
}

it's very confusing?
and why the template box in java editor is wwhite and the template box I
implemented is yellow this is very funny??

thanks to all

a+++


------------------------------------------------------------ ------------
Re: question about template (createActions, formatting) [message #328218 is a reply to message #328209] Mon, 19 May 2008 08:48 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
julien wrote:
> hello world,
>
> I finally found how to create template (not without pain) but some
> questions are mistic for me.
>
> template work more or less but the biggest prob is
> when I put CTRL+SPACE, and I put a template like that by example
>
> FOR IN DO
>
> END;
>
> he is not formated and I have something like that
> BEGIN
> FOR IN DO
> END;
> etc...
> tis is a very big problem
>
>
> why in the editorclass (inherit from TextEditor)
> I have to overight the createActions method what is this method exacly
> (in the case of template)
>
> protected void createActions() {
> super.createActions();
>
> IAction action = new ContentAssistAction(new
> EmptyResourceBundle(), "ContentAssistProposal.", this);
>
> action.setActionDefinitionId(ITextEditorActionDefinitionIds. CONTENT_ASSIST_PROPOSALS);
>
> setAction("ContentAssistProposal", action);
> markAsStateDependentAction("ContentAssistProposal", true);
> }
>
> it's very confusing?
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=138370.
> and why the template box in java editor is wwhite and the template box
> I implemented is yellow this is very funny??
Try 3.4 RC1 and you should be fine regarding the color.

Dani
>
> thanks to all
>
> a+++
>
>
> ------------------------------------------------------------ ------------
Re: question about template (createActions, formatting) [message #328234 is a reply to message #328218] Mon, 19 May 2008 16:08 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
thanks,

I have to say,

I found in TemplatePreferencePage two function,

protected boolean isShowFormatterSetting() {
return true;
}

protected String getFormatterPreferenceKey() {
return super.getFormatterPreferenceKey();
}

my problem is with the getFormatterPreferenceKey
in example I found, I have no idea what I have to return.

in my sourceViewerConfiguration,
the autoeditStrategies is

public IAutoEditStrategy[] getAutoEditStrategies(
ISourceViewer sourceViewer, String contentType) {
return new IAutoEditStrategy[] {new
DefaultIndentLineAutoEditStrategy()};
}


but how to link both??

thanks for all

a++


Daniel Megert a écrit :
> julien wrote:
>> hello world,
>>
>> I finally found how to create template (not without pain) but some
>> questions are mistic for me.
>>
>> template work more or less but the biggest prob is
>> when I put CTRL+SPACE, and I put a template like that by example
>>
>> FOR IN DO
>>
>> END;
>>
>> he is not formated and I have something like that
>> BEGIN
>> FOR IN DO
>> END; etc...
>> tis is a very big problem
>>
>>
>> why in the editorclass (inherit from TextEditor)
>> I have to overight the createActions method what is this method exacly
>> (in the case of template)
>>
>> protected void createActions() {
>> super.createActions();
>>
>> IAction action = new ContentAssistAction(new
>> EmptyResourceBundle(), "ContentAssistProposal.", this);
>>
>> action.setActionDefinitionId(ITextEditorActionDefinitionIds. CONTENT_ASSIST_PROPOSALS);
>>
>> setAction("ContentAssistProposal", action);
>> markAsStateDependentAction("ContentAssistProposal", true);
>> }
>>
>> it's very confusing?
> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=138370.
>> and why the template box in java editor is wwhite and the template box
>> I implemented is yellow this is very funny??
> Try 3.4 RC1 and you should be fine regarding the color.
>
> Dani
>>
>> thanks to all
>>
>> a+++
>>
>>
>> ------------------------------------------------------------ ------------
Re: question about template (createActions, formatting) [message #328411 is a reply to message #328234] Sat, 24 May 2008 06:51 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
julien wrote:
> thanks,
>
> I have to say,
>
> I found in TemplatePreferencePage two function,
>
> protected boolean isShowFormatterSetting() {
> return true;
> }
>
> protected String getFormatterPreferenceKey() {
> return super.getFormatterPreferenceKey();
> }
>
> my problem is with the getFormatterPreferenceKey
> in example I found, I have no idea what I have to return.
Simply a key that is used to store and read that preferences.

Dani
>
> in my sourceViewerConfiguration,
> the autoeditStrategies is
>
> public IAutoEditStrategy[] getAutoEditStrategies(
> ISourceViewer sourceViewer, String contentType) {
> return new IAutoEditStrategy[] {new
> DefaultIndentLineAutoEditStrategy()};
> }
>
>
> but how to link both??
>
> thanks for all
>
> a++
>
>
> Daniel Megert a écrit :
>> julien wrote:
>>> hello world,
>>>
>>> I finally found how to create template (not without pain) but some
>>> questions are mistic for me.
>>>
>>> template work more or less but the biggest prob is
>>> when I put CTRL+SPACE, and I put a template like that by example
>>>
>>> FOR IN DO
>>>
>>> END;
>>>
>>> he is not formated and I have something like that
>>> BEGIN
>>> FOR IN DO
>>> END; etc...
>>> tis is a very big problem
>>>
>>>
>>> why in the editorclass (inherit from TextEditor)
>>> I have to overight the createActions method what is this method
>>> exacly (in the case of template)
>>>
>>> protected void createActions() {
>>> super.createActions();
>>>
>>> IAction action = new ContentAssistAction(new
>>> EmptyResourceBundle(), "ContentAssistProposal.", this);
>>>
>>> action.setActionDefinitionId(ITextEditorActionDefinitionIds. CONTENT_ASSIST_PROPOSALS);
>>>
>>> setAction("ContentAssistProposal", action);
>>> markAsStateDependentAction("ContentAssistProposal", true);
>>> }
>>>
>>> it's very confusing?
>> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=138370.
>>> and why the template box in java editor is wwhite and the template
>>> box I implemented is yellow this is very funny??
>> Try 3.4 RC1 and you should be fine regarding the color.
>>
>> Dani
>>>
>>> thanks to all
>>>
>>> a+++
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
Re: question about template (createActions, formatting) [message #328425 is a reply to message #328411] Sat, 24 May 2008 12:19 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
Daniel Megert a écrit :
> julien wrote:
>> thanks,
>>
>> I have to say,
>>
>> I found in TemplatePreferencePage two function,
>>
>> protected boolean isShowFormatterSetting() {
>> return true;
>> }
>> protected String getFormatterPreferenceKey() {
>> return super.getFormatterPreferenceKey();
>> }
>>
>> my problem is with the getFormatterPreferenceKey
>> in example I found, I have no idea what I have to return.
> Simply a key that is used to store and read that preferences.

heu...
this is my template preference class with his constructor

public class YaflPlugTemplate extends TemplatePreferencePage implements
IWorkbenchPreferencePage {

public YaflPlugTemplate() {
setPreferenceStore(TemplateEditorUI.getDefault().getPreferen ceStore());
setTemplateStore(TemplateEditorUI.getDefault().getTemplateSt ore());

setContextTypeRegistry(TemplateEditorUI.getDefault().getCont extTypeRegistry());
}


and this is my templateStore creation (I took that from google code search

public TemplateStore getTemplateStore() {
if (fStore == null) {
fStore= new ContributionTemplateStore(getContextTypeRegistry(),
Activator.getDefault().getPreferenceStore(), CUSTOM_TEMPLATES_KEY);
fStore.load();
return fStore;
}


is it CUSTOM_TEMPLATES_KEY that getformater preference key has to
return?? cause that doesn't work so?? or is a other thing (but I hav'nt
other constant like that)

thanks

a++


>
> Dani
>>
>> in my sourceViewerConfiguration,
>> the autoeditStrategies is
>>
>> public IAutoEditStrategy[] getAutoEditStrategies(
>> ISourceViewer sourceViewer, String contentType) {
>> return new IAutoEditStrategy[] {new
>> DefaultIndentLineAutoEditStrategy()}; }
>>
>>
>> but how to link both??
>>
>> thanks for all
>>
>> a++
>>
>>
>> Daniel Megert a écrit :
>>> julien wrote:
>>>> hello world,
>>>>
>>>> I finally found how to create template (not without pain) but some
>>>> questions are mistic for me.
>>>>
>>>> template work more or less but the biggest prob is
>>>> when I put CTRL+SPACE, and I put a template like that by example
>>>>
>>>> FOR IN DO
>>>>
>>>> END;
>>>>
>>>> he is not formated and I have something like that
>>>> BEGIN
>>>> FOR IN DO
>>>> END; etc...
>>>> tis is a very big problem
>>>>
>>>>
>>>> why in the editorclass (inherit from TextEditor)
>>>> I have to overight the createActions method what is this method
>>>> exacly (in the case of template)
>>>>
>>>> protected void createActions() {
>>>> super.createActions();
>>>>
>>>> IAction action = new ContentAssistAction(new
>>>> EmptyResourceBundle(), "ContentAssistProposal.", this);
>>>>
>>>> action.setActionDefinitionId(ITextEditorActionDefinitionIds. CONTENT_ASSIST_PROPOSALS);
>>>>
>>>> setAction("ContentAssistProposal", action);
>>>> markAsStateDependentAction("ContentAssistProposal", true);
>>>> }
>>>>
>>>> it's very confusing?
>>> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=138370.
>>>> and why the template box in java editor is wwhite and the template
>>>> box I implemented is yellow this is very funny??
>>> Try 3.4 RC1 and you should be fine regarding the color.
>>>
>>> Dani
>>>>
>>>> thanks to all
>>>>
>>>> a+++
>>>>
>>>>
>>>> ------------------------------------------------------------ ------------
>>>>
Re: question about template (createActions, formatting) [message #328435 is a reply to message #328425] Sat, 24 May 2008 15:52 Go to previous message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
in fact, I ve just remark that the preferencepage is not saved. if I
fill the use code formatter ... and after a apply and after a ok and I
return in the template format page. nothing is saved (the use code
foramtter is empty).

a++

julien a écrit :
> Daniel Megert a écrit :
>> julien wrote:
>>> thanks,
>>>
>>> I have to say,
>>>
>>> I found in TemplatePreferencePage two function,
>>>
>>> protected boolean isShowFormatterSetting() {
>>> return true;
>>> }
>>> protected String getFormatterPreferenceKey() {
>>> return super.getFormatterPreferenceKey();
>>> }
>>>
>>> my problem is with the getFormatterPreferenceKey
>>> in example I found, I have no idea what I have to return.
>> Simply a key that is used to store and read that preferences.
>
> heu...
> this is my template preference class with his constructor
>
> public class YaflPlugTemplate extends TemplatePreferencePage implements
> IWorkbenchPreferencePage {
>
> public YaflPlugTemplate() {
> setPreferenceStore(TemplateEditorUI.getDefault().getPreferen ceStore());
> setTemplateStore(TemplateEditorUI.getDefault().getTemplateSt ore());
>
> setContextTypeRegistry(TemplateEditorUI.getDefault().getCont extTypeRegistry());
>
> }
>
>
> and this is my templateStore creation (I took that from google code search
>
> public TemplateStore getTemplateStore() {
> if (fStore == null) {
> fStore= new
> ContributionTemplateStore(getContextTypeRegistry(),
> Activator.getDefault().getPreferenceStore(), CUSTOM_TEMPLATES_KEY);
> fStore.load();
> return fStore;
> }
>
>
> is it CUSTOM_TEMPLATES_KEY that getformater preference key has to
> return?? cause that doesn't work so?? or is a other thing (but I hav'nt
> other constant like that)
>
> thanks
>
> a++
>
>
>>
>> Dani
>>>
>>> in my sourceViewerConfiguration,
>>> the autoeditStrategies is
>>>
>>> public IAutoEditStrategy[] getAutoEditStrategies(
>>> ISourceViewer sourceViewer, String contentType) {
>>> return new IAutoEditStrategy[] {new
>>> DefaultIndentLineAutoEditStrategy()}; }
>>>
>>>
>>> but how to link both??
>>>
>>> thanks for all
>>>
>>> a++
>>>
>>>
>>> Daniel Megert a écrit :
>>>> julien wrote:
>>>>> hello world,
>>>>>
>>>>> I finally found how to create template (not without pain) but some
>>>>> questions are mistic for me.
>>>>>
>>>>> template work more or less but the biggest prob is
>>>>> when I put CTRL+SPACE, and I put a template like that by example
>>>>>
>>>>> FOR IN DO
>>>>>
>>>>> END;
>>>>>
>>>>> he is not formated and I have something like that
>>>>> BEGIN
>>>>> FOR IN DO
>>>>> END; etc...
>>>>> tis is a very big problem
>>>>>
>>>>>
>>>>> why in the editorclass (inherit from TextEditor)
>>>>> I have to overight the createActions method what is this method
>>>>> exacly (in the case of template)
>>>>>
>>>>> protected void createActions() {
>>>>> super.createActions();
>>>>>
>>>>> IAction action = new ContentAssistAction(new
>>>>> EmptyResourceBundle(), "ContentAssistProposal.", this);
>>>>>
>>>>> action.setActionDefinitionId(ITextEditorActionDefinitionIds. CONTENT_ASSIST_PROPOSALS);
>>>>>
>>>>> setAction("ContentAssistProposal", action);
>>>>> markAsStateDependentAction("ContentAssistProposal", true);
>>>>> }
>>>>>
>>>>> it's very confusing?
>>>> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=138370.
>>>>> and why the template box in java editor is wwhite and the template
>>>>> box I implemented is yellow this is very funny??
>>>> Try 3.4 RC1 and you should be fine regarding the color.
>>>>
>>>> Dani
>>>>>
>>>>> thanks to all
>>>>>
>>>>> a+++
>>>>>
>>>>>
>>>>> ------------------------------------------------------------ ------------
>>>>>
Previous Topic:developing an IDE
Next Topic:Wizard Initialization Problem
Goto Forum:
  


Current Time: Sun Jul 07 03:10:10 GMT 2024

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

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

Back to the top