* @param session
* the current session whose tree API should be updated
*/
private void updateTreeApi(ISession session)
{
IObjectTreeAPI _treeAPI = session.getSessionInternalFrame().getObjectTreeAPI();
final String stmtSep = session.getQueryTokenizer().getSQLStatementSeparator();
final ActionCollection col = getApplication().getActionCollection();
// ////// Object Tree Expanders ////////
// Schema Expanders - sequence
_treeAPI.addExpander(DatabaseObjectType.SCHEMA,
new SchemaExpander(new PostgresSequenceInodeExpanderFactory(), DatabaseObjectType.SEQUENCE));
// Table Expanders - trigger and index
// expander
TableWithChildNodesExpander tableExpander = new TableWithChildNodesExpander();
// extractors
ITableIndexExtractor indexExtractor = new PostgresTableIndexExtractorImpl();
ITableTriggerExtractor triggerExtractor = new PostgresTableTriggerExtractorImpl();
tableExpander.setTableTriggerExtractor(triggerExtractor);
tableExpander.setTableIndexExtractor(indexExtractor);
_treeAPI.addExpander(DatabaseObjectType.TABLE, tableExpander);
// ////// Detail Tabs ////////
// Procedure tab
_treeAPI.addDetailTab(DatabaseObjectType.PROCEDURE, new ProcedureSourceTab(i18n.SHOW_PROCEDURE_SOURCE));
// View Tab
_treeAPI.addDetailTab(DatabaseObjectType.VIEW, new ViewSourceTab(i18n.SHOW_VIEW_SOURCE, stmtSep));
// Index tab
_treeAPI.addDetailTab(DatabaseObjectType.INDEX, new DatabaseObjectInfoTab());
_treeAPI.addDetailTab(DatabaseObjectType.INDEX, new IndexDetailsTab());
_treeAPI.addDetailTab(DatabaseObjectType.INDEX, new IndexSourceTab(i18n.SHOW_INDEX_SOURCE, stmtSep));
// Trigger tabs
_treeAPI.addDetailTab(IObjectTypes.TRIGGER_PARENT, new DatabaseObjectInfoTab());
_treeAPI.addDetailTab(DatabaseObjectType.TRIGGER, new DatabaseObjectInfoTab());
_treeAPI.addDetailTab(DatabaseObjectType.TRIGGER, new TriggerDetailsTab());
_treeAPI.addDetailTab(DatabaseObjectType.TRIGGER, new TriggerSourceTab("The source of the trigger"));
// Sequence tabs
_treeAPI.addDetailTab(DatabaseObjectType.SEQUENCE, new DatabaseObjectInfoTab());
_treeAPI.addDetailTab(DatabaseObjectType.SEQUENCE, new SequenceDetailsTab());
// Lock tab
_treeAPI.addDetailTab(DatabaseObjectType.SESSION, new LockTab());
// ////// Popup Menus ////////
JMenu tableMenu = _resources.createMenu(IMenuResourceKeys.POSTGRES);
_resources.addToMenu(col.get(VacuumTableAction.class), tableMenu);
_treeAPI.addToPopup(DatabaseObjectType.TABLE, tableMenu);
_treeAPI.addToPopup(DatabaseObjectType.SESSION, createSessionMenu(col));
}