uDig

«  Training Materials   ::   Contents   ::   Export Sld Plugin Tutorial  »

Edit Tool Example

This tutorial demonstrates how to make a simple custom edit tool. The tool will select features and change the geometry of the feature into a star.

Requirements for tutorial

What is a Edit Tool?

Edit tools are another sub-type of tools, however they do not (yet) have their own extension point. Instead they are extensions of the org.locationtech.udig.project.ui.tool extension point. Because there are a large number of editing tools that can be created an many of them have similar functionality there is a little framework associated with edit tools development. The design and more detailed discussion of the edit tool framework can be found at Edit Tools

Tutorial

  1. Create a new Plugin called: org.locationtech.udig.tutorials.tool.star
  2. Configure your new created plugin
  3. Open the Plug-in Development perspective.
  4. In the Package Explorer navigate to the plug-in created in the previous section. Open the plug-in manifest by navigating to the META-INF/MANIFEST.MF file under the root of the feature editor plug-in. Double click on the file to open the plug-in manifest editor.
  5. Open the plug-in dependencies by clicking on the Dependencies tab located at the bottom of the editor area.
  6. Click the Add button in the Required plugins column and add the following plugin:
  • org.locationtech.udig.project.ui,
  • org.locationtech.udig.ui
  1. At this point it is critical that you Save your work as the dependencies need to propagate into the project.

Import Resources Into Project

Define a New Extension

  1. Open the extensions page by clicking on the Extensions tab
  2. Click the Add button
  3. Select the org.locationtech.udig.project.ui.tool extension point from the list.
  4. Click the Finish button.
  5. Enter the following Extention Details:
    • ID: org.locationtech.udig.tutorials.tool.star
    • Name: Star Geometry Tool Example

Create a New Tool

  1. Right click on newly added extension, org.locationtech.udig.project.ui.tool, and select New ‣ modalTool
  2. Replace the default data in the id field with org.locationtech.udig.tutorials.tool.star.
  3. Enter a tool tip message into the tooltip field: Changes Geometry to Star
  4. Enter org.locationtech.udig.tutorials.tool.move.StarTool into the class field.
  5. Enter icons/etool16/ into the icon field. (Or press the Browse button and locate the icon)
  6. Enter Move into the name field.
  7. Set onToolbar to true.
  8. Enter org.locationtech.udig.tool.edit.create into the categoryId field. This ensures that the tool will be created in the create Tool category.

«  Training Materials   ::   Contents   ::   Export Sld Plugin Tutorial  »