Revision 5170 trunk/extensions/extCAD/src/com/iver/cit/gvsig/InsertLineExtension.java

View differences:

InsertLineExtension.java
58 58
 */
59 59
public class InsertLineExtension extends Extension {
60 60
	private View view;
61

  
61
	private LineCADTool line;
62 62
	private MapControl mapControl;
63 63

  
64 64
	/**
65 65
	 * @see com.iver.andami.plugins.IExtension#initialize()
66 66
	 */
67 67
	public void initialize() {
68
		LineCADTool line = new LineCADTool();
68
		line = new LineCADTool();
69 69
		CADExtension.addCADTool("_line", line);
70 70
		ArcCADTool arc=new ArcCADTool();
71 71
		CADExtension.addCADTool("_arc", arc);
......
93 93
			if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
94 94
				view = (View) PluginServices.getMDIManager().getActiveView();
95 95
				mapControl = (MapControl) view.getMapControl();
96
				FLayer[] layers = mapControl.getMapContext().getLayers()
97
						.getActives();
98
				if (((FLyrVect) layers[0]).getShapeType() == FShape.LINE
99
						|| ((FLyrVect) layers[0]).getShapeType() == FShape.MULTI) {
96
				FLyrVect lv=(FLyrVect)CADExtension.getEditionManager().getActiveLayerEdited().getLayer();
97
				if (line.isApplicable(lv.getShapeType()))
100 98
					return true;
101
				}
102 99
			}
103 100
		} catch (DriverException e) {
104 101
			e.printStackTrace();

Also available in: Unified diff