|
From: SVN by r. <sv...@ca...> - 2007-10-28 11:42:31
|
Author: roy
Date: 2007-10-28 12:41:30 +0100 (Sun, 28 Oct 2007)
New Revision: 188
Modified:
src/main/java/nl/improved/sqlclient/SQLShell.java
src/main/java/nl/improved/sqlclient/commands/Command.java
src/main/java/nl/improved/sqlclient/commands/DescCommand.java
src/main/java/nl/improved/sqlclient/commands/InfoCommand.java
src/main/java/nl/improved/sqlclient/commands/ShowCommand.java
Log:
made desc command work somewhat again...
TODO: make de<tab> include desc option as well.. instead of only 'delete from'
Modified: src/main/java/nl/improved/sqlclient/SQLShell.java
===================================================================
--- src/main/java/nl/improved/sqlclient/SQLShell.java 2007-10-28 11:12:50 UTC (rev 187)
+++ src/main/java/nl/improved/sqlclient/SQLShell.java 2007-10-28 11:41:30 UTC (rev 188)
@@ -553,7 +553,28 @@
* @return the tab completion value.
*/
protected CharSequence getTabCompletion(SQLCommand commandLines, Point cursorPosition) {
- TabCompletionInfo info = SQLUtil.getTabCompletionInfo(commandLines, cursorPosition);
+ TabCompletionInfo info = null;
+ String cmd = commandLines.getCommandString();
+ if (cmd.length() > 0) {
+ if (cmd.indexOf(' ') > 0) {
+ cmd = cmd.substring(0, cmd.indexOf(' ')).trim();
+ }
+ Command tmpCommand = commands.findCommand(cmd);
+ if (tmpCommand == null) {
+ for (Command c : commands.getCommands()) {
+ if (cmd.equalsIgnoreCase(c.getCommandString().toString())) {
+ tmpCommand = c;
+ break;
+ }
+ }
+ }
+ if (tmpCommand != null) {
+ info = tmpCommand.getTabCompletionInfo(commandLines, cursorPosition);
+ }
+ }
+ if (info == null) {
+ info = SQLUtil.getTabCompletionInfo(commandLines, cursorPosition);
+ }
if (info.getMatchType() == TabCompletionInfo.MatchType.SQL_KEYWORD) {
return nullToEmpty(findMatch(info.getPossibleMatches(), info.getStart()));
}
@@ -795,7 +816,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
@@ -846,7 +867,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
public CharSequence getHelp() {
@@ -878,7 +899,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
public CharSequence getHelp() {
@@ -910,7 +931,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
public CharSequence getHelp() {
@@ -939,7 +960,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
}
@@ -1020,7 +1041,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
public CharSequence getHelp() {
@@ -1079,7 +1100,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
public CharSequence getHelp() {
@@ -1128,7 +1149,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
public CharSequence getHelp() {
Modified: src/main/java/nl/improved/sqlclient/commands/Command.java
===================================================================
--- src/main/java/nl/improved/sqlclient/commands/Command.java 2007-10-28 11:12:50 UTC (rev 187)
+++ src/main/java/nl/improved/sqlclient/commands/Command.java 2007-10-28 11:41:30 UTC (rev 188)
@@ -42,7 +42,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint);
+ TabCompletionInfo getTabCompletionInfo(SQLCommand commandInfo, Point commandPoint);
/**
* Returns a explenation string of how to use this command.
* @return a explenation string of how to use this command.
Modified: src/main/java/nl/improved/sqlclient/commands/DescCommand.java
===================================================================
--- src/main/java/nl/improved/sqlclient/commands/DescCommand.java 2007-10-28 11:12:50 UTC (rev 187)
+++ src/main/java/nl/improved/sqlclient/commands/DescCommand.java 2007-10-28 11:41:30 UTC (rev 188)
@@ -106,7 +106,9 @@
}
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
+ List commandInfo = command.getLines();
+
String startOfCommand = SQLUtil.getStartOfCommand(commandInfo, commandPoint);
String end = startOfCommand.substring(startOfCommand.lastIndexOf(' ')+1);
return new TabCompletionInfo(TabCompletionInfo.MatchType.TABLE_NAMES, new ArrayList<String>(), end);
Modified: src/main/java/nl/improved/sqlclient/commands/InfoCommand.java
===================================================================
--- src/main/java/nl/improved/sqlclient/commands/InfoCommand.java 2007-10-28 11:12:50 UTC (rev 187)
+++ src/main/java/nl/improved/sqlclient/commands/InfoCommand.java 2007-10-28 11:41:30 UTC (rev 188)
@@ -74,7 +74,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
Modified: src/main/java/nl/improved/sqlclient/commands/ShowCommand.java
===================================================================
--- src/main/java/nl/improved/sqlclient/commands/ShowCommand.java 2007-10-28 11:12:50 UTC (rev 187)
+++ src/main/java/nl/improved/sqlclient/commands/ShowCommand.java 2007-10-28 11:41:30 UTC (rev 188)
@@ -102,7 +102,7 @@
* @param commandPoint the cursor position
* @return some tab completion info for the specified command.
*/
- public TabCompletionInfo getTabCompletion(List<? extends CharSequence> commandInfo, Point commandPoint) {
+ public TabCompletionInfo getTabCompletionInfo(SQLCommand command, Point commandPoint) {
return null;
}
|