Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

MonoDevelop: Visual Studio Lite for the Linux Developer : Page 2

This IDE is a replica of the original .NET editor and also contains Windows support.


advertisement
It also provides several extension points:

    * Project Types: project types can define specific build rules or particular file organizations.
    * File Formats: a file format extension can implement a custom reader and writer for projects.
    * Language Bindings: can be used to add support for additional .NET languages.

MonoDevelop.Projects.Gui



This assembly provides:

    * Some dialogs for displaying project information, such as project or combine options.
    * The IconService, which can be used to get icons that represent projects, classes, methods, etc.
    * The code completion engine.
Add-ins can extend the project and combine options dialog by adding new custom options panels.

MonoDevelop.Ide

This assembly implements the MonoDevelop IDE, which is based on all services described so far. It provides a root object (IdeApp) which gives access to all IDE features:

    * The workbench: Documents, pads, layouts, status bar, progress monitors.
    * Project operations: this is a GUI front-end to everything you can do with a project: loading, saving, building, running, showing options, etc.
    * The Command Service: it can be used to define new commands, create menus, context menus and toolbars (see The Command System).
The IDE provides many extension points. Here are some of them:
    * Pads: dockable pads.
    * Views: file content viewers.
    * Commands: add-in can define new commands and integrate them in menus and toolbars.
    * Tree Node Builders: can be used to extend the solution pad, the class pad and any other TreeViewPad based pad. Node builders can create or hide nodes, add overlay icons, add menu options, etc.
    * Menus and Toolbars: add-ins can add new commands to existing menus and toolbars, or create new menus or toolbars.
    * Preferences panels: the preferences dialog can be extended with new options panels.

Figure 3. Properties: This graphic shows the Mono Solution Properties.

Sample Code on Locking and Threading

// class library class Blah {    Hashtable ht;    void Foo (int zzz, Entry blah) {       lock (ht) {           ht.Add (zzz, blah);       }    }    void Bar ()    {       lock (ht) {          foreach (Entry e in ht)             EachBar (e);       }    }    virtual void EachBar (Entry e)    {    } } // User class MyBlah {    void DoStuff ()    {       lock (this) {          int i = GetNumber ();          Entry e = GetEntry ();                    Foo (i, e);       }    }    override void EachBar (Entry e)    {        lock (this) {           DoSomething (e);        }    } }

Sample Code Defining Class Structure

class X : Y { bool Method (int argument_1, int argument_2) { if (argument_1 == argument_2) throw new Exception (Locale.GetText ("They are equal!"); if (argument_1 < argument_2) { if (argument_1 * 3 > 4) return true; else return false; } // // This sample helps keep your sanity while using 8-spaces for tabs // VeryLongIdentifierWhichTakesManyArguments ( Argument1, Argument2, Argument3, NestedCallHere ( MoreNested)); } bool MyProperty { get { return x; } set { x = value; } } void AnotherMethod () { if ((a + 5) != 4) { } while (blah) { if (a) continue; b++; } } }

Figure 4. Test: This figure shows a Unit Test Project Supported by Mono.

Sample Code on Conditional Compilation

#if NET_2_0                CODE_FOR_2_0            #else                CODE_FOR_1_0            #endif

Best Practices

Correctness is essential for the Mono class libraries. Because our code is called by many other people, we often must be more pendantic than most people would be when writing code. These items are guidelines of some things you should check for.

The class libraries are grouped together in the assemblies they belong. Each directory here represents an assembly, and inside each directory we divide the code based on the namespace they implement.

In addition, each assembly directory contains a Test directory that holds the NUnit tests for that assembly. We use a new build system which is described by various README files in mcs/build. The build process typically builds an assembly, but in some cases it also builds special versions of the assemblies intended to be used\ for testing.

MonoDevelop: Extended features

Autosave

MonoDevelop now keeps a copy on disk of all edits done in a file, even if the file has not been saved. In case of a crash, a file recovery dialog is shown which allows restoring unsaved changes.

Code Templates

The latest Mono develop Templates have placeholders. When the template is inserted, the cursor will be moved to the first placeholder and the user can move between placeholders by pressing TAB. Placeholders can be linked to other text in the template, which will be automatically updated. For example, a template for the 'for' statement can have a placeholder for the iteration variable, and when the name of the variable is entered all references to that variable in the template are automatically updated.

Block Selection

Block selection in the editor is now supported by pressing Alt while selecting text.

Big Performance Improvements

The editor is now much faster and will be more responsive when editing large files.

Code Formatting

A new C# formatter has been implemented. This formatter has plenty of formatting options which can be configured per-project. The new Format Document command (available in Edit -> Format -> Format Document) formats the current file following the options specified for the file file type and active project.

When the 'on the fly code formatting' option is enabled, MonoDevelop will automatically format blocks of code following the formatting options set in the project.

XML Documentation Shown in Code Completion

Documentation written in the code using the XML documentation format will now be shown in the Code Completion window.

Code Generator

The 'Show Code Generation Window' command (Alt + Insert by default) allows quickly generating snippets of code based on the current context. Here are some examples:

    * Generate a constructor, initializing a set of selected fields.
    * Generate properties for a set of fields.
    * Override base class members.
    * Implement ToString().
    * Implement equality methods.
    * Introduce a parameter null check in a method.


Tapas Pal is a Microsoft Platform technical professional with Tata Consultancy Services, India. He has with seven years of experience, holds Microsoft certifications in .NET 1.1 and .NET 2.0.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap