use of electric.xml.ParseException in project blue by kunstmusik.
the class BlueSystem method getCodeRepository.
public static File getCodeRepository() {
File repository = new File(blue.BlueSystem.getUserConfigurationDirectory() + File.separator + "codeRepository.xml");
if (!repository.exists()) {
System.out.println("Copying default code repository to user configuration directory");
try {
Document doc = new Document(BlueSystem.class.getResourceAsStream("codeRepository.xml"));
doc.write(repository);
} catch (ParseException | IOException ex) {
ExceptionHandler.printStackTrace(ex);
}
}
return repository;
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class BlueSystem method getUserInstrumentLibrary.
public static InstrumentLibrary getUserInstrumentLibrary() {
if (userInstrumentLibrary == null) {
String userInstrFileName = BlueSystem.getUserConfigurationDirectory() + File.separator + "userInstrumentLibrary.xml";
File f = new File(userInstrFileName);
if (f.exists()) {
boolean error = false;
try {
Document doc = new Document(f);
userInstrumentLibrary = InstrumentLibrary.loadFromXML(doc.getRoot());
} catch (ParseException e1) {
e1.printStackTrace();
error = true;
} catch (Exception e) {
e.printStackTrace();
error = true;
}
if (error) {
JOptionPane.showMessageDialog(null, "There was an error loading " + f.getAbsolutePath() + "\nPlease fix this file or remove it and restart blue.", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
} else {
userInstrumentLibrary = new InstrumentLibrary();
}
}
return userInstrumentLibrary;
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class BlueShare method selectServer.
private static String selectServer() {
String retVal = null;
// get server list from disk
try {
Document doc = new Document(new File(BlueSystem.getConfDir() + File.separator + "blueShare.xml"));
Element root = doc.getRoot();
Elements servers = root.getElements("server");
Object[] serverOptions = new Object[servers.size()];
int i = 0;
while (servers.hasMoreElements()) {
serverOptions[i] = servers.next().getTextString();
i++;
}
Object serverObj = JOptionPane.showInputDialog(null, BlueSystem.getString("blueShare.selectServer.message"), BlueSystem.getString("blueShare.selectServer.title"), JOptionPane.PLAIN_MESSAGE, null, serverOptions, serverOptions[0]);
if (serverObj != null) {
retVal = serverObj.toString();
}
} catch (ParseException | HeadlessException e) {
e.printStackTrace();
}
return retVal;
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class BlueShareRemoteCaller method getInstrument.
public static Instrument getInstrument(InstrumentOption iOption) throws IOException, XmlRpcException, ParseException {
Vector v = new Vector();
String result;
v.add(new Integer(iOption.getInstrumentId()));
result = (String) xrpc.execute("blueShare.getInstrument", v);
Instrument instrument = null;
try {
Document d = new Document(result);
instrument = (Instrument) ObjectUtilities.loadFromXML(d.getRoot());
} catch (Exception e) {
}
return instrument;
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class BlueShareRemoteCaller method getEffect.
public static Effect getEffect(EffectOption iOption) throws IOException, XmlRpcException, ParseException {
Vector v = new Vector();
String result;
v.add(new Integer(iOption.getInstrumentId()));
result = (String) xrpc.execute("blueShare.getEffect", v);
Effect effect = null;
try {
Document d = new Document(result);
effect = Effect.loadFromXML(d.getRoot());
} catch (Exception e) {
}
return effect;
}
Aggregations