use of org.cytoscape.application.CyApplicationConfiguration in project cytoscape-impl by cytoscape.
the class CommandToolPanel method restoreCommandHistory.
private void restoreCommandHistory() {
CyApplicationConfiguration appConfig = serviceRegistrar.getService(CyApplicationConfiguration.class);
File appConfigDir = appConfig.getConfigurationDirectoryLocation();
savedCommandsFile = new File(appConfigDir.getAbsolutePath() + File.separator + "commandHistory.txt");
if (savedCommandsFile.exists()) {
readCommandHistory(savedCommandsFile);
}
}
use of org.cytoscape.application.CyApplicationConfiguration in project cytoscape-impl by cytoscape.
the class Cy3PreferencesPanel method saveStateToConfigDirectory.
// ---------------------------------------------------------------------------------------------------------
public void saveStateToConfigDirectory() {
copyLocalToGlobalProperties();
Map<String, Properties> prefs = propertyMap;
System.out.println("saveStateToConfigDirectory");
for (String key : prefs.keySet()) {
if (key.startsWith("layout"))
continue;
if (key.startsWith("vizmap"))
continue;
final String propertyName = key;
if (propertyName == null || propertyName.isEmpty())
continue;
String propertyFileName = propertyName;
if (!propertyFileName.endsWith(".props"))
propertyFileName += ".props";
final CyApplicationConfiguration config = serviceRegistrar.getService(CyApplicationConfiguration.class);
final File outputFile = new File(config.getConfigurationDirectoryLocation(), propertyFileName);
Properties properties = prefs.get(key);
try {
FileOutputStream out = new FileOutputStream(outputFile);
properties.store(out, null);
out.close();
} catch (Exception e) {
System.err.println("Error in writing properties file.");
}
}
}
use of org.cytoscape.application.CyApplicationConfiguration in project cytoscape-impl by cytoscape.
the class MakeVisualStylesDefaultTask method run.
@Override
public void run(final TaskMonitor monitor) throws Exception {
if (!confirm)
return;
final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
final Set<VisualStyle> currentStyles = vmMgr.getAllVisualStyles();
if (!currentStyles.isEmpty()) {
final VizmapWriterFactory vizmapWriterFactory = servicesUtil.get(VizmapWriterFactory.class);
final CyApplicationConfiguration config = servicesUtil.get(CyApplicationConfiguration.class);
final FileOutputStream os = new FileOutputStream(new File(config.getConfigurationDirectoryLocation(), VizMapperProxy.PRESET_VIZMAP_FILE));
final CyWriter vizmapWriter = vizmapWriterFactory.createWriter(os, currentStyles);
if (!cancelled)
vizmapWriter.run(monitor);
}
}
Aggregations