PackageSrvAutoGenEditorWindow.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. © Siemens AG, 2019
  3. Author: Sifan Ye (sifan.ye@siemens.com)
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. <http://www.apache.org/licenses/LICENSE-2.0>.
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. using System.Collections.Generic;
  15. using UnityEditor;
  16. using UnityEngine;
  17. namespace RosSharp.RosBridgeClient.MessageGeneration
  18. {
  19. public class PackageSrvAutoGenEditorWindow : PackageAutoGenEditorWindow
  20. {
  21. protected override string GenerationType
  22. {
  23. get { return "service"; }
  24. }
  25. protected override string FileExtension
  26. {
  27. get { return "srv"; }
  28. }
  29. [MenuItem("RosBridgeClient/Auto Generate Services/Package Services...", false, 11)]
  30. private static void OpenWindow()
  31. {
  32. PackageSrvAutoGenEditorWindow window = GetWindow<PackageSrvAutoGenEditorWindow>(false, "Service Auto Generation", true);
  33. window.minSize = new Vector2(750, 100);
  34. window.maxSize = new Vector2(750, 100);
  35. window.Show();
  36. }
  37. protected override List<string> Generate(string inPath, string outPath, string rosPackageName = "")
  38. {
  39. return ServiceAutoGen.GenerateSingleService(inPath, outPath, rosPackageName);
  40. }
  41. }
  42. }