|
From: Rogan D. <li...@da...> - 2008-01-07 07:18:29
|
Hi folks, I would like to implement some additional menu items on the TextComponentPopup menu, that can modify the text in the JTextComponent in various ways. I see that there is an overridable method which *SHOULD* suit my purposes: <http://spring-rich-c.svn.sourceforge.net/viewvc/spring-rich-c/trunk/spring-richclient/support/src/main/java/org/springframework/richclient/text/TextComponentPopup.java?view=log> protected CommandGroup getEditableCommandGroup() { CommandGroup editGroup = getCommandManager().getCommandGroup("textEditMenu"); if (editGroup == null) { editGroup = getCommandManager().createCommandGroup( "textEditMenu", new Object[] { GlobalCommandIds.UNDO, GlobalCommandIds.REDO, "separator", GlobalCommandIds.CUT, GlobalCommandIds.COPY, GlobalCommandIds.PASTE, "separator", GlobalCommandIds.SELECT_ALL } ); } return editGroup; } So, in theory, I could just define a "textEditMenu" command group in commands-context.xml, and have my additional commands show up. However, I don't see how to get access to the TextComponent in question in my own commands. The Copy/Paste/etc commands that the TextComponent uses are all defined as inner classes, and can access the TextComponent in that way. But how do I get hold of it in my own (non-inner) class? Is it some magic about Targetable commands that I am not seeing? Thanks Rogan |