Files
UnrealEngineUWP/Engine/Extras/P4VUtils/CommandAttribute.cs
paul chipchase 112f017f85 [P4VUtils] Add a new command to open jira issues tagged in a changelist description in the callers web browser.
#preflight 645cc6062965f6ea8e8318cb

- Add a new command 'OpenJiraCommand' which will attempt to open jira in the users web browser to any issue tagged in that changelists description via the '#jira' tag.
-- We assume that the issue name will be Project-IssueNumber, where the project can contain both letters and numbers. The jira standard enforces that the first character of the project name cannot be a number but we have not enforced that in our checks for simplicity.
-- If multiple issues are tagged we should be able to match with them, even if they are on the same line and/or separated with ' ', ',' or '+'
-- If no tags are found we inform the user via a popup message.
-- We now have an entry in the ini file for the jira server.

- Added a new CommandCategory named 'Browser' to be used by commands that attempt to open new pages in the users web browser.
-- Moved the existing OpenPreflightCommand and RobomergePreviewCommand commands there.
-- It could be argued that PreflightCommand should be moved to 'Browser' too but it feels more at home under 'Horde'
- A number of commands were copy/pasting the code to open a path in a new process (given that the syntax is slightly different per platform) so this code has been moved to a shared ProcessUtils class.

[CL 25426132 by paul chipchase in ue5-main branch]
2023-05-11 09:43:58 -04:00

73 lines
1.7 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
namespace P4VUtils
{
public enum CommandCategory
{
/// <summary>
/// Commands that help with common but simple operations
/// </summary>
Root,
/// <summary>
/// Commands that help with operations relating to content files
/// </summary>
Content,
/// <summary>
/// Commands that help with common but simple operations
/// </summary>
Toolbox,
/// <summary>
/// Complex commands to facilitate integrations
/// </summary>
Integrate,
/// <summary>
/// Local build and horde preflights
/// </summary>
Horde,
/// <summary>
/// Commands that open pages in the users browser
/// </summary>
Browser
}
/// <summary>
/// Attribute used to define a class as a Command to hook into P4V
///
/// Containing attributes to define the cli name of the command, the categorization of the command, and the order it appears in the UI.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public sealed class CommandAttribute : System.Attribute
{
/// <summary>
/// Command name, use to reference the command via command line args
/// </summary>
public string CommandName { get; internal set; } = null!;
/// <summary>
/// Category to organize into UI Elements.
/// </summary>
public CommandCategory Category { get; internal set; }
/// <summary>
/// Used to preserve previous order.
///
/// Defaults to int.MaxValue to ensure any new items appear at the end of the sub menus.
/// </summary>
public int Order { get; internal set; }
public CommandAttribute(string commandName, CommandCategory category, int order = int.MaxValue)
{
CommandName = commandName;
Category = category;
Order = order;
}
}
}