arcgissamples\editing\AddJavaTaskCommand.java
/* Copyright 2010 ESRI * * All rights reserved under the copyright laws of the United States * and applicable international laws, treaties, and conventions. * * You may freely redistribute and use this sample code, with or * without modification, provided you include the original copyright * notice and use restrictions. * * See the use restrictions. * */ package arcgissamples.editing; import com.esri.arcgis.controls.BaseCommand; import com.esri.arcgis.controls.EngineEditor; import com.esri.arcgis.controls.HookHelper; public class AddJavaTaskCommand extends BaseCommand { private static final long serialVersionUID = 1L; private HookHelper helper = null; public void onCreate(Object hook) { super.caption = "Add ReshapePolyline Task"; super.enabled = true; super.name = "JavaEditingTask"; super.toolTip = "Add Java Editing Task"; try { this.helper = new HookHelper(); helper.setHookByRef(hook); } catch (Exception e) { e.printStackTrace(); } super.onCreate(hook); } public void onClick() { //Add the ReshapePolylineEditTask to the EngineEditor //and set it as the current task try { // Get a reference to the editor EngineEditor editor = new EngineEditor(); // Add the java editing task ReshapePolylineEditTask task = new ReshapePolylineEditTask(); editor.addTask(task); editor.setCurrentTaskByRef(task); // Disable the command so that user cannot add again this.enabled = false; } catch (Exception e) { e.printStackTrace(); } } }