mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix bundle properties
This commit is contained in:
@@ -132,6 +132,13 @@ refactoring.push.down.error.cannot.perform.refactoring.using.selected.elements=C
|
||||
refactoring.push.down.error.cannot.perform.refactoring.not.inside.class=Cannot perform pull member down: not inside the class
|
||||
|
||||
|
||||
# extract method
|
||||
refactoring.extract.method.error.cannot.perform.refactoring.when.class.declaration.inside=Cannot perform refactoring with class declaration inside code block
|
||||
refactoring.extract.method.error.cannot.perform.refactoring.when.function.declaration.inside=Cannot perform refactoring with function declaration inside code block
|
||||
refactoring.extract.method.error.cannot.perform.refactoring.no.corresponding.loop.for.break=No corresponding loop for break statement inside code fragment
|
||||
refactoring.extract.method.error.cannot.perform.refactoring.no.corresponding.loop.for.continue=No corresponding loop for continue statement inside code fragment
|
||||
refactoring.extract.method.error.cannot.perform.refactoring.when.execution.flow.is.interrupted=Cannot perform refactoring when execution flow is interrupted
|
||||
|
||||
### Annotators ###
|
||||
ANN.deleting.none=deleting None
|
||||
ANN.assign.to.none=assignment to None
|
||||
@@ -233,3 +240,4 @@ runcfg.labels.interpreter_options=Interpreter &options:
|
||||
runcfg.labels.working_directory=&Working directory:
|
||||
runcfg.captions.script_parameters_dialog=Enter script parameters
|
||||
runcfg.captions.interpreter_options_dialog=Enter interpreter options
|
||||
|
||||
|
||||
+11
-1
@@ -4,6 +4,8 @@ import com.intellij.codeInsight.codeFragment.CodeFragmentUtil;
|
||||
import com.intellij.codeInsight.codeFragment.Position;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ResolveResult;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
|
||||
import com.jetbrains.python.psi.*;
|
||||
|
||||
import java.util.*;
|
||||
@@ -17,10 +19,12 @@ public class PyCodeFragmentBuilder extends PyRecursiveElementVisitor {
|
||||
final Set<String> inElements = new HashSet<String>();
|
||||
final Set<String> outElements = new HashSet<String>();
|
||||
|
||||
private final ScopeOwner myOwner;
|
||||
private final int startOffset;
|
||||
private final int endOffset;
|
||||
|
||||
public PyCodeFragmentBuilder(int start, int end) {
|
||||
public PyCodeFragmentBuilder(final ScopeOwner owner, final int start, final int end) {
|
||||
myOwner = owner;
|
||||
startOffset = start;
|
||||
endOffset = end;
|
||||
}
|
||||
@@ -44,6 +48,9 @@ public class PyCodeFragmentBuilder extends PyRecursiveElementVisitor {
|
||||
if (position == Position.INSIDE) {
|
||||
for (ResolveResult result : element.multiResolve(false)) {
|
||||
final PsiElement declaration = result.getElement();
|
||||
if (declaration == null || !PsiTreeUtil.isAncestor(myOwner, declaration, false)){
|
||||
continue;
|
||||
}
|
||||
final Position pos = CodeFragmentUtil.getPosition(declaration, startOffset, endOffset);
|
||||
// If declaration is before add it to input
|
||||
if (pos == Position.BEFORE) {
|
||||
@@ -61,6 +68,9 @@ public class PyCodeFragmentBuilder extends PyRecursiveElementVisitor {
|
||||
}
|
||||
for (ResolveResult result : element.multiResolve(false)) {
|
||||
final PsiElement declaration = result.getElement();
|
||||
if (declaration == null || !PsiTreeUtil.isAncestor(myOwner, declaration, false)){
|
||||
continue;
|
||||
}
|
||||
final Position pos = CodeFragmentUtil.getPosition(declaration, startOffset, endOffset);
|
||||
// If declaration is inside
|
||||
if (pos == Position.INSIDE) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class PyCodeFragmentUtil {
|
||||
@Override
|
||||
public void visitPyFunction(final PyFunction node) {
|
||||
if (CodeFragmentUtil.getPosition(node, start, end) == Position.INSIDE){
|
||||
throw new CannotCreateCodeFragmentException(PyBundle.message("refactoring.extract.method.error.cannot.perform.refactoring.when.class.declaration.inside"));
|
||||
throw new CannotCreateCodeFragmentException(PyBundle.message("refactoring.extract.method.error.cannot.perform.refactoring.when.function.declaration.inside"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -104,10 +104,8 @@ public class PyCodeFragmentUtil {
|
||||
}
|
||||
|
||||
// Building code fragment
|
||||
final PyCodeFragmentBuilder builder = new PyCodeFragmentBuilder(start, end);
|
||||
final PyCodeFragmentBuilder builder = new PyCodeFragmentBuilder(owner, start, end);
|
||||
owner.acceptChildren(builder);
|
||||
return new CodeFragment(builder.inElements, builder.outElements, returnInstructionInside);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user