Version 4 (modified by manualwiki, 10 years ago) (diff) |
---|
Introduction
Most services provided by RefactorErl are accessible from the Eclipse IDE after installing the RefactorErl plugin in Eclipse. In this guide, we also refer to this plugin as the Eclipse interface. The following functionalities are available from the Eclipse interface:
- Database management
- Semantic queries
- Refactoring
- Dependency graph drawing
- Duplicated code analysis
- Code investigations
A short description for each functionality can be found at the beginning of the relevant sections.
While not required, it's recommended to install the Erlide plugin in Eclipse. Erlide enhances features of the RefactorErl plugin and transforms Eclipse into a complete Erlang IDE.
Installation
Quick summary
- Install the dependencies.
- To install the RefactorErl plugin in Eclipse, click on the Help > Install new software buttons in the Eclipse menu, click Add... in the appearing window, and paste the following link in the Location text field of the window named Add Repository: http://plc.inf.elte.hu/erlang/dl/update/
- After the installation, navigate to the preference pages by clicking Window > Preferences > RefactorErl, and fill in the RefactorErl Base Directory field with the path to the base directory of a locally installed RefactorErl application. In case you would like to connect to a remotely located RefactorErl node instead, fill in the node address of this node in the Server address field.
Dependencies
- Java 8 JRE/JDK or newer.
- Eclipse 4.4.0 Luna or newer.
- RefactorErl 0.9.14.09 or newer. (Not needed in case a remote RefactorErl node is available.)
- GraphViz (Optional. Needed for displaying dependency graphs in SVG.)
- Erlide 0.29 or newer (Optional.)
Java & Eclipse
Please see the developers' site for instructions concerning the obtainment and installation of Java and [https:/www.eclipse.org/ Eclipse].
RefactorErl
Detailed instructions for installing RefactorErl can be found on the related wiki page. Of the various dependencies listed in the guide, the RefactorErl plugin depends only on the RefactorErl base system. This means that if you do not intend to use other interfaces besides the Eclipse interface, you don't need to install any other dependencies (Yaws, Erlang Wx, ...) listed on the referenced wiki page apart from the base system.
As a remainder, here are the steps you need to follow in order to install RefactorErl:
- Install Erlang from your system package manager, or from an installer provided by Erlang Solutions, or you can build Erlang from source. Prior to installation make sure that the version of the Erlang package to be installed is supported by RefactorErl.
- Download RefactorErl.
- Uncompress the archive to the directory where you want RefactorErl to reside.
- Enter the refactorerl-x.y.z.v directory you just uncompressed (here x.y.z.v denotes a version number). Type the command bin\referl -build tool in a terminal window. Wait for the build process to finish. If the build ends with an error, please refer to the wiki page mentioned before.
- Test the tool by typing bin\referl in your terminal. If the build was succesful, an Erlang shell should appear.
You will have to supply the location of the refactorerl-x.y.z.v directory (where we typed in the commands) to the RefactorErl plugin after the plugin is installed into Eclipse.
GraphViz
Optional. GraphViz is used to draw SVG representations of dependency graphs. You will have to supply the location of the dot executable of an installed GraphViz application the first time you use the SVG drawing feature.
Hint: On UNIX-like systems, you can use the type -a dot command to locate the dot executable on your system.
GraphViz can be obtained from the developers' website or presumably from the package manager of your local system.
Erlide
Optional.
The up-to-date version of the Erlide Eclipse plugin can be obtained from the developers' website.
You can also download Erlide from the RefactorErl update site. Just select the Erlang language tools IDE entry besides the RefactorErl plugin entry in the list after you added the update site in Eclipse. See the relevant section for more information. Please note, that the version hosted on the RefactorErl update site might not be up-to-date.
Installing the RefactorErl plugin in Eclipse
The RefactorErl plugin can be installed in Eclipse via our update site.
First copy the following link on the clipboard (eg. Right click > Copy Link Location): http://plc.inf.elte.hu/erlang/dl/update/
Open Eclipse and click on the Help > Install new software buttons in the Eclipse menu.
Click Add... in the appearing window, and paste the link we just copied to the clipboard in the Location text field of the window named Add Repository. Click OK.
In the original Install window select the RefactorErl group and a list should appear, containing the plugins available from the update site we specified in the last step.
To install the RefactorErl plugin, select the RefactorErl Eclipse UI entry. The list might contain additional entries for optional dependencies (Erlang language tools IDE). Installing these plugins is not required, but it will enhance some features of the RefactorErl plugin. Please note, that the version of these dependencies hosted on the RefactorErl update site might not be up-to-date.
After clicking Next on this window, Eclipse will lead you through a series of simple steps before the installation. After the installation is finished, you will need to restart Eclipse.
Uninstalling the RefactorErl plugin
The RefactorErl plugin can be uninstalled from Eclipse like most other Eclipse plugins.
- Open Eclipse
- Click on Help > Installation Details
- In the appearing window select the RefactorErl Eclipse UI entry. Click on the Uninstall button.
First time launch
If the plugin installation was successful in the last step, an error message will appear the first time Eclipse is launched. This happens because we didn't set the path to RefactorErl yet.
The RefactorErl plugin can automatically start a local RefactorErl application and connect to it. Please, see the corresponding section of this guide, if RefactorErl is not yet installed on your system. It is also possible to connect to a RefactorErl application running on a remote server. You do not need to install RefactorErl on your local system to do this.
Navigate to the preference pages by clicking Window > Preferences > RefactorErl.
In case you would like to connect to a local RefactorErl application, fill in the RefactorErl Base Directory field with the path to the base directory of a locally installed RefactorErl application.
In case you would like to connect to a remotely located RefactorErl node instead, fill in the node address of this node in the Server address field.
Click OK. Click Yes on the dialog inquiring wheter you want to reconnect to RefactorErl. If the connection was successful, a Connected to RefactorErl message will appear in the left side of the status bar at the bottom of the Eclipse window.
Congratulations, now you can start using RefactorErl with the Eclipse interface!
Using the RefactorErl Eclipse interface
This section will guide you through the most important interface features. While we include a basic description for each feature group, it may be neccessary for you to read the corresponding wiki pages for an in-depth understanding of the feature group in question.
If you open the RefactorErl perspective or the Erlang perspective (if Erlide is installed) inside Eclipse, a new menu button, with the text RefactorErl on it, will appear in the Eclipse top menu. Much of the features are accessible through the RefactorErl menu, and some features can be accessed in more than one way.
For the rest of this guide we will assume that you have the RefactorErl or the Erlang perspective opened and one of these is the active perspective. As a reminder, perspectives can be opened via the Window > Open Perspective > Other button in the Eclipse top menu.
Database management
The RefactorErl server uses an internal database to store syntactic and semantic information on the source code. RefactorErl provides most of its services with the use of this information. In order for RefactorErl to be able to analyse a source file, that source file must be added to the database.
See the wiki page about database management for a more detailed description of database management in RefactorErl.
Database management features available in the Eclipse interface include:
- Listing the source files in the database
- Showing the contents of a source file
- Adding new source files or directories of source files
- Dropping source files or directories
- Synchronizing the database with the (possibly modified) source files on the disk
- Synchronizing the GUI and the database in case of connection errors or other irregularities
- Appending values to the appdata and include environment variables
- Removing previously added values from the environment variables
- Resetting the database
You can open a view containing the list of files, called the Database view, by clicking RefactorErl > Database > Show Database in the top menu.
When you click in the Database view with the right mouse button, a context menu will appear, containing all database management features. Some of them, like the drop and show features, are dependent on the files or directories selected in the view. Most database management features (the ones not depending on file selection) are also available in the RefactorErl > Database menu.
Source files can also be opened by double clicking on their name in the Database view.
Semantic queries
RefactorErl provides a semantic query language as a straightforward way to query the information residing in the database. See the wiki page on semantic queries for a detailed description of this feature.
The RefactorErl plugin for Eclipse provides an interface to
- write and execute semantic queries with autocompletion support,
- show the results of the previously executed query,
- show a history of preceding queries and their results.
Before we examine the interface, we have to note the following distinction: A semantic query can be global or it can be position based. Position based queries start with the @ character. As an example mod.funs is a global query, because it returns all functions of all modules in the database. On the other hand @fun.references is a position based query, because it returns all references to the function specified by a position on the source file.
You can execute a global query by writing your query in the textfield initially with the text Semantic query in the Eclipse toolbar and pressing the return key. You can also execute global queries by clicking on RefactorErl > Queries > Start query. A dialog will appear, where you can type the global query.
To execute a position based query, open the source file where you want to start the query from, and click on the desired position in the text of the file with the right mouse button. In the appearing context menu, select Run query from position. A dialog will appear, where you can type a position based query (or even a global query).
After a successful query execution a view, called Query result view will appear with the results of your query. You can double click on a line of the result, and if it's possible, an editor tab will open with the file containing the content of that line, highlighting the content in question.
The RefactorErl > Queries > Show query history button will open the Query history view. Double clicking on a query in the Query history view will show a results of this query in a Query result view. Please note, that these are historical results, it may or may not be consistent with the current content of the database.
Refactoring
See the wiki page about the available refactorings for a detailed description of this feature.
Dependency graph drawing
See the wiki page about dependency analysis for a detailed description of this feature.
Duplicated code analysis
See the wiki page about duplicated code analysis for a detailed description of this feature.
Code investigations
Attachments (12)
- install-menu.png (75.1 KB) - added by manualwiki 10 years ago.
- install.png (88.9 KB) - added by manualwiki 10 years ago.
- filelist.png (220.3 KB) - added by manualwiki 10 years ago.
- q.png (172.4 KB) - added by manualwiki 10 years ago.
- autocomplete.png (22.5 KB) - added by manualwiki 10 years ago.
- dep_smart.jpg (228.0 KB) - added by manualwiki 10 years ago.
- dep_erl.png (137.1 KB) - added by manualwiki 10 years ago.
- dupcode.png (183.3 KB) - added by manualwiki 10 years ago.
- inv.png (129.6 KB) - added by manualwiki 10 years ago.
- dep_svg.png (188.1 KB) - added by manualwiki 10 years ago.
- dep_zest.png (229.1 KB) - added by manualwiki 10 years ago.
- prefs.png (80.6 KB) - added by manualwiki 10 years ago.
Download all attachments as: .zip