PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/net/sourceforge/jarbundler/Service.java

#
Java | 204 lines | 63 code | 37 blank | 104 comment | 2 complexity | aa1cf86da8865d71ee039ff9f4edab9a MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. package net.sourceforge.jarbundler;
  2. import java.util.ArrayList;
  3. import java.util.Arrays;
  4. import java.util.List;
  5. /**
  6. * Represents an Info.plist Service specifying a service provided by the application.
  7. *
  8. * Port Name - The name of the port the application monitors for incoming service requests.
  9. *
  10. * Message - The name of the instance method to invoke for the service.
  11. * In Objective-C, the instance method must be of the form messageName:userData:error:.
  12. * In Java, the instance method must be of the form messageName(NSPasteBoard,String).
  13. *
  14. *
  15. * Menu Item - The text to add to the Services menu. The value must be unique.
  16. * You can use a slash character "/" to specify a submenu. For example, Mail/Send
  17. * would appear in the Services Menu as a menu named Mail with an item named Send.
  18. *
  19. *
  20. * Send Types - A list of the data type names that can be read by the service.
  21. * The NSPasteboard class description lists several common data types.
  22. *
  23. *
  24. * Return Types - A list of the data type names that can be returned by the service.
  25. * The NSPasteboard class description lists several common data types.
  26. * You must specify either Return Types, Send Types or both.
  27. *
  28. * You must specify either Send Types, Return Types or both.
  29. *
  30. *
  31. * Key Equivalent - This attribute is optional. The keyboard equivalent used to invoke
  32. * the service menu command. The value has to be a single character. Users invoke this
  33. * keyboard equivalent by pressing the Command and Shift key modifiers along with the character.
  34. *
  35. *
  36. * User Data - This attribute is optional. The value is free choosable and is passed
  37. * to the method as second parameter.
  38. *
  39. *
  40. * Timeout - This attribute is optional. It indicates the number of milliseconds
  41. * Services should wait for a response from the application providing
  42. * a service when a respond is required.
  43. *
  44. *
  45. * <service portname="jarBundler"
  46. * message="processRequest"
  47. * menuitem="JarBundler/Process Request"
  48. * sendtypes="NSStringPboardType,NSFilenamesPboardType"
  49. * returntypes="NSStringPboardType"
  50. * keyequivalent="p"
  51. * userdata="a string passed to the method"
  52. * timeout="5000" />
  53. */
  54. public class Service {
  55. private static final List EMPTYLIST = new ArrayList(0);
  56. /** The name of the port the application monitors for incoming service requests. */
  57. private String portName = null;
  58. /**
  59. * The name of the instance method to invoke for the service.
  60. * In Objective-C, the instance method must be of the form messageName:userData:error:.
  61. * In Java, the instance method must be of the form messageName(NSPasteBoard,String).
  62. */
  63. private String message = null;
  64. /**
  65. * The text to add to the Services menu. The value must be unique.
  66. * You can use a slash character "/" to specify a submenu. For example, Mail/Send
  67. * would appear in the Services Menu as a menu named Mail with an item named Send.
  68. */
  69. private String menuItem = null;
  70. /**
  71. * A list of the data type names that can be read by the service.
  72. * The NSPasteboard class description lists several common data types.
  73. * You must specify either Send Types, Return Types or both.
  74. */
  75. private String[] sendTypes = null;
  76. /**
  77. * A list of the data type names that can be returned by the service.
  78. * The NSPasteboard class description lists several common data types.
  79. * You must specify either Return Types, Send Types or both.
  80. */
  81. private String[] returnTypes = null;
  82. /**
  83. * This attribute is optional. The keyboard equivalent used to invoke
  84. * the service menu command. The value has to be a single character. Users invoke this
  85. * keyboard equivalent by pressing the Command and Shift key modifiers along with the character.
  86. */
  87. private String keyEquivalent = null;
  88. /**
  89. * This attribute is optional. The value is free choosable and is passed
  90. * to the method as second parameter.
  91. */
  92. private String userData = null;
  93. /**
  94. * This attribute is optional. It indicates the number of milliseconds
  95. * Services should wait for a response from the application providing
  96. * a service when a respond is required.
  97. */
  98. private String timeout = null;
  99. public void setPortName(String portName) {
  100. this.portName = portName;
  101. }
  102. public String getPortName() {
  103. return portName;
  104. }
  105. public void setMessage(String message) {
  106. this.message = message;
  107. }
  108. public String getMessage() {
  109. return message;
  110. }
  111. public void setMenuItem(String menuItem) {
  112. this.menuItem = menuItem;
  113. }
  114. public String getMenuItem() {
  115. return menuItem;
  116. }
  117. public void setSendTypes(String sendTypes) {
  118. this.sendTypes = sendTypes.split("[\\s,]");
  119. }
  120. public List getSendTypes() {
  121. return (sendTypes == null) ? EMPTYLIST : Arrays.asList(sendTypes);
  122. }
  123. public void setReturnTypes(String returnTypes) {
  124. this.returnTypes = returnTypes.split("[\\s,]");
  125. }
  126. public List getReturnTypes() {
  127. return (returnTypes == null) ? EMPTYLIST : Arrays.asList(returnTypes);
  128. }
  129. public void setKeyEquivalent(String keyEquivalent) {
  130. this.keyEquivalent = keyEquivalent;
  131. }
  132. public String getKeyEquivalent() {
  133. return keyEquivalent;
  134. }
  135. public void setUserData(String userData) {
  136. this.userData = userData;
  137. }
  138. public String getUserData() {
  139. return userData;
  140. }
  141. public void setTimeout(String timeout) {
  142. this.timeout = timeout;
  143. }
  144. public String getTimeout() {
  145. return timeout;
  146. }
  147. }