First Steps
- Start up Eclipse and choose a workspace. In the following steps it is assumed that the workspace location is C:/workspaces/q.
- Now create a new Q Project: From the main menu choose File->New->Project... In the New Project Dialog open the Q node, select Q Project and press Next. Enter sample as project name and press Finish. The project folder in the file system will be C:/workspaces/q/sample.
- Add a Q Script File from the context menu of the project with New->File. Enter a file name with suffix q, e.g. test.q. The fully qualified path will be C:/workspaces/q/sample/test.q.
- Edit test.q and enter the following two lines:
1+1
([] c:til 5) - Open a command shell and change directory to C:/workspaces/q/sample. Start q with the p parameter to listen on port 1444:
C:/q/q.exe -p 1444 - In Eclipse create a Run Configuration in order to connect to the Q instance started in the step before. Depending on the perspective you can either choose Run->Open Run Dialog from the main menu or Run As->Run Configurations... from the context menu of any q file. The dialog for managing run configurations displays the available types of run configurations on the left side. There you find Remote Q Launch Configuration. Choose New from its context menu and enter localhost as hostname and 1444 as port. User and Password do not need to be entered. Set the name to "Local Q Instance" and finish by clicking Run.
- Switch to the Debug perspective where you will find the launch configuration in the Debug view. The editor still shows the content of test.q. Select the first line (1+1) and choose Q Inspect from the editor's context menu. The expression view opens and displays the result.
- Evaluate the second line in order to have the table displayed in the Q Table View
Evaluating expressions
You can evaluate expressions with the Q Inspect command. It is available in the editor's context menu and the default keybinding is Ctrl+Shift+V. The choice of the default key binding is limited to those keybindings which are not yet occupied from the Eclipse and DLTK platform. You can change it to something more meaningful (like Ctrl+e) via Window->Preferences... General->Keys.
The expression to be evaulated is determined in the following order:
- the selection in the editor
- an identifier below the cursor
- the current line
© 2007,2008 Markus Barchfeld.