LinearDefinition ld = gazetter.getLinearDefinition(); //add .lst record LinearNode ln = new LinearNode("glossary.lst", "minor", "major", "en", "AnnotType"); ld.add(ln); //add Lookup record Map<String, Object> features = new HashMap<>(); features.put("someFeatureName", "some value"); GazetteerNode gn = new GazetteerNode("string to be found", features); gn.setSeparator("@"); GazetteerList theList = ld.getListsByNode().get(ln); theList.add(gn); //save updated files theList.store(); ld.store(); //optionally re-init the gazetteer to make changes to work gazetter.reInit();
GazetteerList theList = theLists.get(iter1.next()); try { if(theList.isModified()) theList.store(); } catch(ResourceInstantiationException ex) { throw new GateRuntimeException(ex.getMessage());
Files.fileFromURL(gazetteerList.getURL()).getName()) .toURI().toURL()); gazetteerList.store(); gazetteerList.setURL(previousURL); gazetteerList.setModified(false);
@Override public void actionPerformed(ActionEvent e) { try { if (linearDefinition.isModified()) { linearDefinition.store(); } for (Object object : linearDefinition.getListsByNode().values()) { GazetteerList gazetteerList = (GazetteerList) object; if (gazetteerList.isModified()) { gazetteerList.store(); } } gazetteer.reInit(); MainFrame.getInstance().statusChanged("Gazetteer saved in " + linearDefinition.getURL().getPath()); definitionTable.repaint(); } catch (ResourceInstantiationException re) { MainFrame.getInstance().statusChanged( "Unable to save the Gazetteer."); Err.prln("Unable to save the Gazetteer.\n" + re.getMessage()); } } }
&& oldListFileName.equals(newListFileName)) { return; } try { // save the previous list gazetteerList.store(); MainFrame.getInstance().statusChanged("Previous list saved in " + gazetteerList.getURL().getPath());