01: /*
02: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: //
07: package com.sun.portal.ffj.util;
08:
09: //
10: import java.text.DateFormat;
11: import java.util.Date;
12: import java.util.HashMap;
13: import java.util.Map;
14:
15: import org.netbeans.modules.java.JMapFormat;
16:
17: import org.openide.filesystems.FileObject;
18: import org.openide.loaders.*;
19: import org.openide.util.MapFormat;
20:
21: //
22: public class PSFormat extends FileEntry.Format {
23: //
24: public PSFormat(MultiDataObject obj, FileObject primaryFile) {
25: super (obj, primaryFile);
26: }
27:
28: public java.text.Format createFormat(FileObject target,
29: String name, String ext) {
30: Map map = new HashMap(8);
31:
32: // File name
33: map.put("NAME", name);
34:
35: // User/author
36: map.put("USER", System.getProperty("user.name"));
37:
38: // Date
39: map.put("DATE", DateFormat.getDateInstance(DateFormat.LONG)
40: .format(new Date()));
41:
42: // Time
43: map.put("TIME", DateFormat.getTimeInstance(DateFormat.SHORT)
44: .format(new Date()));
45:
46: // Java package without Java-file-name (no extension)
47: map.put("PACKAGE", target.getPackageName('.'));
48: map.put("PACKAGE_SLASHES", target.getPackageName('/'));
49:
50: // Fully qualified Java-file-name (no extension)
51: if (target.isRoot()) {
52: map.put("PACKAGE_AND_NAME", name);
53: map.put("PACKAGE_AND_NAME_SLASHES", name);
54: } else {
55: map.put("PACKAGE_AND_NAME", target.getPackageName('.')
56: + '.' + name);
57: map.put("PACKAGE_AND_NAME_SLASHES", target
58: .getPackageName('/')
59: + '/' + name);
60: }
61:
62: //
63: JMapFormat format = new JMapFormat(map);
64: format.setLeftBrace("__");
65: format.setRightBrace("__");
66: format.setCondDelimiter("$");
67: format.setExactMatch(false);
68:
69: //
70: return format;
71: }
72:
73: //
74: //
75: //
76: }
|