use of org.eclipse.core.runtime.Status in project che by eclipse.
the class RefactoringHistoryManager method checkArgumentMap.
/**
* Checks whether the argument map is well-formed.
* <p>
* All arguments contained in the map are checked according to the rules of
* {@link RefactoringDescriptor}.
* </p>
*
* @param arguments
* the argument map
* @throws CoreException
* if the argument violates any of the constraints
*/
public static void checkArgumentMap(final Map arguments) throws CoreException {
Assert.isNotNull(arguments);
for (final Iterator iterator = arguments.entrySet().iterator(); iterator.hasNext(); ) {
final Map.Entry entry = (Map.Entry) iterator.next();
if (entry.getKey() instanceof String) {
final String string = (String) entry.getKey();
final char[] characters = string.toCharArray();
if (characters.length == 0) {
throw new CoreException(new Status(IStatus.ERROR, RefactoringCore.ID_PLUGIN, IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, RefactoringCoreMessages.RefactoringHistoryManager_empty_argument, null));
}
for (int index = 0; index < characters.length; index++) {
if (Character.isWhitespace(characters[index]))
throw new CoreException(new Status(IStatus.ERROR, RefactoringCore.ID_PLUGIN, IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, RefactoringCoreMessages.RefactoringHistoryManager_whitespace_argument_key, null));
}
} else {
throw new CoreException(new Status(IStatus.ERROR, RefactoringCore.ID_PLUGIN, IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, Messages.format(RefactoringCoreMessages.RefactoringHistoryManager_non_string_argument, entry.getKey()), null));
}
if (!(entry.getValue() instanceof String)) {
throw new CoreException(new Status(IStatus.ERROR, RefactoringCore.ID_PLUGIN, IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, Messages.format(RefactoringCoreMessages.RefactoringHistoryManager_non_string_value, entry.getKey()), null));
}
}
}
use of org.eclipse.core.runtime.Status in project che by eclipse.
the class MultiStateUndoChange method isValid.
/**
* {@inheritDoc}
*/
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
if (pm == null)
pm = new NullProgressMonitor();
//$NON-NLS-1$
pm.beginTask("", 1);
try {
if (fValidationState == null)
//$NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), "MultiStateUndoChange has not been initialialized"));
ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(fFile.getFullPath(), LocationKind.IFILE);
fDirty = buffer != null && buffer.isDirty();
return fValidationState.isValid(needsSaving(), true);
} finally {
pm.done();
}
}
use of org.eclipse.core.runtime.Status in project che by eclipse.
the class RefactoringCorePlugin method logRemovedListener.
public static void logRemovedListener(Throwable t) {
IStatus status = new Status(IStatus.ERROR, getPluginId(), IRefactoringCoreStatusCodes.INTERNAL_ERROR, RefactoringCoreMessages.RefactoringCorePlugin_listener_removed, t);
log(status);
}
use of org.eclipse.core.runtime.Status in project che by eclipse.
the class RefactoringCorePlugin method logRemovedParticipant.
public static void logRemovedParticipant(ParticipantDescriptor descriptor, Throwable t) {
IStatus status = new Status(IStatus.ERROR, getPluginId(), IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED, Messages.format(RefactoringCoreMessages.RefactoringCorePlugin_participant_removed, descriptor.getId()), t);
log(status);
}
use of org.eclipse.core.runtime.Status in project che by eclipse.
the class UndoManager2 method performRedo.
public void performRedo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException {
IUndoableOperation redo = fOperationHistory.getRedoOperation(RefactoringCorePlugin.getUndoContext());
UndoableOperation2ChangeAdapter changeOperation = getUnwrappedOperation(redo);
if (changeOperation == null)
throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoManager2_no_change, null));
if (query == null)
query = new NullQuery();
try {
fOperationHistory.redoOperation(redo, pm, new QueryAdapter(query));
} catch (ExecutionException e) {
handleException(e);
}
}
Aggregations