use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class ResourceChangeChecker method createFrom.
private static RefactoringStatus createFrom(IStatus status) {
if (status.isOK())
return new RefactoringStatus();
if (!status.isMultiStatus()) {
switch(status.getSeverity()) {
case IStatus.OK:
return new RefactoringStatus();
case IStatus.INFO:
return RefactoringStatus.createInfoStatus(status.getMessage());
case IStatus.WARNING:
return RefactoringStatus.createWarningStatus(status.getMessage());
case IStatus.ERROR:
return RefactoringStatus.createErrorStatus(status.getMessage());
case IStatus.CANCEL:
return RefactoringStatus.createFatalErrorStatus(status.getMessage());
default:
return RefactoringStatus.createFatalErrorStatus(status.getMessage());
}
} else {
IStatus[] children = status.getChildren();
RefactoringStatus result = new RefactoringStatus();
for (int i = 0; i < children.length; i++) {
result.merge(createFrom(children[i]));
}
return result;
}
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class ValidateEditChecker method check.
/**
* {@inheritDoc}
*/
public RefactoringStatus check(IProgressMonitor monitor) throws CoreException {
IResource[] resources = (IResource[]) fFiles.toArray(new IResource[fFiles.size()]);
RefactoringStatus result = new RefactoringStatus();
IStatus status = Resources.checkInSync(resources);
if (!status.isOK())
result.merge(RefactoringStatus.create(status));
status = Resources.makeCommittable(resources, fContext);
if (!status.isOK()) {
result.merge(RefactoringStatus.create(status));
if (!result.hasFatalError()) {
result.addFatalError(RefactoringCoreMessages.ValidateEditChecker_failed);
}
}
return result;
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class MoveResourceChange method performSourceRestore.
private void performSourceRestore(IProgressMonitor monitor) throws CoreException {
monitor.beginTask(RefactoringCoreMessages.MoveResourceChange_progress_restore_source, 3);
try {
fRestoreSourceChange.initializeValidationData(new SubProgressMonitor(monitor, 1));
RefactoringStatus restoreStatus = fRestoreSourceChange.isValid(new SubProgressMonitor(monitor, 1));
if (!restoreStatus.hasFatalError()) {
fRestoreSourceChange.perform(new SubProgressMonitor(monitor, 1));
}
} finally {
monitor.done();
}
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class ModificationStampValidationState method isValid.
public RefactoringStatus isValid(boolean needsSaving, boolean resilientForDerived) throws CoreException {
RefactoringStatus result = super.isValid(needsSaving, resilientForDerived);
if (result.hasFatalError())
return result;
ModificationStamp currentStamp = getModificationStamp();
// not be dirty
if (fModificationStamp.getValue() != currentStamp.getValue() || // the stamp is a null stamp then the king must be equal as well.
(fModificationStamp.isFileStamp() && fModificationStamp.getValue() == IResource.NULL_STAMP && !currentStamp.isFileStamp()) || (fModificationStamp.isDocumentStamp() && fModificationStamp.getValue() == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP && !currentStamp.isDocumentStamp()) || (fModificationStamp.isFileStamp() && currentStamp.isFileStamp() && isDirty(fFile))) {
result.addFatalError(Messages.format(RefactoringCoreMessages.TextChanges_error_content_changed, BasicElementLabels.getPathLabel(fFile.getFullPath(), false)));
}
return result;
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class Changes method validateModifiesFiles.
public static RefactoringStatus validateModifiesFiles(IFile[] filesToModify) {
RefactoringStatus result = new RefactoringStatus();
IStatus status = Resources.checkInSync(filesToModify);
if (!status.isOK())
result.merge(RefactoringStatus.create(status));
status = Resources.makeCommittable(filesToModify, null);
if (!status.isOK()) {
result.merge(RefactoringStatus.create(status));
if (!result.hasFatalError()) {
result.addFatalError(RefactoringCoreMessages.Changes_validateEdit);
}
}
return result;
}
Aggregations