1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 05:25:21 +02:00

[216252] externalize strings

This commit is contained in:
David McKnight 2008-02-21 15:53:11 +00:00
parent 1ac741f109
commit 4d63a06310
7 changed files with 85 additions and 68 deletions

View file

@ -45,7 +45,7 @@ public class Activator extends Plugin {
//The shared instance.
private static Activator plugin;
public static final String PLUGIN_ID="org.eclipse.rse.services"; //$NON-NLS-1$
/**
* The constructor.

View file

@ -15,12 +15,25 @@ import org.eclipse.osgi.util.NLS;
public class RSEServicesMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.rse.internal.services.messages"; //$NON-NLS-1$
static {
NLS.initializeMessages(BUNDLE_NAME, RSEServicesMessages.class);
}
private RSEServicesMessages() {
}
public static String Socket_timeout;
public static String FILEMSG_OPERATION_FAILED;
public static String FILEMSG_OPERATION_FAILED_DETAILS;
public static String FILEMSG_SECURITY_VIOLATION;
public static String FILEMSG_SECURITY_VIOLATION_DETAILS;
public static String MSG_OPERATION_CANCELED;
public static String FILEMSG_FOLDER_NOT_EMPTY;
public static String FILEMSG_FOLDER_NOT_EMPTY_DETAILS;
static {
NLS.initializeMessages(BUNDLE_NAME, RSEServicesMessages.class);
}
}

View file

@ -15,3 +15,17 @@
#From org.eclipse.team.internal.ccvs.core/messages.properties
Socket_timeout=A timeout occurred connecting to host {0}
FILEMSG_OPERATION_FAILED=Operation failed. File system input or output error
FILEMSG_OPERATION_FAILED_DETAILS=Message reported from file system: {0}
FILEMSG_SECURITY_VIOLATION=Operation failed. Security violation
FILEMSG_SECURITY_VIOLATION_DETAILS=Message reported from file system: {0}
MSG_OPERATION_CANCELED=Operation canceled.
FILEMSG_FOLDER_NOT_EMPTY = Folder is not empty. Cannot delete
FILEMSG_FOLDER_NOT_EMPTY_DETAILS = The operation failed. One possible reason is that the folder is not empty

View file

@ -18,13 +18,18 @@
package org.eclipse.rse.services.files;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.rse.internal.services.Activator;
import org.eclipse.rse.internal.services.RSEServicesMessages;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
/**
* Exception thrown when attempting a file operation and the user
* canceled it before it could be completed.
*/
public class RemoteFileCancelledException extends RemoteFileException {
public class RemoteFileCanceledException extends RemoteFileException {
/**
* A serialVersionUID is recommended for all serializable classes.
@ -37,23 +42,14 @@ public class RemoteFileCancelledException extends RemoteFileException {
/**
* Constructor
*/
public RemoteFileCancelledException() {
public RemoteFileCanceledException() {
super(getMyMessage());
}
/*
* TODO dwd update this to retrieve the new messages when those are created
* myMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELED);
* public static final String MSG_OPERATION_CANCELED = "RSEG1067";
* <Message ID="1067" Indicator="E">
* <LevelOne>Operation cancelled.</LevelOne>
* <LevelTwo></LevelTwo>
* </Message>
*/
private static SystemMessage getMyMessage() {
String l1 = "Operation cancelled."; //$NON-NLS-1$
String l2 = ""; //$NON-NLS-1$
myMessage = new SystemMessage("RSE", "G", "1067", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String msgTxt = RSEServicesMessages.MSG_OPERATION_CANCELED;
myMessage = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt);
return myMessage;
}

View file

@ -17,6 +17,12 @@
package org.eclipse.rse.services.files;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.internal.services.Activator;
import org.eclipse.rse.internal.services.RSEServicesMessages;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
/**
@ -41,27 +47,21 @@ public class RemoteFileIOException extends RemoteFileException {
* @param remoteException the initial cause of this exception
*/
public RemoteFileIOException(Exception remoteException) {
super(getMyMessage(), remoteException);
super(getMyMessage(remoteException), remoteException);
}
private static SystemMessage getMyMessage(Exception remoteException) {
String secondLevel = remoteException.getMessage();
if (secondLevel == null) {
secondLevel = remoteException.getClass().getName();
}
getSystemMessage().makeSubstitution(secondLevel);
}
/*
* TODO dwd update this to retrieve the new messages when those are created
* myMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_IO_ERROR);
* public static final String FILEMSG_IO_ERROR = "RSEF1002";
* <Message ID="1002" Indicator="E">
* <LevelOne>Operation failed. File system input or output error</LevelOne>
* <LevelTwo>Message reported from file system: %1</LevelTwo>
* </Message>
*/
private static SystemMessage getMyMessage() {
String l1 = "Operation failed. File system input or output error"; //$NON-NLS-1$
String l2 = "Message reported from file system: %1"; //$NON-NLS-1$
myMessage = new SystemMessage("RSE", "F", "1002", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String msgTxt = RSEServicesMessages.FILEMSG_OPERATION_FAILED;
String msgDetails = NLS.bind(RSEServicesMessages.FILEMSG_OPERATION_FAILED_DETAILS, secondLevel);
myMessage = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt, msgDetails);
return myMessage;
}

View file

@ -17,6 +17,12 @@
package org.eclipse.rse.services.files;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.internal.services.Activator;
import org.eclipse.rse.internal.services.RSEServicesMessages;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
/**
@ -39,29 +45,21 @@ public class RemoteFileSecurityException extends RemoteFileException {
* @param remoteException the original cause of this exception.
*/
public RemoteFileSecurityException(Exception remoteException) {
super(getMyMessage(), remoteException);
String secondLevel = remoteException.getMessage();
if (secondLevel == null) {
secondLevel = remoteException.getClass().getName();
}
getSystemMessage().makeSubstitution(secondLevel);
super(getMyMessage(remoteException), remoteException);
}
/*
* TODO dwd update this to retrieve the new messages when those are created
* super(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_SECURITY_ERROR), remoteException);
* public static final String FILEMSG_SECURITY_ERROR = "RSEF1001";
* <Message ID="1001" Indicator="E">
* <LevelOne>Operation failed. Security violation</LevelOne>
* <LevelTwo>Message reported from file system: %1</LevelTwo>
* </Message>
*/
private static SystemMessage getMyMessage() {
private static SystemMessage getMyMessage(Exception remoteException) {
if (myMessage == null) {
String l1 = "Operation failed. Security violation"; //$NON-NLS-1$
String l2 = "Message reported from file system: %1"; //$NON-NLS-1$
myMessage = new SystemMessage("RSE", "F", "1001", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String secondLevel = remoteException.getMessage();
if (secondLevel == null) {
secondLevel = remoteException.getClass().getName();
}
String msgTxt = RSEServicesMessages.FILEMSG_SECURITY_VIOLATION;
String msgDetails = NLS.bind(RSEServicesMessages.FILEMSG_SECURITY_VIOLATION_DETAILS, secondLevel);
myMessage = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt, msgDetails);
}
return myMessage;
}

View file

@ -17,6 +17,11 @@
package org.eclipse.rse.services.files;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.rse.internal.services.Activator;
import org.eclipse.rse.internal.services.RSEServicesMessages;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
/**
@ -47,21 +52,12 @@ public class RemoteFolderNotEmptyException extends RemoteFileException {
super(getMyMessage(), remoteException);
}
/*
* TODO dwd update this to retrieve the new messages when those are created
* super(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_FOLDER_NOTEMPTY), remoteException);
* public static final String FILEMSG_FOLDER_NOTEMPTY = "RSEF1003";
* <Message ID="1003" Indicator="E">
* <LevelOne>Folder is not empty. Cannot delete</LevelOne>
* <LevelTwo>The operation failed. One possible reason is that the folder is not empty</LevelTwo>
* </Message>
*/
private static SystemMessage getMyMessage() {
if (myMessage == null) {
String l1 = "Folder is not empty. Cannot delete"; //$NON-NLS-1$
String l2 = "The operation failed. One possible reason is that the folder is not empty"; //$NON-NLS-1$
myMessage = new SystemMessage("RSE", "F", "1003", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String msgTxt = RSEServicesMessages.FILEMSG_FOLDER_NOT_EMPTY;
String msgDetails = RSEServicesMessages.FILEMSG_FOLDER_NOT_EMPTY_DETAILS;
myMessage = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt, msgDetails);
}
return myMessage;
}