/** * Save preferences to disk. * * @param prefsFile * File to save preferences to. */ private void savePrefs(FileWrapper prefsFile) throws IOException, XMLException { _settingsCache.save(prefsFile.getPath()); }
private static GraphXmlSerializer[] createSerializers(GraphPlugin plugin, ISession session, FileWrapper[] graphXmlFiles) { GraphXmlSerializer[] ret = new GraphXmlSerializer[graphXmlFiles.length]; for (int i = 0; i < graphXmlFiles.length; i++) { ret[i] = new GraphXmlSerializer(plugin, session, graphXmlFiles[i].getPath()); } return ret; }
public void transformToLocalCopy() { try { String linkName = new File(_pathOfLinkXmlFile).getName(); String newGraphsName = linkName.substring(LINK_PREFIX.length(), linkName.length()); _graphFilePath = new File(_plugin.getPluginUserSettingsFolder().getPath(), newGraphsName).getAbsolutePath(); _linkXmlBean = null; new File(_pathOfLinkXmlFile).delete(); _pathOfLinkXmlFile = null; } catch (IOException e) { throw new RuntimeException(e); } }
private void onHomeDir() { try { _linkGraphDialog.txtDir.setText(_plugin.getPluginUserSettingsFolder().getPath()); loadTable(_plugin, _session, _plugin.getPluginUserSettingsFolder()); } catch (Exception e) { throw new RuntimeException(e); } }
public FormatController(ISession session, GraphPlugin plugin, FormatControllerListener listener) { try { _plugin = plugin; _session = session; _listener = listener; String userSettingsFolder = _plugin.getPluginUserSettingsFolder().getPath(); File f = new File(userSettingsFolder + File.separator + FORMAT_XML_FILE_NAME); if(f.exists()) { XMLBeanReader br = new XMLBeanReader(); br.load(userSettingsFolder + File.separator + FORMAT_XML_FILE_NAME, this.getClass().getClassLoader()); Vector<FormatXmlBean> buf = new Vector<FormatXmlBean>(); for(Iterator<?> i=br.iterator(); i.hasNext();) { buf.add((FormatXmlBean)i.next()); } _formats = buf.toArray(new FormatXmlBean[buf.size()]); } } catch (Exception e) { throw new RuntimeException(e); } }
public void setAutoCorrects(Hashtable<String, String> newAutoCorrects, boolean enableAutoCorrects) { try { _autoCorrectData = new AutoCorrectData(newAutoCorrects, enableAutoCorrects); XMLBeanWriter bw = new XMLBeanWriter(_autoCorrectData); bw.save(_pluginUserSettingsFolder.getPath() + File.separator + AUTO_CORRECT_DATA_FILE_NAME); } catch (Exception e) { throw new RuntimeException(e); } }
private String generateGraphFilePath(String title) { try { String url = _session.getAlias().getUrl(); return getFileName(_plugin.getPluginUserSettingsFolder().getPath(), url, title); } catch (Exception e) { throw new RuntimeException(e); } }
private void saveFormats() { try { String userSettingsFolder = _plugin.getPluginUserSettingsFolder().getPath(); XMLBeanWriter bw = new XMLBeanWriter(); for (int i = 0; i < _formats.length; i++) { bw.addToRoot(_formats[i]); } bw.save(userSettingsFolder + File.separator + FORMAT_XML_FILE_NAME); } catch (Exception e) { throw new RuntimeException(e); } }
public void renameGraph(String newGraphName) { try { String url = _session.getAlias().getUrl(); String newGraphFile = getFileName(_plugin.getPluginUserSettingsFolder().getPath(), url, newGraphName); if (new File(_graphFilePath).exists()) { if(false == new File(_graphFilePath).renameTo(new File(newGraphFile))) { String msg = "Failed to rename file: " + _graphFilePath; _session.showErrorMessage(msg); throw new IllegalStateException(msg); } String[] params = {_graphFilePath, newGraphFile}; // i18n[graph.graphRenamed=Renamed "{0}" to "{1}"] _session.showMessage(s_stringMgr.getString("graph.graphRenamed", params)); } _graphFilePath = newGraphFile; _title = newGraphName; } catch (IOException e) { throw new RuntimeException(e); } }
private ArrayList<LinkXmlBean> getExistingLinks(GraphPlugin plugin) { try { String[] linkFileNames = plugin.getPluginUserSettingsFolder().list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name.startsWith(DefaultGraphXmlSerializerConfig.LINK_PREFIX)) { return true; } return false; } }); ArrayList<LinkXmlBean> ret = new ArrayList<LinkXmlBean>(); XMLBeanReader br = new XMLBeanReader(); for (String linkFileName : linkFileNames) { br.load(new File(plugin.getPluginUserSettingsFolder().getPath(), linkFileName), LinkGraphController.class.getClassLoader()); ret.add((LinkXmlBean) br.iterator().next()); } return ret; } catch (Exception e) { throw new RuntimeException(e); } }
_settingsCache.load(newPrefsFile.getPath(), getClass().getClassLoader());
os.putNextEntry(new ZipEntry(file.getPath())); _iou.copyBytes(fis, os);
os.putNextEntry(new ZipEntry(file.getPath())); _iou.copyBytes(fis, os);
private void onCreate() { try { int[] seletedRowIndexes = _linkGraphDialog.tblGraphFiles.getSeletedModelRows(); for (int seletedRowIndex : seletedRowIndexes) { GraphFileDisplayBean gdb = _graphFileDisplayBeans.get(seletedRowIndex); String linkName = _plugin.patchName(gdb.getName().toString(), _session); File pathOfLinkXmlFile = new File(_plugin.getPluginUserSettingsFolder().getPath(), createLinkFileName(gdb)); LinkXmlBean linkXmlBean = new LinkXmlBean(linkName, gdb.getName().toString(), gdb.getGraphFile().getAbsolutePath()); XMLBeanWriter bw = new XMLBeanWriter(linkXmlBean); bw.save(pathOfLinkXmlFile.getAbsolutePath()); GraphXmlSerializer graphXmlSerializer = new GraphXmlSerializer(_plugin, _session, linkXmlBean, pathOfLinkXmlFile.getAbsolutePath()); _plugin.createNewGraphControllerForSession(_session, graphXmlSerializer, false); } onWindowClosing(); _linkGraphDialog.setVisible(false); _linkGraphDialog.dispose(); } catch (Exception e) { throw new RuntimeException(e); } }
_linkGraphDialog.txtDir.setText(graphPlugin.getPluginUserSettingsFolder().getPath());