From 411236f2854215b33d67644a750b395cbd972653 Mon Sep 17 00:00:00 2001 From: Fabio Zadrozny Date: Sun, 29 Sep 2024 20:47:48 -0300 Subject: [PATCH] wip --- .../TddQuickFixFromMarkersParticipant.java | 3 ++ ...CodeGenerationQuickFixParticipantTest.java | 2 ++ ...ionQuickFixParticipantWithMarkersTest.java | 2 ++ .../proposals/ICompletionProposalFactory.java | 19 ++++++----- plugins/org.python.pydev/META-INF/MANIFEST.MF | 1 + .../AbstractTddRefactorCompletion.java | 2 +- .../completions}/TddRefactorCompletion.java | 4 +-- ...dRefactorCompletionInInexistentModule.java | 2 +- .../TddRefactorCompletionInModule.java | 2 +- .../DefaultCompletionProposalFactory.java | 32 +++++++++++++++++++ 10 files changed, 56 insertions(+), 13 deletions(-) rename plugins/{com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd => org.python.pydev/src/com/python/pydev/refactoring/tdd/completions}/AbstractTddRefactorCompletion.java (98%) rename plugins/{com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd => org.python.pydev/src/com/python/pydev/refactoring/tdd/completions}/TddRefactorCompletion.java (96%) rename plugins/{com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd => org.python.pydev/src/com/python/pydev/refactoring/tdd/completions}/TddRefactorCompletionInInexistentModule.java (99%) rename plugins/{com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd => org.python.pydev/src/com/python/pydev/refactoring/tdd/completions}/TddRefactorCompletionInModule.java (98%) diff --git a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixFromMarkersParticipant.java b/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixFromMarkersParticipant.java index 873ea3cf98..05aee364a2 100644 --- a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixFromMarkersParticipant.java +++ b/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixFromMarkersParticipant.java @@ -58,6 +58,9 @@ import com.python.pydev.analysis.refactoring.tdd.NullPyCreateAction; import com.python.pydev.analysis.refactoring.tdd.PyCreateClass; import com.python.pydev.analysis.refactoring.tdd.PyCreateMethodOrField; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInInexistentModule; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule; /** * This participant will add a suggestion to create class/methods/attributes when an undefined variable error is found. diff --git a/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantTest.java b/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantTest.java index e4076a1269..351fe632e8 100644 --- a/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantTest.java +++ b/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantTest.java @@ -30,6 +30,8 @@ import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateClassOrMethodOrField; import com.python.pydev.analysis.refactoring.tdd.TddCodeGenerationQuickFixWithoutMarkersParticipant; import com.python.pydev.analysis.refactoring.tdd.TemplateInfo; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule; /** * @author Fabio diff --git a/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantWithMarkersTest.java b/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantWithMarkersTest.java index 48b7d388c3..10a1e7f4a0 100644 --- a/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantWithMarkersTest.java +++ b/plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/tdd/TddCodeGenerationQuickFixParticipantWithMarkersTest.java @@ -42,6 +42,8 @@ import com.python.pydev.analysis.refactoring.refactorer.Refactorer; import com.python.pydev.analysis.refactoring.tdd.TddCodeGenerationQuickFixWithoutMarkersParticipant; import com.python.pydev.analysis.refactoring.tdd.TemplateInfo; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule; /** * @author Fabio diff --git a/plugins/org.python.pydev.core/src/org/python/pydev/core/proposals/ICompletionProposalFactory.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/proposals/ICompletionProposalFactory.java index c247aedb2d..05793422d6 100644 --- a/plugins/org.python.pydev.core/src/org/python/pydev/core/proposals/ICompletionProposalFactory.java +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/proposals/ICompletionProposalFactory.java @@ -136,15 +136,18 @@ ICompletionProposalHandle createMoveImportsToLocalCompletionProposal( ShellId getCythonShellId(); - ICompletionProposalHandle createTddRefactorCompletion(String markerContents, IImageHandle iImageHandle, - String displayString, Object object, Object object2, int priorityCreate, IPyEdit edit, - int locationStrategyBeforeCurrent, List parametersAfterCall, - /*PyCreateMethodOrField*/ Object pyCreateMethod, + ICompletionProposalHandle createTddRefactorCompletion(String replacementString, IImageHandle image, + String displayString, + /*IContextInformation*/Object contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, + int locationStrategy, List parametersAfterCall, /*PyCreateMethodOrField*/Object pyCreateAction, PySelection ps); - ICompletionProposalHandle createTddRefactorCompletionInModule(String string, IImageHandle iImageHandle, - String displayString, Object object, String displayString2, int priorityCreate, IPyEdit edit, File file, - List parametersAfterCall, /*PyCreateMethodOrField*/ Object pyCreateMethod, PySelection callPs, - int locationStrategyFirstMethod); + ICompletionProposalHandle createTddRefactorCompletionInModule(String replacementString, IImageHandle image, + String displayString, + /*IContextInformation*/ Object contextInformation, String additionalProposalInfo, int priority, + IPyEdit edit, + File module, List parametersAfterCall, /*AbstractPyCreateAction*/ Object pyCreateAction, + PySelection ps, + int locationStrategy); } \ No newline at end of file diff --git a/plugins/org.python.pydev/META-INF/MANIFEST.MF b/plugins/org.python.pydev/META-INF/MANIFEST.MF index f705285159..8123e810aa 100644 --- a/plugins/org.python.pydev/META-INF/MANIFEST.MF +++ b/plugins/org.python.pydev/META-INF/MANIFEST.MF @@ -50,6 +50,7 @@ Export-Package: com.python.pydev.actions, com.python.pydev.analysis.ctrl_1, com.python.pydev.analysis.indexview, com.python.pydev.analysis.ui, + com.python.pydev.refactoring.tdd.completions, com.python.pydev.ui.hierarchy, org.python.copiedfromeclipsesrc, org.python.pydev.ast.codecompletion, diff --git a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/AbstractTddRefactorCompletion.java b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/AbstractTddRefactorCompletion.java similarity index 98% rename from plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/AbstractTddRefactorCompletion.java rename to plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/AbstractTddRefactorCompletion.java index 6b15436f5e..8f35b9c1ea 100644 --- a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/AbstractTddRefactorCompletion.java +++ b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/AbstractTddRefactorCompletion.java @@ -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.refactoring.tdd.completions; import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2; import org.eclipse.jface.text.contentassist.IContextInformation; diff --git a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletion.java b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletion.java similarity index 96% rename from plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletion.java rename to plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletion.java index a8f0607c3b..096d88862a 100644 --- a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletion.java +++ b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletion.java @@ -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.refactoring.tdd.completions; import java.util.List; @@ -39,7 +39,7 @@ public final class TddRefactorCompletion extends AbstractTddRefactorCompletion { private PySelection ps; private TemplateInfo templateInfo; - TddRefactorCompletion(String replacementString, IImageHandle image, String displayString, + public TddRefactorCompletion(String replacementString, IImageHandle image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, int locationStrategy, List parametersAfterCall, AbstractPyCreateAction pyCreateAction, PySelection ps) { diff --git a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletionInInexistentModule.java b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletionInInexistentModule.java similarity index 99% rename from plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletionInInexistentModule.java rename to plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletionInInexistentModule.java index 067b49eaa3..0bdcc4d0d2 100644 --- a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletionInInexistentModule.java +++ b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletionInInexistentModule.java @@ -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.refactoring.tdd.completions; import java.io.ByteArrayInputStream; import java.io.File; diff --git a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletionInModule.java b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletionInModule.java similarity index 98% rename from plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletionInModule.java rename to plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletionInModule.java index 734987c0d8..593bfa45f8 100644 --- a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddRefactorCompletionInModule.java +++ b/plugins/org.python.pydev/src/com/python/pydev/refactoring/tdd/completions/TddRefactorCompletionInModule.java @@ -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.refactoring.tdd.completions; import java.io.File; import java.util.List; diff --git a/plugins/org.python.pydev/src/org/python/pydev/editor/codecompletion/proposals/DefaultCompletionProposalFactory.java b/plugins/org.python.pydev/src/org/python/pydev/editor/codecompletion/proposals/DefaultCompletionProposalFactory.java index fcb299c90b..1eedb09aad 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/editor/codecompletion/proposals/DefaultCompletionProposalFactory.java +++ b/plugins/org.python.pydev/src/org/python/pydev/editor/codecompletion/proposals/DefaultCompletionProposalFactory.java @@ -1,5 +1,6 @@ package org.python.pydev.editor.codecompletion.proposals; +import java.io.File; import java.util.List; import org.eclipse.jface.text.IRegion; @@ -35,6 +36,10 @@ import org.python.pydev.shared_core.string.FastStringBuffer; import org.python.pydev.shared_ui.ImageCache; +import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateAction; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion; +import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule; + public class DefaultCompletionProposalFactory implements ICompletionProposalFactory { @Override @@ -273,4 +278,31 @@ public ICompletionProposalHandle createMoveImportsToLocalCompletionProposal(Obje importHandleInfo, iImageHandle, displayString); } + @Override + public ICompletionProposalHandle createTddRefactorCompletion(String replacementString, IImageHandle image, + String displayString, + /*IContextInformation*/ Object contextInformation, String additionalProposalInfo, int priority, + IPyEdit edit, + int locationStrategy, List parametersAfterCall, /*AbstractPyCreateAction*/ Object pyCreateAction, + PySelection ps) { + return new TddRefactorCompletion(replacementString, image, displayString, + (IContextInformation) contextInformation, additionalProposalInfo, + priority, edit, locationStrategy, parametersAfterCall, (AbstractPyCreateAction) pyCreateAction, ps); + } + + @Override + public ICompletionProposalHandle createTddRefactorCompletionInModule(String replacementString, IImageHandle image, + String displayString, + /*IContextInformation*/ Object contextInformation, String additionalProposalInfo, int priority, + IPyEdit edit, + File module, List parametersAfterCall, /*AbstractPyCreateAction*/ Object pyCreateAction, + PySelection ps, + int locationStrategy) { + return new TddRefactorCompletionInModule(replacementString, image, displayString, + (IContextInformation) contextInformation, + additionalProposalInfo, priority, edit, module, parametersAfterCall, + (AbstractPyCreateAction) pyCreateAction, ps, + locationStrategy); + } + }