Archive

Archive for the ‘Plug-in Development’ Category

How to use WPF controls in DXCore Tool Window plug-in

September 16th, 2011 Comments off

DXCore Tool Windows are based on the Windows Forms technology and can use only Windows Forms controls. However, if you would like to use WPF controls there is a work-around intended to use the ElementHost Windows Forms control that is used to host a Windows Presentation Foundation (WPF) element.

Read more…

How to get the declaring element (declaration) from a reference using DXCore

August 29th, 2011 Comments off

Once you have a reference to an element and would like to get its declaration, simply call the GetDeclaration() method of a reference of the Expression type (all references have the Expression base type).

Read more…

How to get ancestors and descendants of a type declaration using DXCore

August 29th, 2011 Comments off

Once you obtained an instance of a class, structure or an interface, for example, by using the DXCore SourceModel service:

CodeRush.Source.ActiveClass
CodeRush.Source.ActiveClassInterfaceOrStruct
CodeRush.Source.ActiveClassInterfaceStructOrModule
CodeRush.Source.ActiveStruct
CodeRush.Source.ActiveInterface

and would like to analyze its hierarchy by retrieving its base and/or derived types, you can use the following APIs:

Read more…

How to edit source files of an entire Visual Studio solution using DXCore

July 4th, 2011 Comments off

Usually, simple edits of text files are accomplished using the TextDocument object, which represents an open source file inside the IDE. The text document object is easy to access through the Documents DXCore service. It has lots of useful methods for editing a text like InsertText, DeleteText and SetText, which take a source code coordinates and a new text for replacement as a parameters. However, to use a text document object, it is required for the file to be opened inside the Visual Studio environment. If a file is closed, there’s no TextDocument object assigned to the file and you simply can’t use its methods. In case you are going to edit closed and/or multiple files, there’s a better way – the FileChange object (in the DevExpress.CodeRush.Core.Replacement namespace).

Read more…

How to implement the Sync Edit feature from Delphi IDE inside Visual Studio IDE using DXCore

June 22nd, 2011 Comments off

According to the Embarcadero’s docwiki:

Sync Edit mode in Delphi allows you to change all occurrences of an identifier when you change one instance of that identifier. When you enter Sync Edit mode, you can tab to each highlighted identifier in your current Code Editor window.

The difference of the Sync Edit feature in Delphi from the usual Rename refactoring from Refactor! (for example) is that a declaration of an identifier may not exist. In this case the Rename is simple not available.

Read more…

How to use DXCore SmartTagProvider control and create your own Popup menu entry

May 23rd, 2011 Comments off

Here’s what the standard Refactor!/Code! and “Jump toPopup menu looks like:

Refactor! Code! Jump to Popup menu

Read more…

DXCore plug-in events overall list

May 6th, 2011 Comments off

Standard DXCore plug-ins include a full set of events supported by DXCore. These events are available right on the plug-ins design surface in the Property Browser. Just choose an event from the list, double click it or press the Enter key and then write an event handler code. The majority of events have sophisticated System.EventArgs descendants that let you handle an event very easily.

Read more…

How to add new menu entries to specific Visual Studio dropdown or context menus

May 3rd, 2011 Comments off

Adding a new menu entry can be easily achieved using the Action DXCore control. Just set the ParentMenu property to the name of the menu, where you would like the new item to appear. As an alternative, you can set the CommonMenu to one of the suggested values. The CommonMenu property has the DevExpress.CodeRush.Menus.VSCommonBar enumeration type, which enumerates most of common Visual Studio menu names, such as File, Edit, View, Tools, DevExpress, Help, etc.

Read more…