/**
* {@inheritDoc}
*/
public void indexSelected(IndexSelectionEvent ev)
{
AbstractIndexDescriptor index = ev.getIndex();
TreeNode parentNode;
if (index instanceof IndexDescriptor)
{
parentNode = standardIndexes;
}
else
{
parentNode = vlvIndexes;
}
DefaultTreeModel model =
(DefaultTreeModel)treePane.getTree().getModel();
int n = model.getChildCount(parentNode);
for (int i=0; i<n; i++)
{
AbstractIndexTreeNode node =
(AbstractIndexTreeNode)model.getChild(parentNode, i);
if (node.getName().equals(index.getName()))
{
TreePath newSelectionPath = new TreePath(node.getPath());
treePane.getTree().setSelectionPath(newSelectionPath);
treePane.getTree().scrollPathToVisible(newSelectionPath);
break;
}
}
}
});
// Create a split pane
pane.setLeftComponent(treeScroll);
pane.setRightComponent(entryPane);
pane.setResizeWeight(0.0);
treePane.getTree().addTreeSelectionListener(new TreeSelectionListener()
{
/**
* {@inheritDoc}
*/
public void valueChanged(TreeSelectionEvent ev)
{
if (!ignoreSelectionEvents)
{
TreePath[] paths = treePane.getTree().getSelectionPaths();
if (entryPane.mustCheckUnsavedChanges())
{
ignoreSelectionEvents = true;
treePane.getTree().setSelectionPath(lastIndexTreePath);
switch (entryPane.checkUnsavedChanges())
{
case DO_NOT_SAVE:
break;
case SAVE:
break;
case CANCEL:
ignoreSelectionEvents = false;
return;
}
if (paths != null)
{
treePane.getTree().setSelectionPaths(paths);
}
else
{
treePane.getTree().clearSelection();
}
ignoreSelectionEvents = false;
}
boolean deletableElementsSelected = false;
boolean nonDeletableElementsSelected = false;
if (paths != null)
{
for (TreePath path : paths)
{
Object node = path.getLastPathComponent();
if (node instanceof IndexTreeNode)
{
IndexDescriptor index = ((IndexTreeNode)node).getIndex();
if (index.isDatabaseIndex())
{
nonDeletableElementsSelected = true;
}
else
{