switch (e.getAction()) {
case LibraryEvent.ADD_TOOL:
if (e.getData() instanceof AddTool) {
ComponentFactory factory = ((AddTool) e.getData()).getFactory();
if (factory instanceof SubcircuitFactory) {
SubcircuitFactory circFact = (SubcircuitFactory) factory;
processCircuit(circFact.getSubcircuit());
}
}
break;
case LibraryEvent.REMOVE_TOOL:
if (e.getData() instanceof AddTool) {
ComponentFactory factory = ((AddTool) e.getData()).getFactory();
if (factory instanceof SubcircuitFactory) {
SubcircuitFactory circFact = (SubcircuitFactory) factory;
Circuit circ = circFact.getSubcircuit();
depends.removeNode(circ);
circ.removeCircuitListener(this);
}
}
break;