• Home >> Net C# >>  VS Add-Ins
  • pocketuml tools add-in for visual studio.net


  • Rating : Excellent[0]   Very Good[0]   Average[0]   Below Average[0]   Poor[0]
  • Pub Date: 10/9/2008
  • admin [ View Profile ]

  • Abstract
  • PocketUML is a portable UML tool for Visual Studio.NET. It supports C# Projects' UML generation from source code. This edition is the first milestone. It only supports some basic UML tools functions. You might think the distance between PocketUML and some other UML tools (such as Rational Rose) is long, but this is just a start, and I will continue with it.

  • Introduction
  •  Sponsored Links
  • in this article, i will introduce how to install and build it. then, i'll discuss the project itself.

    i'm just a uml beginner; there might be many basic notional mistakes in the uml graphics. if you find any mistakes, please e-mail me. thanks!



    click here for a larger image.

    how to build it

    1. download the pocketuml project source code and unzip it.
    2. first, build the pocketumlviewer project.
    3. then, open another project—pocketuml—and build it.
    4. open a new vs.net instance and select add-in manager in the tool menu. then, you will find the pocketuml add-in in it. select the pocketuml add-in and make the checkbox checked (including startup checkbox).
    5. close vs.net and start a new vs.net instance. the pocketuml menu will appear in the tool menu. if you can't find it, try to run recreatecommands.reg, which can be found in the pocketuml project directory. after that, start a new instance; you should see it. otherwise, please e-mail me.
    6. before using it, make sure the five icon files are all placed with the pocketumlviewer.dll in the same directory. those icon files can be found in the pocketumlviewer's project dir.
    7. test it in the vs.net ide.

    how to use it

    1. make sure you properly build it.
    2. open or create a new c# project in vs.net.
    3. select the pocketuml menu item.
    4. if it works fine, you can open a new window in the document area and show the uml graphics in it. also, the report can be seen in the vs.net status bar.
    5. use the left mouse button to select and move it; double-clicking the item will cause a package to show its elements; class or struct will show its specification.
    6. use the right button to show the context menu. to return to a upper level, right-click in the space area and select up level.

    you can change its font, color, or position, but you can't edit its property. that feature will be added in the future.

    pocketuml add-in

    from the beginning, i was supposed to read the file and analyse the source code to generate the uml structure by myself. it's quite a big job to do. but when i finished reading the documents of the vs.net extension, i was impressed by those guys' work. it's definitely perfect. what i have to do is just get the object and read its properties. so easy! thanks go to them!

    in the pocketuml project, i use the vs.net object to get the code model and save it to xml files. maybe everything can't be seen under the uml graphics, but everything was written in the xml files. if you don't want to use uml tools and just want to do some other work outside vs.net, you can use these xml files to know everything about the project. those files can be found in the sub-directory of the project named pocketuml.

    exploring the vs.net code model

    i have created a class, named vsnetcollector, that is used to collect code information from the project. this class is in the namespace pocketuml.dataoperator. also, i created another very huge class named codedata to store all the project information in the namespace pocketuml.data. by using these two classes, i can collect all the information about the project to my own data struct. the class data2xml, that can help me read and write that data to xml files, is stored in namespace pocketuml.dataoperator.

    so the work flow is:

    1. new a codedata object.
    2. use vsnetcollector to collect code model to codedata object.
    3. use data2xml class to save codedata to xml files.

    when i create a new vs.net add-in project, i can find the envdte._dte object. this object is the root object of the vs.net object model. by using this object, i can create a toolwindow, toolbar, and menubar and control all the child windows in the vs.net ide. here, i'll explain the code model. (assume appobject is an envdte._dte object.)

    1. get the solutions.
    2. envdte.solution sln = appobject.solution;
    3. get the projects.
    4. // get all the projects and add to the solution data
      for( int i = 0 ; i < sln.count; i ++ )
      {
      // first, ensure the project is a c#-based project
      // check...
      envdte.project prj = sln.item(i+1);
      // support c# project
      if (prj.fullname.endswith(".csproj") == true)
      {
      // ......
      }
      }
    5. get the project items
    6. for( int i = 0 ; i < prj.projectitems.count ; i ++ )
      {
      // first, ensure the projectitems is a c# source code;
      // otherwise, break this circle.
      envdte.projectitem prjitem = prj.projectitems.item(i+1);

      if (prjitem.name.endswith(".cs") == true &&
      prjitem.name.indexof
      ("assembly") == -1)
      {

      }
      // this step is very important:
      // if the project contains many sub-directories and stores
      // the source in those sub-directories, i must collect it
      // by using these functions. this function is very
      // similar to step 3.
      else if( prjitem.projectitems.count > 0 )
      collectprojectsubitem( prjitem.projectitems, prjdata );
      }
    7. get the code model.
    8. envdte.filecodemodel codemodel = prjitem.filecodemodel;
    9. get the code elements.
    10. envdte.codeelements codeelements = codemodel.codeelements;
    11. get the code element.
    12. // code element contain all the code elements, such as
      // class, struct, interface, enum.....
      // get all the code elements

      for( int i = 0; i < codeelements.count; i ++ )
      {
      envdte.codeelement codeelement = codeelements.item(i+1);
      // collect item data
      collectelementdata( codeelement, codeelementsdata );
      }

    pocketuml viewer control

    the first idea to view the uml data is to create a document window such as winform editor or code editor. but i have searched all of the documents and samples to find how to create a document window; the answer is i can't. although it might be done with the visual studio integrator program (vsip), it's too expensive for an individual to use. fortunately, i noticed that it's embedded in a navigated window object. so, i can write a control to display the uml data in an html document; that means i have to write a html file, too.


    the pocketuml viewer control is an activex control to show the uml data (xml files). it only supports one function: pocketuml::view( string xmlfilename ). when i created the control, the only thing i have to do is call the view function and pass the xml file's name to it. the xml file is created by pocketuml vs.net add-in.

    for more information in how to create an activex control in c#, there are two very good articles that discuss it. also, i'm one of the readers of those great works. thanks go to them.

    1. exposing windows forms controls as activex controls by morgan skinner
      www.codeproject.com
    2. embedding .net controls in java by heath stewart
      www.codeproject.com

    pocketuml system work flow

    1. create a new codedata object (pocketuml vs.net add-in).
    2. fill the codedata through the envdte._dte object model (pocketuml vs.net add-in).
    3. write this codedata to xml files (pocketuml vs.net add-in).
    4. write a html file to use the pocketuml viewer control and pass the xml file name to it (pocketuml vs.net add-in).
    5. call the function applicationobject.executecommand("view.url", htmlfilename) to open the html files under vs.net ide (pocketuml vs.net add-in).
    6. read the xml files into the codedata object (pocketuml viewer control).
    7. display it (pocketuml viewer control).
    8. ui functions (pocketuml viewer control).

    remarks

    uml is a very good language to manage a project. i found there a few uml tools that support vs.net, but all are very expensive to use. therefore, i hope after the first 1.0 version released (i'm not sure of the time), it can be truly useful for others. also, the source code can be valuable for programmers.


    i need more feedback about this project. is it useful or not? if you get any questions, comments, or good ideas, please give them to me. my e-mail address is jiet@msn.com. thanks!

  • Download source - 260394 bytes
  • RATE THIS ARTICLE :
  •  
    • Latest Comments:
      • Add a comment
      • Title:
      • Comment
      •  
    Other popular VS Add-Ins articles:
    • Converting Projects from Visual Studio 2003 to Visual Studio 2005

      Converting Projects from Visual Studio 2003 to Visual Studio 2005This article is intended for most Microsoft development shops using the standard MS technology. It discusses the considerations that need to be taken into account when migrating existing VS2003 applications to VS2005. These considerati

    • PocketUML Tools Add-in for Visual Studio.NET

      PocketUML is a portable UML tool for Visual Studio.NET. It supports C# Projects' UML generation from source code. This edition is the first milestone. It only supports some basic UML tools functions. You might think the distance between PocketUML and some other UML tools (such as Rational Rose) is l

    • Language Wars All Over Again with UML

      The more I learn, the less I know. For example, in my youth I foolishly thought etymology was probably a useless study. Now I know that by figuring out parts and roots of words and by knowing something about their origins—etymology—I can figure out something about new words, and new words are keysto

    • FreeDOM (Programming)

      What is FreeDOM? FreeDOM is a new concept I created that changes a web page into a fully asynchronous event-driven application by using currently available technologies. Below, I will compare FreeDOM with currently working web 2.0 concepts and show you the benefits of switching to this architecture.

    • barcode image generation library

      This article and its code provide a way for developers to put barcodes into their applications. It allows for the generation of barcode images without the use of "barcode fonts". This need arose out of the necessity for one of my own projects to use barcodes and the lack of free libraries

    • News: Microsoft Releases Betas and More

      If you've been paying attention, then you knew it was coming. Today Microsoft released Beta 2 of Visual Studio 2008 (previously codenamed "Orcas"). The new version of Visual Studio includes a number of new features including the over-hyped LINQ as well as built-in support for ASP.NET AJAX.

    • Extending Visual Studio 2005

      The Visual Studio 2005 Integrated Development Environment (IDE) has an abundance of features. These include support for all of your favorite .Net languages, out—of—the box solutions (i.e., web sites, windows forms, mobile applications, etc.), built in refactoring and code snippet support, Intellisen

    • Visual C++ 2005 IDE Enhancements, Part 4: Beta 2 Changes

      Beta 2 is the time in a release cycle when Microsoft traditionally finalizes the feature set of a product and assess which new features are going to make it into the final product. As stated in last month's article, the Visual C++ IDE team has a much heavier workload than the IDE teams associated wi

    • Visual C++ 2005 IDE Enhancements, Part 3: MSBuild

      For long-time Visual C++ developers, Microsoft's introduction of MSBuild will look very much like a back-to-the-future move. Going back in time a fair way, MAK files were the traditional way to record the steps required to build a C++ project. The MAK file was essentially a glorified batch file that

    • Object Tool Bench: Cool New VS 2005 Feature

      A couple of years ago, I was writing some code generators using the CodeDOM namespace. To test the code my generator was writing—to make sure it compiled and ran as expected—I wrote a tool that generated a dynamic assembly and a startup method that invoked the generated code. It was a useful tool. I

    About Us |Contact us |Site Map |Csharp |Visual C / C++ |Visual basic |Java |SQL |Linux / Unix |Ajax
    ©2007-2018 CodeCoolest.com. Ptolive.cn Asp.net source code All Rights Reserved.