Search in sources :

Example 36 with Status

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));
        }
    }
}
Also used : Entry(java.util.Map.Entry) MultiStatus(org.eclipse.core.runtime.MultiStatus) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) Entry(java.util.Map.Entry) CoreException(org.eclipse.core.runtime.CoreException) Iterator(java.util.Iterator) Map(java.util.Map) HashMap(java.util.HashMap) NamedNodeMap(org.w3c.dom.NamedNodeMap)

Example 37 with Status

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();
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) ITextFileBuffer(org.eclipse.core.filebuffers.ITextFileBuffer)

Example 38 with Status

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);
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IStatus(org.eclipse.core.runtime.IStatus)

Example 39 with 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);
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IStatus(org.eclipse.core.runtime.IStatus)

Example 40 with 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);
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) CoreException(org.eclipse.core.runtime.CoreException) IUndoableOperation(org.eclipse.core.commands.operations.IUndoableOperation) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

Status (org.eclipse.core.runtime.Status)538 IStatus (org.eclipse.core.runtime.IStatus)513 CoreException (org.eclipse.core.runtime.CoreException)248 IOException (java.io.IOException)110 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)84 ArrayList (java.util.ArrayList)62 InvocationTargetException (java.lang.reflect.InvocationTargetException)60 IFile (org.eclipse.core.resources.IFile)54 File (java.io.File)53 MultiStatus (org.eclipse.core.runtime.MultiStatus)43 IResource (org.eclipse.core.resources.IResource)41 IPath (org.eclipse.core.runtime.IPath)41 InputStream (java.io.InputStream)36 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)34 PartInitException (org.eclipse.ui.PartInitException)32 IProject (org.eclipse.core.resources.IProject)31 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)25 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)24 SubMonitor (org.eclipse.core.runtime.SubMonitor)24 ITask (com.cubrid.common.core.task.ITask)23