Revision 4899 trunk/extensions/extCAD/src/com/iver/cit/gvsig/CADExtension.java
CADExtension.java | ||
---|---|---|
78 | 78 |
private static CADToolAdapter adapter=new CADToolAdapter(); |
79 | 79 |
private static EditionManager editionManager = new EditionManager(); |
80 | 80 |
private static HashMap namesCadTools = new HashMap(); |
81 |
private MapControl mapControl; |
|
81 |
///private MapControl mapControl;
|
|
82 | 82 |
private static View view; |
83 | 83 |
public static CADToolAdapter getCADToolAdapter(){ |
84 | 84 |
return adapter; |
... | ... | |
99 | 99 |
addCADTool("rotate",rotate); |
100 | 100 |
addCADTool("scale",scale); |
101 | 101 |
addCADTool("editvertex",editvertex); |
102 |
|
|
103 | 102 |
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); |
104 | 103 |
kfm.addKeyEventPostProcessor(new myKeyEventPostProcessor()); |
105 | 104 |
} |
... | ... | |
108 | 107 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
109 | 108 |
*/ |
110 | 109 |
public void execute(String s) { |
111 |
view = (View) PluginServices.getMDIManager().getActiveView(); |
|
112 |
mapControl = (MapControl) view.getMapControl(); |
|
113 |
if (!mapControl.getNamesMapTools().containsKey("cadtooladapter")) |
|
114 |
mapControl.addMapTool("cadtooladapter",adapter); |
|
115 |
view.getMapControl().setTool("cadtooladapter"); |
|
116 |
view.addConsoleListener("cad", new ResponseListener() { |
|
117 |
public void acceptResponse(String response) { |
|
118 |
adapter.textEntered(response); |
|
119 |
// TODO: |
|
120 |
// FocusManager fm=FocusManager.getCurrentManager(); |
|
121 |
// fm.focusPreviousComponent(mapControl); |
|
122 |
/*if (popup.isShowing()){ |
|
123 |
popup.setVisible(false); |
|
124 |
}*/ |
|
110 |
initFocus(); |
|
125 | 111 |
|
126 |
} |
|
127 |
}); |
|
128 |
|
|
129 |
view.getMapControl().setTool("cadtooladapter"); |
|
130 |
|
|
131 | 112 |
if (s.equals("SPLINE")) { |
132 | 113 |
setCADTool("spline",true); |
133 | 114 |
} else if (s.equals("COPY")) { |
... | ... | |
168 | 149 |
} |
169 | 150 |
public static void addCADTool(String name, CADTool c){ |
170 | 151 |
namesCadTools.put(name, c); |
171 |
|
|
172 | 152 |
} |
173 | 153 |
public static void setCADTool(String text,boolean showCommand){ |
174 | 154 |
CADTool ct = (CADTool) namesCadTools.get(text); |
... | ... | |
229 | 209 |
if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) |
230 | 210 |
{ |
231 | 211 |
// Queremos que siempre que haya edici?n esto est? funcionando. |
232 |
editionManager.setMapControl(mapControl); |
|
212 |
///editionManager.setMapControl(mapControl);
|
|
233 | 213 |
return true; |
234 | 214 |
} |
235 | 215 |
else |
... | ... | |
250 | 230 |
// return false; |
251 | 231 |
} |
252 | 232 |
public MapControl getMapControl() { |
253 |
return this.mapControl;
|
|
233 |
return editionManager.getMapControl();
|
|
254 | 234 |
} |
255 | 235 |
class KeyAction extends AbstractAction{ |
256 | 236 |
|
... | ... | |
401 | 381 |
public static CADTool[] getCADTools(){ |
402 | 382 |
return (CADTool[])namesCadTools.values().toArray(new CADTool[0]); |
403 | 383 |
} |
384 |
public static void initFocus(){ |
|
385 |
view = (View) PluginServices.getMDIManager().getActiveView(); |
|
386 |
MapControl mapControl = (MapControl) view.getMapControl(); |
|
387 |
if (!mapControl.getNamesMapTools().containsKey("cadtooladapter")) |
|
388 |
mapControl.addMapTool("cadtooladapter",adapter); |
|
389 |
view.getMapControl().setTool("cadtooladapter"); |
|
390 |
view.addConsoleListener("cad", new ResponseListener() { |
|
391 |
public void acceptResponse(String response) { |
|
392 |
adapter.textEntered(response); |
|
393 |
// TODO: |
|
394 |
// FocusManager fm=FocusManager.getCurrentManager(); |
|
395 |
// fm.focusPreviousComponent(mapControl); |
|
396 |
/*if (popup.isShowing()){ |
|
397 |
popup.setVisible(false); |
|
398 |
}*/ |
|
399 |
|
|
400 |
} |
|
401 |
}); |
|
402 |
editionManager.setMapControl(mapControl); |
|
403 |
view.getMapControl().setTool("cadtooladapter"); |
|
404 |
} |
|
404 | 405 |
} |
Also available in: Unified diff