|
From: SVN by r. <sv...@ca...> - 2007-10-28 11:58:27
|
Author: roy
Date: 2007-10-28 12:57:24 +0100 (Sun, 28 Oct 2007)
New Revision: 189
Modified:
ChangeLog
src/main/java/nl/improved/sqlclient/SQLShell.java
src/main/java/nl/improved/sqlclient/TabCompletionInfo.java
Log:
added batch command completion (list filenames)
Modified: ChangeLog
===================================================================
--- ChangeLog 2007-10-28 11:41:30 UTC (rev 188)
+++ ChangeLog 2007-10-28 11:57:24 UTC (rev 189)
@@ -1,3 +1,8 @@
+0.4
+ * Improve tab comnpletion
+ * Added tabcompletion for:
+ * desc
+ * execute batch command
0.3 (09-10-2007)
* focus fix in login dialog
* Improve desc table to show primary key
Modified: src/main/java/nl/improved/sqlclient/SQLShell.java
===================================================================
--- src/main/java/nl/improved/sqlclient/SQLShell.java 2007-10-28 11:41:30 UTC (rev 188)
+++ src/main/java/nl/improved/sqlclient/SQLShell.java 2007-10-28 11:57:24 UTC (rev 189)
@@ -585,6 +585,9 @@
if (info.getMatchType() == TabCompletionInfo.MatchType.COLUMN_NAMES) {
return nullToEmpty(findMatch(getColumnNames(info.getPossibleMatches()), info.getStart()));
}
+ if (info.getMatchType() == TabCompletionInfo.MatchType.UNKNOWN) {
+ return nullToEmpty(findMatch(info.getPossibleMatches(), info.getStart()));
+ }
Toolkit.beep();
return "";
}
@@ -1150,8 +1153,22 @@
* @return some tab completion info for the specified command.
*/
public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
- return null;
+ String fileName = command.getCommandString().substring(1).trim(); // cutoff '@'
+ String dirName;
+ if (fileName.equals("")) {
+ fileName = ".";
+ dirName = ".";
+ } else {
+ fileName = toFileName(fileName);
+ if (fileName.indexOf('/') > 0) {
+ dirName = new File(fileName).getParent();
+ } else {
+ dirName = ".";
+ }
+ }
+ return new TabCompletionInfo(TabCompletionInfo.MatchType.UNKNOWN,Arrays.asList(new File(dirName).list()) , fileName);
}
+
public CharSequence getHelp() {
return "Specify filename to execute a 'batch' command.\n"+
"For example '@mystatements.sql' executes all statements part of the mystatements.sql file in the current directory."+
Modified: src/main/java/nl/improved/sqlclient/TabCompletionInfo.java
===================================================================
--- src/main/java/nl/improved/sqlclient/TabCompletionInfo.java 2007-10-28 11:41:30 UTC (rev 188)
+++ src/main/java/nl/improved/sqlclient/TabCompletionInfo.java 2007-10-28 11:57:24 UTC (rev 189)
@@ -18,7 +18,7 @@
import java.util.List;
public class TabCompletionInfo {
- public enum MatchType {SQL_KEYWORD, TABLE_NAMES, COLUMN_NAMES, UNKNOWN}
+ public enum MatchType {SQL_KEYWORD, TABLE_NAMES, COLUMN_NAMES, FILE_NAMES, UNKNOWN}
private MatchType type;
private List<String> possibleMatches;
|