mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Provide a meaningful message if CRefactoring.checkInitialConditions() find an Error
This commit is contained in:
parent
6efa4eac63
commit
8b299df1e4
4 changed files with 16 additions and 4 deletions
|
@ -99,7 +99,10 @@ public class ExtractConstantRefactoring extends CRefactoring {
|
||||||
try {
|
try {
|
||||||
lockIndex();
|
lockIndex();
|
||||||
try {
|
try {
|
||||||
super.checkInitialConditions(sm.newChild(6));
|
RefactoringStatus status = super.checkInitialConditions(sm.newChild(6));
|
||||||
|
if(status.hasError()) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
Collection<IASTLiteralExpression> literalExpressionCollection = findAllLiterals();
|
Collection<IASTLiteralExpression> literalExpressionCollection = findAllLiterals();
|
||||||
if(literalExpressionCollection.isEmpty()){
|
if(literalExpressionCollection.isEmpty()){
|
||||||
|
|
|
@ -156,7 +156,10 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
lockIndex();
|
lockIndex();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
super.checkInitialConditions(sm.newChild(6));
|
RefactoringStatus status = super.checkInitialConditions(sm.newChild(6));
|
||||||
|
if(status.hasError()) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
container = findExtractableNodes();
|
container = findExtractableNodes();
|
||||||
sm.worked(1);
|
sm.worked(1);
|
||||||
|
|
|
@ -97,7 +97,10 @@ public class ExtractLocalVariableRefactoring extends CRefactoring {
|
||||||
try {
|
try {
|
||||||
lockIndex();
|
lockIndex();
|
||||||
try {
|
try {
|
||||||
super.checkInitialConditions(sm.newChild(6));
|
RefactoringStatus status = super.checkInitialConditions(sm.newChild(6));
|
||||||
|
if(status.hasError()) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
container = findAllExpressions();
|
container = findAllExpressions();
|
||||||
if (container.size() < 1) {
|
if (container.size() < 1) {
|
||||||
|
|
|
@ -99,7 +99,10 @@ public class GenerateGettersAndSettersRefactoring extends CRefactoring {
|
||||||
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
|
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
|
||||||
SubMonitor sm = SubMonitor.convert(pm, 10);
|
SubMonitor sm = SubMonitor.convert(pm, 10);
|
||||||
|
|
||||||
super.checkInitialConditions(sm.newChild(6));
|
RefactoringStatus status = super.checkInitialConditions(sm.newChild(6));
|
||||||
|
if(status.hasError()) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
if(!initStatus.hasFatalError()) {
|
if(!initStatus.hasFatalError()) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue