Пример #1
0
def addToMenu(tag, args):

    if args.has_key("c"):
        c = args['c']
        if c not in haveseen:
            haveseen[c] = True
            menu = c.frame.menu
            pmenu = menu.getPluginMenu()
            jui_menu = swing.JMenu("JUnit")
            pmenu.add(jui_menu)
            node_item = swing.JMenuItem("Execute Node as JUnit Test")
            node_item.actionPerformed = lambda event: executeNodeAsJUnitTest(c)
            jui_menu.add(node_item)

            node_item2 = swing.JMenuItem("Execute Nodes Marked as JUnit Tests")
            node_item2.actionPerformed = lambda event: executeNodesMarkedAsTests(
                c)
            jui_menu.add(node_item2)

            node_item3 = swing.JMenuItem("Mark/Unmark Node as JUnit Test")
            node_item3.actionPerformed = lambda event: markNodeAsTest(c)
            jui_menu.add(node_item3)

            node_item4 = swing.JMenuItem("Insert JyUnit Template")
            node_item4.actionPerformed = lambda event: insertJyUnitTest(c)
            jui_menu.add(node_item4)
Пример #2
0
 def createMenuItems(self,invocation):
     httpRequestResponseArray = invocation.getSelectedMessages()
     ctx = invocation.getInvocationContext()
     print ctx
     self.menu_list = LinkedList()
     self.menu_item_1 = swing.JMenuItem('test1 button')
     self.menu_item_1.addMouseListener(ResponseContextMenu(self.callbacks, httpRequestResponseArray))
     self.menu_list.add(self.menu_item_1)
     self.menu_item_2 = swing.JMenuItem('test2 button')
     self.menu_item_2.addMouseListener(ResponseContextMenu(self.callbacks, httpRequestResponseArray))
     self.menu_list.add(self.menu_item_2)
     return self.menu_list
Пример #3
0
 def __init__(self, jtp):
     aevent.MouseAdapter.__init__(self)
     self.jtp = jtp
     self.ccp = swing.JPopupMenu()
     cut = swing.JMenuItem("Cut")
     cut.actionPerformed = lambda event: jtp.cut()
     self.ccp.add(cut)
     copy = swing.JMenuItem("Copy")
     copy.actionPerformed = lambda event: jtp.copy()
     self.ccp.add(copy)
     paste = swing.JMenuItem("Paste")
     paste.actionPerformed = lambda event: jtp.paste()
     self.ccp.add(paste)
     jtp.addMouseListener(self)
Пример #4
0
 def __init__( self, jtcomponent ):
     
     self.jtcomponent = jtcomponent
     self.popup = popup = swing.JPopupMenu()
     i1 = swing.JMenuItem( "Cut" )
     i1.actionPerformed = lambda event: jtcomponent.cut()
     popup.add( i1 )
     i2 = swing.JMenuItem( "Copy" )
     i2.actionPerformed = lambda event: jtcomponent.copy()
     popup.add( i2 )
     i3 = swing.JMenuItem( "Paste" )
     i3.actionPerformed = lambda event: jtcomponent.paste()
     popup.add( i3 )
     i4 = swing.JMenuItem( "Select All" )
     i4.actionPerformed = lambda event: jtcomponent.selectAll()
     popup.add( i4 )
     jtcomponent.addMouseListener( self )
Пример #5
0
    def __init__(self,e,instans):
        self.e = e
        self.tab_instans = instans
        send_to_repeater = swing.JMenuItem('Send To Repeater')
        send_to_repeater.addActionListener(ActionEvent('send_to_repeater',e,self.tab_instans))
        send_to_intruder = swing.JMenuItem('Send To Intruder')
        send_to_intruder.addActionListener(ActionEvent('send_to_intruder',e,self.tab_instans))
        clear = swing.JMenuItem('Clear')
        clear.addActionListener(ActionEvent('clear',e,self.tab_instans))
        clear_all = swing.JMenuItem('Clear All')
        clear_all.addActionListener(ActionEvent('clear_all',e,self.tab_instans))

        self.add(send_to_repeater)
        self.add(send_to_intruder)
        self.add(swing.JSeparator())
        self.add(clear)
        self.add(clear_all)
Пример #6
0
 def createMenuItems(self, invocation):
     menu = []
     # Which part of the interface the user selects
     ctx = invocation.getInvocationContext()
     # Message Viewer Req will show menu item if selected by the user
     if ctx == 0 or ctx == 2:
       menu.append(swing.JMenuItem("Commnad Injection", None, actionPerformed=lambda x, inv=invocation: self.add_current_request(inv)))
     return menu if menu else None
 def _createItemStyled(self, text, colour, style):
     item = swing.JMenuItem(
         text,
         actionPerformed=lambda x: self._highlight_tab(x, colour, style))
     item.setFont(
         Font(item.getFont().getName(), style,
              item.getFont().getSize()))
     return item
 def createMenuItems(self, invocation):
     menu = []
     ctx = invocation.getInvocationContext()
     menu.append(
         swing.JMenuItem("Send to CRH",
                         None,
                         actionPerformed=lambda x, inv=invocation: self.
                         menu_action(inv)))
     return menu if menu else None
Пример #9
0
	def createMenuItems(self, invocation):
		self._invocation = invocation
		self._messages_index = self._invocation.getSelectionBounds()
		self._messages = self._invocation.getSelectedMessages()
		self._servicetype = self._invocation.getInvocationContext() % 2
		top_menu = swing.JMenu(self._title)
		for _item in self.typeString:
			top_menu.add(swing.JMenuItem(_item, actionPerformed=lambda x: self.evenHandler(x)))
		return [top_menu]
Пример #10
0
def addToMenu(tags, args):
    if args.has_key("c"):
        c = args['c']
        if c not in haveseen:
            haveseen[c] = True
        menu = c.frame.menu
        pmenu = menu.getPluginMenu()
        open_leocommunicator = swing.JMenuItem("Open LeoCommunicator")
        open_leocommunicator.actionPerformed = lambda event: openLC(c)
        pmenu.add(open_leocommunicator)
Пример #11
0
    def trigger(self, x, y):
        menu = swing.JPopupMenu()
        menu.setInvoker(self.thing)

        for a in self.thing.attrKeys:
            if a in self.thing.editable.keys():
                choices = self.thing.editable[a]
                if choices == ():
                    menu.add(
                        swing.JMenuItem('Select %s' % a,
                                        actionPerformed=lambda x, self=self, a=
                                        a: self.setAttrUnknown(a)))
                else:
                    m2 = swing.JMenu('Choose %s' % a)
                    for c in choices:
                        m2.add(
                            swing.JMenuItem(
                                '%s' % c,
                                actionPerformed=lambda x, server=self.thing.
                                parent.server, id=self.thing.id, a=a, choice=c:
                                server.trySetValue(id, a, choice)))
                    menu.add(m2)

        list = [(name, id) for id, name in self.thing.actions.items()]
        list.sort()
        for name, id in list:
            menu.add(
                swing.JMenuItem(name,
                                actionPerformed=lambda x, self=self, id=id:
                                self.doAction(id)))

        if menu.componentCount > 0:
            s = self.thing.getLocationOnScreen()
            x = s.x + x - 10
            y = s.y + y - 5
            sizeP = menu.preferredSize
            sizeS = getScreenBounds()
            if x + sizeP.width > sizeS.width + sizeS.x:
                x = sizeS.width + sizeS.x - sizeP.width
            if y + sizeP.height > sizeS.height + sizeS.y:
                y = sizeS.height + sizeS.y - sizeP.height
            menu.setLocation(x, y)
            menu.setVisible(1)
Пример #12
0
    def createMenuItems(self,invocation):
        self.context = invocation

        itemContext = invocation.getSelectedMessages()

        if itemContext > 0:
            menuList = ArrayList()
            menuItem = swing.JMenuItem("Send request to MSSQLi-DUET", actionPerformed=self.writeRequestToTextBox) 
            menuList.add(menuItem)
            return menuList
        return None
Пример #13
0
    def getInsertReferenceIntoLeo(self, jd):

        jmi = swing.JMenuItem("Insert Reference As Node")

        def action(event):

            jtf = self._GetReferenceAsObject(jd, self.c)
            jtf.rmv_spot = jd.insertWidget(jtf)
            jtf.requestFocusInWindow()

        jmi.actionPerformed = action
        return jmi
Пример #14
0
 def __init__(self, editor):
     self.c = editor.c
     self.editor = editor.editor
     self.foldprotection = editor.foldprotection
     spelldict = dictionary
     self.spellchecker = SpellChecker(spelldict)
     self.spellchecker.addSpellCheckListener(self)
     b = swing.JMenuItem("Spell Check")
     editor.bodyMenu.addSeparator()
     editor.bodyMenu.add(b)
     b.actionPerformed = self.spellCheck
     self.createWidgets()
Пример #15
0
def addToMenu( tag, args):
    
    if args.has_key( "c"):
        c = args[ 'c']
        if c not in haveseen:
            haveseen[ c ]= True
            menu = c.frame.menu
            pmenu = menu.getPluginMenu()
            ant_menu = swing.JMenu( "Ant")
            pmenu.add( ant_menu)
            ant1_mitem = swing.JMenuItem( "Execute Node in Ant")			
            ant1_mitem.actionPerformed = lambda event : executeAnt( c )
            ant_menu.add( ant1_mitem)
            
            ant2_mitem = swing.JMenuItem( "Execute Ant Nodes in Ant")
            ant2_mitem.actionPerformed = lambda event: executePositionsMarkedAsAntFiles( c )
            ant_menu.add( ant2_mitem )
            
            ant3_mitem =swing.JMenuItem( "Mark/Unmark Node as Ant Project")
            ant3_mitem.actionPerformed = lambda event: markAsAntProject( c )
            ant_menu.add( ant3_mitem)
Пример #16
0
    def createMenuItems(self, contextMenuInvocation):
        self.contextMenuData = contextMenuInvocation.getSelectedMessages()
        self.contextBounds = contextMenuInvocation.getSelectionBounds()
        self.ctx = contextMenuInvocation.getInvocationContext()
        menu_list = []
        menu_list.append(
            swing.JMenuItem("Encode...", actionPerformed=self.menuClicked))
        if (self.ctx == 2) or (self.ctx == 3):
            return menu_list
        if (self.ctx == 0):

            return menu_list
Пример #17
0
    def createMenuItems(self, invocation):
        self.context = invocation

        itemContext = invocation.getSelectedMessages()

        if itemContext > 0:
            menuList = ArrayList()
            menuItem = swing.JMenuItem("Scan with SQLTruncScanner",
                                       None,
                                       actionPerformed=self.start_scan)
            menuList.add(menuItem)
            return menuList
        return None
Пример #18
0
 def getAsMenu( self ):
     
     disabled_text = "Disabled --> JFreeReport not loaded"
     main = swing.JMenu( "Printing and Exporting" )
     jmi = swing.JMenuItem( "Print/Export Node" )
     jmi.actionPerformed = self.printNode
     jmi.setToolTipText( "Writes out Node and Subnodes into one Document" )
     if not jfree_ok:
         jmi.setEnabled( 0 )
         jmi.setToolTipText( disabled_text )
     main.add( jmi )
     jmi = swing.JMenuItem( "Print/Export Outline As More" )
     jmi.actionPerformed = self.printOutlineAsMore
     jmi.setToolTipText( "Writes out Outline in More format" )
     if not jfree_ok:
         jmi.setEnabled( 0 )
         jmi.setToolTipText( disabled_text )
     main.add( jmi )
     jmi = swing.JMenuItem( "Print Tree As Is" )
     jmi.actionPerformed = self.printTreeAsIs
     jmi.setToolTipText( "Prints out an Image of the Outline" )
     main.add( jmi )
     return main
 def _createItem(self, name, colour):
     if colour:
         subSubMenu = swing.JMenu(name)
         subSubMenu.setForeground(colour)
         subSubMenu.add(self._createItemStyled("Normal", colour,
                                               Font.PLAIN))
         subSubMenu.add(self._createItemStyled("Bold", colour, Font.BOLD))
         subSubMenu.add(
             self._createItemStyled("Italic", colour, Font.ITALIC))
         return subSubMenu
     else:
         return swing.JMenuItem(name,
                                actionPerformed=lambda x: self.
                                _highlight_tab(x, colour, Font.PLAIN))
Пример #20
0
    def createLeoSwingPrintMenu(self):

        fmenu = self.getMenu("File")

        components = fmenu.getMenuComponents()

        x = 0
        for z in components:

            if hasattr(z, 'getText') and z.getText() == "Recent Files...":
                break
            x += 1

        spot = x + 1

        pmenu = swing.JMenu("Printing")

        pnodes = swing.JMenu("Print Nodes")
        pmenu.add(pnodes)
        for z in self.printNodeTable:
            item = swing.JMenuItem(z[0])
            item.actionPerformed = z[2]
            pnodes.add(item)

        sep = swing.JSeparator()
        fmenu.add(sep, spot)
        fmenu.add(pmenu, spot + 1)

        print_tree = swing.JMenuItem("Print Tree As Is")
        print_tree.actionPerformed = self.lsp.printTreeAsIs
        pmenu.add(print_tree)
        self.names_and_commands["Print Tree As Is"] = self.lsp.printTreeAsIs
        print_as_more = swing.JMenuItem("Print Outline in More Format")
        print_as_more.actionPerformed = self.lsp.printOutlineAsMore
        self.names_and_commands[
            "Print Outline in More Formet"] = self.lsp.printOutlineAsMore
        pmenu.add(print_as_more)
Пример #21
0
    def createMenuItems(self, invocation):
        menu = []

        # Which part of the interface the user selects
        ctx = invocation.getInvocationContext()

        # Message viewer request will show menu item if selected by the user
        if ctx == 0 or ctx == 2:
            menu.append(
                swing.JMenuItem("Send to InjectionScanner",
                                None,
                                actionPerformed=lambda x, inv=invocation: self.
                                sendToExtender(inv)))

        return menu if menu else None
Пример #22
0
    def add_command(self, menu, **keys):

        if keys['label'] == "Open Python Window":
            keys['command'] = self.openJythonShell

        self.names_and_commands[keys['label']] = keys['command']

        action = self.MenuRunnable(keys['label'], keys['command'], self.c,
                                   self.executor)
        jmenu = swing.JMenuItem(action)
        if keys.has_key('accelerator') and keys['accelerator']:
            accel = keys['accelerator']
            acc_list = accel.split('+')
            changeTo = {
                'Alt': 'alt',
                'Shift': 'shift',  #translation table
                'Ctrl': 'ctrl',
                'UpArrow': 'UP',
                'DnArrow': 'DOWN',
                '-': 'MINUS',
                '+': 'PLUS',
                '=': 'EQUALS',
                '[': 'typed [',
                ']': 'typed ]',
                '{': 'typed {',
                '}': 'typed }',
                'Esc': 'ESCAPE',
                '.': 'typed .',
                "`": "typed `",
                "BkSp": "BACK_SPACE"
            }  #SEE java.awt.event.KeyEvent for further translations
            chg_list = []
            for z in acc_list:
                if z in changeTo:
                    chg_list.append(changeTo[z])
                else:
                    chg_list.append(z)
            accelerator = " ".join(chg_list)
            ks = swing.KeyStroke.getKeyStroke(accelerator)
            if ks:
                self.keystrokes_and_actions[ks] = action
                jmenu.setAccelerator(ks)
            else:
                pass
        menu.add(jmenu)
        label = keys['label']
        return jmenu
Пример #23
0
    def createMenuItems(self, invocation):
        """Adds the extension to the context menu that 
        appears when you right-click an object.
        """
        self.context = invocation
        itemContext = invocation.getSelectedMessages()

        # Only return a menu item if right clicking on a
        # HTTP object
        if itemContext > 0:

            # Must return a Java list
            menuList = ArrayList()
            menuItem = swing.JMenuItem("Send to Example Repeater",
                                       actionPerformed=self.handleHttpTraffic)
            menuList.add(menuItem)
            return menuList
        return None
    def createMenuItems(self, invocation):
        if not invocation.getToolFlag() == self._callbacks.TOOL_REPEATER:
            return

        menu = ArrayList()
        subMenu = swing.JMenu("Highlight Tab")
        # subMenu.setForeground(Color(255, 204, 51))  # uncomment this line if you want the menu item to be highlighted itself
        subMenu.add(self._createItem("Red", Color(255, 50, 0)))
        subMenu.add(self._createItem("Blue", Color(102, 153, 255)))
        subMenu.add(self._createItem("Green", Color(0, 204, 51)))
        subMenu.add(self._createItem("Orange", Color(255, 204, 51)))
        subMenu.add(self._createItem("Purple", Color(204, 51, 255)))
        subMenu.add(self._createItem("None", None))
        subMenu.add(swing.JSeparator())
        save = swing.JMenuItem("Save now", actionPerformed=self.saveSettings)
        save.setFont(save.getFont().deriveFont(Font.ITALIC))
        subMenu.add(save)
        menu.add(subMenu)
        return menu
Пример #25
0
    def createMenuItems(self, invocation):
        menu = []

        # Message Viewer will show menu item if selected by the user
        ctx = invocation.getInvocationContext()
        start = invocation.getSelectionBounds()[0];
        end = invocation.getSelectionBounds()[1];
        messages = invocation.getSelectedMessages();
        if end > start:
            if (ctx == invocation.CONTEXT_MESSAGE_EDITOR_REQUEST or
                ctx == invocation.CONTEXT_MESSAGE_VIEWER_REQUEST):
                if end > start:
                    selected_content = self._helpers.bytesToString(messages[0].getRequest()[start: end])

            if (ctx == invocation.CONTEXT_MESSAGE_EDITOR_RESPONSE or
                ctx == invocation.CONTEXT_MESSAGE_VIEWER_RESPONSE):
                selected_content = self._helpers.bytesToString(messages[0].getResponse())[start: end]

            menu.append(swing.JMenuItem("Send to MyDecoder", None, actionPerformed=lambda x, msg=selected_content: self.sendToMyDecoder(msg)))
        return menu if menu else None
Пример #26
0
    def createMenuItems(self, invocation):

        if not invocation.getToolFlag() == self.callbacks.TOOL_PROXY:
            return

        menu = ArrayList()
        subMenu = swing.JMenu("Highlight Firefox Containers")
        self.enable_menu = swing.JCheckBoxMenuItem(
            "Enabled", self.enabled, actionPerformed=self.saveSettings)
        subMenu.add(self.enable_menu)
        self.remove_header_menu = swing.JCheckBoxMenuItem(
            "Remove header",
            self.remove_header,
            actionPerformed=self.saveSettings)
        subMenu.add(self.remove_header_menu)

        subMenu.add(
            swing.JMenuItem("Edit Mappings",
                            actionPerformed=self.editMappings))
        menu.add(subMenu)
        return menu
Пример #27
0
    def getInsertNodeIntoShell(self, c, jd):

        jm = swing.JMenuItem("Write Node Into Shell as Reference")

        def writeNode(event):

            cp = c.currentPosition()
            at = c.atFileCommands
            c.fileCommands.assignFileIndices()
            at.write(cp.copy(),
                     nosentinels=True,
                     toString=True,
                     scriptWrite=True)
            data = at.stringOutput

            jtf = self._GetReferenceName(jd, data)
            jtf.rmv_spot = jd.insertWidget(jtf)
            jtf.requestFocusInWindow()

        jm.actionPerformed = writeNode
        return jm
Пример #28
0
def addToMenu( tag, args):
    
    g.globalDirectiveList.append( "svn")
    if args.has_key( "c"):
        c = args[ 'c']
        if c not in haveseen:
            haveseen[ c ]= True
            menu = c.frame.menu
            pmenu = menu.getPluginMenu()
            svn_menu = swing.JMenu( "SVN")
            pmenu.add( svn_menu )
            node_item = swing.JMenuItem( "Save and Update Node")
            node_item.actionPerformed = lambda event: saveAndUpdateNode( c )
            svn_menu.add( node_item)
            node_item2 = swing.JMenuItem( "Revert Node")
            node_item2.actionPerformed = lambda event: revertNode( c)
            svn_menu.add( node_item2)
            
            node_item4 = swing.JMenuItem( "Status of Workspace")
            node_item4.actionPerformed = lambda event: status( c )
            svn_menu.add( node_item4 )
            
            node_item5 = swing.JMenuItem( "Add Node To Workspace")   
            node_item5.actionPerformed = lambda event: addNodeToWorkspace( c)
            svn_menu.add( node_item5)
            
            node_item6 = swing.JMenuItem( "Checkout")
            node_item6.actionPerformed = lambda event: checkout( c )
            svn_menu.add( node_item6)
            
            browsem = swing.JMenuItem( "Browse A Repository")
            browsem.actionPerformed = lambda event: browse( c )
            svn_menu.add( browsem )
            
            commit_menu = swing.JMenu( "Commit")
            svn_menu.add( commit_menu)
            commit_dir = swing.JMenuItem( "Commit Nodes Directory")
            commit_menu.add( commit_dir)
            commit_dir.actionPerformed = lambda event: commitDirectory( c )
Пример #29
0
featureDrawingUtil = FeatureDrawingUtil(toolbox.getContext())
toolMenu = toolbox.JMenuBar.getMenu(0)
sep = File.separator  # / for linux and \ for windows

toolbox.centerPanel.components[0].hide()  #comment out to initially show


#install menu items
def showConsole(event):
    toolbox.centerPanel.components[0].show()
    toolbox.pack()


toolMenu.add(
    swing.JMenuItem("Show Console",
                    actionPerformed=showConsole,
                    icon=swing.ImageIcon(startuppath + "images" + sep +
                                         "console_show.png")))


def hideConsole(event):
    toolbox.centerPanel.components[0].hide()
    toolbox.pack()


toolMenu.add(
    swing.JMenuItem("Hide Console",
                    actionPerformed=hideConsole,
                    icon=swing.ImageIcon(startuppath + "images" + sep +
                                         "console_hide.png")))
import UnionSelected  #too much code to inline.  use module
Пример #30
0
import java.io.File as File

featureDrawingUtil = FeatureDrawingUtil(toolbox.getContext())
toolMenu = toolbox.JMenuBar.getMenu(0)
sep = File.separator  # / for linux and \ for windows

toolbox.centerPanel.components[1].hide()  #comment out to initially show


#install menu items
def showConsole(event):
    toolbox.centerPanel.components[1].show()
    toolbox.pack()


toolMenu.add(swing.JMenuItem("Show Console", actionPerformed=showConsole))


def hideConsole(event):
    toolbox.centerPanel.components[1].hide()
    toolbox.pack()


toolMenu.add(swing.JMenuItem("Hide Console", actionPerformed=hideConsole))
import UnionSelected  #too much code to inline.  use module
toolMenu.add(
    swing.JMenuItem("Union Selected",
                    actionPerformed=UnionSelected.unionSelected))
import AlignSelected
alignMenu = swing.JMenu("Align Selected")
alignLeftMenu = swing.JMenuItem("Left",