Archive

Archive for the ‘Plug-in Development’ Category

How to load stored settings from an Options page inside of a plug-in

February 25th, 2011 Comments off

This is the third and the latest part of a topic about adding an options page into your DXCore plug-in. See the other parts, to learn more:

  1. Adding and designing an options page
  2. Implementing the options page settings storing logic
  3. Using settings from an options page inside a plug-in (this post)

In this post, we are going to read plug-in settings from the decoupled storage and update them when they are changed on the options page.

Read more…

How to implement the Options page logic for storing settings

February 25th, 2011 Comments off

Here’s the second part of the post about adding an options page into your DXCore plug-in. See the other parts, to learn more:

  1. Adding and designing an options page
  2. Implementing the options page settings storing logic (this post)
  3. Using settings from an options page inside a plug-in

Read more…

How to create a new plug-in Options page

February 25th, 2011 Comments off

This topic is about adding a DXCore Options page. It has three parts to make it easier to read and follow:

  1. Adding and designing an options page (this post)
  2. Implementing the options page settings storing logic
  3. Using settings from an options page inside a plug-in

Here’s the first part of the topic, and the steps we need to accomplish, to add an options page to your plug-in, and make it work:

  1. Run the options page wizard
  2. Layout controls on the page
  3. Add runtime behavior code for controls, if necessary

Read more…

How to add new contracts for the Add Contract code provider

February 18th, 2011 Comments off

Note, this article has been moved to the official DevExpress Support Center site. Please refer to the moved article as it might have further updates or additional comments. Thank you.

The Add Contract code provider adds conditions for validation of the active method parameters. The Extensible architecture of the DXCore allows you to add new contracts to the list of available contracts using the ContractProvider component inside your plug-in.

The sample below is a rough implementation for the suggestions registered in the DevExpress Support Center database:

  • S133903 Add Contract – Use IsNullOrWhiteSpace on contracts
  • S136474 Add Contract – Allow it to generate code for single parameter

Read more…

CodeRush Clipboard History

December 21st, 2010 Comments off

Clipboard History is a visual multi-clipboard viewer and manager, which makes copying and pasting of data a little easier. It allows you to extend the facility of Windows system’s clipboard, beyond its default capability and the disadvantage that you can only copy once before pasting. The next time you copy or cut another snippet, you overwrite the existing clipboard contents. CodeRush helps to keep the clipboard history that you can use to paste any selected fragment again. You can have up to 64 independent fragments and work with each of them separately, persisting these fragments across Visual Studio sessions for future use. If you copy a code fragment, Clipboard History will maintain its syntax highlighting as well:

Read more…

How to use DXCore DecoupledStorage to persist plug-in data

December 16th, 2010 Comments off

To persist your data using the DecoupedStorage object, use the appropriate ReadXXX and WriteXXX methods. In case your settings are language dependant, DecoupledStorage includes a property “LanguageID” that can create and select child storage objects for the purposes of language-specific storage (e.g., to support independent settings for C#, C++, Basic, etc.). Just set the LanguageID to the appropriate Language identifier (e.g., “CSharp”, “C/C++”, “Basic”, etc.), and then read and write normally. To activate the language-neutral storage object, set the LanguageID to an empty string. If your code is inside a CodeRush Options Page, you can get the LanguageID through the Options page’s LanguageID property (also, you can handle the LanguageChanged event in your Options page to find out when the user wants to create settings for another programming language).

Read more…

How to use Action DXCore control

December 14th, 2010 Comments off

There are only four important things to make the Action component available and working:

  1. Create a new DXCore plug-in if you haven’t done it yet
  2. Drop the Action control on the plug-in designer surface
  3. Fill the ActionName property
  4. Handle the Execute event

That’s it. Using the ActionName you are able to assign a shortcut key, and once it’s pressed, the Execute event will do its job – perform the code you added into the event handler.

Read more…

How to use CodeMetricProvider control to build you own code metric

December 9th, 2010 Comments off

Let’s implement the Comment Density code metric using the CodeMetricProvider DXCore component. This code metric provides the ratio of comment lines to all lines and indicates the comments coverage of your source code. We are going to calculate it in percents for all type declarations like this:

Comment Density = (comment lines / code lines) * 100

The density of comments metric value will be between 0 and 100 percents, and can be used as a quality indicator to see how much of the code is commented. So, if the comment density value for instance is below a certain value defined by the project manager, it indicates that the code is under commented. Let’s assume that what’s recommended is a commenting of at least 15% of the code and a maximum of 30%.

Read more…