ACSElement element = ((DeleteElementEvent)event).getDeletedElement();
model.fireNodeDeleted(element);
_tree.updateUI();
}
else {
ACSProjectElement project = null;
if(event instanceof ProjectSelectedEvent) {
ProjectSelectedEvent e = (ProjectSelectedEvent) event;
project = e.getSelectedProject();
}
if(project == null) {
// The project has been closed.
// XXX this needs to be tested against
// different version of Swing...
_tree.setModel(null);
_tree.setSelectionModel(null);
// Send an empty selection event to notify others that
// nothing is selected.
ElementSelectionEvent.createEvent(getContext(), null);
}
else {
boolean updateModel = false;
TreeModel testModel = _tree.getModel();
// Set the model if's not an ElementTreeModel
if (testModel instanceof ElementTreeModel) {
ElementTreeModel etm = (ElementTreeModel) testModel;
ACSProjectElement currentProject =
(ACSProjectElement) etm.getRoot();
// Set the model if the project is wrong
if (currentProject != project) {
updateModel = true;