diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AbstractAnalysisPreferences.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AbstractAnalysisPreferences.java index 6cc650c400..b6a7983b41 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AbstractAnalysisPreferences.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AbstractAnalysisPreferences.java @@ -9,7 +9,7 @@ import java.util.HashMap; import java.util.Map; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisPreferences; public abstract class AbstractAnalysisPreferences implements IAnalysisPreferences { diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferences.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferences.java index 27f26c6daf..7d915a5da1 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferences.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferences.java @@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.preferences.PydevPrefs; import org.python.pydev.shared_core.SharedCorePlugin; import org.python.pydev.shared_core.preferences.IScopedPreferences; @@ -119,7 +119,7 @@ private Map getSeverityTypeMap() { /** * return the severity based on the user-set values * - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#getSeverityForType(int) + * @see org.python.pydev.core.IAnalysisPreferences#getSeverityForType(int) */ @Override public int getSeverityForType(int type) { @@ -134,7 +134,7 @@ public int getSeverityForType(int type) { /** * yeah, we always do code analysis... * - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#makeCodeAnalysis() + * @see org.python.pydev.core.IAnalysisPreferences#makeCodeAnalysis() */ @Override public boolean makeCodeAnalysis() { @@ -147,7 +147,7 @@ public boolean makeCodeAnalysis() { } /** - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#getNamesIgnoredByUnusedVariable() + * @see org.python.pydev.core.IAnalysisPreferences#getNamesIgnoredByUnusedVariable() */ @Override public Set getNamesIgnoredByUnusedVariable() { @@ -177,7 +177,7 @@ private Set getSetOfNames(String preferencesName) { } /** - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#getModuleNamePatternsToBeIgnored() + * @see org.python.pydev.core.IAnalysisPreferences#getModuleNamePatternsToBeIgnored() */ @Override public Set getModuleNamePatternsToBeIgnored() { diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/OccurrencesAnalyzer.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/OccurrencesAnalyzer.java index 205da706cd..71caab3c6b 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/OccurrencesAnalyzer.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/OccurrencesAnalyzer.java @@ -16,10 +16,10 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jface.text.IDocument; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.analysis.messages.IMessage; import org.python.pydev.ast.analysis.messages.Message; import org.python.pydev.ast.codecompletion.revisited.modules.SourceModule; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IIndentPrefs; import org.python.pydev.core.IPythonNature; import org.python.pydev.core.log.Log; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/additionalinfo/builders/AnalysisBuilderRunnable.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/additionalinfo/builders/AnalysisBuilderRunnable.java index f2a8d617aa..cf26ce424d 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/additionalinfo/builders/AnalysisBuilderRunnable.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/additionalinfo/builders/AnalysisBuilderRunnable.java @@ -20,11 +20,11 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jface.text.IDocument; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.analysis.messages.IMessage; import org.python.pydev.ast.builder.PyDevBuilderVisitor; import org.python.pydev.ast.codecompletion.revisited.modules.SourceModule; import org.python.pydev.core.CheckAnalysisErrors; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IModule; import org.python.pydev.core.IPythonNature; import org.python.pydev.core.MisconfigurationException; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pep8/Pep8Visitor.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pep8/Pep8Visitor.java index 2df13c7fbd..4ab7dbd0ad 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pep8/Pep8Visitor.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pep8/Pep8Visitor.java @@ -15,12 +15,12 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.analysis.messages.IMessage; import org.python.pydev.ast.analysis.messages.Message; import org.python.pydev.ast.codecompletion.revisited.modules.SourceModule; import org.python.pydev.core.CheckAnalysisErrors; import org.python.pydev.core.CorePlugin; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.core.log.Log; import org.python.pydev.core.pep8.Pep8Runner; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/tabnanny/TabNanny.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/tabnanny/TabNanny.java index 0926d18f8c..b4e4b3f85e 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/tabnanny/TabNanny.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/tabnanny/TabNanny.java @@ -14,9 +14,9 @@ import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.analysis.messages.IMessage; import org.python.pydev.ast.analysis.messages.Message; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IIndentPrefs; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.core.docutils.TabNannyDocIterator; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/DuplicationChecker.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/DuplicationChecker.java index eeaccade11..914f65f0f9 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/DuplicationChecker.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/DuplicationChecker.java @@ -12,9 +12,9 @@ import java.util.HashMap; import java.util.Map; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.codecompletion.revisited.modules.SourceToken; import org.python.pydev.ast.codecompletion.revisited.visitors.AbstractVisitor; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IModule; import org.python.pydev.core.IPythonNature; import org.python.pydev.parser.jython.SimpleNode; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/MessagesManager.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/MessagesManager.java index 4de3f05bee..aed4a2d495 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/MessagesManager.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/MessagesManager.java @@ -18,7 +18,6 @@ import org.eclipse.core.resources.IMarker; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.analysis.messages.CompositeMessage; import org.python.pydev.ast.analysis.messages.IMessage; import org.python.pydev.ast.analysis.messages.Message; @@ -26,6 +25,7 @@ import org.python.pydev.ast.codecompletion.revisited.visitors.AbstractVisitor; import org.python.pydev.ast.codecompletion.revisited.visitors.AbstractVisitor.ImportPartSourceToken; import org.python.pydev.core.CheckAnalysisErrors; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IToken; import org.python.pydev.core.docutils.ParsingUtils; import org.python.pydev.core.docutils.PySelection; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/NoSelfChecker.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/NoSelfChecker.java index ca9f9cfec3..08ba6a215c 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/NoSelfChecker.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/NoSelfChecker.java @@ -12,9 +12,9 @@ import java.util.HashMap; import java.util.Map; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.codecompletion.revisited.modules.SourceToken; import org.python.pydev.ast.codecompletion.revisited.visitors.AbstractVisitor; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.ICompletionCache; import org.python.pydev.core.IModule; import org.python.pydev.parser.jython.ast.Assign; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/OccurrencesVisitor.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/OccurrencesVisitor.java index dc15d3b8a1..be3744c907 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/OccurrencesVisitor.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/OccurrencesVisitor.java @@ -19,12 +19,12 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.analysis.messages.IMessage; import org.python.pydev.ast.analysis.messages.Message; import org.python.pydev.ast.codecompletion.revisited.modules.SourceToken; import org.python.pydev.ast.codecompletion.revisited.visitors.AbstractVisitor; import org.python.pydev.ast.codecompletion.revisited.visitors.Definition; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IDefinition; import org.python.pydev.core.IModule; import org.python.pydev.core.IPythonNature; diff --git a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixParticipant.java b/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixParticipant.java index 7fbb366194..393bfbdcef 100644 --- a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixParticipant.java +++ b/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/tdd/TddQuickFixParticipant.java @@ -11,12 +11,10 @@ import java.util.HashSet; import java.util.List; -import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.codecompletion.revisited.CompletionCache; import org.python.pydev.ast.codecompletion.revisited.CompletionState; import org.python.pydev.ast.codecompletion.revisited.CompletionStateFactory; @@ -25,9 +23,12 @@ import org.python.pydev.ast.codecompletion.revisited.visitors.Definition; import org.python.pydev.ast.refactoring.PyRefactoringFindDefinition; import org.python.pydev.ast.refactoring.RefactoringRequest; +import org.python.pydev.core.IAnalysisMarkersParticipant; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.ICodeCompletionASTManager; import org.python.pydev.core.ICompletionState; import org.python.pydev.core.IDefinition; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IModule; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IPythonNature; @@ -38,7 +39,6 @@ import org.python.pydev.core.log.Log; import org.python.pydev.core.preferences.FileTypesPreferences; import org.python.pydev.core.structure.CompletionRecursionException; -import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; import org.python.pydev.parser.jython.SimpleNode; import org.python.pydev.parser.jython.ast.ClassDef; import org.python.pydev.parser.visitors.NodeUtils; @@ -54,8 +54,6 @@ import org.python.pydev.shared_core.structure.Tuple; import org.python.pydev.shared_ui.SharedUiPlugin; -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; @@ -79,7 +77,7 @@ public TddQuickFixParticipant() { } @Override - public void addProps(MarkerAnnotationAndPosition markerAnnotation, IAnalysisPreferences analysisPreferences, + public void addProps(IMarkerInfoForAnalysis markerInfo, IAnalysisPreferences analysisPreferences, String line, PySelection ps, int offset, IPythonNature nature, IPyEdit edit, List props) throws BadLocationException, CoreException { @@ -92,13 +90,13 @@ public void addProps(MarkerAnnotationAndPosition markerAnnotation, IAnalysisPref return; } - if (markerAnnotation.position == null) { + if (!markerInfo.hasPosition()) { return; } - IMarker marker = markerAnnotation.markerAnnotation.getMarker(); - Integer id = (Integer) marker.getAttribute(AnalysisRunner.PYDEV_ANALYSIS_TYPE); - int start = markerAnnotation.position.offset; - int end = start + markerAnnotation.position.length; + Integer id = markerInfo.getPyDevAnalisysType(); + int start = markerInfo.getOffset(); + int end = start + markerInfo.getLength(); + ps.setSelection(start, end); String markerContents; try { diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/AbstractMessage.java b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/AbstractMessage.java index 8ee7972383..522ce40b88 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/AbstractMessage.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/AbstractMessage.java @@ -18,9 +18,9 @@ import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.codecompletion.revisited.modules.SourceToken; import org.python.pydev.ast.codecompletion.revisited.visitors.AbstractVisitor; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IToken; import org.python.pydev.parser.jython.SimpleNode; import org.python.pydev.parser.jython.ast.Import; diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/CompositeMessage.java b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/CompositeMessage.java index 49901785d7..81e4269a73 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/CompositeMessage.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/CompositeMessage.java @@ -14,7 +14,7 @@ import java.util.Iterator; import java.util.List; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IToken; import org.python.pydev.shared_core.string.FastStringBuffer; diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/IMessage.java b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/IMessage.java index 6071b89cf1..1681140609 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/IMessage.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/IMessage.java @@ -25,21 +25,21 @@ public interface IMessage { int getSeverity(); /** - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_DUPLICATED_SIGNATURE - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_NO_SELF - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_REIMPORT - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_UNDEFINED_VARIABLE - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_UNRESOLVED_IMPORT - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_UNUSED_IMPORT - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_UNUSED_VARIABLE - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_UNUSED_PARAMETER - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_UNUSED_WILD_IMPORT - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_USED_WILD_IMPORT - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_NO_EFFECT_STMT - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_INDENTATION_PROBLEM - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_PEP8 - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_ARGUMENTS_MISATCH - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#TYPE_INVALID_ENCODING + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_DUPLICATED_SIGNATURE + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_NO_SELF + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_REIMPORT + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_UNDEFINED_VARIABLE + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_UNRESOLVED_IMPORT + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_UNUSED_IMPORT + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_UNUSED_VARIABLE + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_UNUSED_PARAMETER + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_UNUSED_WILD_IMPORT + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_USED_WILD_IMPORT + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_NO_EFFECT_STMT + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_INDENTATION_PROBLEM + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_PEP8 + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_ARGUMENTS_MISATCH + * @see org.python.pydev.core.IAnalysisPreferences#TYPE_INVALID_ENCODING * * @return this message type */ diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/Message.java b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/Message.java index 8477ed5a84..d986b689ec 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/Message.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/messages/Message.java @@ -10,7 +10,7 @@ package org.python.pydev.ast.analysis.messages; import org.eclipse.core.runtime.Assert; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IToken; public class Message extends AbstractMessage { diff --git a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/IAnalysisMarkersParticipant.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/IAnalysisMarkersParticipant.java similarity index 81% rename from plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/IAnalysisMarkersParticipant.java rename to plugins/org.python.pydev.core/src/org/python/pydev/core/IAnalysisMarkersParticipant.java index 7b89a3aeab..04f1b944b9 100644 --- a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/IAnalysisMarkersParticipant.java +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/IAnalysisMarkersParticipant.java @@ -7,17 +7,13 @@ /* * Created on 24/09/2005 */ -package com.python.pydev.analysis.ctrl_1; +package org.python.pydev.core; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.BadLocationException; -import org.python.pydev.ast.analysis.IAnalysisPreferences; -import org.python.pydev.core.IPyEdit; -import org.python.pydev.core.IPythonNature; import org.python.pydev.core.docutils.PySelection; -import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; import org.python.pydev.shared_core.code_completion.ICompletionProposalHandle; public interface IAnalysisMarkersParticipant { @@ -38,7 +34,7 @@ public interface IAnalysisMarkersParticipant { * @throws BadLocationException * @throws CoreException */ - public abstract void addProps(MarkerAnnotationAndPosition marker, IAnalysisPreferences analysisPreferences, + public abstract void addProps(IMarkerInfoForAnalysis markerInfo, IAnalysisPreferences analysisPreferences, String line, PySelection ps, int offset, IPythonNature nature, IPyEdit edit, List props) throws BadLocationException, CoreException; diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/IAnalysisPreferences.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/IAnalysisPreferences.java similarity index 99% rename from plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/IAnalysisPreferences.java rename to plugins/org.python.pydev.core/src/org/python/pydev/core/IAnalysisPreferences.java index ae2630bc86..e5ad44975c 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/analysis/IAnalysisPreferences.java +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/IAnalysisPreferences.java @@ -7,7 +7,7 @@ /* * Created on 24/07/2005 */ -package org.python.pydev.ast.analysis; +package org.python.pydev.core; import java.util.Set; diff --git a/plugins/org.python.pydev.core/src/org/python/pydev/core/IMarkerInfoForAnalysis.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/IMarkerInfoForAnalysis.java new file mode 100644 index 0000000000..ee8e080424 --- /dev/null +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/IMarkerInfoForAnalysis.java @@ -0,0 +1,20 @@ +package org.python.pydev.core; + +public interface IMarkerInfoForAnalysis { + + Object getPyLintMessageIdAttribute(); + + Integer getPyDevAnalisysType(); + + boolean hasPosition(); + + int getOffset(); + + int getLength(); + + void delete(); + + Object getFlake8MessageId(); + + Object getMessage(); +} 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 1f725835a9..26e887550d 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 @@ -2,11 +2,11 @@ import java.util.List; -import org.eclipse.core.resources.IMarker; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.templates.Template; import org.eclipse.jface.text.templates.TemplateContext; import org.python.pydev.core.ICompletionRequest; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IToken; import org.python.pydev.core.ShellId; @@ -34,13 +34,13 @@ ICompletionProposalHandle createIgnorePyLintCompletionProposalInSameLine( String replacementString, int replacementOffset, int replacementLength, int cursorPosition, IImageHandle image, String displayString, Object contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, String line, PySelection ps, FormatStd format, - IMarker marker); + IMarkerInfoForAnalysis marker); ICompletionProposalHandle createIgnoreFlake8CompletionProposalInSameLine( String replacementString, int replacementOffset, int replacementLength, int cursorPosition, IImageHandle image, String displayString, Object contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, String line, PySelection ps, FormatStd format, - IMarker marker); + IMarkerInfoForAnalysis marker); ICompletionProposalHandle createPyTemplateProposal(Template template, TemplateContext context, IRegion region, IImageHandle image, int relevance); diff --git a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/AbstractAnalysisMarkersParticipants.java b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/AbstractAnalysisMarkersParticipants.java index f13555b97e..339bf92bfa 100644 --- a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/AbstractAnalysisMarkersParticipants.java +++ b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/AbstractAnalysisMarkersParticipants.java @@ -11,7 +11,8 @@ import java.util.List; import org.eclipse.jface.text.BadLocationException; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisMarkersParticipant; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.IAssistProps; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IPythonNature; @@ -67,7 +68,8 @@ public List getProps(PySelection ps, IImageCache imag for (MarkerAnnotationAndPosition marker : markersAtLine) { for (IAnalysisMarkersParticipant participant : participants) { try { - participant.addProps(marker, analysisPreferences, currLine, ps, offset, nature, edit, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), analysisPreferences, currLine, ps, + offset, nature, edit, props); } catch (Exception e) { Log.log("Error when getting proposals.", e); } diff --git a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/IgnoreErrorParticipant.java b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/IgnoreErrorParticipant.java index b71052e3b9..2e4b029e02 100644 --- a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/IgnoreErrorParticipant.java +++ b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/IgnoreErrorParticipant.java @@ -17,22 +17,21 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.BadLocationException; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.core.CheckAnalysisErrors; +import org.python.pydev.core.IAnalysisMarkersParticipant; +import org.python.pydev.core.IAnalysisPreferences; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IPythonNature; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.core.formatter.FormatStd; import org.python.pydev.core.proposals.CompletionProposalFactory; -import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; import org.python.pydev.shared_core.code_completion.ICompletionProposalHandle; import org.python.pydev.shared_core.code_completion.IPyCompletionProposal; import org.python.pydev.shared_core.image.IImageCache; import org.python.pydev.shared_core.image.UIConstants; import org.python.pydev.shared_ui.SharedUiPlugin; -import com.python.pydev.analysis.additionalinfo.builders.AnalysisRunner; - public class IgnoreErrorParticipant implements IAnalysisMarkersParticipant { private Set handled = new HashSet<>(); @@ -51,11 +50,11 @@ public IgnoreErrorParticipant() { } @Override - public void addProps(MarkerAnnotationAndPosition marker, IAnalysisPreferences analysisPreferences, + public void addProps(IMarkerInfoForAnalysis markerInfo, IAnalysisPreferences analysisPreferences, final String line, final PySelection ps, int offset, IPythonNature nature, final IPyEdit edit, List props) throws BadLocationException, CoreException { - Integer id = (Integer) marker.markerAnnotation.getMarker().getAttribute(AnalysisRunner.PYDEV_ANALYSIS_TYPE); + Integer id = markerInfo.getPyDevAnalisysType(); if (handled.contains(id)) { return; } diff --git a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipant.java b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipant.java index 3cbf00ef54..e60577a0da 100644 --- a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipant.java +++ b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipant.java @@ -11,18 +11,17 @@ import java.util.List; -import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.BadLocationException; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisMarkersParticipant; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.ICodeCompletionASTManager; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IPythonNature; import org.python.pydev.core.docutils.PySelection; -import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; import org.python.pydev.shared_core.code_completion.ICompletionProposalHandle; -import com.python.pydev.analysis.additionalinfo.builders.AnalysisRunner; import com.python.pydev.analysis.refactoring.quick_fixes.UndefinedVariableQuickFixCreator; /** @@ -46,12 +45,11 @@ public UndefinedVariableFixParticipant(boolean forceReparseOnApply) { } @Override - public void addProps(MarkerAnnotationAndPosition markerAnnotation, IAnalysisPreferences analysisPreferences, + public void addProps(IMarkerInfoForAnalysis markerInfoForAnalysis, IAnalysisPreferences analysisPreferences, String line, PySelection ps, int offset, IPythonNature initialNature, IPyEdit edit, List props) throws BadLocationException, CoreException { - IMarker marker = markerAnnotation.markerAnnotation.getMarker(); - Integer id = (Integer) marker.getAttribute(AnalysisRunner.PYDEV_ANALYSIS_TYPE); + Integer id = markerInfoForAnalysis.getPyDevAnalisysType(); if (id != IAnalysisPreferences.TYPE_UNDEFINED_VARIABLE) { return; } @@ -63,11 +61,11 @@ public void addProps(MarkerAnnotationAndPosition markerAnnotation, IAnalysisPref return; } - if (markerAnnotation.position == null) { + if (!markerInfoForAnalysis.hasPosition()) { return; } - int start = markerAnnotation.position.offset; - int end = start + markerAnnotation.position.length; + int start = markerInfoForAnalysis.getOffset(); + int end = start + markerInfoForAnalysis.getLength(); UndefinedVariableQuickFixCreator.createImportQuickProposalsFromMarkerSelectedText(edit, ps, offset, initialNature, props, astManager, start, end, forceReparseOnApply); } diff --git a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/flake8/Flake8IgnoreErrorParticipant.java b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/flake8/Flake8IgnoreErrorParticipant.java index 97d824690b..9bee6b2eeb 100644 --- a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/flake8/Flake8IgnoreErrorParticipant.java +++ b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/flake8/Flake8IgnoreErrorParticipant.java @@ -10,25 +10,22 @@ import java.util.List; import java.util.Set; -import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.BadLocationException; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.core.CheckAnalysisErrors; +import org.python.pydev.core.IAnalysisMarkersParticipant; +import org.python.pydev.core.IAnalysisPreferences; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IPythonNature; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.core.formatter.FormatStd; import org.python.pydev.core.proposals.CompletionProposalFactory; -import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; -import org.python.pydev.shared_core.IMiscConstants; import org.python.pydev.shared_core.code_completion.ICompletionProposalHandle; import org.python.pydev.shared_core.code_completion.IPyCompletionProposal; import org.python.pydev.shared_core.image.UIConstants; import org.python.pydev.shared_ui.SharedUiPlugin; -import com.python.pydev.analysis.ctrl_1.IAnalysisMarkersParticipant; - public class Flake8IgnoreErrorParticipant implements IAnalysisMarkersParticipant { private Set handled = new HashSet<>(); @@ -47,13 +44,12 @@ public Flake8IgnoreErrorParticipant() { } @Override - public void addProps(MarkerAnnotationAndPosition marker, IAnalysisPreferences analysisPreferences, + public void addProps(IMarkerInfoForAnalysis markerInfo, IAnalysisPreferences analysisPreferences, final String line, final PySelection ps, int offset, IPythonNature nature, final IPyEdit edit, List props) throws BadLocationException, CoreException { - IMarker m = marker.markerAnnotation.getMarker(); - Object attribute = m.getAttribute(IMiscConstants.FLAKE8_MESSAGE_ID); - Object message = m.getAttribute(IMarker.MESSAGE); + Object attribute = markerInfo.getFlake8MessageId(); + Object message = markerInfo.getMessage(); if (attribute == null || message == null) { return; } @@ -75,7 +71,7 @@ public void addProps(MarkerAnnotationAndPosition marker, IAnalysisPreferences an messageId, ps.getEndLineOffset(), 0, offset, SharedUiPlugin.getImageCache().get(UIConstants.ASSIST_ANNOTATION), displayString, null, - null, IPyCompletionProposal.PRIORITY_DEFAULT, edit, line, ps, format, m); + null, IPyCompletionProposal.PRIORITY_DEFAULT, edit, line, ps, format, markerInfo); props.add(proposal); } } diff --git a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/pylint/PyLintIgnoreErrorParticipant.java b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/pylint/PyLintIgnoreErrorParticipant.java index e450442698..d45af6ad0e 100644 --- a/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/pylint/PyLintIgnoreErrorParticipant.java +++ b/plugins/org.python.pydev/src/com/python/pydev/analysis/ctrl_1/pylint/PyLintIgnoreErrorParticipant.java @@ -10,25 +10,22 @@ import java.util.List; import java.util.Set; -import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.BadLocationException; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.core.CheckAnalysisErrors; +import org.python.pydev.core.IAnalysisMarkersParticipant; +import org.python.pydev.core.IAnalysisPreferences; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IPythonNature; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.core.formatter.FormatStd; import org.python.pydev.core.proposals.CompletionProposalFactory; -import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; -import org.python.pydev.shared_core.IMiscConstants; import org.python.pydev.shared_core.code_completion.ICompletionProposalHandle; import org.python.pydev.shared_core.code_completion.IPyCompletionProposal; import org.python.pydev.shared_core.image.UIConstants; import org.python.pydev.shared_ui.SharedUiPlugin; -import com.python.pydev.analysis.ctrl_1.IAnalysisMarkersParticipant; - public class PyLintIgnoreErrorParticipant implements IAnalysisMarkersParticipant { private Set handled = new HashSet<>(); @@ -48,15 +45,14 @@ public PyLintIgnoreErrorParticipant() { /** * @throws CoreException - * @see org.python.pydev.ast.analysis.ctrl_1.IAnalysisMarkersParticipant#addProps(org.eclipse.core.resources.IMarker, org.python.pydev.ast.analysis.IAnalysisPreferences, java.lang.String, org.python.pydev.core.docutils.PySelection, int, org.python.pydev.editor.PyEdit, java.util.List) + * @see org.python.pydev.core.ctrl_1.IAnalysisMarkersParticipant#addProps(org.eclipse.core.resources.IMarker, org.python.pydev.core.IAnalysisPreferences, java.lang.String, org.python.pydev.core.docutils.PySelection, int, org.python.pydev.editor.PyEdit, java.util.List) */ @Override - public void addProps(MarkerAnnotationAndPosition marker, IAnalysisPreferences analysisPreferences, + public void addProps(IMarkerInfoForAnalysis markerInfo, IAnalysisPreferences analysisPreferences, final String line, final PySelection ps, int offset, IPythonNature nature, final IPyEdit edit, List props) throws BadLocationException, CoreException { - IMarker m = marker.markerAnnotation.getMarker(); - Object attribute = m.getAttribute(IMiscConstants.PYLINT_MESSAGE_ID); + Object attribute = markerInfo.getPyLintMessageIdAttribute(); if (attribute == null) { return; } @@ -75,7 +71,7 @@ public void addProps(MarkerAnnotationAndPosition marker, IAnalysisPreferences an messageId, ps.getEndLineOffset(), 0, offset, SharedUiPlugin.getImageCache().get(UIConstants.ASSIST_ANNOTATION), "pylint: disable=" + messageId, null, - null, IPyCompletionProposal.PRIORITY_DEFAULT, edit, line, ps, format, m); + null, IPyCompletionProposal.PRIORITY_DEFAULT, edit, line, ps, format, markerInfo); props.add(proposal); } } diff --git a/plugins/org.python.pydev/src/com/python/pydev/analysis/organizeimports/OrganizeImports.java b/plugins/org.python.pydev/src/com/python/pydev/analysis/organizeimports/OrganizeImports.java index 7035e57f09..24598908a6 100644 --- a/plugins/org.python.pydev/src/com/python/pydev/analysis/organizeimports/OrganizeImports.java +++ b/plugins/org.python.pydev/src/com/python/pydev/analysis/organizeimports/OrganizeImports.java @@ -29,8 +29,8 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.python.pydev.ast.analysis.IAnalysisPreferences; import org.python.pydev.ast.codecompletion.ProposalsComparator; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.core.log.Log; import org.python.pydev.editor.PyEdit; @@ -120,7 +120,8 @@ public boolean beforePerformArrangeImports(final PySelection ps, final PyEdit ed if (treatedVars.contains(string)) { continue; } - variableFixParticipant.addProps(marker, null, null, ps, start, edit.getPythonNature(), edit, + variableFixParticipant.addProps(marker.asMarkerInfoForAnalysis(), null, null, ps, start, + edit.getPythonNature(), edit, props); if (props.size() > 0) { 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 2e989e1b02..fcb299c90b 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 @@ -2,7 +2,6 @@ import java.util.List; -import org.eclipse.core.resources.IMarker; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.templates.Template; @@ -10,6 +9,7 @@ import org.eclipse.swt.widgets.Display; import org.python.pydev.ast.refactoring.RefactoringRequest; import org.python.pydev.core.ICompletionRequest; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.IToken; import org.python.pydev.core.ShellId; @@ -56,7 +56,7 @@ public ICompletionProposalHandle createIgnorePyLintCompletionProposalInSameLine( String replacementString, int replacementOffset, int replacementLength, int cursorPosition, IImageHandle image, String displayString, Object contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, String line, PySelection ps, FormatStd format, - IMarker marker) { + IMarkerInfoForAnalysis marker) { return new IgnorePyLintCompletionProposalInSameLine(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, (IContextInformation) contextInformation, additionalProposalInfo, priority, edit, line, @@ -68,7 +68,7 @@ public ICompletionProposalHandle createIgnoreFlake8CompletionProposalInSameLine( String replacementString, int replacementOffset, int replacementLength, int cursorPosition, IImageHandle image, String displayString, Object contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, String line, PySelection ps, FormatStd format, - IMarker marker) { + IMarkerInfoForAnalysis marker) { return new IgnoreFlake8CompletionProposalInSameLine(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, (IContextInformation) contextInformation, additionalProposalInfo, priority, edit, line, diff --git a/plugins/org.python.pydev/src/org/python/pydev/editor/codefolding/MarkerAnnotationAndPosition.java b/plugins/org.python.pydev/src/org/python/pydev/editor/codefolding/MarkerAnnotationAndPosition.java index d6ecca4fe6..af92ba3b5b 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/editor/codefolding/MarkerAnnotationAndPosition.java +++ b/plugins/org.python.pydev/src/org/python/pydev/editor/codefolding/MarkerAnnotationAndPosition.java @@ -6,14 +6,93 @@ */ package org.python.pydev.editor.codefolding; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.Position; import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; +import org.python.pydev.core.IMarkerInfoForAnalysis; +import org.python.pydev.core.log.Log; +import org.python.pydev.shared_core.IMiscConstants; + +import com.python.pydev.analysis.additionalinfo.builders.AnalysisRunner; /** * This class bundles the marker annotation and a related position. */ public class MarkerAnnotationAndPosition { + public IMarkerInfoForAnalysis asMarkerInfoForAnalysis() { + return new IMarkerInfoForAnalysis() { + + @Override + public Object getPyLintMessageIdAttribute() { + return getAttribute(IMiscConstants.PYLINT_MESSAGE_ID); + } + + private Object getAttribute(String attr) { + IMarker marker = markerAnnotation.getMarker(); + Object attribute; + try { + attribute = marker.getAttribute(attr); + } catch (Exception e) { + Log.log(e); + return null; + } + return attribute; + } + + @Override + public Integer getPyDevAnalisysType() { + IMarker marker = markerAnnotation.getMarker(); + Integer id; + try { + id = (Integer) marker.getAttribute(AnalysisRunner.PYDEV_ANALYSIS_TYPE); + } catch (Exception e) { + Log.log(e); + return null; + } + return id; + } + + @Override + public Object getFlake8MessageId() { + return getAttribute(IMiscConstants.FLAKE8_MESSAGE_ID); + } + + @Override + public Object getMessage() { + return getAttribute(IMarker.MESSAGE); + } + + @Override + public boolean hasPosition() { + return position != null; + } + + @Override + public int getOffset() { + return position.offset; + } + + @Override + public int getLength() { + return position.length; + } + + @Override + public void delete() { + IMarker marker = markerAnnotation.getMarker(); + if (marker != null) { + try { + marker.delete(); + } catch (CoreException e) { + Log.log(e); + } + } + } + }; + } + public final SimpleMarkerAnnotation markerAnnotation; /** * May be null! diff --git a/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnoreFlake8CompletionProposalInSameLine.java b/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnoreFlake8CompletionProposalInSameLine.java index 0913e16176..55ceb0587b 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnoreFlake8CompletionProposalInSameLine.java +++ b/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnoreFlake8CompletionProposalInSameLine.java @@ -1,10 +1,9 @@ package org.python.pydev.editor.correctionassist; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.contentassist.IContextInformation; import org.python.pydev.ast.formatter.PyFormatter; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.docutils.ParsingUtils; import org.python.pydev.core.docutils.PySelection; @@ -20,13 +19,13 @@ public class IgnoreFlake8CompletionProposalInSameLine extends IgnoreCompletionPr private String line; private PySelection ps; private FormatStd format; - private IMarker marker; + private IMarkerInfoForAnalysis marker; public IgnoreFlake8CompletionProposalInSameLine(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, IImageHandle image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, String line, PySelection ps, FormatStd format, - IMarker marker) { + IMarkerInfoForAnalysis marker) { super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, priority, edit); this.line = line; //the current line @@ -111,11 +110,7 @@ public void apply(IDocument document) { super.apply(document); if (this.marker != null) { - try { - this.marker.delete(); - } catch (CoreException e) { - Log.log(e); - } + this.marker.delete(); } } diff --git a/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnorePyLintCompletionProposalInSameLine.java b/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnorePyLintCompletionProposalInSameLine.java index 484d587f51..e706143846 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnorePyLintCompletionProposalInSameLine.java +++ b/plugins/org.python.pydev/src/org/python/pydev/editor/correctionassist/IgnorePyLintCompletionProposalInSameLine.java @@ -1,10 +1,9 @@ package org.python.pydev.editor.correctionassist; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.contentassist.IContextInformation; import org.python.pydev.ast.formatter.PyFormatter; +import org.python.pydev.core.IMarkerInfoForAnalysis; import org.python.pydev.core.IPyEdit; import org.python.pydev.core.docutils.ParsingUtils; import org.python.pydev.core.docutils.PySelection; @@ -20,13 +19,13 @@ public class IgnorePyLintCompletionProposalInSameLine extends IgnoreCompletionPr private String line; private PySelection ps; private FormatStd format; - private IMarker marker; + private IMarkerInfoForAnalysis marker; public IgnorePyLintCompletionProposalInSameLine(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, IImageHandle image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int priority, IPyEdit edit, String line, PySelection ps, FormatStd format, - IMarker marker) { + IMarkerInfoForAnalysis marker) { super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, priority, edit); this.line = line; //the current line @@ -111,11 +110,8 @@ public void apply(IDocument document) { super.apply(document); if (this.marker != null) { - try { - this.marker.delete(); - } catch (CoreException e) { - Log.log(e); - } + this.marker.delete(); + } } diff --git a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/AnalysisPreferencesStub.java b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/AnalysisPreferencesStub.java index f72cb91ae1..2a784bd9a1 100644 --- a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/AnalysisPreferencesStub.java +++ b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/AnalysisPreferencesStub.java @@ -115,7 +115,7 @@ public boolean makeCodeAnalysis() { } /** - * @see org.python.pydev.ast.analysis.IAnalysisPreferences#getNamesIgnoredByUnusedVariable() + * @see org.python.pydev.core.IAnalysisPreferences#getNamesIgnoredByUnusedVariable() */ @Override public Set getNamesIgnoredByUnusedVariable() { diff --git a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/OccurrencesAnalyzerTest.java b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/OccurrencesAnalyzerTest.java index e8dcefe70d..b36033e862 100644 --- a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/OccurrencesAnalyzerTest.java +++ b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/OccurrencesAnalyzerTest.java @@ -9,10 +9,10 @@ */ package com.python.pydev.analysis; -import static org.python.pydev.ast.analysis.IAnalysisPreferences.TYPE_DUPLICATED_SIGNATURE; -import static org.python.pydev.ast.analysis.IAnalysisPreferences.TYPE_UNDEFINED_VARIABLE; -import static org.python.pydev.ast.analysis.IAnalysisPreferences.TYPE_UNUSED_IMPORT; -import static org.python.pydev.ast.analysis.IAnalysisPreferences.TYPE_UNUSED_VARIABLE; +import static org.python.pydev.core.IAnalysisPreferences.TYPE_DUPLICATED_SIGNATURE; +import static org.python.pydev.core.IAnalysisPreferences.TYPE_UNDEFINED_VARIABLE; +import static org.python.pydev.core.IAnalysisPreferences.TYPE_UNUSED_IMPORT; +import static org.python.pydev.core.IAnalysisPreferences.TYPE_UNUSED_VARIABLE; import java.io.File; import java.io.IOException; diff --git a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/IgnoreErrorFixParticipantTest.java b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/IgnoreErrorFixParticipantTest.java index 44cb18f81f..e767a7b655 100644 --- a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/IgnoreErrorFixParticipantTest.java +++ b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/IgnoreErrorFixParticipantTest.java @@ -13,7 +13,7 @@ import java.util.List; import org.eclipse.jface.text.Document; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.core.formatter.FormatStd; import org.python.pydev.core.proposals.CompletionProposalFactory; @@ -82,7 +82,7 @@ public void testFix() throws Exception { ps = new PySelection(new Document(s)); line = s; offset = s.length(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); assertEquals("UndefinedVariable", props.get(0).getDisplayString()); @@ -102,7 +102,7 @@ public void testFix2() throws Exception { ps = new PySelection(new Document(s)); line = s; offset = s.length(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); assertEquals("UndefinedVariable", props.get(0).getDisplayString()); @@ -122,7 +122,7 @@ public void testFix3() throws Exception { ps = new PySelection(new Document(s)); line = s; offset = s.length(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); assertEquals("UndefinedVariable", props.get(0).getDisplayString()); @@ -142,7 +142,7 @@ public void testFix4() throws Exception { ps = new PySelection(new Document(s)); line = s; offset = s.length(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); assertEquals("UndefinedVariable", props.get(0).getDisplayString()); @@ -162,7 +162,7 @@ public void testFix5() throws Exception { ps = new PySelection(new Document(s)); line = s; offset = s.length(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); assertEquals("UndefinedVariable", props.get(0).getDisplayString()); diff --git a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipantTest.java b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipantTest.java index 03dd189f1b..84d939d8a7 100644 --- a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipantTest.java +++ b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/ctrl_1/UndefinedVariableFixParticipantTest.java @@ -13,7 +13,7 @@ import java.util.List; import org.eclipse.jface.text.Document; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.editor.codecompletion.proposals.CtxInsensitiveImportComplProposal; import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; @@ -74,7 +74,7 @@ public void testFix() throws Exception { ps = new PySelection(new Document(s)); line = s; offset = s.length(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); assertEquals("Import testlib", props.get(0).getDisplayString()); } @@ -95,7 +95,7 @@ public void testFix2() throws Exception { offset = s.length(); props = new ArrayList(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(2, props); assertContains("Import testlib.unittest", props); assertContains("Import testlib", props); @@ -115,7 +115,7 @@ public void testFix3() throws Exception { offset = s.length(); props = new ArrayList(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(3, props); assertContains("Import testlib.unittest.anothertest", props); assertContains("Import testlib.unittest", props); @@ -136,7 +136,7 @@ public void testFix4() throws Exception { offset = s.length(); props = new ArrayList(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(3, props); assertContains("Import testlib.unittest.anothertest", props); assertContains("Import testlib.unittest", props); @@ -158,7 +158,7 @@ public void testFix5() throws Exception { offset = s.length(); props = new ArrayList(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); assertContains("Import AnotherTest (testlib.unittest.anothertest)", props); @@ -178,7 +178,7 @@ public void testFix6() throws Exception { offset = s.length(); props = new ArrayList(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); //appears with __init__ assertContains("Import DTest (relative.rel1.__init__)", props); @@ -204,7 +204,7 @@ public void testFix7() throws Exception { offset = s.length(); props = new ArrayList(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); //appears with _ assertContains("Import Priv3 (relative.rel1._priv1._priv2._priv3)", props); @@ -230,7 +230,7 @@ public void testFix8() throws Exception { offset = s.length(); props = new ArrayList(); - participant.addProps(marker, prefs, line, ps, offset, nature, null, props); + participant.addProps(marker.asMarkerInfoForAnalysis(), prefs, line, ps, offset, nature, null, props); printProps(1, props); //appears with _ assertContains("Import NotPriv3 (relative.rel1._priv1._priv2.notpriv3)", props); diff --git a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/organizeimports/OrganizeImportsTest.java b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/organizeimports/OrganizeImportsTest.java index 3db7fb691e..78dfe78740 100644 --- a/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/organizeimports/OrganizeImportsTest.java +++ b/plugins/org.python.pydev/tests_analysis/com/python/pydev/analysis/organizeimports/OrganizeImportsTest.java @@ -10,7 +10,7 @@ package com.python.pydev.analysis.organizeimports; import org.eclipse.jface.text.Document; -import org.python.pydev.ast.analysis.IAnalysisPreferences; +import org.python.pydev.core.IAnalysisPreferences; import org.python.pydev.editor.codefolding.MarkerAnnotationAndPosition; import com.python.pydev.analysis.additionalinfo.AdditionalInfoTestsBase; diff --git a/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/revisited/javaintegration/AbstractWorkbenchTestCase.java b/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/revisited/javaintegration/AbstractWorkbenchTestCase.java index c2ad8fa821..bdc840448e 100644 --- a/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/revisited/javaintegration/AbstractWorkbenchTestCase.java +++ b/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/revisited/javaintegration/AbstractWorkbenchTestCase.java @@ -112,7 +112,9 @@ public Boolean call(Tuple, List> arg) { NullProgressMonitor monitor = new NullProgressMonitor(); - createJythonInterpreterManager(monitor); + if (TestDependent.JYTHON_JAR_LOCATION != null) { + createJythonInterpreterManager(monitor); + } createPythonInterpreterManager(monitor); } } @@ -571,7 +573,7 @@ protected void createJunitJar(NullProgressMonitor monitor, IProject project) thr if (!junitJarFile.exists()) { FileUtils.copyFile(TestDependent.TEST_PYDEV_PLUGIN_LOC + - "tests_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration/junit.jar", + "tests_completions/org/python/pydev/ast/codecompletion/revisited/javaintegration/junit.jar", junitJarLocatioon); } project.refreshLocal(IResource.DEPTH_INFINITE, monitor); @@ -587,7 +589,7 @@ protected void createGrinderJar(NullProgressMonitor monitor, IProject project) t if (!grinderJarFile.exists()) { FileUtils.copyFile(TestDependent.TEST_PYDEV_PLUGIN_LOC + - "tests_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration/grinder.jar", + "tests_completions/org/python/pydev/ast/codecompletion/revisited/javaintegration/grinder.jar", grinderJarLocatioon); } project.refreshLocal(IResource.DEPTH_INFINITE, monitor);