Skip to content

Tutorial

tomerdragucki edited this page Apr 4, 2017 · 20 revisions

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.

Quick start

  1. Install the plugin (more in Installation Instructions):
  1. Choose Refactor->Laconize..->Tips on/off
  2. 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 also info (default is warnings and errors only)

User interface

The key for efficient and productive work with the plugin is understanding it's various UI features.

Main menu

The main spartanization menu can be found under Refactor->Laconize..:

  • Refactor->Laconize..->active window: preforms spartanization on active window.
  • Refactor->Laconize..->entire project: preforms spartanization on the entire project (could take a few moments).
  • Refactor->Laconize..->Tips on/off: enables/disables spartanization suggestions for current project.
  • Refactor->Laconize..->Refresh all projects (slow): refreshes all project, while rebuilding spartanization suggestions.
  • Refactor->Laconize..->Apply spartanization nature to all projects: enables spartanization suggestions in all projects.
Notes
  • 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).
  • Keep in mind the suggestions will be built for a project only after it refreshed, so consider using Refactor->Laconize..->Refresh all projects (slow) right after Refactor->Laconize..->Apply spartanization nature to all projects.

Marker resolutions

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.
Notes
  • Laconize X will preform all kinds of enabled spartanizations, while Apply 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

  }
}

Quick access to Spartanize current window

You can perform spartanization process on the active window using the methods described above, but also using:

  • Button on the upper menu bar: spartanization button
  • Keyboard shortcut ctrl+5.

Problems view

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).

Clone this wiki locally