SQLConsole: added outline-view for SQL statements

git-svn-id: https://svn.code.sf.net/p/jailer/code/trunk@1490 3dd849cd-670e-4645-a7cd-dd197c8d0e81
This commit is contained in:
rwisser
2017-12-05 07:24:24 +00:00
parent 507d6ff3ad
commit cfb9abc297
9 changed files with 551 additions and 107 deletions
+4
View File
@@ -1,5 +1,9 @@
7.5.9
- SQLConsole: added outline-view for SQL statements.
7.5.8
- SQLConsole: added ability to execute SQL fragments.
- DDL view for tables.
7.5.7
- Minor GUI improvements.
@@ -25,7 +25,7 @@ public class JailerVersion {
/**
* The Jailer version.
*/
public static final String VERSION = "7.5.8";
public static final String VERSION = "7.5.9";
/**
* The Jailer working tables version.
@@ -996,36 +996,6 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel23">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="23" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel24">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="24" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel25">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="25" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="borderBrowserTabPane">
@@ -121,6 +121,7 @@ import net.sf.jailer.ui.databrowser.metadata.MetaDataPanel;
import net.sf.jailer.ui.databrowser.metadata.MetaDataSource;
import net.sf.jailer.ui.databrowser.sqlconsole.SQLConsole;
import net.sf.jailer.util.CancellationHandler;
import net.sf.jailer.util.Pair;
import net.sf.jailer.util.Quoting;
/**
@@ -835,9 +836,6 @@ public class DataBrowser extends javax.swing.JFrame {
jLabel20 = new javax.swing.JLabel();
jLabel21 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jLabel23 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
jLabel25 = new javax.swing.JLabel();
borderBrowserTabPane = new javax.swing.JPanel();
borderBrowserPanel = new javax.swing.JPanel();
titleLabel = new javax.swing.JLabel();
@@ -1256,24 +1254,6 @@ public class DataBrowser extends javax.swing.JFrame {
gridBagConstraints.gridy = 22;
jPanel7.add(jLabel22, gridBagConstraints);
jLabel23.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 23;
jPanel7.add(jLabel23, gridBagConstraints);
jLabel24.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 24;
jPanel7.add(jLabel24, gridBagConstraints);
jLabel25.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 25;
jPanel7.add(jLabel25, gridBagConstraints);
detailsAndBorderBrowserTabbedPane.addTab("Details", jPanel7);
borderBrowserTabPane.setLayout(new java.awt.GridBagLayout());
@@ -2074,9 +2054,6 @@ public class DataBrowser extends javax.swing.JFrame {
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
@@ -2915,6 +2892,10 @@ public class DataBrowser extends javax.swing.JFrame {
protected void selectTable(MDTable mdTable) {
metaDataPanel.select(mdTable);
}
@Override
protected void setOutlineTables(List<Pair<MDTable, String>> outlineTables) {
metaDataPanel.setOutline(outlineTables);
}
};
sqlConsoleContainerPanel.removeAll();
sqlConsoleContainerPanel.add(sqlConsole);
@@ -11,54 +11,215 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,119,0,0,1,-112"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="5" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JTree" name="metaDataTree">
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="5" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTree" name="metaDataTree">
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="refreshButton">
<Properties>
<Property name="text" type="java.lang.String" value="Refresh"/>
<Property name="toolTipText" type="java.lang.String" value="Refresh Database Meta Data Cache"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshButtonActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="5" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="refreshButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Select"/>
<Property name="toolTipText" type="java.lang.String" value="Choose the selecetd table in the tables tree"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshButton1ActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="4" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="8" anchor="13" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="refreshButton">
<Properties>
<Property name="text" type="java.lang.String" value="Refresh"/>
<Property name="toolTipText" type="java.lang.String" value="Refresh Database Meta Data Cache"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshButtonActionPerformed"/>
</Events>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="5" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="refreshButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Select"/>
<Property name="toolTipText" type="java.lang.String" value="Choose the selecetd table in the tables tree"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshButton1ActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="4" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="8" anchor="13" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="outlineList">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property>
<Property name="selectionMode" type="int" value="0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="outlineLabel">
<Properties>
<Property name="text" type="java.lang.String" value=" Outline"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JPanel" name="jPanel3">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="2" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -42,16 +42,21 @@ import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
@@ -73,6 +78,7 @@ import net.sf.jailer.modelbuilder.ModelBuilder;
import net.sf.jailer.ui.AutoCompletion;
import net.sf.jailer.ui.JComboBox;
import net.sf.jailer.ui.StringSearchPanel;
import net.sf.jailer.util.Pair;
/**
* Meta Data UI.
@@ -105,13 +111,41 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
* @param metaDataSource the meta data source
* @param dataModel the data mmodel
*/
public MetaDataPanel(Frame parent, MetaDataSource metaDataSource, MetaDataDetailsPanel metaDataDetailsPanel, final DataModel dataModel, ExecutionContext executionContext) {
@SuppressWarnings({ "rawtypes", "unchecked" })
public MetaDataPanel(Frame parent, MetaDataSource metaDataSource, MetaDataDetailsPanel metaDataDetailsPanel, final DataModel dataModel, ExecutionContext executionContext) {
this.metaDataSource = metaDataSource;
this.dataModel = dataModel;
this.metaDataDetailsPanel = metaDataDetailsPanel;
this.parent = parent;
initComponents();
hideOutline();
final ListCellRenderer olRenderer = outlineList.getCellRenderer();
outlineList.setCellRenderer(new ListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
if (value instanceof Pair) {
value = outlineTableRender((Pair<MDTable, String>) value);
}
return olRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
});
outlineList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
Object value = outlineList.getSelectedValue();
if (!inSelectOutlineTable && value instanceof Pair) {
MDTable mdTable = ((Pair<MDTable, String>) value).a;
inSelectOutlineTable = true;
select(mdTable);
inSelectOutlineTable = false;
}
}
});
tablesComboBox = new JComboBox<String>() {
@Override
public Dimension getMinimumSize() {
@@ -146,7 +180,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
updateTablesCombobox(selectedSchemas);
}
}, metaDataSource, dataModel);
add(searchButton, gridBagConstraints);
jPanel1.add(searchButton, gridBagConstraints);
tablesComboBox.setVisible(false);
refreshButton1.setVisible(false);
@@ -353,6 +387,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
if (last instanceof DefaultMutableTreeNode) {
final Object uo = ((DefaultMutableTreeNode) last).getUserObject();
if (uo instanceof MDTable) {
selectOutlineTable((MDTable) uo);
Table table = MetaDataPanel.this.metaDataSource.toTable((MDTable) uo);
if (table != null) {
updateDataModelView(table);
@@ -376,9 +411,15 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
});
updateTreeModel(metaDataSource);
Font font = outlineLabel.getFont();
if (font != null) {
Font bold = new Font(font.getName(), font.getStyle() | Font.BOLD, font.getSize());
outlineLabel.setFont(bold);
}
}
private Map<String, MDTable> tablesComboboxMDTablePerName = new HashMap<String, MDTable>();
private Map<String, MDTable> tablesComboboxMDTablePerName = new HashMap<String, MDTable>();
private void updateTablesCombobox(Set<MDSchema> selectedSchemas) {
Set<String> tableSet = new HashSet<String>();
@@ -437,6 +478,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
public void reset() {
refreshButton.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
setOutline(new ArrayList<Pair<MDTable, String>>());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
@@ -476,12 +518,14 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
public void select(MDTable mdTable) {
if (mdTable != null) {
selectSchema(mdTable.getSchema());
TreePath path = find(metaDataTree.getModel().getRoot(), mdTable);
if (path != null) {
selectSchema(mdTable.getSchema(), false);
metaDataTree.expandPath(path);
metaDataTree.getSelectionModel().setSelectionPath(path);
scrollToNode(path);
} else {
selectSchema(mdTable.getSchema());
}
}
}
@@ -567,13 +611,19 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
}
public void selectSchema(MDSchema mdSchema) {
selectSchema(mdSchema, true);
}
public void selectSchema(MDSchema mdSchema, boolean scrollToNode) {
if (mdSchema != null) {
DefaultMutableTreeNode node = treeNodePerSchema.get(mdSchema);
if (node != null) {
TreePath path = new TreePath(new Object[] { root, node });
metaDataTree.expandPath(path);
metaDataTree.getSelectionModel().setSelectionPath(path);
scrollToNode(path);
if (scrollToNode) {
scrollToNode(path);
}
}
}
}
@@ -587,13 +637,30 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
metaDataTree = new javax.swing.JTree();
refreshButton = new javax.swing.JButton();
refreshButton1 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
outlineList = new javax.swing.JList();
outlineLabel = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jPanel3 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
setLayout(new java.awt.GridBagLayout());
jPanel1.setLayout(new java.awt.GridBagLayout());
jScrollPane1.setViewportView(metaDataTree);
gridBagConstraints = new java.awt.GridBagConstraints();
@@ -603,7 +670,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jScrollPane1, gridBagConstraints);
jPanel1.add(jScrollPane1, gridBagConstraints);
refreshButton.setText("Refresh");
refreshButton.setToolTipText("Refresh Database Meta Data Cache");
@@ -616,7 +683,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
add(refreshButton, gridBagConstraints);
jPanel1.add(refreshButton, gridBagConstraints);
refreshButton1.setText("Select");
refreshButton1.setToolTipText("Choose the selecetd table in the tables tree");
@@ -630,7 +697,110 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 8);
add(refreshButton1, gridBagConstraints);
jPanel1.add(refreshButton1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jPanel1, gridBagConstraints);
jPanel2.setLayout(new java.awt.GridBagLayout());
outlineList.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
outlineList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane2.setViewportView(outlineList);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
jPanel2.add(jScrollPane2, gridBagConstraints);
outlineLabel.setText(" Outline");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
jPanel2.add(outlineLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
jPanel2.add(jSeparator1, gridBagConstraints);
jPanel3.setLayout(new java.awt.GridBagLayout());
jLabel1.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
jPanel3.add(jLabel1, gridBagConstraints);
jLabel2.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
jPanel3.add(jLabel2, gridBagConstraints);
jLabel3.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 3;
jPanel3.add(jLabel3, gridBagConstraints);
jLabel4.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 4;
jPanel3.add(jLabel4, gridBagConstraints);
jLabel5.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 5;
jPanel3.add(jLabel5, gridBagConstraints);
jLabel6.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 6;
jPanel3.add(jLabel6, gridBagConstraints);
jLabel7.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 7;
jPanel3.add(jLabel7, gridBagConstraints);
jLabel8.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
jPanel3.add(jLabel8, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridheight = 2;
jPanel2.add(jPanel3, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
add(jPanel2, gridBagConstraints);
}// </editor-fold>//GEN-END:initComponents
private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
@@ -641,9 +811,92 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
onSelectTable();
}//GEN-LAST:event_refreshButton1ActionPerformed
private List<Pair<MDTable, String>> outlineTables = new ArrayList<Pair<MDTable, String>>();
private boolean inSelectOutlineTable = false;
private void showOutline() {
jPanel2.setVisible(true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
TreePath path = metaDataTree.getSelectionPath();
if (path != null) {
Rectangle bounds = metaDataTree.getPathBounds(path);
metaDataTree.scrollRectToVisible(new Rectangle(bounds.x, bounds.y, 1, bounds.height));
}
}
});
}
private void hideOutline() {
jPanel2.setVisible(false);
}
private String outlineTableRender(Pair<MDTable, String> mdTable) {
String render;
if (mdTable.a.getSchema().isDefaultSchema) {
render = mdTable.a.getName();
} else {
render = mdTable.a.getSchema().getName() + "." + mdTable.a.getName();
}
String alias = mdTable.b;
if (alias != null) {
return "<html>" + render + " <font color=\"#0000ff\">as</font> " + alias;
}
return render;
}
public void setOutline(List<Pair<MDTable, String>> outlineTables) {
this.outlineTables = new ArrayList<Pair<MDTable, String>>(outlineTables);
DefaultListModel model = new DefaultListModel();
for (Pair<MDTable, String> mdTable: outlineTables) {
model.addElement(mdTable);
}
outlineList.setModel(model);
if (outlineTables.isEmpty()) {
hideOutline();
} else {
showOutline();
}
}
private void selectOutlineTable(MDTable mdTable) {
if (!inSelectOutlineTable) {
inSelectOutlineTable = true;
boolean found = false;
for (Pair<MDTable, String> value: outlineTables) {
if (mdTable.equals(value.a)) {
outlineList.setSelectedValue(value, true);
found = true;
break;
}
}
if (!found) {
outlineList.clearSelection();
}
inSelectOutlineTable = false;
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTree metaDataTree;
private javax.swing.JLabel outlineLabel;
private javax.swing.JList outlineList;
private javax.swing.JButton refreshButton;
private javax.swing.JButton refreshButton1;
// End of variables declaration//GEN-END:variables
@@ -28,6 +28,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -51,6 +52,8 @@ import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Segment;
@@ -248,6 +251,13 @@ public abstract class SQLConsole extends javax.swing.JPanel {
resetStatus();
statusLabel.setVisible(true);
editorPane.addCaretListener(new CaretListener() {
@Override
public void caretUpdate(CaretEvent e) {
updateOutline();
}
});
Thread thread = new Thread(new Runnable() {
@Override
@@ -265,6 +275,55 @@ public abstract class SQLConsole extends javax.swing.JPanel {
thread.start();
}
private AtomicBoolean pending = new AtomicBoolean(false);
private AtomicBoolean stopped = new AtomicBoolean(false);
private String prevSql = null;
/**
* Update of outline of statement under carret.
*/
private void updateOutline() {
if (!pending.get()) {
Pair<Integer, Integer> loc = editorPane.getCurrentStatementLocation(true, true, null, false);
String sql = editorPane.getText(loc.a, loc.b, true);
if (sql.trim().isEmpty()) {
loc = editorPane.getCurrentStatementLocation(true, true, null, true);
sql = editorPane.getText(loc.a, loc.b, true);
}
if (sql.equals(prevSql)) {
return;
}
prevSql = sql;
updateOutline(sql);
if (sql.length() > 100000) { // TODO
stopped.set(false);
pending.set(true);
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
pending.set(false);
if (!stopped.get()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
updateOutline();
}
});
}
}
}).start();
} else {
stopped.set(true);
}
}
}
protected String shortSQL(String sql, int maxLength) {
sql = sql.trim().replaceAll("\\s+", " ");
if (sql.length() > maxLength) {
@@ -571,12 +630,19 @@ public abstract class SQLConsole extends javax.swing.JPanel {
}
}
private void updateOutline(String sql) {
List<Pair<MDTable, String>> allTables = new ArrayList<Pair<MDTable, String>>();
provider.findAliases(sql, null, allTables);
setOutlineTables(allTables);
}
private boolean isDDLStatement(String sql) {
return sql.trim().matches("^(?is)\\b(drop|create|alter|rename)\\b.*");
}
protected abstract void refreshMetaData();
protected abstract void selectTable(MDTable mdTable);
protected abstract void setOutlineTables(List<Pair<MDTable, String>> outlineTables);
private boolean dataHasChanged = false;
@@ -57,7 +57,6 @@ import org.fife.ui.rtextarea.Gutter;
import org.fife.ui.rtextarea.SearchContext;
import org.fife.ui.rtextarea.SearchEngine;
import org.fife.ui.rtextarea.SearchResult;
import org.junit.matchers.Each;
import net.sf.jailer.ui.databrowser.metadata.MDTable;
import net.sf.jailer.ui.databrowser.metadata.MetaDataPanel;
@@ -289,7 +288,7 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
* <code>true</code> to replace only one statement
*/
public void replaceCurrentStatement(String replacement, boolean singleStatement) {
Pair<Integer, Integer> loc = getCurrentStatementLocation(singleStatement, false, null);
Pair<Integer, Integer> loc = getCurrentStatementLocation(singleStatement, false, null, false);
if (loc != null) {
try {
int from = loc.a;
@@ -314,7 +313,7 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
* @return pair of start and end line number
*/
public String getCurrentStatement(boolean singleStatement) {
Pair<Integer, Integer> loc = getCurrentStatementLocation(singleStatement, false, null);
Pair<Integer, Integer> loc = getCurrentStatementLocation(singleStatement, false, null, false);
if (loc != null) {
return getText(loc.a, loc.b, true);
}
@@ -399,7 +398,7 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
* @return pair of start and end line number
*/
public Pair<Integer, Integer> getCurrentStatementLocation(Set<Integer> eosLines) {
return getCurrentStatementLocation(getCaret().getDot() != getCaret().getMark(), false, eosLines);
return getCurrentStatementLocation(getCaret().getDot() != getCaret().getMark(), false, eosLines, false);
}
/**
@@ -409,7 +408,7 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
* @param eosLines if not <code>null</code>, put end-of-statement line numbers into
* @return pair of start and end line number
*/
public Pair<Integer, Integer> getCurrentStatementLocation(boolean singleStatement, boolean currentLineMayBeEmpty, Set<Integer> eosLines) {
public Pair<Integer, Integer> getCurrentStatementLocation(boolean singleStatement, boolean currentLineMayBeEmpty, Set<Integer> eosLines, boolean startAtLineAbove) {
try {
int y = getLineOfOffset(Math.min(getCaret().getDot(), getCaret().getMark()));
int caretBegin = y;
@@ -429,8 +428,10 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
eosLines.add(-start);
}
}
if ((!singleStatement && sLine.length() == 0) || (singleStatement && endsWithSemicolon)) {
break;
if ((/*!singleStatement &&*/ sLine.length() == 0) || (singleStatement && endsWithSemicolon)) {
if (start != y || !startAtLineAbove || !endsWithSemicolon) {
break;
}
}
--start;
}
@@ -470,7 +471,7 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
Segment txt = new Segment();
getDocument().getText(endOff, getLineEndOffset(end) - endOff, txt);
String sLine = txt.toString().trim();
if ((!singleStatement && sLine.length() == 0) && !(currentLineMayBeEmpty && end == y)) {
if ((/*!singleStatement &&*/ sLine.length() == 0) && !(currentLineMayBeEmpty && end == y)) {
if (end > start) {
--end;
}
@@ -182,7 +182,7 @@ public abstract class SQLCompletionProvider<SOURCE, SCHEMA, TABLE> extends Defau
private List<SQLCompletion> getPotentialCompletions(JTextComponent comp, String alreadyEnteredText) {
Pair<Integer, Integer> loc = ((RSyntaxTextAreaWithSQLSyntaxStyle) comp)
.getCurrentStatementLocation(true, true, null);
.getCurrentStatementLocation(true, true, null, false);
String line = ((RSyntaxTextAreaWithSQLSyntaxStyle) comp).getText(loc.a, loc.b, true);
String lineBeforeCaret = ((RSyntaxTextAreaWithSQLSyntaxStyle) comp).getText(loc.a, loc.b, false);
@@ -211,7 +211,7 @@ public abstract class SQLCompletionProvider<SOURCE, SCHEMA, TABLE> extends Defau
}
aliases.clear();
aliasesTopLevel.clear();
aliases.putAll(findAliases(afterCaret != null? beforeCaret + "=" + afterCaret : line, aliasesTopLevel));
aliases.putAll(findAliases(afterCaret != null? beforeCaret + "=" + afterCaret : line, aliasesTopLevel, null));
aliases.putAll(userDefinedAliases);
aliasesTopLevel.putAll(userDefinedAliases);
Clause clause = currentClause(beforeCaret);
@@ -784,7 +784,7 @@ public abstract class SQLCompletionProvider<SOURCE, SCHEMA, TABLE> extends Defau
return reduced;
}
private Map<String, TABLE> findAliases(String statement, Map<String, TABLE> aliasesOnTopLevel) {
public Map<String, TABLE> findAliases(String statement, Map<String, TABLE> aliasesOnTopLevel, List<Pair<TABLE, String>> allTables) {
Map<String, TABLE> aliases = new LinkedHashMap<String, TABLE>();
Pattern pattern = Pattern.compile("(?:\\bas\\b)|(" + reClauseKW + ")|(,|\\(|\\)|=|<|>|!|\\.|\\b(?:on|where|left|right|full|inner|outer|join|and|or|not)\\b)|(" + reIdentifier + ")", Pattern.DOTALL|Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(statement + ")");
@@ -844,6 +844,9 @@ public abstract class SQLCompletionProvider<SOURCE, SCHEMA, TABLE> extends Defau
if (mdSchema != null) {
TABLE mdTable = findTable(mdSchema, table);
if (mdTable != null) {
if (allTables != null) {
allTables.add(new Pair<TABLE, String>(mdTable, alias));
}
Integer prevLevel = levelPerAlias.get(alias);
if (prevLevel == null || prevLevel < level) {
aliases.put(alias, mdTable);
@@ -882,6 +885,9 @@ public abstract class SQLCompletionProvider<SOURCE, SCHEMA, TABLE> extends Defau
if (mdSchema != null) {
TABLE mdTable = findTable(mdSchema, table);
if (mdTable != null) {
if (allTables != null) {
allTables.add(new Pair<TABLE, String>(mdTable, null));
}
Integer prevLevel = levelPerAlias.get(alias);
if (prevLevel == null || prevLevel < level) {
aliases.put(alias, mdTable);
@@ -915,7 +921,9 @@ public abstract class SQLCompletionProvider<SOURCE, SCHEMA, TABLE> extends Defau
}
for (Entry<String, Integer> e: levelPerAlias.entrySet()) {
if (e.getValue() == maxLevel) {
aliasesOnTopLevel.put(e.getKey(), aliases.get(e.getKey()));
if (aliasesOnTopLevel != null) {
aliasesOnTopLevel.put(e.getKey(), aliases.get(e.getKey()));
}
}
}
return aliases;