Simple Add-In in ArcMap


Purpose
This sample illustrates how to create and consume the following types of ArcGIS Add-Ins through ArcMap.
 
  1. Custom Button
  2. Custom Tool
  3. Tool Palette
  4. Toolbar
  5. Menu
  6. Dockable Window
  7. Application Extension
 

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Double click on the SimpleAddin.esraddin file from developer kit home\java\samples\arcobjects\addin\simpleaddin\lib.It will pop up a dialog box asking whether you want to install the addin,click Yes to install.
  2. Start ArcMap.
  3. Go to Customize Menu > Click Customize Mode.
  4. Verify that the Toolbars tab is enabled. Scroll down and select Sample Java Toolbar.
  5. Verify that you can see a toolbar containing the following:Java Add Layer button, ESRI Fixed Zoomout Command,Java Draw Polygon Tool, Java Sample Menu containing the Java Add Layer button and a custom tool palette containing Draw Polygon tool and Zoom In tool.
  6. Select the commands tab.
  7. Select each category above one-by-one and drag the respective commands onto an existing toolbar
  8. Click on the Java Addlayer command.This command will open a file chooser and allow you to browse to data.
  9. Browse to a Shapefile from developer kit home\java\samples\data\usa\states.shp to add the layer to the map.
  10. Click the Draw Polygon tool and draw a ploygon on the map.Once finished this tool will create a solid blue polygon graphic on the map.
  11. Click the Java ShowDocWin Command.This command will open a dockable window.Click on the Show/Update Layer LayerList button and it will show states layer in the list.You can dock this windows anywhere in ArcMap as permitted.
  12. Open a new document by browsing to developer kit home\java\samples\data\mxds\World.mxd((it is not necessary for you to save the existing map document).Notice the application extension is getting called and the dockable window is visible.
  13. Click on the Show/Update LayerList button and it will show all the layers of the world.mxd in the list
  14. When you go to Customize Menu > Extension you can see Java Sample Extension as one of the extensions available for you.


Download the files for Java
addins\button\AddLayerButton.java This will open a JFileChooser and from there you can select a layer and add to the map.This will be called when you click on the AddLayer custom command
addins\tool\DrawPolygonGraphicsTool.java This is a custom tool. Click on the tool and then you can draw a polygon graphics on the map.
addins\dockablewindow\DockableMap.java This is for the dockable window. If you have a map open and when you click on the Show Dockbale Window button, you can see it lists all the layer that are present in the map.This window can be docked inside anywhere in ArcMap.
addins\extension\MapExtension.java This is the application extension.When you open a new map document this application extension is called and in turn it opens a dockable window.
addins\util\ShapeFileFilter.java This is a util file which filters and shows only shape files in the File Chooser




Development licensing Deployment licensing
ArcInfo ArcView