diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.java index c899272678b..807a94aacdc 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.java @@ -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; diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.properties b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.properties index 4a4d77ba93f..5a10a076407 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.properties +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/CommonMessages.properties @@ -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} diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/ICommonMessageIds.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/ICommonMessageIds.java index 32f6abfb7b9..488ec5b916f 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/ICommonMessageIds.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/ICommonMessageIds.java @@ -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$ diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemElementNotFoundException.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemElementNotFoundException.java new file mode 100644 index 00000000000..a6c78adb560 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemElementNotFoundException.java @@ -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; + } + +}