<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-84  評論-56  文章-0  trackbacks-0

    Class Diagram in IntelliJ IDEA 8

    IntelliJ IDEA 8 is already here. It is so feature-rich that it’s rather hard to tell what is most important – improved testing support, or new refactorings, injected languages, or handy interaction with data sources. In due time, we’ll dig deeper into all the new features.

    Let’s begin with something brand-new for IntelliJ IDEA, namely UML Class diagram support. This feature is actually the first attempt to approach UML modeling, and thus requires further finishing and fine-tuning. Try Class diagram with IDEA hands-on – your feedback will be appreciated and considered in further revisions.

    You can use UML Class diagram for two purposes:

    • To create a visual model, populate it with node elements and members, and have the underlying code generated automatically (forward engineering).
    • To explore existing source code, understand its hierarchy and dependencies (reverse engineering).

    Creating visual model

    To demonstrate visual modeling with IntelliJ IDEA UML Class diagram in action, we’ll create a new Java project, add a package (for example, animals), and press (take care of your fingers) Ctrl+Alt+Shift+U. Context menu of the diagram helps create all the required elements, but, since IntelliJ IDEA is strongly keyboard-centric, we’ll use keyboard shortcuts.

     

     

     

     

     

    Press Shift+C to create new classes, for example, Animals, and Carnivore. Now press Shift+I to create an interface, say, Huntable. Note a very handy way to add node elements to a diagram: select a class in the Project view and just drag it to the diagram background:

     

     

     

     

     

     

     

    Next step is to add fields and methods to node elements. Here, again, you can use context menu commands, or keyboard shortcuts. For example, having selected a node element, press Shift+M, and define method name, type and parameters, if any:

     

     

     

     

     

     

    Now, let’s create relationship links between node elements. For this purpose, you have to enable the special edge drawing mode by clicking edge drawing mode button on the diagram toolbar. IntelliJ IDEA can smartly tell the type of relationship link, depending on the source and target nodes.

    Suppose you draw a link from a class to an interface:

     

     

     

     

     

     

     

    Click the Generate methods button, and select the methods you want to be implemented.

    Look into the source code of the Carnivore class, and see that implements clause has been generated, together with the selected methods’ stubs. Drawing a link between two classes, results in generating extends clause:

     

     

     

     

     

     

     

     

     

    Exploring code base with UML Class diagram

    Let’s see how you can use Class diagram in IntelliJ IDEA to reverse engineer source code, and view its structure, hierarchies and dependencies. Select a library package, for example, java.beans, and open its Class diagram:

     

     

     

     

     

     

    What does IntelliJ IDEA suggest to get as much information as possible? Actually, all facilities are on the diagram toolbar and context menu… however, as it is custom for IntelliJ IDEA, you can do everything using both the keyboard, and pointing device.

    If a diagram is too large, get a “10,000-feet view” of it in the Structure tool window. To do that, just press Alt+7:

     

     

     

     

     

    The gray rectangle represents the currently visible area of the diagram. Dragging this rectangle reveals the corresponding portion of diagram. You can zoom in and out using the NumPad plus and minus keys, or rotate your mouse wheel.

    If the names of the node elements are long, you can reduce them to the capital letters only by pressing Alt+N. Pointing to a node shows its fully qualified name at the tooltip:

     

     

     

     

     

     

     

     

    If we want to see the node elements with their members, rather than just class names in the title bars, press the toolbar buttons

    , or use keyboard shortcuts to show fields (Alt+F), constructors (Alt+C), methods (Alt+M) and inner classes (Alt+I) respectively:

     

     

     

     

     

     

     

     

     

     

     

    To show the package the selected node belongs to, just press C, and the diagram will collapse to the container package:

     

     

     

     

     

    The opposite action (E) expands selected package and shows its Class diagram. You can also easily visualize the nodes that reside in the same package, or in subpackages. To do that, select a node element in diagram, and press Space bar. The sibling nodes are highlighted yellow, and the nodes that belong to subpackages of the current package are green. The nodes that reside outside of the current package are not highlighted:

     

     

     

     

     

     

     

     

    If you point to a package, a tooltip appears with the complete information about the package - its name, number of contained classes and subpackages.

    Suppose that you want to explore only a portion of diagram, and remove from view those elements that are of no interest for you. In this case, use the Delete key. The node elements are deleted from diagram, but the corresponding files are left intact. (If you want to physically delete an element, use Safe Delete refactoring).

    For exploring dependencies, click the show dependencies button on the diagram toolbar

    . As you select a node element, its dependency links appear in diagram:

     

     

     

     

     

     

     

    Needless to say that handy navigation shortcuts, search for usages, analysis of dependencies and refactorings you are used to in IntelliJ IDEA, are available in Class diagram too.

    Try the live demo at http://www.jetbrains.com/idea/training/demos/uml-class-diagrams.html

    posted on 2008-11-12 09:45 憶風 閱讀(976) 評論(0)  編輯  收藏 所屬分類: IDE
    主站蜘蛛池模板: 好吊色永久免费视频大全 | 24小时日本电影免费看| 在线播放亚洲第一字幕| 国产99久久久国产精免费| 亚洲精品国精品久久99热| 一级特黄特色的免费大片视频 | 亚洲色一色噜一噜噜噜| 亚洲A∨无码一区二区三区| 久爱免费观看在线网站| 久久夜色精品国产噜噜噜亚洲AV | 亚洲人成国产精品无码| 成人精品视频99在线观看免费| 精品熟女少妇AV免费观看| 亚洲熟妇AV一区二区三区浪潮 | 亚洲精品国产suv一区88 | 色噜噜的亚洲男人的天堂| 国产精品久久免费视频| 亚洲av中文无码字幕色不卡| 无码欧精品亚洲日韩一区夜夜嗨 | 一级毛片免费全部播放| 亚洲午夜久久久久久久久久| 亚洲精品乱码久久久久蜜桃| 在线精品免费视频| 亚洲性无码av在线| 久久成人a毛片免费观看网站| 亚洲国产女人aaa毛片在线| 又长又大又粗又硬3p免费视频| 国产精品亚洲mnbav网站| 成全视频高清免费观看电视剧| 亚洲资源在线观看| 成年性午夜免费视频网站不卡| 亚洲欧洲国产综合| 精品国产精品久久一区免费式| 九九久久国产精品免费热6| 亚洲av色福利天堂| 成人毛片免费观看视频在线| 黄页免费视频播放在线播放| 九月丁香婷婷亚洲综合色| 18禁无遮挡无码国产免费网站| 精品亚洲av无码一区二区柚蜜| 国产成人涩涩涩视频在线观看免费|