Create a view extension
- Last UpdatedJul 23, 2024
- 3 minute read
To develop a view extension, in addition to the steps needed for all IDE extensions, the extension public class must implement “IaaIDEView” interface from the “Extensibility” assembly. If the view needs to handle commands, it must implement “IaaCommandTarget” interface also from the same assembly.
The IDE uses “IaaIDEView” interface to communicate with the view extension, which has four methods and an event as described below:
-
When requesting a view to select a specific object in it, IDE calls extension’s “SelectObject” method. This is used for example, when synchronizing views.
-
To find out whether the active view extension supports in-place renaming for the selected object, the IDE calls extension’s “CanInPlaceRename” method.
-
If the extension supports in-place renaming then the IDE calls its “BeginInPlaceRename” method to start renaming.
-
When any command is invoked, the IDE call “EndInPlaceRename” method on the active view, if it supports in-place renaming to give it a chance to come out of rename.
-
The extension is supposed to fire “RenameInPlaceEnd” event when in-place rename ends.
A view extension should provide some details on how and where it should be displayed in the Galaxy Explorer. Following is an example extract from the sample manifest, emphasizing on view details.
<Root>
<Snapins>
<View TypeId="540C08D5-803A-41f5-8900-86B11A510193" Priority="650">
<Title>Flat Filtered View</Title>
<DefaultPosition>Top</DefaultPosition>
<Visible>true</Visible>
</View>
</Snapins>
</Root>
-
The Title tag indicates the view caption for the dockable window in the Galaxy Explorer for the view extension.
-
The DefaultPosition tag indicates the initial dock position for the view extension when the IDE loads it for the first time. Since IDE persists its layout information, next time IDE loads the view layout from the persisted layout information. Valid values for the DefaultPosition are Top, Bottom, Left, Right and Floating.
-
The Visible tag indicates whether the view extension should be displayed right away when it is loaded and the valid values are “true” and “false”.
The “IaaIDEView” derives from “IaaSelectionSource” interface, which needs to be implemented by the view extensions. This allows the view extensions to publish its selection information to the IDE. The IDE then passes this information from the active view to the command extensions so that the command states can be appropriately updated. The selection information is also passed on to the command extensions when the command is invoked by the user. The “IaaSelectionSource” interface has one property and three events as described below:
-
IDE uses the “SelectedObjects” property in this interface to get the current user selection in the view whenever user switches from one view to another.
-
Whenever the selection changes in the view, the view should fire one of the three following events so that IDE’s selection state stays current. This is needed to update the commands so that all command UI vectors like, menu items and toolbar buttons are in sync with the user selection.
-
If possible, when the user adds a new item to the selection, the event “SelectionAdd” should be fired providing the newly selected object’s information in the event arguments.
-
If possible, when the user removes an item from the existing selection, the event “SelectionRemove” should be fired providing the information on the object getting de-selected in the event arguments.
-
At a minimum, whenever the selection changes, the view should fire the “SelectionReset” event, and provide the new selection in the view as the arguments.
-