def on_activate(self, node, col): from sqlide_tableman_ext import show_table_inspector if show_table_inspector is not None: if self.klass == 'db.Table': show_table_inspector(self.editor, [(self.schema, node.get_string(self.name_column).encode("utf8"))]) elif self.klass == 'db.Index' and hasattr(self, 'parent_name_column'): show_table_inspector(self.editor, [(self.schema, node.get_string(self.parent_name_column).encode("utf8"))], "indexes")
def showInspector(editor, selection): schema_insp = [] table_insp = [] table_insp_idx = [] for s in selection: if s.type == "db.Schema": schema_insp.append(s.schemaName) elif (s.type == "db.Table") or (s.type == "db.View"): table_insp.append((s.schemaName, s.name)) elif s.type == "db.Index": table_insp_idx.append((s.schemaName, s.owner.name)) else: log_error("Unsupported inspector type: %s\n" % s.type) if len(schema_insp): show_schema_manager(editor, schema_insp, False) if len(table_insp): show_table_inspector(editor, table_insp) if len(table_insp_idx): show_table_inspector(editor, table_insp_idx, "indexes") return 0