Home » Eclipse Projects » Eclipse Platform » question about template (createActions, formatting)
| |
Re: question about template (createActions, formatting) [message #328234 is a reply to message #328218] |
Mon, 19 May 2008 16:08 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
No real name![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=elekis%40gmail.com) 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 message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Dani Megert![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=Daniel_Megert%40ch.ibm.com) 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 message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
No real name![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=elekis%40gmail.com) 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 Go to previous message](theme/Solstice/images/up.png) |
No real name![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=elekis%40gmail.com) 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+++
>>>>>
>>>>>
>>>>> ------------------------------------------------------------ ------------
>>>>>
|
|
|
Goto Forum:
Current Time: Wed Sep 04 17:14:55 GMT 2024
Powered by FUDForum. Page generated in 0.04692 seconds
|