Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » syntax coloring in editTemplateDialog
syntax coloring in editTemplateDialog [message #264400] Thu, 29 July 2004 07:43 Go to next message
Eclipse UserFriend
I'm developping a template for my editor,
when the user want to add new templates i want to have syntax coloring in
the edit Dialog of template
I need to override the createViewer from EditTemplateDialog but this class
is a private class ( not visible from my package )

How can I do it?



extracted from class
org.eclipse.ui.texteditor.templates.EditTemplateDialog :

/**
* Dialog to edit a template. Clients will usually instantiate, but may
also
* may
* extend.
* @since 3.0
*/
class EditTemplateDialog extends StatusDialog {

...
...
/**
* Creates the viewer to be used to display the pattern. Subclasses may
* override.
* @param parent the parent composite of the viewer
* @return a configured <code>SourceViewer</code>
*/

protected SourceViewer createViewer(Composite parent) {
SourceViewer viewer= new SourceViewer(parent, null, null, false,
SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);

SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

ContentAssistant assistant= new ContentAssistant();
assistant.enableAutoActivation(true);
assistant.enableAutoInsert(true);
assistant.setContentAssistProcessor(fTemplateProcessor,
IDocument.DEFAULT_CONTENT_TYPE);
return assistant;
}
};
viewer.configure(configuration);
return viewer;
}



The only solution i have is to copy class file (+StatusDialog because it's
also a private class) in my project and set the class as a public class.

Maybe Eclipse developpers can set this class as a public for next release.
Re: syntax coloring in editTemplateDialog [message #264421 is a reply to message #264400] Thu, 29 July 2004 09:46 Go to previous message
Eclipse UserFriend
Create your own Dialog for editing templates and return it from
createTemplateEditDialog in your subclass of TemplatePreferencePage.

You can copy the existing version of EditTemplateDialog as base for your
custom implementation - the fact that it is package visible only means
that it is not API and may change without migration path. But if you
maintain your own copy, all is fine.

HTH, tom

LIM Erwin wrote:
> I'm developping a template for my editor,
> when the user want to add new templates i want to have syntax coloring in
> the edit Dialog of template
> I need to override the createViewer from EditTemplateDialog but this class
> is a private class ( not visible from my package )
>
> How can I do it?
>
>
>
> extracted from class
> org.eclipse.ui.texteditor.templates.EditTemplateDialog :
>
> /**
> * Dialog to edit a template. Clients will usually instantiate, but may
> also
> * may
> * extend.
> * @since 3.0
> */
> class EditTemplateDialog extends StatusDialog {
>
> ...
> ...
> /**
> * Creates the viewer to be used to display the pattern. Subclasses may
> * override.
> * @param parent the parent composite of the viewer
> * @return a configured <code>SourceViewer</code>
> */
>
> protected SourceViewer createViewer(Composite parent) {
> SourceViewer viewer= new SourceViewer(parent, null, null, false,
> SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
>
> SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
> public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
>
> ContentAssistant assistant= new ContentAssistant();
> assistant.enableAutoActivation(true);
> assistant.enableAutoInsert(true);
> assistant.setContentAssistProcessor(fTemplateProcessor,
> IDocument.DEFAULT_CONTENT_TYPE);
> return assistant;
> }
> };
> viewer.configure(configuration);
> return viewer;
> }
>
>
>
> The only solution i have is to copy class file (+StatusDialog because it's
> also a private class) in my project and set the class as a public class.
>
> Maybe Eclipse developpers can set this class as a public for next release.
>
>
Previous Topic:No of test in Eclipsse UI Tests varies for platform
Next Topic:Setting branding for Eclipse 3.0 help systems
Goto Forum:
  


Current Time: Mon May 12 22:14:51 EDT 2025

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

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

Back to the top