Index: trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ConsoleTabComposite.java
===================================================================
--- trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ConsoleTabComposite.java	(revision 1237)
+++ trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ConsoleTabComposite.java	(revision 1243)
@@ -35,6 +35,9 @@
 import org.eclipse.swt.events.KeyEvent;
 
+import de.ugoe.cs.util.FileTools;
+import de.ugoe.cs.util.StringTools;
 import de.ugoe.cs.util.console.CommandExecuter;
 import de.ugoe.cs.util.console.Console;
+import de.ugoe.cs.util.console.GlobalDataContainer;
 import de.ugoe.cs.util.console.listener.ICommandListener;
 
@@ -143,9 +146,38 @@
 
     private void autoCompleteCommand() {
-        String commandPrefix = textCommand.getText().trim();
-        String completedPrefix = CommandExecuter.getInstance().autoCompleteCommand(commandPrefix);
-        
-        textCommand.setText(completedPrefix.toString());
-        textCommand.setSelection(completedPrefix.length());
+        String prefix = textCommand.getText();
+        int end = textCommand.getCaretPosition() - 1;
+        int start = 0;
+        
+        for (int i = end; i >= 0; i--) {
+            if (Character.isWhitespace(prefix.charAt(i))) {
+                start = i + 1;
+                break;
+            }
+        }
+        
+        String textPrefix = prefix.substring(0, start);
+        String textSuffix = prefix.substring(end + 1);
+        prefix = prefix.substring(start, end + 1);
+        
+        String completedPrefix = null;
+        if ("".equals(textCommand.getText().substring(0, start).trim())) {
+            // search for a command completion
+            completedPrefix = CommandExecuter.getInstance().autoCompleteCommand(prefix);
+        }
+        else {
+            // complete an object in the data store or a file name
+            completedPrefix = FileTools.autoCompletePath(prefix);
+            
+            if (prefix.equals(completedPrefix)) {
+                // file completion wasn't possible, so try to complete using data objects
+                String[] completions =
+                    GlobalDataContainer.getInstance().getAllKeys().toArray(new String[0]);
+                completedPrefix = StringTools.autocomplete(prefix, completions);
+            }
+        }
+        
+        textCommand.setText(textPrefix + completedPrefix + textSuffix);
+        textCommand.setSelection(textPrefix.length() + completedPrefix.length());
     }
     
