Esempio n. 1
0
            def run(self):
                self.assign_to_attribs_helper.run()

        systemGlobals[
            'AssignToAttribsOfSelfAction'] = AssignToAttribsOfSelfAction

    import assign_params_to_attributes_action
    #---------------------------------------------------------------------------------------------- Bind it to Ctrl+2, a
    sDescription = 'Assign method params to attribs of self'
    assign_to_attribs_helper = assign_params_to_attributes_action.AssignToAttribsOfSelf(
        editor)
    editor.addOfflineActionListener(
        ACTIVATION_STRING,
        AssignToAttribsOfSelfAction(assign_to_attribs_helper), sDescription,
        WAIT_FOR_ENTER)

    #------------------------------------------------------------------------------------------------- Bind it to Ctrl+1
    if created_class:
        #This has to be done only once when the class is created.

        from org.python.pydev.editor.correctionassist import PythonCorrectionProcessor  #@UnresolvedImport
        ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST = 'ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST'
        if not PythonCorrectionProcessor.hasAdditionalAssist(
                ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST):
            import assign_params_to_attributes_assist
            assist = assign_params_to_attributes_assist.AssistAssignParamsToAttributes(
            )
            PythonCorrectionProcessor.addAdditionalAssist(
                ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST, assist)
# This is a magic trick that tells the PyDev Extensions editor about the
# namespace provided for pydev scripts:
if False:
    from org.python.pydev.editor import PyEdit  #@UnresolvedImport
    cmd = 'command string'
    editor = PyEdit

assert cmd is not None
assert editor is not None

if DEBUG and cmd == 'onSave':
    from org.python.pydev.jython import JythonPlugin  #@UnresolvedImport
    editor.pyEditScripting.interpreter = JythonPlugin.newPythonInterpreter()

if cmd == 'onCreateActions' or (DEBUG and cmd == 'onSave'):
    from org.python.pydev.editor.correctionassist import PythonCorrectionProcessor  #@UnresolvedImport
    import assign_params_to_attributes_action as helper
    import assign_params_to_attributes_assist as helper2

    sDescription = 'Assign method params to attribs of self'
    o = helper.AssignToAttribsOfSelf(editor)
    editor.addOfflineActionListener(ACTIVATION_STRING, o, sDescription,
                                    WAIT_FOR_ENTER)

    ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST = 'ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST'
    if not PythonCorrectionProcessor.hasAdditionalAssist(
            ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST):
        assist = helper2.AssistAssignParamsToAttributes()
        PythonCorrectionProcessor.addAdditionalAssist(
            ASSIGN_PARAMS_TO_ATTRIBUTES_ASSIST, assist)