use of electric.xml.ParseException in project blue by kunstmusik.
the class CodeRepositoryDialog method setupTree.
private void setupTree() {
try {
TreeNode rootNode = CodeRepositoryManager.getCodeRepositoryTreeNode(true);
codeTree = new JTree(rootNode);
treeModel = (DefaultTreeModel) codeTree.getModel();
treeModel.setAsksAllowsChildren(true);
codeTree.setEditable(true);
codeTree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
int row = codeTree.getClosestRowForLocation(e.getX(), e.getY());
TreePath path = codeTree.getClosestPathForLocation(e.getX(), e.getY());
if (row == -1) {
cards.show(editPanel, "disabled");
selected = null;
return;
}
CodeRepositoryTreeNode tempNode = (CodeRepositoryTreeNode) path.getLastPathComponent();
ElementHolder tempElem = (ElementHolder) tempNode.getUserObject();
if (UiUtilities.isRightMouseButton(e)) {
showPopup(tempNode, tempElem, e.getX(), e.getY());
} else {
if (tempElem.isGroup) {
cards.show(editPanel, "disabled");
selected = null;
} else {
cards.show(editPanel, "enabled");
selected = tempElem;
code1Text.setText(tempElem.text);
}
undo.discardAllEdits();
;
}
}
});
} catch (ParseException pe) {
System.out.println("[blue.gui.OpcodePopup] There was an error trying to open or parse opcodes.xml or codeRepository.xml");
pe.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class EffectImportPane method importEffect.
private void importEffect() {
EffectOption effectOption = iTableModel.getInstrumentOption(instrumentTable.getSelectedRow());
if (effectOption == null) {
return;
}
try {
Effect effect = BlueShareRemoteCaller.getEffect(effectOption);
if (effect == null) {
String error = BlueSystem.getString("blueShare.effect.importError");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
// data.getOrchestra().addInstrument(instrument);
// instrumentTreeModel.reload();
// InstrumentLibrary instrLib =
// BlueSystem.getUserInstrumentLibrary();
EffectsLibrary library = EffectsLibrary.getInstance();
library.importEffect(effect);
library.save();
String message = BlueSystem.getString("blueShare.effect.importSuccess");
JOptionPane.showMessageDialog(null, message, BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
} catch (ParseException pe) {
String error = BlueSystem.getString("blueShare.selectServer.couldNotReadResponse");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (XmlRpcException xre) {
String error = "Error: " + xre.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (IOException ioe) {
String error = "Error: " + ioe.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class ScriptLibrary method getInstance.
public static ScriptLibrary getInstance() {
if (library == null) {
String scriptLibFileName = BlueSystem.getUserConfigurationDirectory() + File.separator + "scriptLibrary.xml";
File f = new File(scriptLibFileName);
if (f.exists()) {
boolean error = false;
try {
Document doc = new Document(f);
library = ScriptLibrary.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);
}
}
if (library == null) {
library = new ScriptLibrary();
System.out.println("Creating new Script Library");
}
}
return library;
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class BlueSystem method getSoundObjectLibrary.
public static Library<SoundObject> getSoundObjectLibrary() {
if (soundObjectLibrary == null) {
String userInstrFileName = BlueSystem.getUserConfigurationDirectory() + File.separator + "soundObjectLibrary.xml";
File f = new File(userInstrFileName);
if (f.exists()) {
boolean error = false;
try {
Document doc = new Document(f);
Map<String, Object> objRefMap = new HashMap<>();
soundObjectLibrary = Library.loadLibrary(doc.getRoot(), elem -> {
try {
return (SoundObject) ObjectUtilities.loadFromXML(elem, objRefMap);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
});
} 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 {
soundObjectLibrary = Library.createLibrary("SoundObjects");
}
}
return soundObjectLibrary;
}
use of electric.xml.ParseException in project blue by kunstmusik.
the class BlueSystem method getUDOLibrary.
public static UDOLibrary getUDOLibrary() {
if (udoLibrary == null) {
String userInstrFileName = BlueSystem.getUserConfigurationDirectory() + File.separator + "udoLibrary.xml";
File f = new File(userInstrFileName);
if (f.exists()) {
boolean error = false;
try {
Document doc = new Document(f);
udoLibrary = udoLibrary.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 {
udoLibrary = new UDOLibrary();
}
}
return udoLibrary;
}
Aggregations