From 68f7972dff3532b93b6185d19da716e34bcdb4dd Mon Sep 17 00:00:00 2001
From: deadlocker8 <deadlocker@gmx.de>
Date: Fri, 16 Sep 2016 12:40:21 +0200
Subject: [PATCH] implemented autocomplete feature

---
 bin/commandLine/CommandLineController$1.class | Bin 1368 -> 1462 bytes
 bin/commandLine/CommandLineController$2.class | Bin 0 -> 1073 bytes
 bin/commandLine/CommandLineController.class   | Bin 4786 -> 6576 bytes
 bin/commandLine/_en.properties                |  11 +-
 bin/commands/CommandShortcuts.class           | Bin 0 -> 1065 bytes
 bin/commands/PossibleCommands.class           | Bin 801 -> 851 bytes
 src/commandLine/CommandLine.java              |   2 +-
 src/commandLine/CommandLineController.java    | 193 ++++++++++++------
 src/commandLine/_en.properties                |  11 +-
 src/commands/CommandShortcuts.java            |  23 +++
 src/commands/PossibleCommands.java            |   3 +-
 11 files changed, 173 insertions(+), 70 deletions(-)
 create mode 100644 bin/commandLine/CommandLineController$2.class
 create mode 100644 bin/commands/CommandShortcuts.class
 create mode 100644 src/commands/CommandShortcuts.java

diff --git a/bin/commandLine/CommandLineController$1.class b/bin/commandLine/CommandLineController$1.class
index 880eccbdc686b23d4d6337cda0c8fa6005ac990d..49f2355d32ecca790d580f34166cfe2648a41df5 100644
GIT binary patch
delta 347
zcmcb?wT+wW)W2Q(7#J8#7y>qO9bmHHWRPR9<YBO4P-0|Y4smqiV$fi);bE|4;9_Lp
zNK8&nEiP6u;$o0su;*cLU=UzrU{B7^D=y8Qe3B`g(QUFK^E`fE20umymdw1&5=I6Y
z4WEeu;**~;M>A?pc4U#~+{wViz{J475IQ-N#im|+8-w^J28(SB$}<`Gw6-wt>|n6g
z-o{|Jk%57MnL&_&fkBIbi-CbbkAauLfI)=8m_d=jltF{Rg29x*iou4#mcf(3o*{t2
zfgyy!i9v{gfk6ynI)gBS2m=U&GB`3gF)%VXGcYi)F|ddT3yTXlGKey`FfcN3M=~%l
zXhI#tsil2@L1G(&E68ppu-$A7j0_A6j9_y?Zf0R{XJBApV(?(_1k+v&-V6*3EDRb9
SJ`Da03=CWhj9?uM3=9BZ!Z3#b

delta 214
zcmdnSeS?eZ)W2Q(7#J8#7~D5<9blTw%pAsOJ2{GZ9<vLB>*U|eb&P70t61bYr!X)v
zFflMN*iK%=Vw1O#fq{XUL6CugL5_i)fq_ArftNv-L4?78L6O0TL4(1R!IZ(A!G^(-
zL5P8YK@6gkL6|{=0R(IrEEp^q7#XY>7#LU?m_>wz1soYf8LSx?8Mql37&M_)acXHF
zV363xU^BUpRYuc}fq{XE!JfeZOgl0-F)%Q&FlaD1Gq^D@FmN$2GBAS7W?%pSbmkj|

diff --git a/bin/commandLine/CommandLineController$2.class b/bin/commandLine/CommandLineController$2.class
new file mode 100644
index 0000000000000000000000000000000000000000..f33ce602ec2282fd579c474b77d257c707279324
GIT binary patch
literal 1073
zcmX^0Z`VEs1_l!bV|E56Mh4~N{M_8cycD0zyi|Q>1lu`3ucRnHCnvQ?#fY7Og^@uZ
zE3qt5KPNFSUEe<`D>b=<oq>&!K?E#XT9TOq(p->Olvt8q#K^!_l95@gV!+6t>_gCe
zYeoh(o6Nk-5<5l)H4P%vYlbm0usG+Zq;fJaGVt;+urqLQF)%am^DuBS2rx1*Yk(B+
zgFNI{nwykb6q1;flgh{-<ddJAm=l&*lnLTP1zA82Wn@q#Y^{osH6sIia(-?>Vo@q1
zgF4)$#UP)9g3uaf2tq{DlaoP$L5iJ0l953G8WM0>9tLR!8Ab;7?9|Hg{Gt?)3&EiY
z4&&gGqRhN>Yc2*k1_gEod6e*n$nh{JGAJ=Ja6+9FlF!H>s^NoSf~F@U15>^s$aHiE
zSc7DYz<xn!gG8=1l0i@rO;0WcMg|QY22lnvMh33n{L-T2RJTk}&`M!VIC>yM85uZ(
zGt=`DOG-hZW`k)gL<B7b*<c2xoi!r^ziVD{PJVG_Ub=5;Nk)DOJA*zWgCf*hpa_RW
z1&EDE!8{CxpoGDbSXz<~3ay;fl2k?p9?!hI)FS7c#Ny)AVg>~UMh0dEMg~>}Mgaj(
zl44+BU}j)o;A8;#nwx=v!GeK_fr){EflEt!D+7<#b_TwU3=9lR41yprunb7|Ee0V5
z1_mAmMzE+bg9rly10yKN7#JBqrg$+hfz9R7-ohZRvxPx?8-wf`xH)WKefPm;C_vOP
zK+FJ{sm!1PmgiwmWl&*Y5^!V?Wl)2ftINO)R?n-YeSkqi=KzDmHU@QcgBigFgFL~)
ipb55Ai$NPq>oDjtFfgz%=rI^D7=fM62)2rWfdK%VH~=;P

literal 0
HcmV?d00001

diff --git a/bin/commandLine/CommandLineController.class b/bin/commandLine/CommandLineController.class
index 599d4ef1c027c4c82ded9c8f7daf005973c1b040..d6d149ea752d50f710ba853e0fcd3931897f332b 100644
GIT binary patch
delta 2302
zcmdm_y1|(1)W2Q(7#J8#7_B#Q33K!FFnnbA#K^#0RGP=gV5u?jqr~I@CZ2kqti-ZJ
z{hY+Sbp4>xyu8GuoK$Ne1_p)?Tnt|szOyrYV`Pv9DM_o)Pb?_N$xKcx$;{8w56DR@
zNy{(F<ze{2@RN~&qo_2`C$S{8h><~D1DlbWVT=qsiKQj^$@#ejIjJS7Tnuv={_rpe
z{AKvZ$iP)xl2}wy9G+Q{F<FmAoIQ%2k%5sxd7^+~y^0YR!+!=lE`|g~W*$ZsMpi}!
zmg4-P5=I6|s70kEnK}B-`MCv&MTsT(Mb?^O9E|LY4AORXb_xOc#l@LPIjIWC`MJ4?
zc`3yTY57G8N?Z)3jGR0SybS&vjNFV2%t}^VoDBOJd3hN57}6LS*t1hB%kzs;gcum>
z89p#FaKLmkG6<w)=9HusrKUJT4P<2COD-)cO3f>QiZC*W`Q#@j=7c2{Wr9L8q_QA2
z1jJxu(1e5x*ujoPMTwO@nZ+eGJ}}cko&Y)0+RmDhfg>?FIkmVrP{n|Yfss+1hv5<f
zA6!($5F{wY!|)zi&<G?b%fs*sESQs+o0O6W((b^ph>?K<$~T<s&aG1~;FO<VQe0A$
zSm2vll98WM%*Ck6sLsx)#>k)qifu@O$jmFt&ra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Y{
zVPIrnV5rmD!XUAQ;l?(Gsq+|$Cp(K4)Nf>9U|?ntVqjoUV&Gt4U|7z;%dnC`oMAPC
z6~h_^Uxu{|0Sp@$3K%vr)G};g5N2Rt;DH#$Ai^NZz`(GUfq{XIf$29xfQ|qM!v_Xc
z21W*c1_m$<vXWJ6JHtniB}`yT*ua{5zy>ifFbMc?Fnk89Mc4BMUC&aO9tI|cZww3!
TObp){elRdFfRcnY0~i1RocM5Q

diff --git a/bin/commandLine/_en.properties b/bin/commandLine/_en.properties
index c7814cf..deb6bb3 100644
--- a/bin/commandLine/_en.properties
+++ b/bin/commandLine/_en.properties
@@ -1,13 +1,16 @@
 app.name=CommandLine
-version.code=1
-version.name=1.0.0
-version.date=26.07.16
+version.code=0
+version.name=1.1.0
+version.date=16.09.16
 
 help.list=list - lists all possible commands
 help.help=help - shows help for given command\nSYNTAX:  help [COMMAND]
 help.clear=clear - clears the history
+help.shortcuts=shortcuts - lists all available shortcuts
 
 error.general=An error occurred.
 error.unknown.command=Unknown command. Use \"list\" for a list of possible commands.
 error.invalid.arguments=Invalid arguments. Use \"help commandname\" for help.
-error.no.help=Unknown command as parameter. Can't display help. Use \"list\" for a list of possible commands.
\ No newline at end of file
+error.no.help=Unknown command as parameter. Can't display help. Use \"list\" for a list of possible commands.
+
+info.shortcuts=[ENTER] - execute command\n[UP] - scroll through recently used commands\n[ESC] - clear input\n[TAB] - autocomplete
\ No newline at end of file
diff --git a/bin/commands/CommandShortcuts.class b/bin/commands/CommandShortcuts.class
new file mode 100644
index 0000000000000000000000000000000000000000..41f4889d0da5c483195663eb2466b3df5a10defc
GIT binary patch
literal 1065
zcmX^0Z`VEs1_l!bdv*pUMh3~`{M_8cyp&>nX9y!WBfqF5xwNF1oq>gsK>%Hvk%7%7
zGcU8mj*)>`Lo<w#fyFsLC6$YTnSqmsft7)cgMpiofwLH92qyzG11}E)9|J!l1ABIA
zWqE#43L}G%PgY`CqJB<dUb=p8Nl|8Ax;03lAP<8OgD@ilUtVc$QfiTZT0mk^Vs0@b
z1EVJggD4{dUq)(9fgXz4;yerzAhS6^QY9g&6(x)e{63j^seWK1LK2g5QbG3RCnx5F
zB^G6Z_)tNXl8nq^Mh0mgbT7g~z?zYPJ+&e=xwIsekwH%*8q?JndYwx1QgTwQHN&_V
z6d07)859{A#L&%$sNrEyW>8^d;7w00an8>xDay~uNiAYzP}R_c84B_SELK2lgfeRm
z1~o<o5y!H`%p8!96yQ#_;$qNX&|+uMWMoi;+6&T(-54GQZ3Z1i2G)Y2%)Amt22l-6
z4?;Ym$HSn{V8F;An4VhVlbDxYnwXvn@dYD;jD{veTWLvVj($*Taeir0GE~-@gTaWA
zfiE*JEgunWTnr`*X6y{6j0_UsRDeYv4}&>_1tSAzdTI$Ic`!1lVRIbBV&r7R$iNQu
zHY0;DmIz~HU`ql=5hH^HES%v<AL1ozMh326uqWIyL5W8cJ!9yBoXw!fz{tSN00K-5
zjG&ayz{tSPz`zi|0OB(+h-qzS;LsA{+RDJA#k`e4KubtuD}&fZ1_lNu21y161~CR!
z1_lN$1{MY$1}+9(27U%U22lon1}O#x1|9}RunK7g83qOhMh001IjHFg49s9#rF6D2
z$P1}%V^9Y%bha_*3K?!=Fy6+Xj<A6btWt!5lR=b0l0gh?vI1C4iUDFW1A`QUC4&{%
RHYo;c1{<*3ZNYA|0{}Rw2o?YU

literal 0
HcmV?d00001

diff --git a/bin/commands/PossibleCommands.class b/bin/commands/PossibleCommands.class
index f89f06a53eb69b4c55cd2523a41972728870249d..7415b1fb1a5d3021a461a791a4846b9b4c8b505f 100644
GIT binary patch
delta 269
zcmZ3;cA1Uq)W2Q(7#J8#7z{RYc{94OGsrM9NG9j!<|gK)6ze-f7{M9&MJ36lCB<9}
z(hR~}4Dt+$><kKw3<6n+Wr_NwC7C(;jzvX@mBl;^N({=AOBqesRCyRg7}O?jU{qk#
zn0%3O311NdI|B$<?PlPKWS`v3q*x!xwwpmZayx@;@D2vK?F=fL8Pqp2FfcGNXfiM`
z$br@KGH@~QF^DkmGsrOrFlaCcG8i!MGFUPQF=&BRGB7YQh%j(5Ffwp6FfiydFfuSQ
kFfg!cZD-I%7{vw_<OXZu0kc^dbQpAb7(lx9z~<-!04jAW<^TWy

delta 186
zcmcc2wvbKW)W2Q(7#J8#7<Abgm>3x(CmS+JZq(Fa<lthEVUS~Ike%GfD9S9)pfGtR
zqbZvb4}%DU^5iRw3XH0gzcMc2OJQJV00D#D3_Ou+lb16o8th<@-p-)7nL%YE0|NsS
zgBk+^gA@ZB0|Nsu0~Z4yg9rmZgB*hZgBk-bgFb^GgZgAPW_djggkm-ZMg|53ZU%J*
X1_mB5o0UP6L5qQbfssKQY@`kVHQO18

diff --git a/src/commandLine/CommandLine.java b/src/commandLine/CommandLine.java
index 16d1f8f..5e9add8 100644
--- a/src/commandLine/CommandLine.java
+++ b/src/commandLine/CommandLine.java
@@ -57,7 +57,7 @@ public class CommandLine
 	{
 		return lastShownCommand;
 	}
-	
+
 	public String getPromptText()
 	{
 		return promptText;
diff --git a/src/commandLine/CommandLineController.java b/src/commandLine/CommandLineController.java
index d4b4fc5..d96b28d 100644
--- a/src/commandLine/CommandLineController.java
+++ b/src/commandLine/CommandLineController.java
@@ -1,11 +1,13 @@
 package commandLine;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 
 import commands.Command;
 import commands.HistoryEntry;
 import commands.HistoryType;
 import commands.PossibleCommands;
+import javafx.application.Platform;
 import javafx.event.EventHandler;
 import javafx.fxml.FXML;
 import javafx.scene.control.TextArea;
@@ -15,6 +17,7 @@ import javafx.scene.input.KeyEvent;
 
 /**
  * Controller for the CommandLine stage
+ * 
  * @author deadlocker8
  *
  */
@@ -22,84 +25,90 @@ public class CommandLineController
 {
 	@FXML private TextArea textareaHistory;
 	@FXML private TextField textfieldInput;
-	
-	private CommandLine commandLine; 
-	
+
+	private CommandLine commandLine;
+
 	public void init(CommandLine commandLine)
-	{	
-		this.commandLine = commandLine;		
-		
-		commandLine.getBundle().setController(this);	
-		commandLine.getBundle().setLanguageBundle(commandLine.getLanguageBundle());	
-		
+	{
+		this.commandLine = commandLine;
+
+		commandLine.getBundle().setController(this);
+		commandLine.getBundle().setLanguageBundle(commandLine.getLanguageBundle());
+
 		textareaHistory.setEditable(false);
-		textareaHistory.setWrapText(true);		
-		
+		textareaHistory.setWrapText(true);
+
 		textfieldInput.setOnKeyPressed(new EventHandler<KeyEvent>()
 		{
 			@Override
 			public void handle(KeyEvent event)
 			{
 				if(event.getCode().equals(KeyCode.ENTER))
-	            {
+				{
 					parse();
-	            }
-				
+				}
+
 				if(event.getCode().equals(KeyCode.UP))
-	            {
+				{
 					showLastCommand();
-	            }
-				
+				}
+
 				if(event.getCode().equals(KeyCode.ESCAPE))
-	            {
+				{
 					clearConsole();
-	            }
+				}
+				
+				if(event.getCode().equals(KeyCode.TAB))
+				{
+					autocomplete();
+					event.consume();
+				}
 			}
-		});	 	
-		
-		printPrompt();		
-	}	
+		});
+
+		printPrompt();
+	}
 
 	public void printPrompt()
-	{		
+	{
 		setConsoleText();
-		clearConsole();	
+		clearConsole();
 	}
-	
+
 	public void print(String message)
-	{		
+	{
 		commandLine.history.add(new HistoryEntry(HistoryType.MESSAGE, message));
 		setConsoleText();
 		printPrompt();
 	}
-	
+
 	public void clearHistoryLog()
 	{
 		textareaHistory.setText("");
 	}
-	
+
 	public void clearHistory()
 	{
 		commandLine.history = new ArrayList<>();
 	}
-	
+
 	public void clearConsole()
 	{
 		textfieldInput.setText("");
 		textfieldInput.requestFocus();
 	}
-	
+
 	private void setConsoleText()
-	{	
-		clearHistoryLog();	
-		
+	{
+		clearHistoryLog();
+
 		StringBuilder sb = new StringBuilder();
 		boolean printedLastEntry = false;
-		for(int i = 0; i < commandLine.history.size(); i++)		
-		{							
+		for(int i = 0; i < commandLine.history.size(); i++)
+		{
 			HistoryEntry currentEntry = commandLine.history.get(i);
 			if(currentEntry.getType().equals(HistoryType.COMMAND))
-			{				
+			{
 				if(printedLastEntry)
 				{
 					sb.append("\n");
@@ -110,72 +119,136 @@ public class CommandLineController
 				printedLastEntry = true;
 			}
 			else
-			{							
+			{
 				if(i != 0)
 				{
 					sb.append("\n");
 				}
 				sb.append(currentEntry.getText());
-				printedLastEntry = true;											
+				printedLastEntry = true;
 			}
-		}	
-		
+		}
+
 		textareaHistory.setText(sb.toString());
-		textareaHistory.positionCaret(sb.toString().length());		
+		textareaHistory.positionCaret(sb.toString().length());
 	}
-	
+
 	private boolean executeCommand(String[] command)
 	{
 		for(Command cmd : PossibleCommands.possibleCommands)
 		{
 			if(cmd.getKeyword().equals(command[0]))
-			{				
-				cmd.execute(command, commandLine.getBundle());		
+			{
+				cmd.execute(command, commandLine.getBundle());
 				return true;
 			}
 		}
 		return false;
 	}
-	
+
 	private void parse()
 	{
-		String input = textfieldInput.getText().replace("\n", "");			
-		
+		String input = textfieldInput.getText().replace("\n", "");
+
 		if(input.equals(""))
 		{
 			printPrompt();
 			return;
-		}	
-		
+		}
+
 		commandLine.globalHistory.add(new HistoryEntry(HistoryType.COMMAND, input));
 		commandLine.history.add(new HistoryEntry(HistoryType.COMMAND, input));
-		commandLine.lastShownCommand = -1;
-		
-		String[] command = input.split(" ");		
-		if(!executeCommand(command))		
+		commandLine.lastShownCommand = - 1;
+
+		String[] command = input.split(" ");
+		if( ! executeCommand(command))
 		{
-			print(commandLine.getLanguageBundle().getString("error.unknown.command"));			
+			print(commandLine.getLanguageBundle().getString("error.unknown.command"));
 		}
 		else
 		{
 			printPrompt();
 		}
 	}
-	
+
 	private void showLastCommand()
 	{
 		if(commandLine.globalHistory.size() > 0)
 		{
 			if(commandLine.lastShownCommand <= 0)
 			{
-				textfieldInput.setText(commandLine.globalHistory.get(commandLine.globalHistory.size()-1).getText());
-				commandLine.lastShownCommand = commandLine.globalHistory.size()-1;
+				textfieldInput.setText(commandLine.globalHistory.get(commandLine.globalHistory.size() - 1).getText());
+				commandLine.lastShownCommand = commandLine.globalHistory.size() - 1;
 			}
 			else
-			{			
+			{
 				textfieldInput.setText(commandLine.globalHistory.get(commandLine.lastShownCommand - 1).getText());
-				commandLine.lastShownCommand--;				
+				commandLine.lastShownCommand--;
+			}
+			
+			Platform.runLater(()->
+			{				
+				textfieldInput.positionCaret(textfieldInput.getText().length());				
+			});
+		}
+	}
+	
+	private void autocomplete()
+	{
+		String input = textfieldInput.getText().replace("\n", "");
+
+		if(input.equals(""))
+		{			
+			return;
+		}
+		
+		ArrayList<Command> commands = PossibleCommands.possibleCommands;
+		
+		//filter possible commands
+		ArrayList<Command> filteredCommands = new ArrayList<>();
+		for(Command currentCommand : commands)
+		{
+			if(currentCommand.getKeyword().startsWith(input))
+			{
+				filteredCommands.add(currentCommand);
 			}
+		}	
+		
+		//sort commands alphabetically		
+		filteredCommands.sort(new Comparator<Command>()
+		{
+			@Override
+			public int compare(Command o1, Command o2)
+			{
+				return o1.keyword.compareTo(o2.keyword);				
+			}
+		});		
+		
+		if(filteredCommands.size() == 1)
+		{
+			textfieldInput.setText(filteredCommands.get(0).getKeyword());
+		}
+		else
+		{
+			StringBuilder sb = new StringBuilder();		
+			sb.append(">>> Possible commands for \"" + input + "\":\n");
+			for(int i = 0; i < filteredCommands.size(); i++)
+			{
+				sb.append(filteredCommands.get(i).keyword);
+				if(i != (filteredCommands.size()-1))
+				{
+					sb.append("\n");
+				}
+			}
+			
+			print(sb.toString());	
+			
+			textfieldInput.setText(input);
 		}
+		
+		Platform.runLater(()->
+		{				
+			textfieldInput.positionCaret(textfieldInput.getText().length());				
+		});
 	}
 }
\ No newline at end of file
diff --git a/src/commandLine/_en.properties b/src/commandLine/_en.properties
index c7814cf..deb6bb3 100644
--- a/src/commandLine/_en.properties
+++ b/src/commandLine/_en.properties
@@ -1,13 +1,16 @@
 app.name=CommandLine
-version.code=1
-version.name=1.0.0
-version.date=26.07.16
+version.code=0
+version.name=1.1.0
+version.date=16.09.16
 
 help.list=list - lists all possible commands
 help.help=help - shows help for given command\nSYNTAX:  help [COMMAND]
 help.clear=clear - clears the history
+help.shortcuts=shortcuts - lists all available shortcuts
 
 error.general=An error occurred.
 error.unknown.command=Unknown command. Use \"list\" for a list of possible commands.
 error.invalid.arguments=Invalid arguments. Use \"help commandname\" for help.
-error.no.help=Unknown command as parameter. Can't display help. Use \"list\" for a list of possible commands.
\ No newline at end of file
+error.no.help=Unknown command as parameter. Can't display help. Use \"list\" for a list of possible commands.
+
+info.shortcuts=[ENTER] - execute command\n[UP] - scroll through recently used commands\n[ESC] - clear input\n[TAB] - autocomplete
\ No newline at end of file
diff --git a/src/commands/CommandShortcuts.java b/src/commands/CommandShortcuts.java
new file mode 100644
index 0000000..63b5cbf
--- /dev/null
+++ b/src/commands/CommandShortcuts.java
@@ -0,0 +1,23 @@
+package commands;
+
+/**
+ * Lists all available Shortcuts
+ * @author deadlocker8
+ *
+ */
+public class CommandShortcuts extends Command
+{
+	public CommandShortcuts()
+	{		
+		super.keyword = "shortcuts";		
+		super.numberOfParams = 0;
+		super.helptText = "help.shortcuts";
+	}
+
+	@Override
+	public void execute(String[] command, CommandBundle bundle)
+	{		
+		bundle.getController().print("Available Shortcuts:");
+		bundle.getController().print(bundle.getLanguageBundle().getString("info.shortcuts"));
+	}
+}
\ No newline at end of file
diff --git a/src/commands/PossibleCommands.java b/src/commands/PossibleCommands.java
index bdf8a51..35842a6 100644
--- a/src/commands/PossibleCommands.java
+++ b/src/commands/PossibleCommands.java
@@ -13,6 +13,7 @@ public class PossibleCommands
 	public static final ArrayList<Command> possibleCommands = new ArrayList<>(Arrays.asList(
 				new CommandList(),
 				new CommandHelp(),
-				new CommandClear()				
+				new CommandClear(),
+				new CommandShortcuts()
 			));	
 }
\ No newline at end of file
-- 
GitLab