use of net.sf.launch4j.binding.InvariantViolationException in project cogtool by cogtool.
the class MainFrame method save.
private boolean save() {
// XXX
try {
_configForm.get(ConfigPersister.getInstance().getConfig());
if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
File f = _fileChooser.getSelectedFile();
if (!f.getPath().endsWith(".xml")) {
f = new File(f.getPath() + ".xml");
}
ConfigPersister.getInstance().save(f);
_saved = true;
showConfigName(f);
return true;
}
return false;
} catch (InvariantViolationException ex) {
warn(ex);
return false;
} catch (BindingException ex) {
warn(ex.getMessage());
return false;
} catch (ConfigPersisterException ex) {
warn(ex.getMessage());
return false;
}
}
use of net.sf.launch4j.binding.InvariantViolationException in project chipKIT32-MAX by chipKIT32.
the class MainFrame method save.
private boolean save() {
// XXX
try {
_configForm.get(ConfigPersister.getInstance().getConfig());
if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
File f = _fileChooser.getSelectedFile();
if (!f.getPath().endsWith(".xml")) {
f = new File(f.getPath() + ".xml");
}
ConfigPersister.getInstance().save(f);
_saved = true;
showConfigName(f);
return true;
}
return false;
} catch (InvariantViolationException ex) {
warn(ex);
return false;
} catch (BindingException ex) {
warn(ex.getMessage());
return false;
} catch (ConfigPersisterException ex) {
warn(ex.getMessage());
return false;
}
}
use of net.sf.launch4j.binding.InvariantViolationException in project megameklab by MegaMek.
the class MainFrame method save.
private boolean save() {
// XXX
try {
_configForm.get(ConfigPersister.getInstance().getConfig());
if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
File f = _fileChooser.getSelectedFile();
if (!f.getPath().endsWith(".xml")) {
f = new File(f.getPath() + ".xml");
}
ConfigPersister.getInstance().save(f);
_saved = true;
showConfigName(f);
return true;
}
return false;
} catch (InvariantViolationException ex) {
warn(ex);
return false;
} catch (BindingException ex) {
warn(ex.getMessage());
return false;
} catch (ConfigPersisterException ex) {
warn(ex.getMessage());
return false;
}
}
use of net.sf.launch4j.binding.InvariantViolationException in project megameklab by MegaMek.
the class Cmd method build.
/**
* @return Output file path.
*/
public File build() throws BuilderException {
final Config c = ConfigPersister.getInstance().getConfig();
try {
c.validate();
} catch (InvariantViolationException e) {
throw new BuilderException(e.getMessage());
}
File rc = null;
File ro = null;
File outfile = null;
FileInputStream is = null;
FileOutputStream os = null;
final RcBuilder rcb = new RcBuilder();
try {
rc = rcb.build(c);
ro = Util.createTempFile("o");
outfile = ConfigPersister.getInstance().getOutputFile();
Cmd resCmd = new Cmd(_basedir);
resCmd.addExe("windres").add(Util.WINDOWS_OS ? "--preprocessor=type" : "--preprocessor=cat").add("-J rc -O coff -F pe-i386").addAbsFile(rc).addAbsFile(ro);
_log.append(Messages.getString("Builder.compiling.resources"));
resCmd.exec(_log);
Cmd ldCmd = new Cmd(_basedir);
ldCmd.addExe("ld").add("-mi386pe").add("--oformat pei-i386").add((c.getHeaderType().equals(Config.GUI_HEADER)) ? "--subsystem windows" : "--subsystem console").add(// strip symbols
"-s").addFiles(c.getHeaderObjects()).addAbsFile(ro).addFiles(c.getLibs()).add("-o").addAbsFile(outfile);
_log.append(Messages.getString("Builder.linking"));
ldCmd.exec(_log);
if (!c.isDontWrapJar()) {
_log.append(Messages.getString("Builder.wrapping"));
int len;
byte[] buffer = new byte[1024];
is = new FileInputStream(Util.getAbsoluteFile(ConfigPersister.getInstance().getConfigPath(), c.getJar()));
os = new FileOutputStream(outfile, true);
while ((len = is.read(buffer)) > 0) {
os.write(buffer, 0, len);
}
}
_log.append(Messages.getString("Builder.success") + outfile.getPath());
return outfile;
} catch (IOException e) {
Util.delete(outfile);
_log.append(e.getMessage());
throw new BuilderException(e);
} catch (ExecException e) {
Util.delete(outfile);
String msg = e.getMessage();
if (msg != null && msg.indexOf("windres") != -1) {
if (e.getErrLine() != -1) {
_log.append(Messages.getString("Builder.line.has.errors", String.valueOf(e.getErrLine())));
_log.append(rcb.getLine(e.getErrLine()));
} else {
_log.append(Messages.getString("Builder.generated.resource.file"));
_log.append(rcb.getContent());
}
}
throw new BuilderException(e);
} finally {
Util.close(is);
Util.close(os);
Util.delete(rc);
Util.delete(ro);
}
}
use of net.sf.launch4j.binding.InvariantViolationException in project beast-mcmc by beast-dev.
the class MainFrame method save.
private boolean save() {
try {
_configForm.get(ConfigPersister.getInstance().getConfig());
if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
File f = _fileChooser.getSelectedFile();
if (!f.getPath().endsWith(".xml")) {
f = new File(f.getPath() + ".xml");
}
ConfigPersister.getInstance().save(f);
_saved = true;
showConfigName(f);
return true;
}
return false;
} catch (InvariantViolationException ex) {
warn(ex);
return false;
} catch (BindingException ex) {
warn(ex.getMessage());
return false;
} catch (ConfigPersisterException ex) {
warn(ex.getMessage());
return false;
}
}
Aggregations