New Features in ModelMaker Code Explorer for VS 1.10

C# 2.0 support

  • New C# v2 language mode enables new C# 2 syntax features in editor and parser. Language mode C# v1 and C# v2 can be selected on Properties | C# |Parsing tab.
  • Partial class, record and interface support.
  • Anonymous method support
  • Extern alias support, including :: to reference extern alias members.
  • Static classes support.
  • Generic types support.
  • Property accessor visibility support.

Generic new features

  • Property Completion Edit entity detects a property without access specifiers and applies the defaults for new properties (read/write method, read/write code, state field etc) before showing the Edit Property dialog. Property Completion is automatically enabled/disabled with a "don't ask me again" style confirmation dialog.
    // C#
    int Test {} // Ctrl+E to Edit Entity and suggest accessor defaults.
    int this[int index] {} // similar

    // Pascal
    property Test: Integer; // Ctrl+E to Edit Entity and suggest accessor defaults.
    property Test[Index: Integer]: Integer; // similar
  • Multiple Inheritance for interfaces: in both C# and Delphi.NET interfaces can have multiple ancestors. ModelMaker Code Explorer allows adding additional ancestors in a comma separated list in the Edit interface dialog. To display hierarchy (for example in classes view), only the first ancestors is used.
  • Comment Selected Members (Members view) and Comment Entity at Cursor(IDE Editor), comments out selected entities. For properties, accessors and state fields are auto included. Operation is designer safe: components, (wired) event handlers and designer classes are auto removed from the selection.
  • Toggle Comment Selection comments out the selected text with a //-style comment, or uncomments selected //-style comments
  • Extract Method works on pascal module procedures.
  • Extract Method dialog allows changing the way the original code is treated. Defaults to setting as defined in Properties|Language|Editing tab.
  • Extract Property, similar as Extract Method but creates a property with read access method instead of a plain method. Default shortcut Shift+Alt+X
  • The Explorer accepts file drag drop. Dropped files are opened in the IDE editor.
  • In rearrange mode the explorer locates the declaration for a pascal method or procedure instead of the declaration.
  • To avoid invisible menu items on smaller screens, the MMX IDE main menu and Editor Pop up menu have been reorganized to make them more compact.
  • Declaration Hints can be displayed in Classes view for entity (methods etc) declarations that span multiple lines. Enabled/ disabled on Properties|General|Display tab.
  • Unwrap Declaration" is available in the members view when declaration hints are displayed (pascal only). Unwraps the selected declarations into a single line.
  • Members View | Wizards | Format Reserved Words, allows formatting pascal keywords. Select lower case , upper case or first letter upper case.
  • C# modifiers order is adjustable on the Properties "New entities" tab.
  • Parameter Wizard improvements:
    • Keyboard shortcut Ctrl+H has been assigned to "Suggest type based on history" button to the right of the parameter name edit.
    • Typing a : (colon) in the name removes this character and also invokes the Suggest type wizard plus sets focus to the type name combo.
    • The type name combo allows selecting the drop down style similar to the normal type selector drop down style: select from history, classes, interfaces or presets.
    • The "Suggest type" wizard has been now auto-selects the const modifier for string (Pascal only).
  • Explorer window shortcuts are customizable on the Properties | Keybindings | Explorer Shortcuts tab.
  • Copy Full Name in the Members view copies the qualified member name(s) to the clipboard.
  • Pascal Class insertion position (add class, paste class) takes inheritance into account. A class declaration is inserted before any descendants in the module.
  • If a Pascal class ancestor is declared after a descendent, an error is displayed in the Errors node.
  • Option "Empty lines unassociate comments" on [Language]|Parsing tab allows unassociating comments like in the example below. The introductionary comment { TSample } won't be associated with the constructor method and therefore not moved or copied with it either.
    { TSample }

    constructor TSample.Create;
    begin
      inherited;
    end;
  • If customized type presets use different spelling for internal defined pascal types such as STRING, integer or boolean, this customized spelling is used whenever creating new entities. Existing type names for existing entities are unchanged. As a result setting for lower case string has been removed from Pascal | Editing options. The spelling for string (String, STRING) is now taken from the type presets.
  • Try .. finally wizard: acts like a smart surround template, looking at the preceding code to determine the code for the finally block. Customizable using a look-up list in file TryFinallyWizard.txt in the shared directory, for example "C:\Program Files\ModelMakerTools\Shared". Check this article for details. Default shortcut is Ctrl+Alt+J (similar to Delphi's Ctrl+J to invoke a template). The Pascal wizard code snippets are customizable. Check Properties | Pascal | Code Snippets.
  • Surround with Default Block Wizard: acts like a smart surround template to enclose the selection or line in a begin end or { }.block. Indention is smart and derived from the code preceding the selection. Default shortcut is Ctrl+Shift+B.
  • Member search bar in Members view filter bar. Filters members on case insensitive (partial) name. String can be auto cleared when activating contents view and/ or members view. Check General|Display options tab. In Explorer and IDE Editor keyboard shortcut Ctrl+1 sets focus to the search bar. In the Search bar the Enter key selects the first member and then either sets focus to the members list, or if there's only a single member, invokes the "locate implementation" command and moves focus to the editor. Alt+Enter works similar, except that it invokes "locate declaration". The Up and Down arrow keys select the first member in the members view and set focus to the members list.
  • Add Indexer: adds a fully implemented indexer (array) property with just a few clicks. Check the article for more details.
  • Interfaces supported by classes may be displayed in the Classes view. Clicking the interface or icon navigates to the interface declaration, similar to how ModelMaker Code Explorer navigates to ancestors.
  • Replace Method with Method Object refactoring. Creates a new class containing a copy of the selected method plus a backpointer. Inserts code to instantiate and call the new class. The first step to decompose a long method into other methods on the same object.
  • Default Sort Class at cursor position available as IDE editor refactoring. Keyboard shortcut can be assigned in Keybindings tab.
  • Sort selected members: applies the default sorting scheme to members selected in the editor - not the members view. Available for C# only
  • Sorting restores the entity at editor position.
  • Add Local Var allows initializing local variable at method entrance. Creational Wizard logic is used to suggest variable initialization code.
  • Property Access Code for existing access methods can be replaced with a new access code snippets (pascal only).
  • Pascal: IntelliReplace available for renamed methods and properties. Because IntelliReplace replaces all identifiers with Former Name, not just references to the renamed method or property, it should only be used for uncommon names. IntelliReplacing identifiers like Add and Delete might cause unwanted replacements. Therefore IntelliReplace for methods and properties always shows a confirmation dialog that allows selecting a class (including declaration) or module rename scope.
  • Pascal: IntelliReplace propagates Renamed Field in class interface (for example property declarations).
  • Pascal: Breakup Property removes the property declaration without deleting the access members. Available from members view pop up menu "Convert".
  • Documentation Pane font can be adjusted on Properties General | Documentation tab.
  • Reverse Assignment: reverses the left and right expressions in an := (pascal) or = (C#) statement.
  • Paste Prototype: (pascal) allows pasting methods while applying one of the following options:
    • Clear method implementation: removes method implementation while pasting, inserting just the implementation header
    • Insert inherited call, used in combination with Clear method implementation.
    • Mark virtual methods override, used to paste methods declared as virtual as overrides.
    • Change visibility, used to paste interface members (with no or default visibility) into a class specifying new visibility.
    Invoked from Members view pop up menu (default shortcut Ctrl+Alt+V) or when dropping members on a class with Alt-key pressed down.
  • Add/Edit Method dialog allows adding implementation snippets to new or existing methods.
  • Usage report tab shows how often you've used the explorer commands. The "Send..." function on this tab sends the data by email to ModelMaker Tools after your confirmation.

Customizable Property Access Code

  • Property access code as inserted with the Pascal and C# Edit Property dialogs is customizable. Previously the (hard coded) getter and setter code would be selected through check box options ("Read Code" "Write Code" etc.). This is now done with combo boxes that allow adding new code snippets. Macros can be used to make snippets more flexible. Here are a few examples for new pascal accessor code snippets:
    // new setter example
    if (<!FieldName!> <> <!WriteParam!>) then
    begin
      <!FieldName!> := <!WriteParam!>;
      Changed;
    end;
    or for reading an enumerated value from a combo box:
    // new getter example
    Result := <!PropertyType!>(<!PropertyName!>Combo.ItemIndex);
  • The code snippets are maintained on Properties | [Language] | Code Snippets tabs. These allow adding new snippets and changing predefined snippets.

Navigation History and Favorites

  • Members can be marked as "Favorite". Favorite members appear first in the member list and have a different background color (default yellow). Using favorites helps repeated navigating within the same set of members (methods). For example, if you're working on a specific feature, you usually need to navigate between several methods involved in the feature implementation. Marking these methods as favorite, groups them and brings them to the top of members view, speeding up navigation. To toggle a member's favorite state, use Ctrl+Shift+F in either the Members view or in the IDE editor. Favorites respect the filter settings: a favorite method is not visible if methods are suppressed. A member's Favorite state is (within limitations) persistent between sessions. Also favorites are usually restored after (manual) editing the source file. However, in certain editing scenarios a favorite can be reset to normal. Particularly after changing both the name for the containing class and the member name at once. The favorites background color can be customized using the registry settings.
  • A navigation history is available as a global navigation multiple files spanning history from the classes view. Similar a history filtered for the current class is available in the members view. Entities can be added automatically and or manually to the history. By default methods at the editor cursor position are added on a sampling base. Optionally also clicking on methods and properties in the members view automatically adds them to the history. To manually add an item to the history, use Ctrl+H in either members view or the IDE editor. The history acts as a list of recently visited class/ members, not a forward / backward stack. The history can be customized in the new Properties | History tab. Note: IDE Editor Global History and adding sampled methods is not working if the explorer window is invisible.
  • "Back to Last Editing Position": positions the editor on the last modified source. Available from explorer classes view toolbar and from the main MMX | Navigation menu.
  • A bookmark is (optionally) dropped when creating a new method, by default drop bookmark #9. Check Properties | History tab.

Creational Wizard

The Creational Wizard is used to insert field and property initialization code snippets in a constructor. Optionally a parameter is added to the constructor parameter list to initialize a field or property. You may select an existing constructor or create a new one. Similar finalization snippets can be inserted in a destructor.

  • The Field and Property dialogs have a Creational Wizard Tab that is used to initialize the field or property.
  • A separate Creational Wizard dialog allows selecting multiple fields or properties at once. This wizard is available from the Wizards pop up menus (Contents and Members view) and IDE main MMX menu.
  • Presets are available to help fill in initialization / finalization code snippets
    • Composite inserts code to instantiate and finalize a member. For example List := TList.Create; or list = New List(); For Pascal also destructor code is inserted like FreeAndNil(List);
    • Aggregate adds a parameter to the constructor parameter list and assigns the parameter value to the member. No destructor code is inserted.
    • Assign Default Value inserts an assignment.
    • Owned adds finalization code to a destructor, like FreeAndNil(List);
  • All code is fully editable and the suggested snippets are customizable.
  • Read more on (customizing) this feature in this article.

Source Region support

  • Sorting and rearranging leaves source regions intact. Sorting can move regions to top or bottom and recursively sort inside regions. Options can be found on Properties | [Language] | Sorting tab.
  • Regions inside classes can be displayed in the classes view. Check "show contained regions" button on the classes view toolbar. Currently the displayed regions only navigate to the region declaration. When selecting a region, no members are displayed.

Pascal String Conversion Wizard

  • String Scanner Options are now in separate tab in options dialog
  • Default conversion type may be selected (resourcestring, const, unlocalized etc).
  • In addition to marking a line as unlocalized, a line may be "custom marked" with a user definable comment. This comment defaults to "// TODO: check string"
  • The Module String Conversion Wizard dialog allows scrolling the IDE editor up and down - Hotkeys are Ctrl+Alt+Up/Down. This allows inspecting the string context.
  • The default scroll offset when navigating through extracted strings is adjustable: string is positioned 0..20 lines from the top.
  • If an external file is defined to define extracted strings, this file is auto created if it does not exist (after confirmation).

Solved bugs

  • Running the Multi File string conversion Wizard from the IDE main menu with an invisible Code Explorer window would cause an AV. Solved
  • String conversion wizard toolbars did not show Hints. Solved.
  • Pascal: Sorting and rearranging would include procedure forward declarations resulting in uncompilable code. Forward declarations are now skipped during rearrange and sorting. If necessary procedure forward declarations are moved in front of rearranged (sorted) module procedure implementations.
  • Invoking Edit Property and then Cancel the dialog, could in certain cases cause an access violation. Solved.
  • Adding a new entity would not always pick up the identifier at cursor position when using tabs. Solved.
  • Convert to Const would replace the constant with the suggested identifier rather than the identifier name after editing. Solved.
  • The parser recovers better from too many { tokens in a method body, thus allowing some operations to work normally.
  • When adding a new method, the cursor would be positioned on the method declaration rather than inside the method block. Solved
  • On VS2003 shutdown an access violation could occur. Solved
  • Introduce Parameter Object would add "Data: TData" to the method's parameter list rather than the new parameters class. Solved.
  • Copy Full Name for class members would just copy the member name. Solved.
  • Defining a default external file for the module string conversion wizard, would clear this file each time the Properties dialog OK button was clicked. Solved.
  • Some dialogs would appear bad when using large fonts. Solved