Revision 40972 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/actions/CopyPasteLayersUtils.java
CopyPasteLayersUtils.java | ||
---|---|---|
68 | 68 |
/** |
69 | 69 |
* The file which is used to save the layers |
70 | 70 |
*/ |
71 |
private static String CLIPBOARD_FILE_NAME = "gvSIG_clipboard.tmp"; |
|
71 |
private static String CLIPBOARD_FILE_NAME = "gvSIG_layers_clipboard.tmp"; |
|
72 |
private static String CLIPBOARD_FOLDER = |
|
73 |
System.getProperty("user.home") + File.separator + "gvSIG" |
|
74 |
+ File.separator + "clipboard-layers"; |
|
75 |
|
|
76 |
static { |
|
77 |
File f = new File(CLIPBOARD_FOLDER); |
|
78 |
f.mkdirs(); |
|
79 |
} |
|
72 | 80 |
|
73 | 81 |
private static/* XML */PersistenceManager persManager = ToolsLocator |
74 | 82 |
.getPersistenceManager(); |
... | ... | |
84 | 92 |
* @throws IOException |
85 | 93 |
*/ |
86 | 94 |
private static OutputStream getClipboardOStream() throws IOException { |
87 |
String strf = |
|
88 |
System.getProperty("user.home") + File.separator + "gvSIG" |
|
89 |
+ File.separator + CLIPBOARD_FILE_NAME; |
|
95 |
String strf = CLIPBOARD_FOLDER+ File.separator + CLIPBOARD_FILE_NAME; |
|
90 | 96 |
File f = new File(strf); |
91 | 97 |
if (f.exists()) { |
92 | 98 |
/* |
... | ... | |
95 | 101 |
*/ |
96 | 102 |
f.delete(); |
97 | 103 |
} |
104 |
f.createNewFile(); |
|
98 | 105 |
/* |
99 | 106 |
* File will be removed on exit |
100 | 107 |
*/ |
101 | 108 |
f.deleteOnExit(); |
102 | 109 |
return new FileOutputStream(f); |
103 | 110 |
} |
111 |
|
|
112 |
public static void clearClipboard() throws IOException { |
|
113 |
String strf = CLIPBOARD_FOLDER + File.separator + CLIPBOARD_FILE_NAME; |
|
114 |
File f = new File(strf); |
|
115 |
if (f.exists()) { |
|
116 |
f.delete(); |
|
117 |
} |
|
118 |
} |
|
104 | 119 |
|
105 | 120 |
/** |
106 | 121 |
* Gets the input stream to read the clipboard or null |
... | ... | |
110 | 125 |
* @throws IOException |
111 | 126 |
*/ |
112 | 127 |
private static InputStream getClipboardIStream() throws IOException { |
113 |
String strf = |
|
114 |
System.getProperty("user.home") + File.separator + "gvSIG" |
|
115 |
+ File.separator + CLIPBOARD_FILE_NAME; |
|
128 |
String strf = CLIPBOARD_FOLDER + File.separator + CLIPBOARD_FILE_NAME; |
|
116 | 129 |
File f = new File(strf); |
117 | 130 |
if (f.exists()) { |
118 | 131 |
return new FileInputStream(f); |
Also available in: Unified diff