Class View


The Class View window is similar in design and function to the Solution Explorer window. It, too, provides a hierarchical view of project elements. However, the view here is not concerned with the physical files that constitute a solution or project; rather, this window provides a view of the various namespaces, types, interfaces, and enums within a project.

The Class View window is composed of four major visual components: a toolbar, a search bar, a tree view of types (called the objects pane), and a members pane.

Figure 5.3. The Class View window.


Toolbar

The Class View window's toolbar provides easy access to command buttons for adding virtual folders, moving forward and back through the objects pane items, and controlling which objects are displayed.

Table 5.4 describes the various Class View toolbar buttons.

Table 5.4. Class View Toolbar Buttons

Icon

Description

Class View new folder. Creates a virtual folder used to organize objects within the objects pane.

Back. Causes the previously selected item to become the currently selected item.

Forward. Causes the most recently selected item to become the currently selected item. This button is available only after using the Back button.

Class view settings. Displays a drop-down list that allows you to select object types to display within the objects pane and the members pane. The available options include

  • Show Base Types

  • Show Derived Types

  • Show Project References

  • Show Hidden Types and References

  • Show Public Members

  • Show Protected Members

  • Show Private Members

  • Show Other Members

  • Show Inherited Members

View Class Diagram. Creates a class diagram project item and launches the viewer for that item. All of the types contained within the project will be automatically added to the diagram.


The Search Bar

The search bar is a drop-down text box that provides a quick and easy way to filter the objects shown in the objects pane. When a search term (such as type name or namespace name) is entered, the Class View window will clear the objects pane and then repopulate it with only those objects that match the search term. Figure 5.4 shows the results of a search for FeedAdapter.

Figure 5.4. Filtering the objects pane.


To restore the objects pane and remove the filter, click on the Clear Search button to the right of the Search button.

Recent search terms are saved for reuse in the drop-down list.

Objects Pane

The objects pane encloses a tree of objects grouped, at the highest level, by project. Each object is identified by an icon and by its name. Expanding a project node within the tree will reveal the various types contained within that project. Further parent-child relationships are also visible, such as the namespace-to-class relationship and the type-to-parent-type relationship.

Table 5.5 shows the icons used in the object pane.

Table 5.5. Objects Pane Icons

Icon

Description

Class/Struct

Delegate

Enum

Namespace

Module

Interface


Certain signal images are also overlaid on top of these icons to visually represent scope and access information for each object. These access type signal icons are shown in Table 5.6.

Table 5.6. Scope/Access Signal Icons

Icon

Description

Private

Internal/Friend

(n/a)

Public

Protected


The depth of the various levels shown for each object will be dictated by the view settings in place at the time. For instance, turning on the Show Base Types option will append an additional base type level to the tree for each type. The object pane's principal duty is to allow quick and easy navigation back and forth through the object tree for each project. It exposes, in other words, an object-oriented view of each project.

Right-clicking within the objects pane will display the shortcut menu. The menu is essentially identical to the shortcut menu exposed by the Solution Explorer, with the exception of various Sort and Group by selections. The Sort options available here are

  • Sort Alphabetically The projects, namespaces, and types in the objects pane will be sorted in ascending, alphabetic order.

  • Sort by Object Type The types in the objects pane will be alphabetically sorted by their general classification (for example, in the following order: classes, enums, interfaces, structs).

  • Sort by Object Access The types will be sorted by their access modifier (public, private, protected, and so on).

  • Group by Object Type Another folder level will be added to the tree for each distinct object type present. For example, if a project contains both class and interface types, a class folder and an interface folder will be displayed in the objects pane tree, with their correlated types contained within.

Members Pane

The members pane reacts to the selection(s) made in the objects pane by displaying all of the membersproperties, events, constants, variables, enumsdefined on the selected type. Each member has a distinctive icon to immediately convey information such as scope and type; even member signatures show up here (note that the same signal icons used by the objects pane, and documented in Table 5.7, are used here as well).

Table 5.7. Members Pane Icons

Icon

Description

Constant

Method/Function

Property

Field


The members pane is ideal for quickly visualizing type behavior and attributes: Just select the class/type in the objects pane and browse its members in the members pane.

Note

Many developers will find that the bulk of their development tasks are more easily envisioned and acted on here within the Class View window as opposed to the Solution Explorer window. The available actions among the two are virtually identical, and the Class View window provides a much more code-focused perspective of your projects. Developers can spelunk through inheritance trees and see, at a glance, the various members implemented on each defined type within their project. The con to using the Class View is that source code control information is not visually surfaced here.


The members pane also exposes a context menu that has invaluable tools for browsing and editing code. For one, you can directly apply the Rename refactoring to a selected member. Other capabilities exposed here include the ability to immediately view the definition code for a member, to find every code location where the selected member is referenced, and to launch the Object Browser with the primary node for the member already selected for you.

The ability to alter the filter and display settings is also presented here. Figure 5.5 illustrates all of the available commands on this menu.

Figure 5.5. The members pane context menu.





Microsoft Visual Studio 2005 Unleashed
Microsoft Visual Studio 2005 Unleashed
ISBN: 0672328194
EAN: 2147483647
Year: 2006
Pages: 195

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net