[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: question about template (createActions, formatting)

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().getPreferenceStore());
setTemplateStore(TemplateEditorUI.getDefault().getTemplateStore());
setContextTypeRegistry(TemplateEditorUI.getDefault().getContextTypeRegistry());
}



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+++


------------------------------------------------------------------------