Skip to main content

Display the revision selection dialog

To display the revision selection dialog for a configuration-managed model file, call the SelectRevision method of the ICommonUI object.

public void SelectRevision(ICommandContext c, ICommandParams p) 
{
var model = c.App.Workspace.CurrentModel;
var modelUnit = model.ModelUnit;

ICommonUI commonUi = c.App.Window.UI;

IScmRevision revision = null;

switch (modelUnit.Type)
{
case "Project":
//If the unit type is project, call the method without specifying the model unit.
rev = commonUi.SelectRevision();
break;
case "Model":
//If the unit type is model, call the method with the model unit.
rev = commonUi.SelectRevision(modelUnit);
break;
}

if (revision == null)
{
c.App.Output.WriteLine("sample", "No revision was selected.");
return;
}

c.App.Output.WriteLine("sample", $"Selected revision: {revision.Revision}");
}