1 18 19 package org.objectweb.jac.ide.diagrams; 20 21 import CH.ifa.draw.framework.DrawingEditor; 22 import CH.ifa.draw.framework.Figure; 23 import CH.ifa.draw.figures.TextTool; 24 import CH.ifa.draw.standard.TextHolder; 25 import java.awt.event.MouseEvent ; 26 27 class AttachedTextTool extends TextTool { 28 29 private boolean fConnected = false; 30 31 public AttachedTextTool(DrawingEditor editor, Figure prototype) { 32 super(editor, prototype); 33 } 34 35 39 public void mouseDown(MouseEvent e, int x, int y) { 40 super.mouseDown(e, x, y); 41 42 Figure pressedFigure = drawing().findFigureInside(x, y); 43 TextHolder textHolder = getTypingTarget(); 44 if (!fConnected && pressedFigure != null && 45 textHolder != null && pressedFigure != textHolder 46 && (pressedFigure instanceof LinkFigure) ) { 47 48 51 textHolder.connect(pressedFigure); 52 fConnected = true; 54 } 55 } 56 57 61 public void activate() { 62 super.activate(); 63 fConnected = false; 64 } 65 66 69 146 } 147 | Popular Tags |