[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl Editor.java, 1.19, 1.20
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2011-05-11 10:14:44
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory vz-cvs-2.sog:/tmp/cvs-serv28522/src/net/sourceforge/bprocessor/gl Modified Files: Editor.java Log Message: Index: Editor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/Editor.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Editor.java 5 May 2011 10:22:55 -0000 1.19 --- Editor.java 11 May 2011 10:14:42 -0000 1.20 *************** *** 60,63 **** --- 60,65 ---- */ public class Editor implements MouseListener, Observer { + private static Editor instance; + /** The logger */ private static Logger log = Logger.getLogger(Editor.class); *************** *** 95,98 **** --- 97,107 ---- private JPanel jp; + /** + * + * @return instance of Editor + */ + public static Editor instance() { + return instance; + } /** *************** *** 229,232 **** --- 238,242 ---- */ public Editor() { + instance = this; Selection.primary().addObserver(this); Project.getInstance().addStaticObserver(this); *************** *** 408,417 **** } /** * Change the tool used by gl ! * @param key The new tool * @return The chosen tool */ ! public Tool changeTool(String key) { tool.cleanUp(); this.repaint(true); --- 418,438 ---- } + + /** + * + * @param key The key of the next tool + * @return the next tool + */ + public Tool changeTool(String key) { + Tool next = ToolFactory.getFactory(this).get(key); + return changeTool(next); + } + /** * Change the tool used by gl ! * @param next The new tool * @return The chosen tool */ ! public Tool changeTool(Tool next) { tool.cleanUp(); this.repaint(true); *************** *** 419,423 **** glc.removeMouseMotionListener(tool); glc.removeKeyListener(tool); ! tool = ToolFactory.getFactory(this).get(key); if (tool != null) { glc.addMouseListener(tool); --- 440,444 ---- glc.removeMouseMotionListener(tool); glc.removeKeyListener(tool); ! tool = next; if (tool != null) { glc.addMouseListener(tool); |