-
Notifications
You must be signed in to change notification settings - Fork 56
Tutorial
This is a short tutorial, teaching how to install and use the plugin. You can post installation or usage issues on https://github.com/SpartanRefactoring/Spartanizer/issues.
- Install the plugin (more in Installation Instructions):
- go to Spartan Refactoring Eclipse Marketplace page
- Drag installation button to eclipse's window
- install the plugin
- Right click on the project in the Package Explorer and
Refactor->Spartanization tips on/off
(keyboard shortcut:ctrl+4
) - Tips for spartanizing your code should appear in the
problems
view within a few minutes.
- Be sure to configure the
problems
view so that it shows alsoinfo
(default iswarnings
anderrors
only)
The key for efficient and productive work with the plugin is understanding it's various UI features.
The main spartanization menu can be found under Spartanizer->Spartanize...
:
-
Spartanizer->Spartanize...->current selection
: preforms spartanization on the text currently selected. -
Spartanizer->Spartanize...->active window
: preforms spartanization on active window. -
Spartanizer->Spartanize...->entire project
: preforms spartanization on the entire project (could take a few moments). -
Spartanizer->Spartanize...->Refresh all projects (slow)
: refreshes all project, while rebuilding spartanization suggestions. -
Spartanizer->Preferences...
: Spartanizer preferences
- Spartanizing entire project means preforming major textual changes. Currently there is no way of reverting this process, though
ctrl+z
is available (for files that were open during the spartanization process).
The main feature of the plugin is marking code with spartanization suggestion. A short description of the suggestion will be shown upon hovering the cursor over the marker, followed by the following resolution options:
-
Apply
: apply suggestion for the marked code. -
Laconize function
: performs spartanization process on the containing function (see below). -
Laconize class
: same as above, but for containing class. -
Apply to compilation unit
: performs the described suggestion for the entire file. -
Apply to entire project
: same as above, but for the entire project. -
Disable tip
: disables all the suggestions the same as the current one. -
Suppress spartanization tips on function
: disables spartanization suggestions for the containing function (see below). -
Suppress laconize tips on class
: same as above, but for containing class. -
Class under construction
: disables spartanization suggestions for the containing class, and adds an@UnderConstruction
annotation to the class (the user has to define the annotation after choosing that option).
-
Laconize X
will preform all kinds of enabled spartanizations, whileApply to X
will perform only the current suggestion. - Spartanization suggestions disabling mechanism is implemented using Javadoc comments. A declaration (i.e. class, function and so on) with
[[SuppressWarningsSpartan]]
in it's Javadoc will disallow any spartanization options within it. Using[[EnableWarningsSpartan]]
will enable the suggestions once again, so user defined spartanization protocol can be easily conducted using using nested Javadoc spartanization comments. For example:
/**
* My cool class.
* [[SuppressWarningsSpartan]]
*/
Class MyClass {
// tips are disabled here
/**
* My cool inner class.
* [[EnableWarningsSpartan]]
*/
Class MyInnerClass {
// tips are enabled here
}
}
- The Java compiler for your project should set "Process Javadoc comments" in order for it to work.
You can perform spartanization process on the active window using the methods described above, but also using:
- Button on the upper menu bar:
- Keyboard shortcut
ctrl+5
.
The spartanization tips can be view in the problems
tab in the lower eclipse window. The suggestions are considered as info
markers, and right click->Refactor->Spartanization Preferences
opens the preferences page you can read more about here- Spartanizer preferences