root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / CADExtension.java @ 38608
History | View | Annotate | Download (17.2 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.editing; |
42 |
|
43 |
import java.awt.KeyEventPostProcessor; |
44 |
import java.awt.KeyboardFocusManager; |
45 |
import java.awt.event.ActionEvent; |
46 |
import java.awt.event.ActionListener; |
47 |
import java.awt.event.KeyEvent; |
48 |
import java.awt.event.MouseEvent; |
49 |
import java.util.HashMap; |
50 |
|
51 |
import javax.swing.AbstractAction; |
52 |
import javax.swing.JMenuItem; |
53 |
import javax.swing.JPopupMenu; |
54 |
import javax.swing.JTable; |
55 |
import javax.swing.KeyStroke; |
56 |
import javax.swing.text.JTextComponent; |
57 |
|
58 |
import org.gvsig.andami.IconThemeHelper; |
59 |
import org.gvsig.andami.PluginServices; |
60 |
import org.gvsig.andami.PluginsLocator; |
61 |
import org.gvsig.andami.PluginsManager; |
62 |
import org.gvsig.andami.plugins.Extension; |
63 |
import org.gvsig.andami.preferences.IPreference; |
64 |
import org.gvsig.andami.preferences.IPreferenceExtension; |
65 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
66 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
67 |
import org.gvsig.editing.gui.accelerators.ForceCursorAccelerator; |
68 |
import org.gvsig.editing.gui.accelerators.GridAccelerator; |
69 |
import org.gvsig.editing.gui.accelerators.OrtoAccelerator; |
70 |
import org.gvsig.editing.gui.accelerators.RefentAccelerator; |
71 |
import org.gvsig.editing.gui.cad.CADTool; |
72 |
import org.gvsig.editing.gui.cad.CADToolAdapter; |
73 |
import org.gvsig.editing.gui.cad.tools.CopyCADTool; |
74 |
import org.gvsig.editing.gui.cad.tools.RotateCADTool; |
75 |
import org.gvsig.editing.gui.cad.tools.ScaleCADTool; |
76 |
import org.gvsig.editing.gui.cad.tools.SymmetryCADTool; |
77 |
import org.gvsig.editing.gui.preferences.EditingPage; |
78 |
import org.gvsig.editing.project.documents.view.toc.MenuEntry; |
79 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
80 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
81 |
import org.gvsig.fmap.mapcontrol.MapControl; |
82 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
83 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
84 |
import org.gvsig.tools.dynobject.DynObject; |
85 |
import org.gvsig.utils.console.JConsole; |
86 |
import org.gvsig.utils.console.ResponseListener; |
87 |
import org.gvsig.utils.console.jedit.JEditTextArea; |
88 |
import org.slf4j.Logger; |
89 |
import org.slf4j.LoggerFactory; |
90 |
|
91 |
|
92 |
/**
|
93 |
* Extensi?n dedicada a controlar las diferentes operaciones sobre el editado de
|
94 |
* una capa.
|
95 |
*
|
96 |
* @author Vicente Caballero Navarro
|
97 |
*/
|
98 |
public class CADExtension extends Extension implements IPreferenceExtension{ |
99 |
private static Logger logger = LoggerFactory.getLogger(CADExtension.class); |
100 |
|
101 |
private static HashMap adapters=new HashMap(); |
102 |
|
103 |
private static DefaultViewPanel view; |
104 |
|
105 |
private MapControl mapControl;
|
106 |
private static CADToolAdapter adapter=null; |
107 |
private EditingPage editingPage=new EditingPage(); |
108 |
|
109 |
|
110 |
public static CADToolAdapter getCADToolAdapter(FLayer layer) { |
111 |
IWindow[] windows=PluginServices.getMDIManager().getAllWindows();
|
112 |
for (int i = 0; i < windows.length; i++) { |
113 |
IWindow window=windows[i]; |
114 |
if (window instanceof DefaultViewPanel){ |
115 |
DefaultViewPanel v=(DefaultViewPanel)window; |
116 |
if (v.getModel().getMapContext().equals(layer.getMapContext())){
|
117 |
if (!adapters.containsKey(v.getModel())) {
|
118 |
adapters.put(v.getModel(),new CADToolAdapter());
|
119 |
} |
120 |
return (CADToolAdapter)adapters.get(v.getModel());
|
121 |
} |
122 |
} |
123 |
} |
124 |
return null; |
125 |
} |
126 |
|
127 |
public static CADToolAdapter getCADToolAdapter() { |
128 |
org.gvsig.andami.ui.mdiManager.IWindow view=PluginServices.getMDIManager().getActiveWindow(); |
129 |
if (view instanceof DefaultViewPanel) { |
130 |
DefaultViewPanel v=(DefaultViewPanel)view; |
131 |
if (!adapters.containsKey(v.getModel())) {
|
132 |
adapters.put(v.getModel(),new CADToolAdapter());
|
133 |
} |
134 |
adapter=(CADToolAdapter)adapters.get(v.getModel()); |
135 |
return adapter;
|
136 |
} |
137 |
return adapter;
|
138 |
|
139 |
} |
140 |
|
141 |
/**
|
142 |
* @see org.gvsig.andami.plugins.IExtension#initialize()
|
143 |
*/
|
144 |
public void initialize() { |
145 |
|
146 |
// Registramos los Popup menus:
|
147 |
MenuEntry.register(); |
148 |
|
149 |
CopyCADTool copy = new CopyCADTool();
|
150 |
RotateCADTool rotate = new RotateCADTool();
|
151 |
ScaleCADTool scale = new ScaleCADTool();
|
152 |
SymmetryCADTool symmetry=new SymmetryCADTool();
|
153 |
addCADTool("_copy", copy);
|
154 |
addCADTool("_rotate", rotate);
|
155 |
addCADTool("_scale", scale);
|
156 |
addCADTool("_symmetry", symmetry);
|
157 |
// Registramos las teclas de acceso r?pido que vamos a usar.
|
158 |
|
159 |
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0); |
160 |
RefentAccelerator accRef = new RefentAccelerator();
|
161 |
PluginServices.registerKeyStroke(key, accRef); |
162 |
|
163 |
key = KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0); |
164 |
OrtoAccelerator accOrto = new OrtoAccelerator();
|
165 |
PluginServices.registerKeyStroke(key, accOrto); |
166 |
|
167 |
key = KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0); |
168 |
GridAccelerator accGrid = new GridAccelerator();
|
169 |
PluginServices.registerKeyStroke(key, accGrid); |
170 |
|
171 |
key = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); |
172 |
ForceCursorAccelerator accForce = new ForceCursorAccelerator();
|
173 |
PluginServices.registerKeyStroke(key, accForce); |
174 |
|
175 |
|
176 |
KeyboardFocusManager kfm = KeyboardFocusManager |
177 |
.getCurrentKeyboardFocusManager(); |
178 |
kfm.addKeyEventPostProcessor(new myKeyEventPostProcessor());
|
179 |
|
180 |
registerIcons(); |
181 |
} |
182 |
|
183 |
@Override
|
184 |
public void postInitialize() { |
185 |
//Register the edition symbology
|
186 |
registerEditionSymbology(); |
187 |
} |
188 |
|
189 |
/**
|
190 |
* It registers the default symbology used in edition
|
191 |
*/
|
192 |
private void registerEditionSymbology() { |
193 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
194 |
DynObject dynObject = pluginsManager.getPlugin(getClass()).getPluginProperties(); |
195 |
|
196 |
MapControlManager mapControlManager = MapControlLocator.getMapControlManager(); |
197 |
|
198 |
if (dynObject.hasDynValue(EditingPage.DEFAULT_AXIS_REFERENCES_SYMBOL)){
|
199 |
mapControlManager.setAxisReferenceSymbol( |
200 |
(ISymbol)dynObject.getDynValue(EditingPage.DEFAULT_AXIS_REFERENCES_SYMBOL)); |
201 |
} |
202 |
|
203 |
if (dynObject.hasDynValue(EditingPage.DEFAULT_RECTANGLE_SELECTION_SYMBOL)) {
|
204 |
mapControlManager.setGeometrySelectionSymbol( |
205 |
(ISymbol)dynObject.getDynValue(EditingPage.DEFAULT_RECTANGLE_SELECTION_SYMBOL)); |
206 |
} |
207 |
|
208 |
if (dynObject.hasDynValue(EditingPage.DEFAULT_HANDLER_SYMBOL)) {
|
209 |
mapControlManager.setHandlerSymbol( |
210 |
(ISymbol)dynObject.getDynValue(EditingPage.DEFAULT_HANDLER_SYMBOL)); |
211 |
} |
212 |
} |
213 |
|
214 |
private void registerIcons(){ |
215 |
IconThemeHelper.registerIcon("action", "layer-modify-copy", this); |
216 |
IconThemeHelper.registerIcon("action", "layer-modify-symmetry", this); |
217 |
IconThemeHelper.registerIcon("action", "layer-modify-rotate", this); |
218 |
IconThemeHelper.registerIcon("action", "layer-modify-scale", this); |
219 |
IconThemeHelper.registerIcon("action", "layer-modify-edit-vertex", this); |
220 |
IconThemeHelper.registerIcon("action", "layer-modify-join", this); |
221 |
IconThemeHelper.registerIcon("action", "layer-modify-matrix", this); |
222 |
IconThemeHelper.registerIcon("action", "layer-modify-move", this); |
223 |
IconThemeHelper.registerIcon("action", "layer-modify-rotate", this); |
224 |
IconThemeHelper.registerIcon("action", "layer-modify-stretch", this); |
225 |
|
226 |
|
227 |
IconThemeHelper.registerIcon("preferences", "preferences-layer-modify-flatness", this); |
228 |
IconThemeHelper.registerIcon("preferences", "preferences-snapper", this); |
229 |
} |
230 |
|
231 |
/**
|
232 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
233 |
*/
|
234 |
public void execute(String s) { |
235 |
initFocus(); |
236 |
if( "layer-modify-copy".equalsIgnoreCase(s) ) { |
237 |
setCADTool("_copy", true); |
238 |
} else if( "layer-modify-symmetry".equalsIgnoreCase(s) ) { |
239 |
setCADTool("_symmetry", true); |
240 |
} else if( "layer-modify-rotate".equalsIgnoreCase(s) ) { |
241 |
setCADTool("_rotate", true); |
242 |
} else if( "layer-modify-scale".equalsIgnoreCase(s) ) { |
243 |
setCADTool("_scale", true); |
244 |
} else if( "layer-modify-edit-vertex".equalsIgnoreCase(s) ) { |
245 |
setCADTool("_editvertex", true); |
246 |
} else if( "layer-modify-join".equalsIgnoreCase(s) ) { |
247 |
setCADTool("_join", true); |
248 |
} else if( "layer-modify-matrix".equalsIgnoreCase(s) ) { |
249 |
setCADTool("_matriz", true); |
250 |
} else if( "layer-modify-move".equalsIgnoreCase(s) ) { |
251 |
setCADTool("_move", true); |
252 |
} else if( "layer-modify-rotate".equalsIgnoreCase(s) ) { |
253 |
setCADTool("_rotate", true); |
254 |
} else if( "layer-modify-stretch".equalsIgnoreCase(s) ) { |
255 |
setCADTool("_stretch", true); |
256 |
} else {
|
257 |
logger.info("Action command '"+s+"' not supportted in "+this.getClass().getName()); |
258 |
} |
259 |
CADToolAdapter cta=getCADToolAdapter(); |
260 |
cta.configureMenu(); |
261 |
} |
262 |
|
263 |
public static void addCADTool(String name, CADTool c) { |
264 |
CADToolAdapter.addCADTool(name, c); |
265 |
} |
266 |
|
267 |
public static void setCADTool(String text, boolean showCommand) { |
268 |
CADToolAdapter cta=getCADToolAdapter(); |
269 |
CADTool ct=cta.getCADTool(text); |
270 |
|
271 |
if (ct == null) |
272 |
throw new RuntimeException("No such cad tool"); |
273 |
cta.initializeFlatness(); |
274 |
cta.setCadTool(ct); |
275 |
ct.init(); |
276 |
if (showCommand) {
|
277 |
if (PluginServices.getMDIManager().getActiveWindow() instanceof DefaultViewPanel) { |
278 |
DefaultViewPanel vista = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
279 |
vista.getConsolePanel().addText("\n" + ct.getName(),
|
280 |
JConsole.COMMAND); |
281 |
cta.askQuestion(); |
282 |
} |
283 |
} |
284 |
// PluginServices.getMainFrame().setSelectedTool("SELECT");
|
285 |
// PluginServices.getMainFrame().enableControls();
|
286 |
} |
287 |
|
288 |
public static CADTool getCADTool() { |
289 |
CADToolAdapter cta=getCADToolAdapter(); |
290 |
return cta.getCadTool();
|
291 |
} |
292 |
|
293 |
/**
|
294 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
295 |
*/
|
296 |
public boolean isEnabled() { |
297 |
// initFocus();
|
298 |
return true; |
299 |
} |
300 |
|
301 |
/**
|
302 |
* @see org.gvsig.andami.plugins.IExtension#isVisible()
|
303 |
*/
|
304 |
public boolean isVisible() { |
305 |
if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
|
306 |
view = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
307 |
mapControl = view.getMapControl(); |
308 |
FLayer[] layers = mapControl.getMapContext().getLayers()
|
309 |
.getActives(); |
310 |
// if (!(layers[0] instanceof FLyrAnnotation)) {
|
311 |
// return true;
|
312 |
// }
|
313 |
return true; |
314 |
} |
315 |
return false; |
316 |
} |
317 |
|
318 |
public MapControl getMapControl() {
|
319 |
return getEditionManager().getMapControl();
|
320 |
} |
321 |
|
322 |
class KeyAction extends AbstractAction { |
323 |
|
324 |
private String key; |
325 |
|
326 |
public KeyAction(String key) { |
327 |
this.key = key;
|
328 |
} |
329 |
|
330 |
/*
|
331 |
* (non-Javadoc)
|
332 |
*
|
333 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
334 |
*/
|
335 |
public void actionPerformed(ActionEvent e) { |
336 |
view.focusConsole(key); |
337 |
} |
338 |
|
339 |
} |
340 |
|
341 |
class MyAction extends AbstractAction { |
342 |
private String actionCommand; |
343 |
|
344 |
public MyAction(String command) { |
345 |
actionCommand = command; |
346 |
} |
347 |
|
348 |
/**
|
349 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
350 |
*/
|
351 |
public void actionPerformed(ActionEvent e) { |
352 |
CADToolAdapter cta=getCADToolAdapter(); |
353 |
cta.keyPressed(actionCommand); |
354 |
} |
355 |
|
356 |
} |
357 |
|
358 |
/**
|
359 |
* @author fjp
|
360 |
*
|
361 |
* La idea es usar esto para recibir lo que el usuario escribe y enviarlo a
|
362 |
* la consola de la vista para que salga por all?.
|
363 |
*/
|
364 |
private class myKeyEventPostProcessor implements KeyEventPostProcessor { |
365 |
|
366 |
public boolean postProcessKeyEvent(KeyEvent e) { |
367 |
// System.out.println("KeyEvent e = " + e);
|
368 |
CADToolAdapter cta=getCADToolAdapter(); |
369 |
if ((cta == null) || (view == null)) |
370 |
return false; |
371 |
|
372 |
if (cta.getMapControl() == null){ |
373 |
return false; |
374 |
} |
375 |
|
376 |
if (e.getID() != KeyEvent.KEY_RELEASED) |
377 |
return false; |
378 |
if (!(e.getComponent() instanceof JTextComponent)) { |
379 |
if (e.getKeyCode() == KeyEvent.VK_DELETE) |
380 |
cta.keyPressed("eliminar");
|
381 |
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) |
382 |
cta.keyPressed("escape");
|
383 |
else if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
384 |
// TODO: REVISAR ESTO CUANDO VIENE UN INTRO DESDE UN
|
385 |
// JTEXTAREA
|
386 |
// QUE NO ES EL DE CONSOLA
|
387 |
if (!(e.getSource() instanceof JTable)) |
388 |
view.focusConsole("");
|
389 |
} |
390 |
else if ((!e.isActionKey() && e.getKeyCode()!=KeyEvent.VK_TAB)) { |
391 |
//if (Character.isLetterOrDigit(e.getKeyChar())) {
|
392 |
Character keyChar = new Character(e.getKeyChar()); |
393 |
if (e.getComponent().getName() != null) { |
394 |
System.out
|
395 |
.println("Evento de teclado desde el componente "
|
396 |
+ e.getComponent().getName()); |
397 |
if (!e.getComponent().getName().equals(
|
398 |
"CADConsole")) {
|
399 |
view.focusConsole(keyChar + "");
|
400 |
} |
401 |
} else {
|
402 |
if (!(e.getComponent() instanceof JTextComponent)) { |
403 |
view.focusConsole(keyChar + "");
|
404 |
} |
405 |
} |
406 |
//}
|
407 |
} |
408 |
} |
409 |
return false; |
410 |
} |
411 |
|
412 |
} |
413 |
|
414 |
/*
|
415 |
* private void registerKeyStrokes(){ for (char key = '0'; key <= '9';
|
416 |
* key++){ Character keyChar = new Character(key);
|
417 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key),
|
418 |
* keyChar); mapControl.getActionMap().put(keyChar, new
|
419 |
* KeyAction(keyChar+"")); } for (char key = 'a'; key <= 'z'; key++){
|
420 |
* Character keyChar = new Character(key);
|
421 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key),
|
422 |
* keyChar); mapControl.getActionMap().put(keyChar, new
|
423 |
* KeyAction(keyChar+"")); } for (char key = 'A'; key <= 'Z'; key++){
|
424 |
* Character keyChar = new Character(key);
|
425 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key),
|
426 |
* keyChar); mapControl.getActionMap().put(keyChar, new
|
427 |
* KeyAction(keyChar+"")); }
|
428 |
* //this.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
|
429 |
* 0), "enter"); //this.getActionMap().put("enter", new MyAction("enter"));
|
430 |
* Character keyChar = new
|
431 |
* Character(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0).getKeyChar());
|
432 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
|
433 |
* 0),keyChar); mapControl.getActionMap().put(keyChar, new KeyAction(""));
|
434 |
* // El espacio como si fuera INTRO Character keyCharSpace = new
|
435 |
* Character(' ');
|
436 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke('
|
437 |
* '), keyCharSpace); mapControl.getActionMap().put(keyCharSpace, new
|
438 |
* KeyAction(""));
|
439 |
*
|
440 |
* }
|
441 |
*/
|
442 |
private static JPopupMenu popup = new JPopupMenu(); |
443 |
|
444 |
public static void clearMenu() { |
445 |
popup.removeAll(); |
446 |
} |
447 |
|
448 |
public static void addMenuEntry(String text) { |
449 |
JMenuItem menu = new JMenuItem(text); |
450 |
menu.setActionCommand(text); |
451 |
menu.setEnabled(true);
|
452 |
menu.setVisible(true);
|
453 |
menu.addActionListener(new ActionListener() { |
454 |
public void actionPerformed(ActionEvent e) { |
455 |
CADToolAdapter cta=getCADToolAdapter(); |
456 |
cta.transition(e.getActionCommand()); |
457 |
} |
458 |
}); |
459 |
|
460 |
popup.add(menu); |
461 |
} |
462 |
|
463 |
public static void showPopup(MouseEvent e) { |
464 |
popup.show(e.getComponent(), e.getX(), e.getY()); |
465 |
} |
466 |
|
467 |
public static DefaultViewPanel getView() { |
468 |
return view;
|
469 |
} |
470 |
|
471 |
public static void clearView() { |
472 |
view = null;
|
473 |
} |
474 |
|
475 |
/**
|
476 |
* @return Returns the editionManager.
|
477 |
*/
|
478 |
public static EditionManager getEditionManager() { |
479 |
CADToolAdapter cta=getCADToolAdapter(); |
480 |
return cta.getEditionManager();
|
481 |
} |
482 |
|
483 |
public static CADTool[] getCADTools() { |
484 |
return CADToolAdapter.getCADTools();
|
485 |
} |
486 |
|
487 |
public static void initFocus() { |
488 |
view = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
489 |
MapControl mapControl = view.getMapControl(); |
490 |
CADToolAdapter cta=getCADToolAdapter(); |
491 |
if (!mapControl.getNamesMapTools().containsKey("cadtooladapter")){ |
492 |
// StatusBarListener sbl=new StatusBarListener(view.getMapControl());
|
493 |
// mapControl.addMapTool("cadtooladapter", new Behavior[]{adapter,new MouseMovementBehavior(sbl)});
|
494 |
mapControl.addBehavior("cadtooladapter", cta);
|
495 |
} |
496 |
// view.getMapControl().setTool("cadtooladapter");
|
497 |
JEditTextArea jeta=view.getConsolePanel().getTxt(); |
498 |
jeta.requestFocusInWindow(); |
499 |
jeta.setCaretPosition(jeta.getText().length()); |
500 |
|
501 |
view.addConsoleListener("cad", new ResponseListener() { |
502 |
public void acceptResponse(String response) { |
503 |
CADToolAdapter cta=getCADToolAdapter(); |
504 |
cta.textEntered(response); |
505 |
// TODO:
|
506 |
// FocusManager fm=FocusManager.getCurrentManager();
|
507 |
// fm.focusPreviousComponent(mapControl);
|
508 |
/*
|
509 |
* if (popup.isShowing()){ popup.setVisible(false); }
|
510 |
*/
|
511 |
|
512 |
} |
513 |
}); |
514 |
cta.getEditionManager().setMapControl(mapControl); |
515 |
view.getMapControl().setTool("cadtooladapter");
|
516 |
} |
517 |
|
518 |
public IPreference[] getPreferencesPages() { |
519 |
IPreference[] preferences=new IPreference[1]; |
520 |
preferences[0]=editingPage;
|
521 |
return preferences;
|
522 |
} |
523 |
} |