Author: kaiyi4
Date: Fri Aug 29 12:56:11 2008
New Revision: 2667

Added:
   trunk/src/ca/sqlpower/architect/swingui/olap/OLAPContextMenuFactory.java
- copied, changed from r2666, /trunk/src/ca/sqlpower/architect/swingui/olap/ContextMenuFactory.java
Removed:
   trunk/src/ca/sqlpower/architect/swingui/olap/ContextMenuFactory.java
Modified:
   trunk/src/ca/sqlpower/architect/swingui/PlayPen.java
   trunk/src/ca/sqlpower/architect/swingui/PopupMenuFactory.java
   trunk/src/ca/sqlpower/architect/swingui/RelationalPlayPenFactory.java
   trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPane.java
   trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java
   trunk/src/ca/sqlpower/architect/swingui/olap/OLAPTree.java

Log:
Fixed a bug, "reluctant olap popup creation", popup menu are created based on selected component instead of 'clicked' component.

This required a change in the popup factor interface.

It may be ideal if we could allow relational playpen popup factory to create popup menus for individual relational playpencomponents. But that's beyond the scope of this commit, since it's working correctly now.

OLAP playpen factory now creates popup menus from given source object, if the object is null, then an olap playpen popup is created instead.

Modified: trunk/src/ca/sqlpower/architect/swingui/PlayPen.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/PlayPen.java        (original)
+++ trunk/src/ca/sqlpower/architect/swingui/PlayPen.java Fri Aug 29 12:56:11 2008
@@ -2246,7 +2246,7 @@
                        } else {
session.getArchitectFrame().getCreateIdentifyingRelationshipAction().cancel(); session.getArchitectFrame().getCreateNonIdentifyingRelationshipAction().cancel();
-                               maybeShowPopup(evt);
+//                             maybeShowPopup(evt);
                        }
 //                     updateDBTree();
                }
@@ -2350,7 +2350,8 @@
                    } else {
                        if (evt.isPopupTrigger() && popupFactory != null) {
                            PlayPen pp = (PlayPen) evt.getSource();
-                           JPopupMenu popup = popupFactory.createPopupMenu();
+ //XXX we should let popupfactory to produce playpencomponent popup as well
+                           JPopupMenu popup = 
popupFactory.createPopupMenu(null);
                            popup.show(pp, evt.getX(), evt.getY());
                        }
                    }

Modified: trunk/src/ca/sqlpower/architect/swingui/PopupMenuFactory.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/PopupMenuFactory.java       
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/PopupMenuFactory.java Fri Aug 29 12:56:11 2008
@@ -31,9 +31,15 @@
 public interface PopupMenuFactory {

     /**
- * Creates a popup menu appropriate to this factory's settings and current state. + * Creates a popup menu appropriate to this factory's settings and current
+     * state.
+     *
+     * @param sourceComponent
+ * Source Component which the popup menu is based on, it can be + * null, if that is the case, then a popup menu for the playpen
+     *            is created
      *
* @return The popup menu that should be displayed now. Will not be null.
      */
-    JPopupMenu createPopupMenu();
+    JPopupMenu createPopupMenu(Object sourceComponent);
 }

Modified: trunk/src/ca/sqlpower/architect/swingui/RelationalPlayPenFactory.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/RelationalPlayPenFactory.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/RelationalPlayPenFactory.java Fri Aug 29 12:56:11 2008
@@ -61,14 +61,14 @@
 import ca.sqlpower.architect.swingui.event.SelectionListener;

 /**
- * Factory class that creates a PlayPen instance that's set up for use
- * in relational modeling (tables and relationships).
+ * Factory class that creates a PlayPen instance that's set up for use in
+ * relational modeling (tables and relationships).
  */
 public class RelationalPlayPenFactory {

     @SuppressWarnings("unused")
private static final Logger logger = Logger.getLogger(RelationalPlayPenFactory.class);
-
+
public static PlayPen createPlayPen(ArchitectSwingSession session, DBTree dbTree) {
         PlayPen pp = new PlayPen(session);
         pp.setPopupFactory(new RelationalPopupFactory(pp, session));
@@ -78,10 +78,11 @@
         pp.getContentPane().addPlayPenContentListener(synchronizer);
         return pp;
     }
-
+
private static class RelationalPopupFactory implements PopupMenuFactory {
-
+
         private final PlayPen pp;
+
         private final ArchitectSwingSession session;

         RelationalPopupFactory(PlayPen pp, ArchitectSwingSession session) {
@@ -89,41 +90,42 @@
             this.session = session;
         }

-        public JPopupMenu createPopupMenu() {
+        /**
+ * Creates a popup menu for the object. But at the moment, we are only
+         * using this to create popup menu for relational playpen
+         * <p>
+ * Specific component in relational playpen currently creates their own popup menus
+         * <p>
+ * It is expected that <code>sourceComponent</code> is <code>null</code>
+         */
+        public JPopupMenu createPopupMenu(Object sourceComponent) {
             JPopupMenu menu = new JPopupMenu();

             JMenuItem mi = new JMenuItem();
mi.setAction(session.getArchitectFrame().getCreateTableAction());
             menu.add(mi);
-
+
             mi = new JMenuItem();
-            Icon icon = new ImageIcon(
- ClassLoader.getSystemResource("icons/famfamfam/wrench.png")); //$NON-NLS-1$
-            AutoLayoutAction layoutAction =
-                new AutoLayoutAction(
-                        session,
-                        session.getPlayPen(),
- Messages.getString("PlayPen.straightenLinesActionName"), //$NON-NLS-1$ - Messages.getString("PlayPen.straightenLinesActionDescription"), //$NON-NLS-1$
-                        icon);
+ Icon icon = new ImageIcon(ClassLoader.getSystemResource("icons/famfamfam/wrench.png")); //$NON-NLS-1$ + AutoLayoutAction layoutAction = new AutoLayoutAction(session, session.getPlayPen(), Messages + .getString("PlayPen.straightenLinesActionName"), //$NON-NLS-1$ + Messages.getString("PlayPen.straightenLinesActionDescription"), //$NON-NLS-1$
+                    icon);
             layoutAction.setLayout(new LineStraightenerLayout());
             mi.setAction(layoutAction);
             menu.add(mi);
-
+
             if (pp.isDebugEnabled()) {
                 menu.addSeparator();
                 mi = new JMenuItem("Show Relationships"); //$NON-NLS-1$
                 mi.addActionListener(new ActionListener() {
                     public void actionPerformed(ActionEvent evt) {
-                        JOptionPane.showMessageDialog(pp,
-                                new JScrollPane(
-                                    new JList(
-                                        new java.util.Vector<Relationship>(
-                                            pp.getRelationships()))));
+ JOptionPane.showMessageDialog(pp, new JScrollPane(new JList(new java.util.Vector<Relationship>(
+                                pp.getRelationships()))));
                     }
                 });
                 menu.add(mi);
-
+
mi = new JMenuItem("Show PlayPen Components"); //$NON-NLS-1$ mi.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN);
                 mi.addActionListener(new ActionListener() {
@@ -131,47 +133,45 @@
                         StringBuffer componentList = new StringBuffer();
for (int i = 0; i < pp.getContentPane().getComponentCount(); i++) { PlayPenComponent c = pp.getContentPane().getComponent(i); - componentList.append(c).append("["+c.getModel()+"]\n"); //$NON-NLS-1$ //$NON-NLS-2$ + componentList.append(c).append("[" + c.getModel() + "]\n"); //$NON-NLS-1$ //$NON-NLS-2$
                         }
-                        JOptionPane.showMessageDialog(pp,
-                                new JScrollPane(
- new JTextArea(componentList.toString()))); + JOptionPane.showMessageDialog(pp, new JScrollPane(new JTextArea(componentList.toString())));
                     }
                 });
                 menu.add(mi);
-
+
                 mi = new JMenuItem("Show Undo Vector"); //$NON-NLS-1$
mi.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN);
                 mi.addActionListener(new ActionListener() {
                     public void actionPerformed(ActionEvent evt) {
-                        JOptionPane.showMessageDialog(pp,
-                                new JScrollPane(
-                                    new JTextArea(
- session.getUndoManager().printUndoVector()))); + JOptionPane.showMessageDialog(pp, new JScrollPane(new JTextArea(session.getUndoManager()
+                                .printUndoVector())));
                     }
                 });
                 menu.add(mi);
             }
-
+
             return menu;
         }
-
+
     }
-
+
     /**
      * Asks the playpen to set up its own generic keyboard actions (select,
* edit, cancel, keyboard navigation) and then adds the relational-specific - * keyboard actions on top of those. This is not done in the factory method + * keyboard actions on top of those. This is not done in the factory method * because there are some circular startup dependencies between PlayPen and
      * ArchitectFrame, so these actions have to be set up later.
      *
-     * @param pp The playpen to activate the keyboard actions on
-     * @param session The session the playpen belongs to
+     * @param pp
+     *            The playpen to activate the keyboard actions on
+     * @param session
+     *            The session the playpen belongs to
      */
static void setupKeyboardActions(final PlayPen pp, final ArchitectSwingSession session) {
         pp.setupKeyboardActions();
         final ArchitectFrame af = session.getArchitectFrame();
-
+
String KEY_DELETE_SELECTED = "ca.sqlpower.architect.swingui.PlayPen.KEY_DELETE_SELECTED"; //$NON-NLS-1$

InputMap inputMap = pp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
@@ -179,73 +179,86 @@
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), KEY_DELETE_SELECTED); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), KEY_DELETE_SELECTED); pp.getActionMap().put(KEY_DELETE_SELECTED, af.getDeleteSelectedAction()); - if (af.getDeleteSelectedAction() == null) logger.warn("af.deleteSelectedAction is null!"); //$NON-NLS-1$
+        if (af.getDeleteSelectedAction() == null)
+            logger.warn("af.deleteSelectedAction is null!"); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getZoomToFitAction().getValue(Action.ACCELERATOR_KEY), "ZOOM TO FIT"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getZoomToFitAction().getValue(Action.ACCELERATOR_KEY), "ZOOM TO FIT"); //$NON-NLS-1$ pp.getActionMap().put("ZOOM TO FIT", af.getZoomToFitAction()); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getZoomInAction().getValue(Action.ACCELERATOR_KEY), "ZOOM IN"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getZoomInAction().getValue(Action.ACCELERATOR_KEY), "ZOOM IN"); //$NON-NLS-1$ pp.getActionMap().put("ZOOM IN", af.getZoomInAction()); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getZoomOutAction().getValue(Action.ACCELERATOR_KEY), "ZOOM OUT"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getZoomOutAction().getValue(Action.ACCELERATOR_KEY), "ZOOM OUT"); //$NON-NLS-1$ pp.getActionMap().put("ZOOM OUT", af.getZoomOutAction()); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getZoomResetAction().getValue(Action.ACCELERATOR_KEY), "ZOOM RESET"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getZoomResetAction().getValue(Action.ACCELERATOR_KEY), "ZOOM RESET"); //$NON-NLS-1$ pp.getActionMap().put("ZOOM RESET", af.getZoomResetAction()); //$NON-NLS-1$
-

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getCreateTableAction().getValue(Action.ACCELERATOR_KEY), "NEW TABLE"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getCreateTableAction().getValue(Action.ACCELERATOR_KEY), "NEW TABLE"); //$NON-NLS-1$ pp.getActionMap().put("NEW TABLE", af.getCreateTableAction()); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getInsertColumnAction().getValue(Action.ACCELERATOR_KEY), "NEW COLUMN"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getInsertColumnAction().getValue(Action.ACCELERATOR_KEY), "NEW COLUMN"); //$NON-NLS-1$ pp.getActionMap().put("NEW COLUMN", af.getInsertColumnAction()); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getInsertIndexAction().getValue(Action.ACCELERATOR_KEY), "NEW INDEX"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getInsertIndexAction().getValue(Action.ACCELERATOR_KEY), "NEW INDEX"); //$NON-NLS-1$ pp.getActionMap().put("NEW INDEX", af.getInsertIndexAction()); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getCreateIdentifyingRelationshipAction().getValue(Action.ACCELERATOR_KEY), "NEW IDENTIFYING RELATION"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getCreateIdentifyingRelationshipAction().getValue(Action.ACCELERATOR_KEY),
+                "NEW IDENTIFYING RELATION"); //$NON-NLS-1$
pp.getActionMap().put("NEW IDENTIFYING RELATION", af.getCreateIdentifyingRelationshipAction()); //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke) af.getCreateNonIdentifyingRelationshipAction().getValue(Action.ACCELERATOR_KEY), "NEW NON IDENTIFYING RELATION"); //$NON-NLS-1$
+        pp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ (KeyStroke) af.getCreateNonIdentifyingRelationshipAction().getValue(Action.ACCELERATOR_KEY),
+                "NEW NON IDENTIFYING RELATION"); //$NON-NLS-1$
pp.getActionMap().put("NEW NON IDENTIFYING RELATION", af.getCreateNonIdentifyingRelationshipAction()); //$NON-NLS-1$

final Object KEY_EDIT_SELECTION = "ca.sqlpower.architect.PlayPen.KEY_EDIT_SELECTION"; //$NON-NLS-1$

- pp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), KEY_EDIT_SELECTION); + pp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+                KEY_EDIT_SELECTION);
         pp.getActionMap().put(KEY_EDIT_SELECTION, new AbstractAction() {
             public void actionPerformed(ActionEvent e) {
                 ActionEvent ev = new ActionEvent(e.getSource(), e.getID(),
- ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN,
-                                e.getWhen(), e.getModifiers());
+ ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN, e.getWhen(), e.getModifiers());
                 af.getEditSelectedAction().actionPerformed(ev);
             }
         });
-
+
     }

-    static class SelectionSynchronizer
-    implements SelectionListener,
-            ItemSelectionListener<SQLTable, SQLColumn>,
+ static class SelectionSynchronizer implements SelectionListener, ItemSelectionListener<SQLTable, SQLColumn>,
             TreeSelectionListener, PlayPenContentListener {

         private int eventDepth = 0;
+
         private final DBTree tree;
+
         private final PlayPen pp;
-
+
         public SelectionSynchronizer(DBTree tree, PlayPen pp) {
             this.tree = tree;
             this.pp = pp;
         }
-
+
         /**
          * Synchronizes the dbtTree selection with the playpen selections
-         * @throws ArchitectException
+         *
+         * @throws ArchitectException
          *
          */
         public void updateDBTree() {
-            if (eventDepth != 1) return;
+            if (eventDepth != 1)
+                return;
             tree.clearSelection();
-
+
             List<TreePath> selectionPaths = new ArrayList<TreePath>();
             boolean addedPaths = false;
             // Keep track of the last tree path
@@ -258,9 +271,9 @@
                     addedPaths = true;
                     lastPath = tp;
                 }
-
+
                 if (comp instanceof TablePane) {
- for (SQLColumn col :((TablePane) comp).getSelectedItems()) { + for (SQLColumn col : ((TablePane) comp).getSelectedItems()) {
                         tp = tree.getTreePathForNode(col);
                         if (!selectionPaths.contains(tp)) {
                             selectionPaths.add(tp);
@@ -270,12 +283,12 @@
                     }
                 }
             }
-
+
             // Scroll to last tree path.
             if (lastPath != null) {
                 tree.scrollPathToVisible(lastPath);
             }
-
+
tree.setSelectionPaths(selectionPaths.toArray(new TreePath[selectionPaths.size()]));
             if (addedPaths) {
                 tree.clearNonPlayPenSelections();
@@ -283,18 +296,22 @@
         }

         /**
- * Selects the corresponding objects from the give TreePaths on the PlayPen.
+         * Selects the corresponding objects from the give TreePaths on the
+         * PlayPen.
          *
-         * @param treePaths TreePaths containing the objects to select.
+         * @param treePaths
+         *            TreePaths containing the objects to select.
          */
         private void selectInPlayPen(TreePath[] treePaths) {
-            if (eventDepth != 1) return;
+            if (eventDepth != 1)
+                return;
             if (treePaths == null) {
                 pp.selectNone();
             } else {
                 List<SQLObject> objects = new ArrayList<SQLObject>();
                 for (TreePath tp : treePaths) {
- if (tree.isTargetDatabaseNode(tp) | | !tree.isTargetDatabaseChild(tp)) continue; + if (tree.isTargetDatabaseNode(tp) | | !tree.isTargetDatabaseChild(tp))
+                        continue;
                     SQLObject obj = (SQLObject) tp.getLastPathComponent();
                     // only select playpen represented objects.
if ((obj instanceof SQLTable || obj instanceof SQLRelationship || obj instanceof SQLColumn) &&
@@ -364,7 +381,7 @@
         public void PlayPenComponentRemoved(PlayPenContentEvent e) {
             if (e.getPlayPenComponent() instanceof ContainerPane<?, ?>) {
((ContainerPane<SQLTable, SQLColumn>) e.getPlayPenComponent()).removeItemSelectionListener(this);
-            }
+            }
         }
     }
 }

Copied: trunk/src/ca/sqlpower/architect/swingui/olap/OLAPContextMenuFactory.java (from r2666, /trunk/src/ca/sqlpower/architect/swingui/olap/ContextMenuFactory.java)
==============================================================================
--- /trunk/src/ca/sqlpower/architect/swingui/olap/ContextMenuFactory.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/olap/OLAPContextMenuFactory.java Fri Aug 29 12:56:11 2008
@@ -19,9 +19,6 @@

 package ca.sqlpower.architect.swingui.olap;

-import java.util.ArrayList;
-import java.util.List;
-
 import javax.swing.JPopupMenu;

 import ca.sqlpower.architect.olap.OLAPObject;
@@ -33,8 +30,6 @@
 import ca.sqlpower.architect.olap.MondrianModel.Schema;
 import ca.sqlpower.architect.olap.MondrianModel.VirtualCube;
 import ca.sqlpower.architect.swingui.ArchitectSwingSession;
-import ca.sqlpower.architect.swingui.PlayPen;
-import ca.sqlpower.architect.swingui.PlayPenComponent;
 import ca.sqlpower.architect.swingui.PopupMenuFactory;
 import ca.sqlpower.architect.swingui.olap.action.EditCubeAction;
 import ca.sqlpower.architect.swingui.olap.action.EditDimensionAction;
@@ -47,12 +42,12 @@
 /**
* Creates context menus for the tree or the playpen. (Or anyone else who wants one).
  */
-public class ContextMenuFactory implements PopupMenuFactory {
+public class OLAPContextMenuFactory implements PopupMenuFactory {

     private final ArchitectSwingSession session;
     private final OLAPEditSession oSession;

- public ContextMenuFactory(ArchitectSwingSession session, OLAPEditSession oSession) { + public OLAPContextMenuFactory(ArchitectSwingSession session, OLAPEditSession oSession) {
         this.session = session;
         this.oSession = oSession;
     }
@@ -60,15 +55,16 @@
     /**
* Creates a context menu for the given olap object. This menu should be
      * appropriate for the tree or the PlayPen.
-     * <p>
-     * TODO: support multi-select (pass in a list of selected objects)
      *
- * @param obj The items the menu is for. If no items are selected, pass in null.
-     * @return
+     * @param sourceComponent
+ * The source component which the popup menu for, if the given
+     *            source component is null, he a popup for the playpen is
+     *            created instead
+     * @return The popup menu for the given source
      */
-    public JPopupMenu createContextMenu(OLAPObject obj) {
+    public JPopupMenu createPopupMenu(Object sourceComponent) {
+        OLAPObject obj = (OLAPObject) sourceComponent;
         JPopupMenu m = new JPopupMenu();
-
         if (obj == null) {
             m.add(oSession.getCreateCubeAction());
             m.add(oSession.getCreateDimensionAction());
@@ -112,24 +108,6 @@
         }

         return m;
-    }
-
-    /**
- * Gathers the selected items from the play pen and returns the appropriate
-     * popup menu.
-     */
-    public JPopupMenu createPopupMenu() {
-        List<OLAPObject> selectedObjects = new ArrayList<OLAPObject>();
-        PlayPen pp = oSession.getOlapPlayPen();
-        for (PlayPenComponent ppc : pp.getSelectedItems()) {
-            if (ppc.getModel() instanceof OLAPObject) {
-                selectedObjects.add((OLAPObject) ppc.getModel());
-            }
-        }
-        if (selectedObjects.isEmpty()) {
-            return createContextMenu(null);
-        } else {
-            return createContextMenu(selectedObjects.get(0));
-        }
+
     }
 }

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPane.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPane.java  (original)
+++ trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPane.java Fri Aug 29 12:56:11 2008
@@ -373,7 +373,7 @@
     }

     public JPopupMenu getPopup() {
-        return getPlayPen().getPopupFactory().createPopupMenu();
+ return getPlayPen().getPopupFactory().createPopupMenu(this.getModel());
     }

     @Override

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java Fri Aug 29 12:56:11 2008
@@ -76,7 +76,7 @@
         OLAPModelListener ppcl = new OLAPModelListener(pp, oSession);
         pp.addPlayPenLifecycleListener(ppcl);

-        pp.setPopupFactory(new ContextMenuFactory(session, oSession));
+        pp.setPopupFactory(new OLAPContextMenuFactory(session, oSession));
OLAPUtil.listenToHierarchy(oSession.getOlapSession().getSchema(), ppcl, null);

SelectionSynchronizer synchronizer = new SelectionSynchronizer(oSession.getOlapTree(), pp);

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/OLAPTree.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/OLAPTree.java  (original)
+++ trunk/src/ca/sqlpower/architect/swingui/olap/OLAPTree.java Fri Aug 29 12:56:11 2008
@@ -48,7 +48,7 @@

     private static final Logger logger = Logger.getLogger(OLAPTree.class);

-    private final ContextMenuFactory menuFactory;
+    private final OLAPContextMenuFactory menuFactory;

     private final JTreeCollapseAllAction collapseAllAction;
     private final JTreeExpandAllAction expandAllAction;
@@ -61,7 +61,7 @@
         addMouseListener(new PopupListener());
collapseAllAction = new JTreeCollapseAllAction(this, "Collapse All");
         expandAllAction = new JTreeExpandAllAction(this, "Expand All");
-        menuFactory = new ContextMenuFactory(session, oSession);
+        menuFactory = new OLAPContextMenuFactory(session, oSession);
     }

  // ----------------- popup menu stuff ----------------
@@ -99,7 +99,7 @@
                     lpc = (OLAPObject) p.getLastPathComponent();
                 }

-                JPopupMenu popup = menuFactory.createContextMenu(lpc);
+                JPopupMenu popup = menuFactory.createPopupMenu(lpc);

                 if (lpc != null) {
                     popup.addSeparator();

Reply via email to