mirror of
https://github.com/Wisser/Jailer.git
synced 2026-05-24 11:39:31 -05:00
delay removal of highlights in SQL console
This commit is contained in:
@@ -33,6 +33,7 @@ import net.sf.jailer.datamodel.DataModel;
|
||||
import net.sf.jailer.datamodel.Table;
|
||||
import net.sf.jailer.modelbuilder.JDBCMetaDataBasedModelElementFinder;
|
||||
import net.sf.jailer.util.Quoting;
|
||||
import net.sf.jailer.util.SqlUtil;
|
||||
|
||||
/**
|
||||
* Meta Data Source.
|
||||
@@ -272,7 +273,12 @@ public class MetaDataSource {
|
||||
if (defaultSchema != null) {
|
||||
String schemaName = Quoting.staticUnquote(table.getSchema(defaultSchema.getName()));
|
||||
String schemaNameUC = schemaName.toUpperCase(Locale.ENGLISH);
|
||||
String tableName = Quoting.staticUnquote(table.getUnqualifiedName());
|
||||
String tableName = table.getName().trim();
|
||||
int i = SqlUtil.indexOfDot(tableName);
|
||||
if (i >= 0) {
|
||||
tableName = tableName.substring(i + 1);
|
||||
}
|
||||
Quoting.staticUnquote(tableName);
|
||||
String tableNameUC = tableName.toUpperCase(Locale.ENGLISH);
|
||||
|
||||
MDSchema schemaExact = null;
|
||||
|
||||
@@ -621,15 +621,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
loc = editorPane.getCurrentStatementLocation(true, true, null, true);
|
||||
sql = editorPane.getText(loc.a, loc.b, true);
|
||||
}
|
||||
if (sql.trim().isEmpty()) {
|
||||
hightlight(0, 0);
|
||||
} else {
|
||||
try {
|
||||
hightlight(editorPane.getLineStartOffset(loc.a), editorPane.getLineEndOffset(loc.b));
|
||||
} catch (BadLocationException e) {
|
||||
hightlight(0, 0);
|
||||
}
|
||||
}
|
||||
hightlight(editorPane, 0, 0);
|
||||
if (checkPrevSql && sql.equals(prevSql) && editorPane.getCaretPosition() == prevCaretPos) {
|
||||
return;
|
||||
}
|
||||
@@ -2400,7 +2392,14 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
private void hightlight(RSyntaxTextAreaWithSQLSyntaxStyle editor, int a, int b) {
|
||||
try {
|
||||
if (currentHighlightTag != null) {
|
||||
editor.getHighlighter().removeHighlight(currentHighlightTag);
|
||||
int delay = 2000;
|
||||
Object hl = currentHighlightTag;
|
||||
Timer timer = new Timer(delay, e -> {
|
||||
editor.getHighlighter().removeHighlight(hl);
|
||||
});
|
||||
timer.setInitialDelay(delay);
|
||||
timer.setRepeats(false);
|
||||
timer.start();
|
||||
currentHighlightTag = null;
|
||||
}
|
||||
if (a != b) {
|
||||
@@ -2704,10 +2703,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
Runnable close = () -> {
|
||||
dialog.setVisible(false);
|
||||
dialog.dispose();
|
||||
if (currentHighlightTag != null) {
|
||||
editorPane.getHighlighter().removeHighlight(currentHighlightTag);
|
||||
currentHighlightTag = null;
|
||||
}
|
||||
hightlight(editorPane, 0, 0);
|
||||
};
|
||||
dialog.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
@@ -3735,10 +3731,6 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
return editorPane;
|
||||
}
|
||||
|
||||
private void hightlight(int a, int b) {
|
||||
hightlight(editorPane, 0, 0);
|
||||
}
|
||||
|
||||
protected abstract void onContentStateChange(File file, boolean dirty);
|
||||
protected abstract void setReloadLimit(int limit);
|
||||
|
||||
|
||||
@@ -651,7 +651,7 @@ public class WCTypeAnalyser {
|
||||
}
|
||||
|
||||
PrimaryKey pk = new PrimaryKey(new ArrayList<net.sf.jailer.datamodel.Column>(), false);
|
||||
Table table = new Table(woComments.toString().trim(), pk, false, false);
|
||||
Table table = new Table(woComments.toString(), pk, false, false);
|
||||
table.setColumns(selectClause);
|
||||
result.table = table;
|
||||
result.cte = cte.toString();
|
||||
|
||||
Reference in New Issue
Block a user