Skip to content

Commit

Permalink
wi
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Sep 28, 2024
1 parent 9b27249 commit 69339b0
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 13 deletions.
1 change: 1 addition & 0 deletions plugins/com.python.pydev.analysis/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Export-Package: com.python.pydev.analysis,
com.python.pydev.analysis.refactoring.changes,
com.python.pydev.analysis.refactoring.quick_fixes,
com.python.pydev.analysis.refactoring.refactorer,
com.python.pydev.analysis.refactoring.tdd,
com.python.pydev.analysis.refactoring.wizards,
com.python.pydev.analysis.refactoring.wizards.rename,
com.python.pydev.analysis.refactoring.wizards.rename.visitors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.analysis.refactoring.tdd;

import java.util.List;

import org.eclipse.jface.action.IAction;
import org.python.pydev.ast.refactoring.RefactoringInfo;
import org.python.pydev.core.IPyEdit;
import org.python.pydev.shared_core.code_completion.ICompletionProposalHandle;
Expand All @@ -21,7 +20,7 @@ public abstract class AbstractPyCreateAction {

protected IPyEdit targetEditor;

public void setActiveEditor(IAction action, IPyEdit edit) {
public void setActiveEditor(IPyEdit edit) {
this.targetEditor = edit;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.analysis.refactoring.tdd;

import java.util.List;

Expand Down Expand Up @@ -36,7 +36,7 @@ public abstract class AbstractPyCreateClassOrMethodOrField extends AbstractPyCre

public abstract String getCreationStr();

protected abstract String getDefaultActTok();
public abstract String getDefaultActTok();

protected ICompletionProposalHandle createProposal(PySelection pySelection, String source,
Tuple<Integer, String> offsetAndIndent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.analysis.refactoring.tdd;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.analysis.refactoring.tdd;

import java.util.List;

Expand Down Expand Up @@ -44,7 +44,7 @@ public String getCreationStr() {
}

@Override
protected String getDefaultActTok() {
public String getDefaultActTok() {
return "MyClass";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.analysis.refactoring.tdd;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -49,7 +49,7 @@ public String getCreationStr() {
}

@Override
protected String getDefaultActTok() {
public String getDefaultActTok() {
if (createAs == FIELD) {
return "my_field";
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/com.python.pydev.refactoring/plugin_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, class_, key, desc, group):

ACTIONS_AND_BINDING = [
#The actions below are now available through the Ctrl+1 quick fixes!
#Action('com.python.pydev.refactoring.tdd.PyCreateClass', 'Alt+Shift+S C', 'CreateClass', 'tddGroup'),
#Action('com.python.pydev.refactoring.tdd.PyCreateMethodOrField', 'Alt+Shift+S M', 'CreateMethod', 'tddGroup'),
#Action('com.python.pydev.analysis.refactoring.tdd.PyCreateClass', 'Alt+Shift+S C', 'CreateClass', 'tddGroup'),
#Action('com.python.pydev.analysis.refactoring.tdd.PyCreateMethodOrField', 'Alt+Shift+S M', 'CreateMethod', 'tddGroup'),
Action('org.python.pydev.refactoring.ui.actions.ExtractMethodAction', ('M2+M3+M', 'M3+M2+T E'), 'ExtractMethod', 'pepticRefactoringGroup'),
]
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@

import com.python.pydev.analysis.additionalinfo.builders.AnalysisRunner;
import com.python.pydev.analysis.ctrl_1.AbstractAnalysisMarkersParticipants;
import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateAction;
import com.python.pydev.analysis.refactoring.tdd.PyCreateClass;
import com.python.pydev.analysis.refactoring.tdd.PyCreateMethodOrField;

public class TddCodeGenerationQuickFixParticipant extends AbstractAnalysisMarkersParticipants {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@

import com.python.pydev.analysis.additionalinfo.builders.AnalysisRunner;
import com.python.pydev.analysis.ctrl_1.IAnalysisMarkersParticipant;
import com.python.pydev.analysis.refactoring.tdd.NullPyCreateAction;
import com.python.pydev.analysis.refactoring.tdd.PyCreateClass;
import com.python.pydev.analysis.refactoring.tdd.PyCreateMethodOrField;

/**
* This participant will add a suggestion to create class/methods/attributes when an undefined variable error is found.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.python.pydev.parser.PyParser;
import org.python.pydev.shared_core.image.IImageHandle;

import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateAction;

/**
* This is the proposal that goes outside. It only creates the proposal that'll actually do something later, as
* creating that proposal may be slower.
Expand Down Expand Up @@ -81,7 +83,7 @@ public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {

public TemplateProposal getAsTemplateProposal() {
if (executed == null) {
pyCreateAction.setActiveEditor(null, edit);
pyCreateAction.setActiveEditor(edit);
try {
RefactoringInfo refactoringInfo = new RefactoringInfo(edit, ps.getTextSelection());
executed = (TemplateProposal) pyCreateAction.createProposal(refactoringInfo, this.fReplacementString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import org.python.pydev.editor.actions.PyOpenAction;
import org.python.pydev.shared_core.image.IImageHandle;

import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateAction;
import com.python.pydev.analysis.refactoring.tdd.PyCreateClass;

/**
* This is the proposal that goes outside. It only creates the proposal that'll actually do something later, as
* creating that proposal may be slower.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.python.pydev.editor.actions.PyOpenAction;
import org.python.pydev.shared_core.image.IImageHandle;

import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateAction;

/**
* This is the proposal that goes outside. It only creates the proposal that'll actually do something later, as
* creating that proposal may be slower.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.python.pydev.shared_core.code_completion.ICompletionProposalHandle;
import org.python.pydev.shared_core.structure.Tuple;

import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateClassOrMethodOrField;

public class ExecutePyCreate {

public static void execute(AbstractPyCreateClassOrMethodOrField action, RefactoringInfo refactoringInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.python.pydev.shared_core.string.CoreTextSelection;
import org.python.pydev.shared_core.string.ICoreTextSelection;

import com.python.pydev.analysis.refactoring.tdd.PyCreateClass;

public class PyCreateClassTest extends TestCaseUtils {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import org.python.pydev.shared_core.string.CoreTextSelection;
import org.python.pydev.shared_core.string.ICoreTextSelection;

import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateAction;
import com.python.pydev.analysis.refactoring.tdd.PyCreateMethodOrField;

public class PyCreateMethodTest extends TestCaseUtils {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.python.pydev.shared_core.string.FastStringBuffer;

import com.python.pydev.analysis.refactoring.refactorer.Refactorer;
import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateClassOrMethodOrField;

/**
* @author Fabio
Expand Down

0 comments on commit 69339b0

Please sign in to comment.