Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19165/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
SpaceTool.java
Log Message:
Added a selection menu that should be applied to selection when "SpaceTool" is active
Index: SpaceTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SpaceTool.java 11 Jan 2006 12:05:32 -0000 1.2
--- SpaceTool.java 11 Jan 2006 13:24:17 -0000 1.3
***************
*** 9,12 ****
--- 9,13 ----
import java.awt.Cursor;
+ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
***************
*** 58,61 ****
--- 59,67 ----
}
+ if (e.getButton() == MouseEvent.BUTTON3) {
+ glv.popup(makeSelectionMenu(), e.getX(), e.getY());
+ done = true;
+ }
+
if (!done) {
super.pressed(e);
***************
*** 63,66 ****
--- 69,95 ----
}
+ /**
+ * MenuAction for making anonymous actionlisteners
+ */
+ protected abstract class MenuAction implements ActionListener {
+ }
+
+ /**
+ * Create a popup for performing operations on selection
+ * @return The popup menu
+ */
+ protected JPopupMenu makeSelectionMenu() {
+ JPopupMenu menu = new JPopupMenu();
+ JMenuItem offsetItem = new JMenuItem("Offset Constraint");
+ offsetItem.addActionListener(new MenuAction() {
+ public void actionPerformed(ActionEvent event) {
+ log.info("OffsetConstraint should be added to selection here");
+ }
+ }
+ );
+ menu.add(offsetItem);
+ return menu;
+ }
+
/**
* Creates the correct type popup menu.
|