Revision 13731

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/gui/TOC.java
78 78

  
79 79
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
80 80
import com.iver.andami.PluginServices;
81
import com.iver.andami.messages.NotificationManager;
81 82
import com.iver.cit.gvsig.fmap.AtomicEvent;
82 83
import com.iver.cit.gvsig.fmap.AtomicEventListener;
83 84
import com.iver.cit.gvsig.fmap.MapContext;
......
621 622
        			// double click with left button ON A BRANCH/NODE (layer)
622 623
        			if (e.getClickCount()>=2 && e.getButton() == MouseEvent.BUTTON1) {
623 624
        				e.consume();
624
        				TocItemBranch leaf = (TocItemBranch) node.getUserObject();
625
        				
626
        				IContextMenuAction action = leaf.getDoubleClickAction();
627
        				if (action != null) {
628
        					FLayer[] actives = mapContext.getLayers().getActives();
629
        					if (actives.length == 0) {
630
        						/* in case no layer was selected, will use the layer
631
        						 * contained by this object
632
        						 */ 
633
        						
634
        						actives = new FLayer[] { 
635
        								(FLayer) node.getUserObject()
636
        						};
625
        				PluginServices.getMDIManager().setWaitCursor();
626
        				try {
627
        					TocItemBranch leaf = (TocItemBranch) node.getUserObject();
628

  
629
        					IContextMenuAction action = leaf.getDoubleClickAction();
630
        					if (action != null) {
631
        						FLayer[] actives = mapContext.getLayers().getActives();
632
        						if (actives.length == 0) {
633
        							/* in case no layer was selected, will use the layer
634
        							 * contained by this object
635
        							 */ 
636

  
637
        							actives = new FLayer[] { 
638
        									(FLayer) node.getUserObject()
639
        							};
640
        						}
641
        						action.execute(leaf, actives);
637 642
        					}
638
        					action.execute(leaf, actives);
643
        				} catch (Exception ex) {
644
        					NotificationManager.addError(ex);
645
        				} finally {
646
        					PluginServices.getMDIManager().restoreCursor();
639 647
        				}
640 648
        				return;
641 649
        			}
642
        			
650

  
643 651
        			TocItemBranch elTema = (TocItemBranch) node.getUserObject();
644 652
        			FLayer lyr = elTema.getLayer();
645 653
        			lyr.getMapContext().beginAtomicEvent();
......
702 710
        			// double click with left button ON A LEAF (ISymbol)
703 711
        			if (e.getClickCount()>=2 && e.getButton() == MouseEvent.BUTTON1) {
704 712
        				e.consume();
705
        				TocItemLeaf leaf = (TocItemLeaf) node.getUserObject();
706
        				IContextMenuAction action = leaf.getDoubleClickAction();
707
        				if (action != null) {
708
        					FLayer[] actives = mapContext.getLayers().getActives();
709
        					if (actives.length == 0) {
710
        						// in case no layer was selected, will use the layer containing this
711
        						// leaf object
712
        						actives = new FLayer[] { 
713
        								((TocItemBranch) ((DefaultMutableTreeNode) node.getParent()).getUserObject()).getLayer()
714
        						};
713

  
714
        				PluginServices.getMDIManager().setWaitCursor();
715
        				try {
716
        					TocItemLeaf leaf = (TocItemLeaf) node.getUserObject();
717
        					IContextMenuAction action = leaf.getDoubleClickAction();
718
        					if (action != null) {
719
        						FLayer[] actives = mapContext.getLayers().getActives();
720
        						if (actives.length == 0) {
721
        							// in case no layer was selected, will use the layer containing this
722
        							// leaf object
723
        							actives = new FLayer[] { 
724
        									((TocItemBranch) ((DefaultMutableTreeNode) node.getParent()).getUserObject()).getLayer()
725
        							};
726
        						}
727
        						action.execute(leaf, actives);
715 728
        					}
716
        					action.execute(leaf, actives);
729
        				} catch (Exception ex) {
730
        					NotificationManager.addError(ex);
731
        				} finally {
732
        					PluginServices.getMDIManager().restoreCursor();
717 733
        				}
718 734
        				return;
719 735
        			}

Also available in: Unified diff