Code Conjurer Manual
Installation
We recommend to use Eclipse 3.3.1 (Europa), other versions may cause problems.
To install the plugin -
- Close any open instances of Eclipse
- Remove any former installation of the Code Conjurer (delete the jar-file in the /plugins folder)
- Copy the file com.merotronics.merobase.code_conjurer_1.0.0.date.jar to your
/plugins folder, which can be found in your Eclipse installation directory
(or use our update site under http://merobase.com/updates).
- Launch Eclipse
Prerequisites
If everything went fine, you will see a button with the Merobase logo in your
Eclipse toolbar. If you cannot see this button, open the About Eclipse SDK dialogue
via the Help menu and examine the plugin details. If Merobase is not listed
there the installation has failed. Consider using a different version of Eclipse.
Before you start using the
Code Conjurer, you need to configure its preferences. In the
Window menu click on the entry Preferences and after the preferences dialog is
opened select the entry Merobase in the tree on the left..
Select the Connection options page and enter your username and password (you can
register your user account at
http://merobase.com
for free). According to your company's needs, you may need to specify a proxy
server to connect to the Web.
When you've finished with these settings, you can start using the
Code Conjurer. Further options will be described later in this
manual.
Pro-Active Component Recommendations
The Code Conjurer offers you the possibility to search for components
while you are programming. To activate the proactive recommendation assistant,
simply click on the small Merobase button in your Eclipse toolbar. A view called
"Reuse Recommendations" will open below the Java editor, where the recommendations
will be displayed. A basic example should demonstrate how the Code Conjurer works:
Imagine you need a component that provides the four basic mathematical operations.
So you create a new class
Calculator
in your project and start typing
public
int add(int a, int b) { }
Now the
Code Conjurer will automatically in the background send a query
to the merobase server and after the blink of an eye you will find numerous recommendations
in the recommendation view:
In the recommendations view you may now select the components retrieved one by
one and examine their code in the code preview. If a component fits your needs,
a simple double click on it is enough to insert it into your project. If the classname
is the same as that of an already existing class, it will overwrite the existing
class. Alternatively, you may also want to double click on a method to paste the
code of the method into the active Java editor:
In the upper right corner you can see three or four buttons, depending on your
version of the
Code Conjurer. One of them shows a small flashlight which can
be used to initiate a search manually at any time on the code in the active Java
editor. To the left of this button, there are two other buttons, that can be used
to expand or collapse the results tree to make navigation through it easier. All
pasting operations can be undone simply using the undo function of Eclipse by
pressing CTRL-Z.
Manual Searching
Sometimes you might want to search for only one keyword or you are not satisfied
with the query built by the Component Finder. In this case, you have the opportunity
to send any arbitrary text to the merobase server. Simply type your query into
the Java editor (best as a comment so no error is reported by Eclipse) and select
it. A right-click on the selection will offer a function called "Search merobase.com".
Clicking on this, the selected text will be sent to the server without any modification.
If the query meets the Merobase requirements and format and there are any components
matching you will receive the results to it after a few moments in the Recommendations
view.
QuickFixes for Missing Dependencies
The Eclipse quickfix feature offers developers a convenient way
to correct errors in their source code or to search for a solution. If for instance
a type cannot be resolved by Eclipse, the quickfix by default offers the opportunity
to create a new class with the name of the type. This means that you have to write
the code for the generated interface, however. The Code Conjurer
adds a feature to the quickfixes of Eclipse in order to directly search for the
unresolved type.
The following Java code example, will make Eclipse to offer the shown quickfix:
class BlackJack {
public void init() {
Deck d = new Deck();
}
}
After a few moments the Recommendations view will present all the found components
and you can insert an appropriate one into your project with a simple double click.
Advanced Query Settings
Maximum Number of Results to Show
Registered Merobase users can obtain 100 results for a query by default. Nevertheless,
this number of components is in general too large to be examined by a developer
on the fly. Thus the Code Conjurer offers the opportunity to reduce
the number of retrieved and displayed recommendations. With the slider you can
set the number of results to a value between 5 and 100.
License Settings
Components in the Merobase index are - as far as possible - classified by the
open source license they were released under. To offer you the possibility to
retrieve only components that meet your license requirements, you can set the
license filter according to your needs.
Duplicates Filter
From time to time Merobase may offer you the same component twice. This can be
for different reasons, but most likely one single component was stored at two
or more distinct places on the Internet and thus was indexed more than once. Since
you normally do not need these duplicates, you can activate the duplicate filter
in the query preferences in order that the Code Conjurer only delivers
you unique components.
Nevertheless, later during your development / retrieval process, it may be convenient
to disable the filter. For example - after you have inserted a component into
the editor, you might want to let the plugin resolve some dependencies which may
be stored at the location of a duplicate of the component.
Automatic Dependency Resolution
Sometimes components recommended by the Code Conjurer plugin depend themself on
other components. If they are contained in the same package, the Code Conjurer
will automatically download the necessary component(s) and insert it/them into
your project. To enable this feature, simply enable it in the query settings.
Further Constraint Settings in Code Conjurer
Host Constraints
To restrict searches to certain hosts, you can specify a list of hosts that should
be used for searches by the Code Conjurer. Thus the recommendation
view will display only candidates from this server. Results from other servers
that might be available in the Merobase index are ignored. You can enable this
feature if , for example, you only want to reuse components from your company's
repositories and not from servers, projects and developers on the Internet (however,
you should consider to purchase our the merobase Enterprise version to make this
process more convenient). For the sake of simplicity, you can enable/disable this
feature with the appropriate button instead everytime adding/deleting items in
the host list.
Project Constraints
Just as it is possible to restrict searches to certain hosts, you can also restrict
searches on certain projects. To enable this feature click on the enable button
in the preferences and add projects to the list according to the rules of merobase.
You might specify something like "eclipse.org" if you want to search for components
only inside the Eclipse project.