mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[226374][api] Add SystemElementNotFoundException
This commit is contained in:
parent
7b40bac1eb
commit
135e6469bd
4 changed files with 57 additions and 0 deletions
|
@ -56,6 +56,8 @@ public class CommonMessages extends NLS {
|
|||
public static String MSG_OPERATION_UNSUPPORTED;
|
||||
public static String MSG_OPERATION_SECURITY_VIOLATION;
|
||||
|
||||
public static String MSG_ELEMENT_NOT_FOUND;
|
||||
|
||||
public static String MSG_RESOLVE_PROGRESS;
|
||||
|
||||
public static String MSG_QUERY_PROGRESS;
|
||||
|
|
|
@ -43,6 +43,7 @@ MSG_OPERATION_CANCELLED = Operation cancelled.
|
|||
MSG_OPERATION_UNSUPPORTED = Operation not supported: ''{0}''
|
||||
MSG_OPERATION_SECURITY_VIOLATION=Operation failed. Security violation on ''{0}''
|
||||
|
||||
MSG_ELEMENT_NOT_FOUND = Missing element for {0}: \''{1}\''
|
||||
|
||||
# messages
|
||||
MSG_CONNECT_PROGRESS = Connecting to {0}
|
||||
|
|
|
@ -47,6 +47,8 @@ public interface ICommonMessageIds {
|
|||
public static final String MSG_EXCEPTION_RENAMING = "RSEG1064"; //$NON-NLS-1$
|
||||
public static final String MSG_EXCEPTION_MOVING = "RSEG1065"; //$NON-NLS-1$
|
||||
|
||||
public static final String MSG_ELEMENT_NOT_FOUND = "RSEG9999";//FIXME //$NON-NLS-1$
|
||||
|
||||
public static final String MSG_ERROR_UNEXPECTED = "RSEG8002"; //$NON-NLS-1$
|
||||
public static final String MSG_LOCK_TIMEOUT = "RSEG9999";//FIXME //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver.messages;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.IClientServerConstants;
|
||||
|
||||
/**
|
||||
* Exception thrown when an operation was requested on a given remote element,
|
||||
* but that element did not exist. Like trying to delete a file that does not
|
||||
* exist. The framework may treat such an exception differently than other kinds
|
||||
* of exceptions.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public class SystemElementNotFoundException extends SystemMessageException {
|
||||
/**
|
||||
* A serialVersionUID is recommended for all serializable classes. This
|
||||
* trait is inherited from Throwable. This should be updated if there is a
|
||||
* schema change for this class.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param element an Absolute Path for the element that could not be found.
|
||||
*/
|
||||
public SystemElementNotFoundException(String element, String operation) {
|
||||
super(getMyMessage(element, operation));
|
||||
}
|
||||
|
||||
private static SystemMessage getMyMessage(String element, String operation) {
|
||||
//TODO generate an internal backtrace and attach to the message
|
||||
String msgText = NLS.bind(CommonMessages.MSG_ELEMENT_NOT_FOUND, operation, element);
|
||||
SystemMessage msg = new SimpleSystemMessage(IClientServerConstants.PLUGIN_ID,
|
||||
ICommonMessageIds.MSG_ELEMENT_NOT_FOUND, IStatus.ERROR, msgText);
|
||||
return msg;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue