How to use the @bentley/ui-framework.CommandItemDef function in @bentley/ui-framework

To help you get started, we’ve selected a few @bentley/ui-framework examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get openMessageBoxCommand() {
    const textNode = document.createTextNode("This is a box opened using IModelApp.notifications.openMessageBox and using promise/then to process result.");
    const message = document.createElement("div");
    message.appendChild(textNode);
    message.appendChild(this._longMessage);

    return new CommandItemDef({
      commandId: "openMessageBox",
      iconSpec: "icon-info",
      labelKey: "SampleApp:buttons.openMessageBox",
      execute: () => {
        // tslint:disable-next-line:no-floating-promises
        IModelApp.notifications.openMessageBox(MessageBoxType.Ok,
          message,
          MessageBoxIconType.Information)
          .then((value: MessageBoxValue) => { window.alert("Closing message box ... value is " + value); });
      },
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get setLengthFormatMetricCommand() {
    return new CommandItemDef({
      commandId: "setLengthFormatMetric",
      iconSpec: "icon-info",
      labelKey: "SampleApp:buttons.setLengthFormatMetric",
      execute: () => {
        IModelApp.quantityFormatter.useImperialFormats = false;
        IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, "Set Length Format to Metric"));
      },
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get warningMessageStickyCommand() {
    return new CommandItemDef({
      commandId: "warningMessage",
      iconSpec: "icon-status-warning",
      labelKey: "SampleApp:buttons.warningMessageBox",
      execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, AppTools._warningStr, AppTools._detailMsg, OutputMessageType.Sticky)),
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get item2() {
    return new CommandItemDef({
      commandId: "item2",
      iconSpec: "icon-placeholder",
      labelKey: "SampleApp:buttons.item2",
      applicationData: { key: "value" },
      execute: () => { AppUi.command2(); },
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get errorMessageCommand() {
    return new CommandItemDef({
      commandId: "errorMessage",
      iconSpec: "icon-status-rejected",
      labelKey: "SampleApp:buttons.errorMessageBox",
      execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error,
        "This is an error message", this._longMessage,
        OutputMessageType.Alert, OutputMessageAlert.Dialog)),
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get informationMessageBoxCommand() {
    return new CommandItemDef({
      commandId: "informationMessage",
      iconSpec: "icon-info",
      labelKey: "SampleApp:buttons.informationMessageBox",
      execute: () => ModalDialogManager.openDialog(AppTools._messageBox(MessageSeverity.Information, IModelApp.i18n.translate("SampleApp:buttons.informationMessageBox"))),
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / frontstages / ViewsFrontstage.tsx View on Github external
private get _reduceWidgetOpacity() {
    return new CommandItemDef({
      iconSpec: "icon-placeholder", labelKey: "SampleApp:buttons.reduceWidgetOpacity", execute: () => { UiFramework.setWidgetOpacity(0.50); },
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get infoMessageCommand() {
    return new CommandItemDef({
      commandId: "infoMessage",
      iconSpec: "icon-info",
      labelKey: "SampleApp:buttons.informationMessageBox",
      execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, "This is an info message", this._detailedMessage)),
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get openMessageBoxCommand2() {
    const textNode = document.createTextNode("This is a box opened using IModelApp.notifications.openMessageBox and using async/await to process result.");
    const message = document.createElement("div");
    message.appendChild(textNode);
    message.appendChild(this._longMessage);

    return new CommandItemDef({
      commandId: "openMessageBox2",
      iconSpec: "icon-status-warning",
      labelKey: "SampleApp:buttons.openMessageBox",
      execute: async () => {
        const value: MessageBoxValue = await IModelApp.notifications.openMessageBox(MessageBoxType.YesNo,
          message,
          MessageBoxIconType.Warning);
        window.alert("Closing message box ... value is " + value);
      },
    });
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
public static get errorMessageAlertCommand() {
    return new CommandItemDef({
      commandId: "errorMessage",
      iconSpec: "icon-status-error",
      labelKey: "SampleApp:buttons.errorMessageBox",
      execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, AppTools._errorStr, AppTools._detailMsg, OutputMessageType.Alert)),
    });
  }