-
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. -
Apply after preview
: allow you to inspect the suggestion while comparing the original code with the spartanized one. -
Laconize file
: performs spartanization process on the current file. -
Laconize function
: same as above, but for containing function. -
Laconize class
: same as above, but for containing class. -
Apply to enclosing function
: performs the described suggestion for the containing function. -
Apply to compilation unit
: same as above, but for the entire file. -
Apply to entire project
: same as above, but for the entire project. -
Suppress laconize tips on function
: disables spartanization suggestions for the containing function (see below). -
Suppress laconize tips on class
: same as above, but for containing class. -
Suppress laconize tips on class
: same as above, but for containing file.
-
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
}
}
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->Laconize..
offers the same menu as the main spartanization menu (see above).