1 /* |
1 /* |
2 * Copyright (c) 1994, 2002, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
279 |
280 |
280 return theClone; |
281 return theClone; |
281 } |
282 } |
282 |
283 |
283 public synchronized String toProperty() { |
284 public synchronized String toProperty() { |
284 StringBuilder sb = new StringBuilder(); |
285 StringJoiner sj = new StringJoiner("; "); |
285 |
|
286 String separator = "; "; |
|
287 boolean needSeparator = false; |
|
288 |
286 |
289 int action = getAction(); |
287 int action = getAction(); |
290 if (action != MimeEntry.UNKNOWN) { |
288 if (action != MimeEntry.UNKNOWN) { |
291 sb.append("action=" + actionKeywords[action]); |
289 sj.add("action=" + actionKeywords[action]); |
292 needSeparator = true; |
|
293 } |
290 } |
294 |
291 |
295 String command = getLaunchString(); |
292 String command = getLaunchString(); |
296 if (command != null && command.length() > 0) { |
293 if (command != null && command.length() > 0) { |
297 if (needSeparator) { |
294 sj.add("application=" + command); |
298 sb.append(separator); |
295 } |
299 } |
296 |
300 sb.append("application=" + command); |
297 String image = getImageFileName(); |
301 needSeparator = true; |
298 if (image != null) { |
302 } |
299 sj.add("icon=" + image); |
303 |
|
304 if (getImageFileName() != null) { |
|
305 if (needSeparator) { |
|
306 sb.append(separator); |
|
307 } |
|
308 sb.append("icon=" + getImageFileName()); |
|
309 needSeparator = true; |
|
310 } |
300 } |
311 |
301 |
312 String extensions = getExtensionsAsList(); |
302 String extensions = getExtensionsAsList(); |
313 if (extensions.length() > 0) { |
303 if (extensions.length() > 0) { |
314 if (needSeparator) { |
304 sj.add("file_extensions=" + extensions); |
315 sb.append(separator); |
|
316 } |
|
317 sb.append("file_extensions=" + extensions); |
|
318 needSeparator = true; |
|
319 } |
305 } |
320 |
306 |
321 String description = getDescription(); |
307 String description = getDescription(); |
322 if (description != null && !description.equals(getType())) { |
308 if (description != null && !description.equals(getType())) { |
323 if (needSeparator) { |
309 sj.add("description=" + description); |
324 sb.append(separator); |
310 } |
325 } |
311 |
326 sb.append("description=" + description); |
312 return sj.toString(); |
327 } |
|
328 |
|
329 return sb.toString(); |
|
330 } |
313 } |
331 |
314 |
332 public String toString() { |
315 public String toString() { |
333 return "MimeEntry[contentType=" + typeName |
316 return "MimeEntry[contentType=" + typeName |
334 + ", image=" + imageFileName |
317 + ", image=" + imageFileName |