use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class RefactoringSearchEngine2 method clearResults.
/**
* Clears all results found so far, and sets resets the status to {@link RefactoringStatus#OK}.
*/
public final void clearResults() {
getCollector().clearResults();
fStatus = new RefactoringStatus();
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class SurroundWithTryCatchRefactoring method checkActivationBasics.
public RefactoringStatus checkActivationBasics(CompilationUnit rootNode) throws CoreException {
RefactoringStatus result = new RefactoringStatus();
fRootNode = rootNode;
fAnalyzer = new SurroundWithTryCatchAnalyzer(fCUnit, fSelection);
fRootNode.accept(fAnalyzer);
result.merge(fAnalyzer.getStatus());
ITypeBinding[] exceptions = fAnalyzer.getExceptions();
if (fIsMultiCatch && (exceptions == null || exceptions.length <= 1)) {
result.merge(RefactoringStatus.createWarningStatus(RefactoringCoreMessages.SurroundWithTryCatchRefactoring_notMultipleexceptions));
}
return result;
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class CommentAnalyzer method perform.
public static RefactoringStatus perform(Selection selection, IScanner scanner, int start, int length) {
RefactoringStatus result = new RefactoringStatus();
if (length <= 0)
return result;
new CommentAnalyzer().check(result, selection, scanner, start, start + length - 1);
return result;
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class InlineTempRefactoring method checkInitialConditions.
/*
* @see Refactoring#checkActivation(IProgressMonitor)
*/
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
try {
//$NON-NLS-1$
pm.beginTask("", 1);
RefactoringStatus result = Checks.validateModifiesFiles(ResourceUtil.getFiles(new ICompilationUnit[] { fCu }), getValidationContext());
if (result.hasFatalError())
return result;
VariableDeclaration declaration = getVariableDeclaration();
result.merge(checkSelection(declaration));
if (result.hasFatalError())
return result;
result.merge(checkInitializer(declaration));
return result;
} finally {
pm.done();
}
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class IntroduceFactoryRefactoring method initialize.
private RefactoringStatus initialize(JavaRefactoringArguments arguments) {
final String selection = arguments.getAttribute(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION);
if (selection != null) {
int offset = -1;
int length = -1;
final StringTokenizer tokenizer = new StringTokenizer(selection);
if (tokenizer.hasMoreTokens())
offset = Integer.valueOf(tokenizer.nextToken()).intValue();
if (tokenizer.hasMoreTokens())
length = Integer.valueOf(tokenizer.nextToken()).intValue();
if (offset >= 0 && length >= 0) {
fSelectionStart = offset;
fSelectionLength = length;
} else
return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_illegal_argument, new Object[] { selection, JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION }));
} else
return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION));
String handle = arguments.getAttribute(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT);
if (handle != null) {
final IJavaElement element = JavaRefactoringDescriptorUtil.handleToElement(arguments.getProject(), handle, false);
if (element == null || !element.exists() || element.getElementType() != IJavaElement.COMPILATION_UNIT)
return JavaRefactoringDescriptorUtil.createInputFatalStatus(element, getName(), IJavaRefactorings.INTRODUCE_FACTORY);
else {
fCUHandle = (ICompilationUnit) element;
initialize();
}
} else
return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT));
handle = arguments.getAttribute(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1);
if (handle != null) {
final IJavaElement element = JavaRefactoringDescriptorUtil.handleToElement(arguments.getProject(), handle, false);
if (element == null || !element.exists() || element.getElementType() != IJavaElement.TYPE)
return JavaRefactoringDescriptorUtil.createInputFatalStatus(element, getName(), IJavaRefactorings.INTRODUCE_FACTORY);
else {
final IType type = (IType) element;
fFactoryClassName = type.getFullyQualifiedName();
}
} else
return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT));
final String name = arguments.getAttribute(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME);
if (//$NON-NLS-1$
name != null && !"".equals(name))
fNewMethodName = name;
else
return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME));
final String protect = arguments.getAttribute(ATTRIBUTE_PROTECT);
if (protect != null) {
fProtectConstructor = Boolean.valueOf(protect).booleanValue();
} else
return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, ATTRIBUTE_PROTECT));
return new RefactoringStatus();
}
Aggregations