Home » Eclipse Projects » Eclipse Platform » question about template (createActions, formatting)
question about template (createActions, formatting) [message #328209] |
Sun, 18 May 2008 05:24  |
Eclipse User |
|
|
|
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 #328234 is a reply to message #328218] |
Mon, 19 May 2008 12:08   |
Eclipse User |
|
|
|
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 02:51   |
Eclipse User |
|
|
|
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 08:19   |
Eclipse User |
|
|
|
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 11:52  |
Eclipse User |
|
|
|
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+++
>>>>>
>>>>>
>>>>> ------------------------------------------------------------ ------------
>>>>>
|
|
|
Goto Forum:
Current Time: Fri May 09 01:09:07 EDT 2025
Powered by FUDForum. Page generated in 0.04614 seconds
|