Revision 2306 branches/pilotoDWG/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/CADToolAdapter.java

View differences:

CADToolAdapter.java
22 22
import com.iver.utiles.console.JConsole;
23 23

  
24 24
import org.apache.log4j.Logger;
25
import org.exolab.castor.xml.CastorException;
25 26

  
26 27
import java.awt.Color;
27 28
import java.awt.Cursor;
......
412 413
		questionAsked = false;
413 414
		logger.debug(text);
414 415
		if (!cadToolStack.isEmpty()){
415
		int ret = ((CadTool) cadToolStack.peek()).transition(text, source, sel,
416
				values);
416
		    CadTool ct = (CadTool) cadToolStack.peek();
417
		    String[] trs = ct.getAutomaton().getCurrentTransitions();
418
		    boolean esta = false;
419
		    for (int i = 0; i < trs.length; i++) {
420
                if (trs[i].toUpperCase().equals(text.toUpperCase()))
421
                    esta = true;
422
            }
423
		    if (!esta){
424
		        askQuestion();
425
		    }else{
426
				int ret = ct.transition(text, source, sel,
427
						values);
417 428

  
418
		if ((ret & Automaton.AUTOMATON_FINISHED) == Automaton.AUTOMATON_FINISHED) {
419
			popCadTool();
429
				if ((ret & Automaton.AUTOMATON_FINISHED) == Automaton.AUTOMATON_FINISHED) {
430
					popCadTool();
420 431

  
421
			if (cadToolStack.isEmpty()) {
422
				pushCadTool(new SelectionCadTool());
423
				PluginServices.getMainFrame().selectTool("selection");
424
			}
432
					if (cadToolStack.isEmpty()) {
433
						pushCadTool(new SelectionCadTool());
434
						PluginServices.getMainFrame().selectTool("selection");
435
					}
425 436

  
426
			askQuestion();
437
					askQuestion();
427 438

  
428
			getMapControl().drawMap(false);
429
		} else {
430
			if (((CadTool) cadToolStack.peek()).getAutomaton().checkState('c')) {
431
				getMapControl().drawMap(false);
432
			}
439
					getMapControl().drawMap(false);
440
				} else {
441
					if (((CadTool) cadToolStack.peek()).getAutomaton().checkState('c')) {
442
						getMapControl().drawMap(false);
443
					}
433 444

  
434
			if (!questionAsked) {
435
				askQuestion();
436
			}
437
		}
445
					if (!questionAsked) {
446
						askQuestion();
447
					}
448
				}
438 449

  
439
		configureMenu();
450
				configureMenu();
451
		    }
440 452
		}
441 453
		PluginServices.getMainFrame().enableControls();
442 454
	}

Also available in: Unified diff