public QuickCodePopupMenu(SourceFileEditor editor) {
        super("Quick Code");
        
        this.editor = editor;
        
        // Construct Menu items);
        JMenu opCodes = new JMenu("Insert OpCode");
            // OpCode menu items are auto-generated later on
        JMenu statements = new JMenu("Build");
            JMenuItem includeDirective = new JMenuItem("Include directive");
            JMenuItem macro = new JMenuItem("Macro");
            JMenuItem macroCall = new JMenuItem("Macro Call");
            JMenuItem label = new JMenuItem("Label");
            JMenuItem data = new JMenuItem("Data value");
            JMenuItem string = new JMenuItem("String value");
            JMenuItem comment = new JMenuItem("Comment");
                
        // Add menu items
        add(opCodes);
        
            // Loop through OpCodes and create menu items
            for(final OpCode opCode : OpCode.values()) {
                JMenuItem opCodeMenuItem = new JMenuItem(opCode.name());
                opCodeMenuItem.setToolTipText(opCode.getDescription());
                opCodeMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        String statement = buildOpCodeStatement(opCode);
                        if(statement != null) {
                            insertTextAtCaret(statement);
                        }
                    }
                });
                
                opCodes.add(opCodeMenuItem);
            }

        add(statements);
            statements.add(includeDirective);
            statements.addSeparator();
            statements.add(macro);
            statements.add(macroCall);
            statements.addSeparator();
            statements.add(label);
            statements.add(data);
            statements.add(string);
            statements.addSeparator();
            statements.add(comment);

        // Add listeners
        
        includeDirective.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String statement = buildIncludeDirective();
                if(statement != null) {
                    insertTextAtCaret(statement);
                }
            }
        });
        
        macro.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String statement = buildMacro();
                if(statement != null) {
                    insertTextAtCaret(statement);
                }
            }
        });
        
        macroCall.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String statement = buildMacroCall();
                if(statement != null) {
                    insertTextAtCaret(statement);
                }
            }
        });
        
        label.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String statement = buildLabel();
                if(statement != null) {
                    insertTextAtCaret(statement);
                }
            }
        });
        
        data.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String statement = buildData();
                if(statement != null) {
                    insertTextAtCaret(statement);
                }
            }
        });
        
        string.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String statement = buildString();
                if(statement != null) {
                    insertTextAtCaret(statement);
                }
            }
        });
        
        comment.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String statement = buildComment();
                if(statement != null) {
                    insertTextAtCaret(statement);
                }
            }
        });
    }