Integrating IntelliJ IDEA

From BaseX Documentation

(Difference between revisions)
Jump to: navigation, search
Line 26: Line 26:
* Start IntelliJ IDEA and select ''Configure''→''Plugins''.
* Start IntelliJ IDEA and select ''Configure''→''Plugins''.
-
* In the Plugins window select the tab ''Marketplace''.
+
* In the Plugins window, select the tab ''Marketplace''.
* Type "XQuery Support" into the ''Search plugins in marketplace'' field.
* Type "XQuery Support" into the ''Search plugins in marketplace'' field.
* Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
* Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
Line 33: Line 33:
===From the IntelliJ IDEA Menu===
===From the IntelliJ IDEA Menu===
* Select ''Settings/Preferences'' in the ''IntelliJ IDEA'' menu.
* Select ''Settings/Preferences'' in the ''IntelliJ IDEA'' menu.
-
* In the Settings/Preferences window select ''Plugins''.
+
* In the Settings/Preferences window, select ''Plugins''.
-
* In the Plugins window select the tab ''Marketplace''.
+
* In the Plugins window, select the tab ''Marketplace''.
* Type "XQuery Support" into the ''Search plugins in marketplace'' field.
* Type "XQuery Support" into the ''Search plugins in marketplace'' field.
* Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
* Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
Line 66: Line 66:
This assumes that you already have a BaseX database named {{code|factbook}}.
This assumes that you already have a BaseX database named {{code|factbook}}.
* In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
* In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
-
* Click on the {{Code|+}} button in the middle column, to add a new data source.
+
* Click on the {{Code|+}} button in the middle column to add a new data source.
* Select ''BaseX'' from the dropdown box.
* Select ''BaseX'' from the dropdown box.
-
* In the right-hand column, fill in the appropriate connection details; e.g. default values:
+
* In the right-hand column, fill in the appropriate connection details, e.g. default values:
** <code>Host = localhost</code>
** <code>Host = localhost</code>
** <code>Port = 1984</code>
** <code>Port = 1984</code>
Line 79: Line 79:
==Querying Your Data==
==Querying Your Data==
-
* To create a new project, choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
+
* To create a new project choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
-
* In the ''New Project'' dialog choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
+
* In the ''New Project'' dialog, choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
* Enter a name and location for your project.
* Enter a name and location for your project.
* In the project view, create a new XQuery file, either by right-clicking on the project name and choosing ''New''→''XQuery File'' or by selecting ''New''→''XQuery File'' from the File menu. Enter a file name and click ''OK''.
* In the project view, create a new XQuery file, either by right-clicking on the project name and choosing ''New''→''XQuery File'' or by selecting ''New''→''XQuery File'' from the File menu. Enter a file name and click ''OK''.
Line 86: Line 86:
[[File:Intellij-query.png]]
[[File:Intellij-query.png]]
* Click the green ''Run'' button below the IntelliJ IDEA menu bar.
* Click the green ''Run'' button below the IntelliJ IDEA menu bar.
-
* In the ''Edit Configuration'' dialog choose one of the two data source from the dropdown box, either "BaseX" or "BaseX (native embedded)". If you select "BaseX", make sure that BaseX is up and running.
+
* In the ''Edit Configuration'' dialog, choose one of the two data sources from the dropdown box, either "BaseX" or "BaseX (native embedded)". If you select "BaseX", make sure that BaseX is up and running.
* Click ''Run'' to execute your query.
* Click ''Run'' to execute your query.
Line 98: Line 98:
===From the Start Screen===
===From the Start Screen===
* Start IntelliJ IDEA and select ''Configure''→''Plugins''.
* Start IntelliJ IDEA and select ''Configure''→''Plugins''.
-
* In the Plugins window select the tab ''Marketplace''.
+
* In the Plugins window, select the tab ''Marketplace''.
* Type "XQuery" into the ''Search plugins in marketplace'' field.
* Type "XQuery" into the ''Search plugins in marketplace'' field.
* Click the ''Install'' button below ''xquery-intellij-plugin''.
* Click the ''Install'' button below ''xquery-intellij-plugin''.
Line 105: Line 105:
===From the IntelliJ IDEA Menu===
===From the IntelliJ IDEA Menu===
* Select ''Settings/Preferences'' in the ''IntelliJ IDEA'' menu.
* Select ''Settings/Preferences'' in the ''IntelliJ IDEA'' menu.
-
* In the Settings/Preferences window select ''Plugins''.
+
* In the Settings/Preferences window, select ''Plugins''.
-
* In the Plugins window select the tab ''Marketplace''.
+
* In the Plugins window, select the tab ''Marketplace''.
* Type "XQuery" into the ''Search plugins in marketplace'' field.
* Type "XQuery" into the ''Search plugins in marketplace'' field.
* Click the ''Install'' button below ''xquery-intellij-plugin'' plugin.
* Click the ''Install'' button below ''xquery-intellij-plugin'' plugin.
Line 124: Line 124:
==Querying Your Data==
==Querying Your Data==
-
* To create a new project, choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
+
* To create a new project choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
-
* In the ''New Project'' dialog choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
+
* In the ''New Project'' dialog, choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
* Enter a name and location for your project.
* Enter a name and location for your project.
* Click the ''Add Configuration'' button below the IntelliJ IDEA menu bar.
* Click the ''Add Configuration'' button below the IntelliJ IDEA menu bar.
[[File:Intellij-add-configuration.png]]
[[File:Intellij-add-configuration.png]]
-
* In the ''Run/Debug Configurations'' dialog expand the Templates list and choose the ''XQuery'' entry.
+
* In the ''Run/Debug Configurations'' dialog, expand the Templates list and choose the ''XQuery'' entry.
* Click on the three dots {{Code|...}} next to the ''Query Processor'' dropdown box.
* Click on the three dots {{Code|...}} next to the ''Query Processor'' dropdown box.
-
* In the ''Manage Query Processors'' dialog click on the {{Code|+}} button.
+
* In the ''Manage Query Processors'' dialog, click on the {{Code|+}} button.
-
* In the ''New Query Processor Instance" dialog, set the following preferences:
+
* In the ''New Query Processor Instance'' dialog, set the following preferences:
** <code>Name = BaseX</code>
** <code>Name = BaseX</code>
** <code>Implementation = BaseX</code> (should be preset!)
** <code>Implementation = BaseX</code> (should be preset!)
Line 140: Line 140:
** <code>Username = admin</code>
** <code>Username = admin</code>
** <code>Password = admin</code>
** <code>Password = admin</code>
 +
** If you tick the check box ''Create a standalone instance'', the fields ''Hostname'', ''Database port'', ''Username'', and ''Password'' remain empty.
[[File:Intellij-new-query-processor.png]]
[[File:Intellij-new-query-processor.png]]
-
* Click ''OK'' to exit the ''New Query Processor Instance" dialog.
+
* Click ''OK'' to exit the ''New Query Processor Instance'' dialog.
-
* In the ''Manage Query Processors'' now choose the "BaseX 9.1.1 (BaseX)" entry and click ''OK''.
+
* In the ''Manage Query Processors'' dialog, now choose the "BaseX 9.1.1 (BaseX)" entry and click ''OK''.
* The ''Query Processor'' dropdown box in the ''Run/Debug Configurations'' dialog should now also display "BaseX 9.1.1 (BaseX)". If not, select it from the dropdown box.
* The ''Query Processor'' dropdown box in the ''Run/Debug Configurations'' dialog should now also display "BaseX 9.1.1 (BaseX)". If not, select it from the dropdown box.
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
Line 148: Line 149:
* Type in your query.
* Type in your query.
* Click on the ''Add Configuration'' button once again.
* Click on the ''Add Configuration'' button once again.
-
* In the ''Run/Debug Configurations'' dialog click the {{Code|+}} button to create a new configuration based on a template.
+
* In the ''Run/Debug Configurations'' dialog, click the {{Code|+}} button to create a new configuration based on a template.
-
* Chose the "XQuery" template you configured earlier.
+
* Choose the "XQuery" template you configured earlier.
-
* Enter a name, e.g. "BaseX" into the ''Name'' field.
+
* Enter a name, e.g. "BaseX", into the ''Name'' field.
* The query processor should be preset to "BaseX 9.1.1 (BaseX)".
* The query processor should be preset to "BaseX 9.1.1 (BaseX)".
-
* In the ''Script File'' field enter the path to your query file.
+
* In the ''Script File'' field, enter the path to your query file.
[[File:Intellij-xquery-configuration.png]]
[[File:Intellij-xquery-configuration.png]]
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
-
* Now, the green ''Run'' button should be available below the IntelliJ IDEA menu bar.
+
* Now, the configuration should be set and the green ''Run'' button should be available below the IntelliJ IDEA menu bar.
[[File:Intellij-run-button.png]]
[[File:Intellij-run-button.png]]
-
* Make sure that BaseX is up and running and click the ''Run'' button to execute your query.
+
* If the configuration does not run as a standalone instance, make sure that BaseX is up and running.
 +
* Click the ''Run'' button to execute your query.

Revision as of 15:36, 24 January 2019

This article is part of the Getting Started Section. It describes how to run XPath/XQuery code from within the IntelliJ IDEA IDE. There are currently two XQuery plugins for IntelliJ IDEA on the market:

Contents

Preparations

The following steps apply to all operating systems and both plugins:

XQuery Support + MarkLogic Debugger

This section focuses on Grzegorz Ligas' XQuery Support plugin.

Installation

After installing IntelliJ IDEA and BaseX, install the XQuery Support plugin by one of the following methods:

From the Start Screen

Intellij-startbildschirm.png

From the IntelliJ IDEA Menu

Setting Up

File Extensions and XQuery Flavor

Intellij-xquery-settings.png

Configuring The Processor

You can set up the plugin as a standalone processor or client.

Standalone

Client

This assumes that you already have a BaseX database named factbook.

Intellij-basex-data-source.png

Querying Your Data

Intellij-query.png

xquery-intellij-plugin

This section focuses on Reece H. Dunn's xquery-intellij-plugin.

Installation

After installing IntelliJ IDEA and BaseX, install the xquery-intellij-plugin by one of the following methods:

From the Start Screen

From the IntelliJ IDEA Menu

Configuring The Processor

Intellij-xquery-settings-2.png

Querying Your Data

Intellij-add-configuration.png

Intellij-new-query-processor.png

Intellij-xquery-configuration.png

Intellij-run-button.png

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export