svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / CADExtension.java @ 38564
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 |
} |
229 |
|
230 |
/**
|
231 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
232 |
*/
|
233 |
public void execute(String s) { |
234 |
initFocus(); |
235 |
if( "layer-modify-copy".equalsIgnoreCase(s) ) { |
236 |
setCADTool("_copy", true); |
237 |
} else if( "layer-modify-symmetry".equalsIgnoreCase(s) ) { |
238 |
setCADTool("_symmetry", true); |
239 |
} else if( "layer-modify-rotate".equalsIgnoreCase(s) ) { |
240 |
setCADTool("_rotate", true); |
241 |
} else if( "layer-modify-scale".equalsIgnoreCase(s) ) { |
242 |
setCADTool("_scale", true); |
243 |
} else if( "layer-modify-edit-vertex".equalsIgnoreCase(s) ) { |
244 |
setCADTool("_editvertex", true); |
245 |
} else if( "layer-modify-join".equalsIgnoreCase(s) ) { |
246 |
setCADTool("_join", true); |
247 |
} else if( "layer-modify-matrix".equalsIgnoreCase(s) ) { |
248 |
setCADTool("_matriz", true); |
249 |
} else if( "layer-modify-move".equalsIgnoreCase(s) ) { |
250 |
setCADTool("_move", true); |
251 |
} else if( "layer-modify-rotate".equalsIgnoreCase(s) ) { |
252 |
setCADTool("_rotate", true); |
253 |
} else if( "layer-modify-stretch".equalsIgnoreCase(s) ) { |
254 |
setCADTool("_stretch", true); |
255 |
} else {
|
256 |
logger.info("Action command '"+s+"' not supportted in "+this.getClass().getName()); |
257 |
} |
258 |
CADToolAdapter cta=getCADToolAdapter(); |
259 |
cta.configureMenu(); |
260 |
} |
261 |
|
262 |
public static void addCADTool(String name, CADTool c) { |
263 |
CADToolAdapter.addCADTool(name, c); |
264 |
} |
265 |
|
266 |
public static void setCADTool(String text, boolean showCommand) { |
267 |
CADToolAdapter cta=getCADToolAdapter(); |
268 |
CADTool ct=cta.getCADTool(text); |
269 |
|
270 |
if (ct == null) |
271 |
throw new RuntimeException("No such cad tool"); |
272 |
cta.initializeFlatness(); |
273 |
cta.setCadTool(ct); |
274 |
ct.init(); |
275 |
if (showCommand) {
|
276 |
if (PluginServices.getMDIManager().getActiveWindow() instanceof DefaultViewPanel) { |
277 |
DefaultViewPanel vista = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
278 |
vista.getConsolePanel().addText("\n" + ct.getName(),
|
279 |
JConsole.COMMAND); |
280 |
cta.askQuestion(); |
281 |
} |
282 |
} |
283 |
// PluginServices.getMainFrame().setSelectedTool("SELECT");
|
284 |
// PluginServices.getMainFrame().enableControls();
|
285 |
} |
286 |
|
287 |
public static CADTool getCADTool() { |
288 |
CADToolAdapter cta=getCADToolAdapter(); |
289 |
return cta.getCadTool();
|
290 |
} |
291 |
|
292 |
/**
|
293 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
294 |
*/
|
295 |
public boolean isEnabled() { |
296 |
// initFocus();
|
297 |
return true; |
298 |
} |
299 |
|
300 |
/**
|
301 |
* @see org.gvsig.andami.plugins.IExtension#isVisible()
|
302 |
*/
|
303 |
public boolean isVisible() { |
304 |
if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
|
305 |
view = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
306 |
mapControl = view.getMapControl(); |
307 |
FLayer[] layers = mapControl.getMapContext().getLayers()
|
308 |
.getActives(); |
309 |
// if (!(layers[0] instanceof FLyrAnnotation)) {
|
310 |
// return true;
|
311 |
// }
|
312 |
return true; |
313 |
} |
314 |
return false; |
315 |
} |
316 |
|
317 |
public MapControl getMapControl() {
|
318 |
return getEditionManager().getMapControl();
|
319 |
} |
320 |
|
321 |
class KeyAction extends AbstractAction { |
322 |
|
323 |
private String key; |
324 |
|
325 |
public KeyAction(String key) { |
326 |
this.key = key;
|
327 |
} |
328 |
|
329 |
/*
|
330 |
* (non-Javadoc)
|
331 |
*
|
332 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
333 |
*/
|
334 |
public void actionPerformed(ActionEvent e) { |
335 |
view.focusConsole(key); |
336 |
} |
337 |
|
338 |
} |
339 |
|
340 |
class MyAction extends AbstractAction { |
341 |
private String actionCommand; |
342 |
|
343 |
public MyAction(String command) { |
344 |
actionCommand = command; |
345 |
} |
346 |
|
347 |
/**
|
348 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
349 |
*/
|
350 |
public void actionPerformed(ActionEvent e) { |
351 |
CADToolAdapter cta=getCADToolAdapter(); |
352 |
cta.keyPressed(actionCommand); |
353 |
} |
354 |
|
355 |
} |
356 |
|
357 |
/**
|
358 |
* @author fjp
|
359 |
*
|
360 |
* La idea es usar esto para recibir lo que el usuario escribe y enviarlo a
|
361 |
* la consola de la vista para que salga por all?.
|
362 |
*/
|
363 |
private class myKeyEventPostProcessor implements KeyEventPostProcessor { |
364 |
|
365 |
public boolean postProcessKeyEvent(KeyEvent e) { |
366 |
// System.out.println("KeyEvent e = " + e);
|
367 |
CADToolAdapter cta=getCADToolAdapter(); |
368 |
if ((cta == null) || (view == null)) |
369 |
return false; |
370 |
|
371 |
if (cta.getMapControl() == null){ |
372 |
return false; |
373 |
} |
374 |
|
375 |
if (e.getID() != KeyEvent.KEY_RELEASED) |
376 |
return false; |
377 |
if (!(e.getComponent() instanceof JTextComponent)) { |
378 |
if (e.getKeyCode() == KeyEvent.VK_DELETE) |
379 |
cta.keyPressed("eliminar");
|
380 |
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) |
381 |
cta.keyPressed("escape");
|
382 |
else if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
383 |
// TODO: REVISAR ESTO CUANDO VIENE UN INTRO DESDE UN
|
384 |
// JTEXTAREA
|
385 |
// QUE NO ES EL DE CONSOLA
|
386 |
if (!(e.getSource() instanceof JTable)) |
387 |
view.focusConsole("");
|
388 |
} |
389 |
else if ((!e.isActionKey() && e.getKeyCode()!=KeyEvent.VK_TAB)) { |
390 |
//if (Character.isLetterOrDigit(e.getKeyChar())) {
|
391 |
Character keyChar = new Character(e.getKeyChar()); |
392 |
if (e.getComponent().getName() != null) { |
393 |
System.out
|
394 |
.println("Evento de teclado desde el componente "
|
395 |
+ e.getComponent().getName()); |
396 |
if (!e.getComponent().getName().equals(
|
397 |
"CADConsole")) {
|
398 |
view.focusConsole(keyChar + "");
|
399 |
} |
400 |
} else {
|
401 |
if (!(e.getComponent() instanceof JTextComponent)) { |
402 |
view.focusConsole(keyChar + "");
|
403 |
} |
404 |
} |
405 |
//}
|
406 |
} |
407 |
} |
408 |
return false; |
409 |
} |
410 |
|
411 |
} |
412 |
|
413 |
/*
|
414 |
* private void registerKeyStrokes(){ for (char key = '0'; key <= '9';
|
415 |
* key++){ Character keyChar = new Character(key);
|
416 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key),
|
417 |
* keyChar); mapControl.getActionMap().put(keyChar, new
|
418 |
* KeyAction(keyChar+"")); } for (char key = 'a'; key <= 'z'; key++){
|
419 |
* Character keyChar = new Character(key);
|
420 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key),
|
421 |
* keyChar); mapControl.getActionMap().put(keyChar, new
|
422 |
* KeyAction(keyChar+"")); } for (char key = 'A'; key <= 'Z'; key++){
|
423 |
* Character keyChar = new Character(key);
|
424 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key),
|
425 |
* keyChar); mapControl.getActionMap().put(keyChar, new
|
426 |
* KeyAction(keyChar+"")); }
|
427 |
* //this.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
|
428 |
* 0), "enter"); //this.getActionMap().put("enter", new MyAction("enter"));
|
429 |
* Character keyChar = new
|
430 |
* Character(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0).getKeyChar());
|
431 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
|
432 |
* 0),keyChar); mapControl.getActionMap().put(keyChar, new KeyAction(""));
|
433 |
* // El espacio como si fuera INTRO Character keyCharSpace = new
|
434 |
* Character(' ');
|
435 |
* mapControl.getInputMap(MapControl.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke('
|
436 |
* '), keyCharSpace); mapControl.getActionMap().put(keyCharSpace, new
|
437 |
* KeyAction(""));
|
438 |
*
|
439 |
* }
|
440 |
*/
|
441 |
private static JPopupMenu popup = new JPopupMenu(); |
442 |
|
443 |
public static void clearMenu() { |
444 |
popup.removeAll(); |
445 |
} |
446 |
|
447 |
public static void addMenuEntry(String text) { |
448 |
JMenuItem menu = new JMenuItem(text); |
449 |
menu.setActionCommand(text); |
450 |
menu.setEnabled(true);
|
451 |
menu.setVisible(true);
|
452 |
menu.addActionListener(new ActionListener() { |
453 |
public void actionPerformed(ActionEvent e) { |
454 |
CADToolAdapter cta=getCADToolAdapter(); |
455 |
cta.transition(e.getActionCommand()); |
456 |
} |
457 |
}); |
458 |
|
459 |
popup.add(menu); |
460 |
} |
461 |
|
462 |
public static void showPopup(MouseEvent e) { |
463 |
popup.show(e.getComponent(), e.getX(), e.getY()); |
464 |
} |
465 |
|
466 |
public static DefaultViewPanel getView() { |
467 |
return view;
|
468 |
} |
469 |
|
470 |
public static void clearView() { |
471 |
view = null;
|
472 |
} |
473 |
|
474 |
/**
|
475 |
* @return Returns the editionManager.
|
476 |
*/
|
477 |
public static EditionManager getEditionManager() { |
478 |
CADToolAdapter cta=getCADToolAdapter(); |
479 |
return cta.getEditionManager();
|
480 |
} |
481 |
|
482 |
public static CADTool[] getCADTools() { |
483 |
return CADToolAdapter.getCADTools();
|
484 |
} |
485 |
|
486 |
public static void initFocus() { |
487 |
view = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
488 |
MapControl mapControl = view.getMapControl(); |
489 |
CADToolAdapter cta=getCADToolAdapter(); |
490 |
if (!mapControl.getNamesMapTools().containsKey("cadtooladapter")){ |
491 |
// StatusBarListener sbl=new StatusBarListener(view.getMapControl());
|
492 |
// mapControl.addMapTool("cadtooladapter", new Behavior[]{adapter,new MouseMovementBehavior(sbl)});
|
493 |
mapControl.addBehavior("cadtooladapter", cta);
|
494 |
} |
495 |
// view.getMapControl().setTool("cadtooladapter");
|
496 |
JEditTextArea jeta=view.getConsolePanel().getTxt(); |
497 |
jeta.requestFocusInWindow(); |
498 |
jeta.setCaretPosition(jeta.getText().length()); |
499 |
|
500 |
view.addConsoleListener("cad", new ResponseListener() { |
501 |
public void acceptResponse(String response) { |
502 |
CADToolAdapter cta=getCADToolAdapter(); |
503 |
cta.textEntered(response); |
504 |
// TODO:
|
505 |
// FocusManager fm=FocusManager.getCurrentManager();
|
506 |
// fm.focusPreviousComponent(mapControl);
|
507 |
/*
|
508 |
* if (popup.isShowing()){ popup.setVisible(false); }
|
509 |
*/
|
510 |
|
511 |
} |
512 |
}); |
513 |
cta.getEditionManager().setMapControl(mapControl); |
514 |
view.getMapControl().setTool("cadtooladapter");
|
515 |
} |
516 |
|
517 |
public IPreference[] getPreferencesPages() { |
518 |
IPreference[] preferences=new IPreference[1]; |
519 |
preferences[0]=editingPage;
|
520 |
return preferences;
|
521 |
} |
522 |
} |