WhiteBoxEditorUtil.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzToolsFramework/API/ToolsApplicationAPI.h>
  9. #include <AzToolsFramework/SourceControl/SourceControlAPI.h>
  10. namespace WhiteBox
  11. {
  12. void RequestEditSourceControl(const char* absoluteFilePath)
  13. {
  14. bool active = false;
  15. AzToolsFramework::SourceControlConnectionRequestBus::BroadcastResult(
  16. active, &AzToolsFramework::SourceControlConnectionRequestBus::Events::IsActive);
  17. if (active)
  18. {
  19. AzToolsFramework::SourceControlCommandBus::Broadcast(
  20. &AzToolsFramework::SourceControlCommandBus::Events::RequestEdit, absoluteFilePath, true,
  21. []([[maybe_unused]] bool success, [[maybe_unused]] AzToolsFramework::SourceControlFileInfo info)
  22. {
  23. });
  24. }
  25. }
  26. IEditor* GetIEditor()
  27. {
  28. IEditor* editor = nullptr;
  29. AzToolsFramework::EditorRequests::Bus::BroadcastResult(editor, &AzToolsFramework::EditorRequests::GetEditor);
  30. return editor;
  31. }
  32. } // namespace WhiteBox