OpenNavigator Command

Purpose

Opens a repository in the object navigator.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify an array of the Variant type in the property, the elements of this array contain the following values:

Parameter Description
Element 1:
IMetabase
Repository to be opened in the object navigator.
Element 2:
UiNavOpenMode
Optional parameter that defines whether user private folder or the specified folder is to be opened.
If the element is not set, the object navigator opens the repository root folder.
Element 3:
IMetabaseObjectDescriptor
The optional parameter containing description of the repository folder that will be opened on a new navigator tab and will be a root one.

Application Features

It is used to open an already connected repository in the object navigator.

Example

Executing the example requires that repository contains:

Executing the example requires links to the Metabase, Ui system assemblies.

The procedure is a handler of the OnClick event for the Button1 button.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array 
Of Variant;
    Root: IMetabaseObjectDescriptor;
Begin
    MB := MetabaseClass.Active;
    Target := WinApplication.Instance.GetPluginTarget(
"Std");
    Context := Target.CreateExecutionContext;
    Root := MB.ItemById(
"IDFOLDER");
    Data := 
New Variant[3];
    Data[
0] := MB;
    Data[
1] := UiNavOpenMode.SetFolder;
    Data[
2] := Root;
    Context.Data := Data;
    Target.Execute(
"OpenNavigator", Context);
End Sub Button1OnClick;

After executing the example, the folder with the IDFOLDER specified identifier will be opened on a new navigator tab. The repository folder level will be limited with the specified folder that will be the root one.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    MAN: IMetabaseManager;
    Def: IMetabaseDefinition;
    Cred: ICredentials;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
Begin
    MB := MetabaseClass.Active;
    MAN := MB.Definition.Manager;
    Cred := MAN.Packs.Item(
0).Package.CreateCredentials(AuthenticationMode.Password);
    Def := MAN.Definitions.FindById(
"TEST");
    (Cred 
As IPasswordCredentials).UserName := "Test";
    (Cred 
As IPasswordCredentials).Password := "Test";
    MB := Def.Open(Cred);
    Target := WinApplication.Instance.GetPluginTarget(
"Std");
    Context := Target.CreateExecutionContext;
    Context.Data := MB;
    Target.Execute(
"OpenNavigator", Context);
End Sub Button1OnClick;

After executing the example the connection to the repository with the TEST identifier will be established. The Test password and username are used to connect to this repository. The level of repository folders will be unlimited.

See also:

IUiCommandTarget.Execute