Revision 46643 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/InitializeApplicationExtension.java
InitializeApplicationExtension.java | ||
---|---|---|
142 | 142 |
|
143 | 143 |
v = prefs.get("LegendsFolder", folderManager.getHome().getAbsolutePath()); |
144 | 144 |
folderManager.setLastPath("LegendsFolder", new File(v)); |
145 |
|
|
146 |
try { |
|
147 |
PluginsManager pluginManager = PluginsLocator.getPluginsManager(); |
|
148 |
PluginServices plugin = pluginManager.getPlugin(this); |
|
149 |
DynObject preferences = plugin.getPluginProperties(); |
|
150 |
Map<String,String>paths = (Map<String,String>) preferences.getDynValue("folderManagerPaths"); |
|
151 |
if( paths!=null ) { |
|
152 |
for (Map.Entry<String, String> path : paths.entrySet()) { |
|
153 |
String name = path.getKey(); |
|
154 |
String path_s = path.getValue(); |
|
155 |
folderManager.set(name, new File(path_s)); |
|
156 |
} |
|
157 |
} |
|
158 |
pluginManager.addShutdownTask("saveFolderManagerPaths", () -> { |
|
159 |
doFolderManagerPaths(); |
|
160 |
}, false, 100); |
|
161 |
} catch (Exception ex) { |
|
162 |
LOGGER.warn("Can't restore folder manager paths.", ex); |
|
163 |
} |
|
164 |
|
|
145 | 165 |
} |
146 | 166 |
|
147 | 167 |
@Override |
... | ... | |
242 | 262 |
} |
243 | 263 |
} |
244 | 264 |
|
265 |
private void doFolderManagerPaths() { |
|
266 |
FoldersManager folderManager = ToolsLocator.getFoldersManager(); |
|
267 |
PluginsManager pluginManager = PluginsLocator.getPluginsManager(); |
|
268 |
PluginServices plugin = pluginManager.getPlugin(this); |
|
269 |
DynObject preferences = plugin.getPluginProperties(); |
|
270 |
|
|
271 |
Map<String,String> paths = new HashMap<>(); |
|
272 |
for (String name: folderManager) { |
|
273 |
File f = folderManager.get(name); |
|
274 |
if( f!=null ) { |
|
275 |
paths.put(name, f.getAbsolutePath()); |
|
276 |
} |
|
277 |
} |
|
278 |
preferences.setDynValue("folderManagerPaths",paths); |
|
279 |
} |
|
280 |
|
|
245 | 281 |
private static class ShowNewMaximizedView implements Runnable { |
246 | 282 |
|
247 | 283 |
@Override |
Also available in: Unified diff