• Products
  • Download
  • Purchase
  • Support
  • Company
Actipro Software company logo
Twitter Follow Actipro RSS Subscribe (RSS Feed)

The Actipro Blog

Tag Cloud

  • aero
  • blog
  • docking
  • editors
  • gauge
  • intelliprompt
  • navigation
  • propertygrid
  • ribbon
  • shared library
  • silverlight
  • syntaxeditor
  • themes
  • views
  • winforms
  • wpf

Latest Twitter News

November 21, 2011 at 11:14 AM
#WPF Studio 2011.2 is out now! Includes enhanced themes for native WPF conrtols and new SyntaxEditor features. http://t.co/uEMCaGPG

September 26, 2011 at 1:25 PM
If you'd like to see our #WPF / #Silverlight SyntaxEditor code editor control ported to Metro, provide feedback here: http://t.co/xXBNIDTi

September 15, 2011 at 8:31 PM
If you want to see SyntaxEditor eventually show up in Win8's #xaml UI, be sure to add your support to this MS thread: http://t.co/FBjz6TuC

August 15, 2011 at 1:47 PM
New SyntaxEditor IntelliPrompt parameter info feature docs/samples ready for the 2011.2 #WPF and #Silverlight releases. http://t.co/ezoYIjv

August 2, 2011 at 2:40 PM
First look at new automated IntelliPrompt parameter info coming to our C#/VB editor control in #WPF / #Silverlight http://t.co/CUz6O1T

Twitter Follow us on Twitter

Month List

  • 2012
    • February (3)
    • January (2)
  • 2011
    • December (2)
    • November (7)
    • October (2)
    • September (1)
    • August (5)
    • July (3)
    • June (6)
    • May (5)
    • April (8)
    • March (4)
    • February (5)
    • January (9)
  • 2010
    • December (9)
    • November (10)
    • October (4)
    • September (8)
    • August (12)
    • July (9)
    • June (7)
    • May (6)
    • April (7)
    • March (6)
    • February (6)
    • January (4)
  • 2009
    • December (2)
    • November (2)
    • October (12)
    • September (3)
    • August (11)
    • July (10)
    • June (6)
    • May (3)
    • April (7)
    • March (6)
    • February (8)
    • January (10)
  • 2008
    • December (10)
    • November (2)
    • October (3)
    • September (5)
    • August (5)
    • July (8)
    • June (4)
    • May (4)
    • April (10)
    • March (8)
    • February (1)
    • January (2)

Category List

  • RSS feed for ActiproActipro (289)
  • RSS feed for Blog SummaryBlog Summary (13)
  • RSS feed for GeneralGeneral (34)
  • RSS feed for In developmentIn development (150)
  • RSS feed for New featuresNew features (140)
  • RSS feed for New productNew product (30)
  • RSS feed for PromotionPromotion (2)
  • RSS feed for SilverlightSilverlight (71)
  • RSS feed for Tips and tricksTips and tricks (4)
  • RSS feed for Visual Studio 2008Visual Studio 2008 (2)
  • RSS feed for Windows FormsWindows Forms (20)
  • RSS feed for Windows VistaWindows Vista (10)
  • RSS feed for WPFWPF (235)
  • RSS feed for XAMLXAML (23)

About Us

Actipro Software is a leading provider of .NET user interface controls for the WPF, Silverlight, and WinForms frameworks, and is most well-known for their SyntaxEditor syntax-highlighting code editor control.

Please take some time to learn more about us and our product offerings.

SyntaxEditor for WPF Language Designer enhancements (part 7)

October 13, 2009 at 6:24 AM
by Bill Henning (Actipro)

In the previous post of this series we built the language project in the Language Designer, found that there was an error, and resolved the error.  Now that all the errors have been eliminated, we are ready to generate code.

Code generation configuration pane

The code generation configuration pane has fields where we can enter the namespace in which any generated C#/VB code will be placed, along with the output folder in which files are to be created.

There also is an option to output a language definition (.langdef) file instead of C#/VB code files.

For today’s post we’ll output C# code files.  Incidentally the Options tab has buttons that let you select the output language for code files.

CodeGen1 

This pane also shows the list of files that can be generated for our language.  With just several minutes of work seen in our previous steps, our ECMAScript language project already has six classes that can be generated.

Let’s take a look at a couple of them. 

The EcmaScriptSyntaxLanguage class

The EcmaScriptSyntaxLanguage is a class that inherits SyntaxLanguage and is what you would create an instance of in your application.  Once you generate all the files to your hard drive and include them in your project, your language is ready for use with this sort of code:

   1: editor.Document.Language = new EcmaScriptSyntaxLanguage();

Pretty easy, isn’t it? 

To see what code is generated for this class, we’ll use the Preview Selected feature:

CodeGen2

The code is generated on the fly and opened in a new document window with full syntax highlighting.  Note how clean and concise code is written, and how all code is fully commented so that you know what it is doing.  Your creator and copyright information (indicated in the General Properties pane) is also inserted in the summary comments of each class generated.

This constructor code auto-registers all the services that have been created in the Language Designer such as a lexer, token classifier factory, and example text provider.  More service support will be added in the future as well.

The EcmaScriptLexer class

Next, let’s look at the lexer class that is generated and registered as a service in EcmaScriptSyntaxLanguage.  The lexer implements the ILexer interface.

CodeGen3

In its constructor it proceeds to build a dynamic lexer via code.  The dynamic lexer contains all the states and patterns we previously created using the New Dynamic Lexer Wizard and then later modified using the Lexer pane in the Language Designer.

Some SyntaxEditor 4.0 for WinForms veterans may be wondering what happened to the XML definitions for dynamic lexers.  Well those are still available via the checkbox option to generate a language definition file instead of code files.

Generating code to disk

To generate this code to disk, we simply click the Generate All button back on the code generation configuration pane.  All the files are written to disk and can be included in your project for immediate use.

The classes are all partial classes so that they can be extended in other files without worry of your enhancements being overwritten the next time you generate code.

Next steps

In the next post, we’ll select the option to generate a language definition instead of code files and will see how to load it at run-time.

Tags: wpf, syntaxeditor
Filed under: Actipro, In development, WPF
Submit to DotNetKicks...
Permalink | Comments (1)

Related posts

SyntaxEditor for WPF Language Designer enhancements (part 1)Many customers of our WinForms and WPF SyntaxEditor controls have asked for an easy way to get start...SyntaxEditor for WPF Language Designer enhancements (part 2)This post is the second post in our series on upcoming enhancements to the SyntaxEditor for WPF Lang...SyntaxEditor for WPF Language Designer enhancements (part 3)In the previous post of this series we started the Language Designer and entered some high-level gen...

Comments

January 1, 2010 at 22:48  

trackback

Actipro Blog 2009 Q4 posting summary

Actipro Blog 2009 Q4 posting summary

The Actipro Blog - WPF and WinForms Development

Comments are closed
Copyright © 1999-2012 Actipro Software LLC. All rights reserved.
Home Actipro Software | Products | Download | Contact Us