1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-07 16:26:11 +02:00

bug 53123 externalize strings

This commit is contained in:
Andrew Niefer 2004-03-01 22:16:48 +00:00
parent 0f74ca46c3
commit 74206bb9c0
36 changed files with 263 additions and 199 deletions

View file

@ -1,3 +1,6 @@
2004-03-01 Andrew Niefer
externalize strings : Bug 53123
2004-03-01 Hoda Amer
Removing the "empty" array in the CElement that was not used anywhere !

View file

@ -13,7 +13,7 @@ import org.eclipse.core.runtime.Status;
public class CCProjectNature extends CProjectNature {
public static final String CC_NATURE_ID= CCorePlugin.PLUGIN_ID + ".ccnature";
public static final String CC_NATURE_ID= CCorePlugin.PLUGIN_ID + ".ccnature"; //$NON-NLS-1$
public static void addCCNature(IProject project, IProgressMonitor mon) throws CoreException {
addNature(project, CC_NATURE_ID, mon);
@ -33,7 +33,7 @@ public class CCProjectNature extends CProjectNature {
IStatus status = new Status(IStatus.ERROR,
CCorePlugin.PLUGIN_ID,
CCorePlugin.CDT_PROJECT_NATURE_ID_MISMATCH,
"project must have a cnature", null); // $NON_NLS
CCorePlugin.getResourceString("CCProjectNature.exception.noNature"), null); // $NON_NLS //$NON-NLS-1$
throw new CoreException(status);
}
}

View file

@ -28,7 +28,7 @@ import org.eclipse.core.runtime.Status;
*/
public class CConventions {
private final static String scopeResolutionOperator= "::";
private final static String scopeResolutionOperator= "::"; //$NON-NLS-1$
private final static char fgDot= '.';
private final static char fgColon= ':';
@ -37,7 +37,7 @@ public class CConventions {
return false;
}
String trimmed = name.trim();
if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){
if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){ //$NON-NLS-1$
return false;
}
@ -80,7 +80,7 @@ public class CConventions {
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.class.nullName"), null); //$NON-NLS-1$
}
String trimmed = name.trim();
if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){
if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){ //$NON-NLS-1$
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.class.nameWithBlanks"), null); //$NON-NLS-1$
}
int index = name.lastIndexOf(scopeResolutionOperator);

View file

@ -57,21 +57,21 @@ public class CCorePlugin extends Plugin {
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
public static final String PLUGIN_ID = "org.eclipse.cdt.core";
public static final String PLUGIN_ID = "org.eclipse.cdt.core"; //$NON-NLS-1$
public static final String BUILDER_MODEL_ID = PLUGIN_ID + ".CBuildModel";
public static final String BINARY_PARSER_SIMPLE_ID = "BinaryParser";
public final static String BINARY_PARSER_UNIQ_ID = PLUGIN_ID + "." + BINARY_PARSER_SIMPLE_ID;
public final static String PREF_BINARY_PARSER = "binaryparser";
public final static String DEFAULT_BINARY_PARSER_SIMPLE_ID = "ELF";
public final static String DEFAULT_BINARY_PARSER_UNIQ_ID = PLUGIN_ID + "." + DEFAULT_BINARY_PARSER_SIMPLE_ID;
public final static String PREF_USE_STRUCTURAL_PARSE_MODE = "useStructualParseMode";
public static final String BUILDER_MODEL_ID = PLUGIN_ID + ".CBuildModel"; //$NON-NLS-1$
public static final String BINARY_PARSER_SIMPLE_ID = "BinaryParser"; //$NON-NLS-1$
public final static String BINARY_PARSER_UNIQ_ID = PLUGIN_ID + "." + BINARY_PARSER_SIMPLE_ID; //$NON-NLS-1$
public final static String PREF_BINARY_PARSER = "binaryparser"; //$NON-NLS-1$
public final static String DEFAULT_BINARY_PARSER_SIMPLE_ID = "ELF"; //$NON-NLS-1$
public final static String DEFAULT_BINARY_PARSER_UNIQ_ID = PLUGIN_ID + "." + DEFAULT_BINARY_PARSER_SIMPLE_ID; //$NON-NLS-1$
public final static String PREF_USE_STRUCTURAL_PARSE_MODE = "useStructualParseMode"; //$NON-NLS-1$
public final static String ERROR_PARSER_SIMPLE_ID = "ErrorParser"; //$NON-NLS-1$
// Build Model Interface Discovery
public final static String BUILD_SCANNER_INFO_SIMPLE_ID = "ScannerInfoProvider";
public final static String BUILD_SCANNER_INFO_UNIQ_ID = PLUGIN_ID + "." + BUILD_SCANNER_INFO_SIMPLE_ID;
public final static String BUILD_SCANNER_INFO_SIMPLE_ID = "ScannerInfoProvider"; //$NON-NLS-1$
public final static String BUILD_SCANNER_INFO_UNIQ_ID = PLUGIN_ID + "." + BUILD_SCANNER_INFO_SIMPLE_ID; //$NON-NLS-1$
/**
@ -125,7 +125,7 @@ public class CCorePlugin extends Plugin {
static {
try {
fgResourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.internal.core.CCorePluginResources");
fgResourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.internal.core.CCorePluginResources"); //$NON-NLS-1$
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
@ -158,9 +158,9 @@ public class CCorePlugin extends Plugin {
try {
return fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
} catch (NullPointerException e) {
return "#" + key + "#";
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
@ -185,7 +185,7 @@ public class CCorePlugin extends Plugin {
}
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e));
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$
}
public static void log(IStatus status) {
@ -223,7 +223,7 @@ public class CCorePlugin extends Plugin {
public void startup() throws CoreException {
super.startup();
cdtLog = new CDTLogWriter(CCorePlugin.getDefault().getStateLocation().append(".log").toFile());
cdtLog = new CDTLogWriter(CCorePlugin.getDefault().getStateLocation().append(".log").toFile()); //$NON-NLS-1$
//Set debug tracing options
CCorePlugin.getDefault().configurePluginDebugOptions();
@ -441,15 +441,15 @@ public class CCorePlugin extends Plugin {
public IConsole getConsole(String id) {
try {
IExtensionPoint extension = getDescriptor().getExtensionPoint("CBuildConsole");
IExtensionPoint extension = getDescriptor().getExtensionPoint("CBuildConsole"); //$NON-NLS-1$
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
String builderID = configElements[j].getAttribute("builderID");
String builderID = configElements[j].getAttribute("builderID"); //$NON-NLS-1$
if ((id == null && builderID == null) || (id != null && id.equals(builderID))) {
return (IConsole) configElements[j].createExecutableExtension("class");
return (IConsole) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
}
}
}
@ -499,13 +499,13 @@ public class CCorePlugin extends Plugin {
if (extension != null) {
IConfigurationElement element[] = extension.getConfigurationElements();
for (int i = 0; i < element.length; i++) {
if (element[i].getName().equalsIgnoreCase("cextension")) {
parser = (IBinaryParser) element[i].createExecutableExtension("run");
if (element[i].getName().equalsIgnoreCase("cextension")) { //$NON-NLS-1$
parser = (IBinaryParser) element[i].createExecutableExtension("run"); //$NON-NLS-1$
break;
}
}
} else {
IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "No Binary Format", null);
IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CCorePlugin.exception.noBinaryFormat"), null); //$NON-NLS-1$
throw new CoreException(s);
}
return parser;
@ -642,13 +642,13 @@ public class CCorePlugin extends Plugin {
// }
public IProcessList getProcessList() {
IExtensionPoint extension = getDescriptor().getExtensionPoint("ProcessList");
IExtensionPoint extension = getDescriptor().getExtensionPoint("ProcessList"); //$NON-NLS-1$
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
if (configElements.length != 0) {
try {
return (IProcessList) configElements[0].createExecutableExtension("class");
return (IProcessList) configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
}
}
@ -686,7 +686,7 @@ public class CCorePlugin extends Plugin {
if ((id == null && parserID == null) || (id != null && parserID.equals(id))) {
IConfigurationElement[] configElements = extensions[i]. getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
IErrorParser parser = (IErrorParser)configElements[j].createExecutableExtension("class");
IErrorParser parser = (IErrorParser)configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
list.add(parser);
}
}
@ -713,13 +713,13 @@ public class CCorePlugin extends Plugin {
}
private static final String MODEL = CCorePlugin.PLUGIN_ID + "/debug/model" ; //$NON-NLS-1$
private static final String INDEXER = CCorePlugin.PLUGIN_ID + "/debug/indexer";
private static final String INDEX_MANAGER = CCorePlugin.PLUGIN_ID + "/debug/indexmanager";
private static final String INDEXER = CCorePlugin.PLUGIN_ID + "/debug/indexer"; //$NON-NLS-1$
private static final String INDEX_MANAGER = CCorePlugin.PLUGIN_ID + "/debug/indexmanager"; //$NON-NLS-1$
private static final String SEARCH = CCorePlugin.PLUGIN_ID + "/debug/search" ; //$NON-NLS-1$
private static final String MATCH_LOCATOR = CCorePlugin.PLUGIN_ID + "/debug/matchlocator" ; //$NON-NLS-1$
private static final String PARSER = CCorePlugin.PLUGIN_ID + "/debug/parser" ; //$NON-NLS-1$
private static final String SCANNER = CCorePlugin.PLUGIN_ID + "/debug/scanner"; //$NON-NLS-1$
private static final String DELTA = CCorePlugin.PLUGIN_ID + "/debug/deltaprocessor" ;
private static final String DELTA = CCorePlugin.PLUGIN_ID + "/debug/deltaprocessor" ; //$NON-NLS-1$
private static final String CONTENTASSIST = CCorePlugin.PLUGIN_ID + "/debug/contentassist" ; //$NON-NLS-1$
/**
* Configure the plugin with respect to option settings defined in ".options" file
@ -731,7 +731,7 @@ public class CCorePlugin extends Plugin {
if(option != null) Util.VERBOSE_PARSER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
option = Platform.getDebugOption(SCANNER);
if( option != null ) Util.VERBOSE_SCANNER = option.equalsIgnoreCase("true");
if( option != null ) Util.VERBOSE_SCANNER = option.equalsIgnoreCase("true"); //$NON-NLS-1$
option = Platform.getDebugOption(MODEL);
if(option != null) Util.VERBOSE_MODEL = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
@ -739,7 +739,7 @@ public class CCorePlugin extends Plugin {
boolean indexFlag = false;
option = Platform.getDebugOption(INDEX_MANAGER);
if(option != null) {
indexFlag = option.equalsIgnoreCase("true");
indexFlag = option.equalsIgnoreCase("true"); //$NON-NLS-1$
IndexManager.VERBOSE = indexFlag;
} //$NON-NLS-1$

View file

@ -16,7 +16,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class CProjectNature implements IProjectNature {
public static final String C_NATURE_ID = CCorePlugin.PLUGIN_ID + ".cnature";
public static final String C_NATURE_ID = CCorePlugin.PLUGIN_ID + ".cnature"; //$NON-NLS-1$
private IProject fProject;

View file

@ -28,7 +28,7 @@ public class CommandLauncher {
protected boolean fShowCommand;
protected String[] fCommandArgs;
protected String fErrorMessage = "";
protected String fErrorMessage = ""; //$NON-NLS-1$
private String lineSeparator;
@ -46,7 +46,7 @@ public class CommandLauncher {
public CommandLauncher() {
fProcess= null;
fShowCommand= false;
lineSeparator = System.getProperty("line.separator", "\n");
lineSeparator = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@ -99,7 +99,7 @@ public class CommandLauncher {
// add platform specific arguments (shell invocation)
fCommandArgs= constructCommandArray(commandPath.toOSString(), args);
fProcess= ProcessFactory.getFactory().exec(fCommandArgs, env, changeToDirectory.toFile());
fErrorMessage= "";
fErrorMessage= ""; //$NON-NLS-1$
} catch (IOException e) {
setErrorMessage(e.getMessage());
fProcess= null;
@ -146,7 +146,7 @@ public class CommandLauncher {
errInPipe = new PipedInputStream(errOutPipe);
inputPipe = new PipedInputStream(outputPipe);
} catch( IOException e ) {
setErrorMessage("Command canceled");
setErrorMessage(CCorePlugin.getResourceString("CommandLauncher.error.commandCanceled")); //$NON-NLS-1$
return COMMAND_CANCELED;
}
@ -184,7 +184,7 @@ public class CommandLauncher {
if (monitor.isCanceled()) {
closure.terminate();
state = COMMAND_CANCELED;
setErrorMessage("Command canceled");
setErrorMessage(CCorePlugin.getResourceString("CommandLauncher.error.commandCanceled")); //$NON-NLS-1$
}
try {

View file

@ -29,8 +29,8 @@ public class ErrorParserManager extends OutputStream {
private int nOpens;
private final static String OLD_PREF_ERROR_PARSER = "errorOutputParser"; // $NON-NLS-1$
public final static String PREF_ERROR_PARSER = CCorePlugin.PLUGIN_ID + ".errorOutputParser"; // $NON-NLS-1$
private final static String OLD_PREF_ERROR_PARSER = "errorOutputParser"; //$NON-NLS-1$
public final static String PREF_ERROR_PARSER = CCorePlugin.PLUGIN_ID + ".errorOutputParser"; //$NON-NLS-1$
private IProject fProject;
private IMarkerGenerator fMarkerGenerator;
@ -124,7 +124,7 @@ public class ErrorParserManager extends OutputStream {
fDirectoryStack.removeElementAt(i - 1);
return dir;
}
return new Path("");
return new Path(""); //$NON-NLS-1$
}
public int getDirectoryLevel() {
@ -140,7 +140,7 @@ public class ErrorParserManager extends OutputStream {
}
if (fErrorParsers.size() == 0) {
initErrorParsersMap();
CCorePlugin.getDefault().getPluginPreferences().setValue(OLD_PREF_ERROR_PARSER, ""); // remove old prefs
CCorePlugin.getDefault().getPluginPreferences().setValue(OLD_PREF_ERROR_PARSER, ""); // remove old prefs //$NON-NLS-1$
}
}
@ -306,7 +306,7 @@ public class ErrorParserManager extends OutputStream {
* Called by the error parsers. Return the previous line, save in the working buffer.
*/
public String getPreviousLine() {
return new String((previousLine) == null ? "" : previousLine);
return new String((previousLine) == null ? "" : previousLine); //$NON-NLS-1$
}
/**

View file

@ -13,3 +13,38 @@ CoreModel.BinaryContainer.Binaries=Binaries
CoreModel.CModelStatus.Error_in_CPlugin=Error in C Plugin
CoreModel.NullBinaryParser.Not_binary_file=not a binary file
CoreModel.NullBinaryParser.Null_Format=Null Format
CommandLauncher.error.commandCanceled=Command canceled
CCProjectNature.exception.noNature=Project must have a cnature
CCorePlugin.exception.noBinaryFormat=No Binary Format
CDescriptorManager.exception.alreadyConfigured=CDTProject already configured
COwner.exception.invalidOwnerID=Invalid CDTProject owner ID
COwner.exception.invalidOwnerExtension=Invalid CDTProject owner extension
CDescriptor.exception.projectAlreadyExists=CDTProject already exisits
CDescriptor.exception.unmatchedOwnerId=CDTProject already exisits but does not match owner ID of creator
CDescriptor.exception.fileNotFound=CDTProject file not found
CDescriptor.exception.missingOwnerId=Missing owner id
CDescriptor.exception.missingElement=Missing cdtproject element
CDescriptor.exception.providerNotFound=Extension provider not found.
Util.exception.invalidArchive=Not a valid archive file.
Util.exception.arrayToSmall=Array to small
Util.exception.notPE=Not a PE format
Util.exception.notELF=Not ELF format
Util.exception.notDOSFormat=Not DOS EXE format
Util.exception.unknownFormat=Unknow machine/format
Util.exception.nullPath=Path is null
Util.exception.noFileAssociation=No file associated with Binary
Util.exception.missingBytes=missing bytes
Util.exception.noData=no more data
Util.exception.cannotCreatePty=Can not create pty
Util.exception.closeError=close error
Util.error.cannotRun=Cannot run
Util.unknownName=unknown C++ encoded name
Util.unknownFormat=Unknown debug format

View file

@ -53,7 +53,7 @@ public class CDTLogWriter {
this.logFile = log;
if(log.length() > MAXLOG_SIZE){
log.delete();
this.logFile = CCorePlugin.getDefault().getStateLocation().append(".log").toFile();
this.logFile = CCorePlugin.getDefault().getStateLocation().append(".log").toFile(); //$NON-NLS-1$
}
openLogFile();
}

View file

@ -60,15 +60,15 @@ public class CDescriptor implements ICDescriptor {
private HashMap extInfoMap = new HashMap(4);
private Document dataDoc;
static final String DESCRIPTION_FILE_NAME = ".cdtproject";
static final String DESCRIPTION_FILE_NAME = ".cdtproject"; //$NON-NLS-1$
private static final char[][] NO_CHAR_CHAR = new char[0][];
private static final String PROJECT_DESCRIPTION = "cdtproject";
private static final String PROJECT_EXTENSION = "extension";
private static final String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
private static final String PATH_ENTRY = "cpathentry";
private static final String PROJECT_DATA = "data";
private static final String PROJECT_DATA_ITEM = "item";
private static final String PROJECT_DATA_ID = "id";
private static final String PROJECT_DESCRIPTION = "cdtproject"; //$NON-NLS-1$
private static final String PROJECT_EXTENSION = "extension"; //$NON-NLS-1$
private static final String PROJECT_EXTENSION_ATTRIBUTE = "attribute"; //$NON-NLS-1$
private static final String PATH_ENTRY = "cpathentry"; //$NON-NLS-1$
private static final String PROJECT_DATA = "data"; //$NON-NLS-1$
private static final String PROJECT_DATA_ITEM = "item"; //$NON-NLS-1$
private static final String PROJECT_DATA_ID = "id"; //$NON-NLS-1$
private boolean fDirty;
private boolean autoSave;
@ -92,7 +92,7 @@ public class CDescriptor implements ICDescriptor {
IStatus.WARNING,
CCorePlugin.PLUGIN_ID,
CCorePlugin.STATUS_CDTPROJECT_EXISTS,
"CDTProject already exisits",
CCorePlugin.getResourceString("CDescriptor.exception.projectAlreadyExists"), //$NON-NLS-1$
(Throwable) null);
} else {
status =
@ -100,7 +100,7 @@ public class CDescriptor implements ICDescriptor {
IStatus.ERROR,
CCorePlugin.PLUGIN_ID,
CCorePlugin.STATUS_CDTPROJECT_MISMATCH,
"CDTProject already exisits but does not match owner ID of creator",
CCorePlugin.getResourceString("CDescriptor.exception.unmatchedOwnerId"), //$NON-NLS-1$
(Throwable) null);
}
throw new CoreException(status);
@ -118,7 +118,7 @@ public class CDescriptor implements ICDescriptor {
IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
if (!descriptionPath.toFile().exists()) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "CDTProject file not found", (Throwable) null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CDescriptor.exception.fileNotFound"), (Throwable) null); //$NON-NLS-1$
throw new CoreException(status);
}
fOwner = new COwner(readCDTProject(descriptionPath));
@ -134,7 +134,7 @@ public class CDescriptor implements ICDescriptor {
IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
if (!descriptionPath.toFile().exists()) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "CDTProject file not found", (Throwable) null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CDescriptor.exception.fileNotFound"), (Throwable) null); //$NON-NLS-1$
throw new CoreException(status);
}
readCDTProject(descriptionPath);
@ -154,15 +154,15 @@ public class CDescriptor implements ICDescriptor {
Document document = parser.parse(file);
Node node = document.getFirstChild();
if (node.getNodeName().equals(PROJECT_DESCRIPTION)) {
String ownerID = node.getAttributes().getNamedItem("id").getNodeValue();
String ownerID = node.getAttributes().getNamedItem("id").getNodeValue(); //$NON-NLS-1$
if ( ownerID != null) {
readProjectDescription(node);
return ownerID;
}
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Missing owner id", null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CDescriptor.exception.missingOwnerId"), null); //$NON-NLS-1$
throw new CoreException(status);
}
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Missing cdtproject element", null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CDescriptor.exception.missingElement"), null); //$NON-NLS-1$
throw new CoreException(status);
} catch (Exception e) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getLocalizedMessage(), e);
@ -311,7 +311,7 @@ public class CDescriptor implements ICDescriptor {
format.setIndenting(true);
format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
Serializer serializer =
SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format);
SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format); //$NON-NLS-1$
serializer.asDOMSerializer().serialize(doc);
return s.toString("UTF8"); //$NON-NLS-1$
}
@ -341,12 +341,12 @@ public class CDescriptor implements ICDescriptor {
}
private void decodeProjectExtension(Element element) throws CoreException {
ICExtensionReference ext = create(element.getAttribute("point"), element.getAttribute("id"));
ICExtensionReference ext = create(element.getAttribute("point"), element.getAttribute("id")); //$NON-NLS-1$ //$NON-NLS-2$
NodeList extAttrib = element.getChildNodes();
for (int j = 0; j < extAttrib.getLength(); j++) {
if (extAttrib.item(j).getNodeName().equals(PROJECT_EXTENSION_ATTRIBUTE)) {
NamedNodeMap attrib = extAttrib.item(j).getAttributes();
ext.setExtensionData(attrib.getNamedItem("key").getNodeValue(), attrib.getNamedItem("value").getNodeValue());
ext.setExtensionData(attrib.getNamedItem("key").getNodeValue(), attrib.getNamedItem("value").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
@ -369,16 +369,16 @@ public class CDescriptor implements ICDescriptor {
CExtensionReference extension[] = (CExtensionReference[]) extIterator.next();
for (int i = 0; i < extension.length; i++) {
configRootElement.appendChild(element = doc.createElement(PROJECT_EXTENSION));
element.setAttribute("point", extension[i].getExtension());
element.setAttribute("id", extension[i].getID());
element.setAttribute("point", extension[i].getExtension()); //$NON-NLS-1$
element.setAttribute("id", extension[i].getID()); //$NON-NLS-1$
CExtensionInfo info = (CExtensionInfo) extInfoMap.get(extension[i]);
if (info != null) {
Iterator attribIterator = info.getAttributes().entrySet().iterator();
while (attribIterator.hasNext()) {
Entry entry = (Entry) attribIterator.next();
Element extAttributes = doc.createElement(PROJECT_EXTENSION_ATTRIBUTE);
extAttributes.setAttribute("key", (String) entry.getKey());
extAttributes.setAttribute("value", (String) entry.getValue());
extAttributes.setAttribute("key", (String) entry.getKey()); //$NON-NLS-1$
extAttributes.setAttribute("value", (String) entry.getValue()); //$NON-NLS-1$
element.appendChild(extAttributes);
}
}
@ -393,12 +393,12 @@ public class CDescriptor implements ICDescriptor {
IExtensionPoint extensionPoint = pluginRegistry.getExtensionPoint(ext.getExtension());
IExtension extension = extensionPoint.getExtension(ext.getID());
if ( extension == null) {
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Extension provider not found.", null));
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CDescriptor.exception.providerNotFound"), null)); //$NON-NLS-1$
}
IConfigurationElement element[] = extension.getConfigurationElements();
for (int i = 0; i < element.length; i++) {
if (element[i].getName().equalsIgnoreCase("cextension")) {
cExtension = (InternalCExtension) element[i].createExecutableExtension("run");
if (element[i].getName().equalsIgnoreCase("cextension")) { //$NON-NLS-1$
cExtension = (InternalCExtension) element[i].createExecutableExtension("run"); //$NON-NLS-1$
cExtension.setExtenionReference(ext);
cExtension.setProject(fProject);
break;
@ -419,7 +419,7 @@ public class CDescriptor implements ICDescriptor {
IStatus.ERROR,
CCorePlugin.PLUGIN_ID,
IStatus.ERROR,
"getProjectDataDoc",
"getProjectDataDoc", //$NON-NLS-1$
e));
}
Element rootElem = dataDoc.createElement(PROJECT_DATA);

View file

@ -106,7 +106,7 @@ public class CDescriptorManager implements IResourceChangeListener {
fDescriptorMap = new HashMap();
}
if ( fDescriptorMap.get(project) != null ) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_EXISTS, "CDTProject already configured", (Throwable)null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_EXISTS, CCorePlugin.getResourceString("CDescriptorManager.exception.alreadyConfigured"), (Throwable)null); //$NON-NLS-1$
throw new CoreException(status);
}
try {

View file

@ -29,11 +29,11 @@ public class COwner implements ICOwnerInfo {
public COwner(String id) throws CoreException {
ownerID = id;
IExtensionPoint extpoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("CProject");
IExtensionPoint extpoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("CProject"); //$NON-NLS-1$
extension = extpoint.getExtension(ownerID);
if (extension == null) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Invalid CDTProject owner ID", (Throwable)null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("COwner.exception.invalidOwnerID"), (Throwable)null); //$NON-NLS-1$
throw new CoreException(status);
}
}
@ -50,38 +50,38 @@ public class COwner implements ICOwnerInfo {
if ( fPlatform == null ) {
IConfigurationElement element[] = extension.getConfigurationElements();
for( int i = 0; i < element.length; i++ ) {
if ( element[i].getName().equalsIgnoreCase("cproject") ) {
fPlatform = element[i].getAttribute("platform");
if ( element[i].getName().equalsIgnoreCase("cproject") ) { //$NON-NLS-1$
fPlatform = element[i].getAttribute("platform"); //$NON-NLS-1$
break;
}
}
}
return fPlatform == null ? "*" : fPlatform;
return fPlatform == null ? "*" : fPlatform; //$NON-NLS-1$
}
void configure(IProject project, ICDescriptor cproject) throws CoreException {
IConfigurationElement element[] = extension.getConfigurationElements();
for( int i = 0; i < element.length; i++ ) {
if ( element[i].getName().equalsIgnoreCase("cproject") ) {
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class");
if ( element[i].getName().equalsIgnoreCase("cproject") ) { //$NON-NLS-1$
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class"); //$NON-NLS-1$
owner.configure(cproject);
return;
}
}
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Invalid CDTProject owner extension", (Throwable)null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("COwner.exception.invalidOwnerExtension"), (Throwable)null); //$NON-NLS-1$
throw new CoreException(status);
}
void update(IProject project, ICDescriptor cproject, String extensionID) throws CoreException {
IConfigurationElement element[] = extension.getConfigurationElements();
for( int i = 0; i < element.length; i++ ) {
if ( element[i].getName().equalsIgnoreCase("cproject") ) {
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class");
if ( element[i].getName().equalsIgnoreCase("cproject") ) { //$NON-NLS-1$
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class"); //$NON-NLS-1$
owner.update(cproject, extensionID);
return;
}
}
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Invalid CDTProject owner extension", (Throwable)null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("COwner.exception.invalidOwnerExtension"), (Throwable)null); //$NON-NLS-1$
throw new CoreException(status);
}

View file

@ -38,7 +38,7 @@ public class ProcessClosure {
fOutputStream= out;
fInputStream= in;
setDaemon(true);
lineSeparator = (String) System.getProperty("line.separator");
lineSeparator = (String) System.getProperty("line.separator"); //$NON-NLS-1$
}
public void run() {
@ -117,13 +117,13 @@ public class ProcessClosure {
* reader threads.
*/
public void runNonBlocking() {
ThreadGroup group= new ThreadGroup("CBuilder" + fCounter++);
ThreadGroup group= new ThreadGroup("CBuilder" + fCounter++); //$NON-NLS-1$
InputStream stdin= fProcess.getInputStream();
InputStream stderr= fProcess.getErrorStream();
fOutputReader= new ReaderThread(group, "OutputReader", stdin, fOutput);
fErrorReader= new ReaderThread(group, "ErrorReader", stderr, fError);
fOutputReader= new ReaderThread(group, "OutputReader", stdin, fOutput); //$NON-NLS-1$
fErrorReader= new ReaderThread(group, "ErrorReader", stderr, fError); //$NON-NLS-1$
fOutputReader.start();
fErrorReader.start();

View file

@ -19,13 +19,13 @@ public class GASErrorParser implements IErrorParser {
// /tmp/cc8EXnKk.s:46: Error: no such 386 instruction: `b'
try {
String previous = eoParser.getPreviousLine();
String fileName = "";
String fileName = ""; //$NON-NLS-1$
IFile file = null;
int num = 0;
int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
String desc = line;
if (previous != null && previous.startsWith("Assembler")) {
if (! line.startsWith("FATAL")) {
if (previous != null && previous.startsWith("Assembler")) { //$NON-NLS-1$
if (! line.startsWith("FATAL")) { //$NON-NLS-1$
int firstColon= line.indexOf(':');
if (firstColon != -1) {
fileName = line.substring(0, firstColon);
@ -45,7 +45,7 @@ public class GASErrorParser implements IErrorParser {
}
}
if (file == null) {
desc = fileName + " " + desc;
desc = fileName + " " + desc; //$NON-NLS-1$
}
eoParser.generateMarker(file, num, desc, severity, null);
}

View file

@ -39,8 +39,8 @@ public class GCCErrorParser implements IErrorParser {
/* Guard against drive in Windows platform. */
if (firstColon == 1) {
try {
String os = System.getProperty("os.name");
if (os != null && os.startsWith("Win")) {
String os = System.getProperty("os.name"); //$NON-NLS-1$
if (os != null && os.startsWith("Win")) { //$NON-NLS-1$
try {
if (Character.isLetter(line.charAt(0))) {
firstColon = line.indexOf(':', 2);
@ -92,13 +92,13 @@ public class GCCErrorParser implements IErrorParser {
// gnu c: filename:no: (Each undeclared identifier is reported
// only once. filename:no: for each function it appears in.)
if (desc.startsWith ("(Each undeclared")) {
if (desc.startsWith ("(Each undeclared")) { //$NON-NLS-1$
// Do nothing.
return false;
} else {
String previous = eoParser.getPreviousLine();
if (desc.endsWith(")")
&& previous.indexOf("(Each undeclared") >= 0 ) {
if (desc.endsWith(")") //$NON-NLS-1$
&& previous.indexOf("(Each undeclared") >= 0 ) { //$NON-NLS-1$
// Do nothing.
return false;
}
@ -114,34 +114,34 @@ public class GCCErrorParser implements IErrorParser {
*
*/
int s;
if((s = desc.indexOf("\' undeclared")) != -1) {
int p = desc.indexOf("`");
if((s = desc.indexOf("\' undeclared")) != -1) { //$NON-NLS-1$
int p = desc.indexOf("`"); //$NON-NLS-1$
if (p != -1) {
varName = desc.substring(p+1, s);
//System.out.println("undex varName "+ varName);
}
} else if((s = desc.indexOf("\' defined but not used")) != -1) {
int p = desc.indexOf("`");
} else if((s = desc.indexOf("\' defined but not used")) != -1) { //$NON-NLS-1$
int p = desc.indexOf("`"); //$NON-NLS-1$
if (p != -1) {
varName = desc.substring(p+1, s);
//System.out.println("unused varName "+ varName);
}
} else if((s = desc.indexOf("conflicting types for `")) != -1) {
int p = desc.indexOf("\'", s);
} else if((s = desc.indexOf("conflicting types for `")) != -1) { //$NON-NLS-1$
int p = desc.indexOf("\'", s); //$NON-NLS-1$
if (p != -1) {
varName = desc.substring(desc.indexOf("`") + 1, p);
varName = desc.substring(desc.indexOf("`") + 1, p); //$NON-NLS-1$
//System.out.println("confl varName "+ varName);
}
} else if((s = desc.indexOf("previous declaration of `")) != -1) {
int p = desc.indexOf("\'", s);
} else if((s = desc.indexOf("previous declaration of `")) != -1) { //$NON-NLS-1$
int p = desc.indexOf("\'", s); //$NON-NLS-1$
if (p != -1) {
varName = desc.substring(desc.indexOf("`") + 1, p);
varName = desc.substring(desc.indexOf("`") + 1, p); //$NON-NLS-1$
//System.out.println("prev varName "+ varName);
}
} else if ((s = desc.indexOf("parse error before ")) != -1) {
int p = desc.indexOf("\'", s);
} else if ((s = desc.indexOf("parse error before ")) != -1) { //$NON-NLS-1$
int p = desc.indexOf("\'", s); //$NON-NLS-1$
if (p != -1) {
varName = desc.substring(desc.indexOf("`") + 1, p);
varName = desc.substring(desc.indexOf("`") + 1, p); //$NON-NLS-1$
//System.out.println("prev varName "+ varName);
}
}
@ -159,8 +159,8 @@ public class GCCErrorParser implements IErrorParser {
* hello.c:3: in inclusion a.h:3
*
*/
if (eoParser.getScratchBuffer().startsWith("In file included from ")) {
if (line.startsWith("from ")) {
if (eoParser.getScratchBuffer().startsWith("In file included from ")) { //$NON-NLS-1$
if (line.startsWith("from ")) { //$NON-NLS-1$
// We want the last error in the chain, so continue.
eoParser.appendToScratchBuffer(line);
return false;
@ -168,8 +168,8 @@ public class GCCErrorParser implements IErrorParser {
String buffer = eoParser.getScratchBuffer();
eoParser.clearScratchBuffer();
int from = -1;
String inclusionError = fileName + ":" + num;
while ((from = buffer.indexOf("from ")) != -1) {
String inclusionError = fileName + ":" + num; //$NON-NLS-1$
while ((from = buffer.indexOf("from ")) != -1) { //$NON-NLS-1$
int coma = buffer.indexOf(',', from);
String buf;
if (coma != -1) {
@ -177,10 +177,10 @@ public class GCCErrorParser implements IErrorParser {
buffer = buffer.substring(coma);
} else {
buf = buffer.substring(from + 5);
buffer = "";
buffer = ""; //$NON-NLS-1$
}
String t = buf;
buf += " in inclusion " + inclusionError;
buf += " in inclusion " + inclusionError; //$NON-NLS-1$
inclusionError = t;
// Call the parsing process again.
processLine(buf, eoParser);
@ -195,17 +195,17 @@ public class GCCErrorParser implements IErrorParser {
if (file != null) {
// If there is a conflict set the error on the project.
if (eoParser.isConflictingName(fileName)) {
desc = "*" + desc;
desc = "*" + desc; //$NON-NLS-1$
file = null;
}
}
}
if (desc.startsWith("warning") || desc.startsWith("Warning")) {
if (desc.startsWith("warning") || desc.startsWith("Warning")) { //$NON-NLS-1$ //$NON-NLS-2$
severity = IMarkerGenerator.SEVERITY_WARNING;
// Remove the warning.
String d = desc.substring("warning".length()).trim();
if (d.startsWith(":")) {
String d = desc.substring("warning".length()).trim(); //$NON-NLS-1$
if (d.startsWith(":")) { //$NON-NLS-1$
d = d.substring(1).trim();
}
@ -216,14 +216,14 @@ public class GCCErrorParser implements IErrorParser {
// Display the fileName.
if (file == null) {
desc = desc +"[" + fileName + "]";
desc = desc +"[" + fileName + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
eoParser.generateMarker(file, num, desc, severity, varName);
} else {
if (line.startsWith("In file included from ")) {
if (line.startsWith("In file included from ")) { //$NON-NLS-1$
eoParser.appendToScratchBuffer(line);
} else if (line.startsWith("from ")) {
} else if (line.startsWith("from ")) { //$NON-NLS-1$
eoParser.appendToScratchBuffer(line);
}
}

View file

@ -32,33 +32,33 @@ public class GLDErrorParser implements IErrorParser {
String fileName = buf.substring(0, firstPara);
String previous = eoParser.getPreviousLine();
if (previous == null)
previous = "";
previous = ""; //$NON-NLS-1$
int colon = previous.indexOf(':');
if (colon != -1) {
previous = previous.substring(colon + 1);
}
desc = "*" + previous + " " + desc;
desc = "*" + previous + " " + desc; //$NON-NLS-1$ //$NON-NLS-2$
// Since we do not have any way to know the name of the C file
// where the undefined reference is refering we set the error
// on the project.
IFile file = eoParser.findFilePath(fileName);
if (file == null) {
desc = fileName + " " + desc;
desc = fileName + " " + desc; //$NON-NLS-1$
}
eoParser.generateMarker(file, 0, desc, IMarkerGenerator.SEVERITY_ERROR_RESOURCE, null);
} else if (buf.endsWith("ld")){
} else if (buf.endsWith("ld")){ //$NON-NLS-1$
// By default treat the condition as fatal/error, unless marked as a warning
int errorType = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
desc = desc.trim();
if(desc.startsWith("warning") || desc.startsWith("Warning")) {
if(desc.startsWith("warning") || desc.startsWith("Warning")) { //$NON-NLS-1$ //$NON-NLS-2$
errorType = IMarkerGenerator.SEVERITY_WARNING;
}
String fileName = line.substring(0, firstColon);
IFile file = eoParser.findFilePath(fileName);
if (file == null) {
desc = fileName + " " + desc;
desc = fileName + " " + desc; //$NON-NLS-1$
}
eoParser.generateMarker(file, 0, desc, errorType, null);

View file

@ -16,8 +16,8 @@ public class VCErrorParser implements IErrorParser {
/* Guard against drive in Windows platform. */
if (firstColon == 1) {
try {
String os = System.getProperty("os.name");
if (os != null && os.startsWith("Win")) {
String os = System.getProperty("os.name"); //$NON-NLS-1$
if (os != null && os.startsWith("Win")) { //$NON-NLS-1$
try {
if (Character.isLetter(line.charAt(0))) {
firstColon = line.indexOf(':', 2);
@ -29,7 +29,7 @@ public class VCErrorParser implements IErrorParser {
}
}
String firstPart = line.substring(0, firstColon);
StringTokenizer tok = new StringTokenizer(firstPart, "()");
StringTokenizer tok = new StringTokenizer(firstPart, "()"); //$NON-NLS-1$
if (tok.hasMoreTokens()) {
String fileName = tok.nextToken();
if (tok.hasMoreTokens()) {
@ -44,10 +44,10 @@ public class VCErrorParser implements IErrorParser {
if (file != null || eoParser.isConflictingName(fileName)) {
String desc = line.substring(firstColon + 1).trim();
if (file == null) {
desc = "*" + desc;
desc = "*" + desc; //$NON-NLS-1$
}
int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
if (desc.startsWith("warning")) {
if (desc.startsWith("warning")) { //$NON-NLS-1$
severity = IMarkerGenerator.SEVERITY_WARNING;
}
eoParser.generateMarker(file, num, desc, severity, null);

View file

@ -12,6 +12,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
public class Coff {
public static final String NL = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
@ -64,7 +66,7 @@ public class Coff {
public void commonSetup(byte[] hdr, boolean little) throws EOFException {
if (hdr == null || hdr.length < FILHSZ) {
throw new EOFException("array to small"); //$NON-NLS-1
throw new EOFException(CCorePlugin.getResourceString("Util.exception.arrayToSmall")); //$NON-NLS-1$
}
ReadMemoryAccess memory = new ReadMemoryAccess(hdr, little);
f_magic = memory.getUnsignedShort();

View file

@ -7,6 +7,8 @@ package org.eclipse.cdt.utils.coff;
import java.io.IOException;
import java.io.RandomAccessFile;
import org.eclipse.cdt.core.CCorePlugin;
public class Exe {
public static final String NL = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
@ -62,7 +64,7 @@ public class Exe {
}
memory.getBytes(e_signature);
if (e_signature[0] != 'M' || e_signature[1] != 'Z') {
throw new IOException("Not DOS EXE format"); //$NON-NLS-1$
throw new IOException(CCorePlugin.getResourceString("Util.exception.notDOSFormat")); //$NON-NLS-1$
}
e_lastsize = memory.getShort();
e_nblocks = memory.getShort();

View file

@ -8,6 +8,7 @@ package org.eclipse.cdt.utils.coff;
import java.io.IOException;
import java.io.RandomAccessFile;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.coff.Coff.FileHeader;
import org.eclipse.cdt.utils.coff.Coff.OptionalHeader;
import org.eclipse.cdt.utils.coff.Coff.SectionHeader;
@ -313,7 +314,7 @@ public class PE {
rfile.readFully(sig);
if (!((sig[0] == 'P') && (sig[1] == 'E')
&& (sig[2] == '\0') && (sig[3] == '\0'))) {
throw new IOException("Not a PE format");
throw new IOException(CCorePlugin.getResourceString("Util.exception.notPE")); //$NON-NLS-1$
}
} catch (IOException e) {
rfile.seek(pos);
@ -323,7 +324,7 @@ public class PE {
// Check if this a valid machine.
if (!isValidMachine(fileHeader.f_magic)) {
throw new IOException("Unknow machine/format");
throw new IOException(CCorePlugin.getResourceString("Util.exception.unknownFormat")); //$NON-NLS-1$
}
if (fileHeader.f_opthdr > 0) {
@ -479,7 +480,7 @@ public class PE {
if (idx + 4 < data.length) {
if (!((data[idx + 0] == 'P') && (data[idx + 1] == 'E')
&& (data[idx + 2] == '\0') && (data[idx + 3] == '\0'))) {
throw new IOException("Not a PE format");
throw new IOException(CCorePlugin.getResourceString("Util.exception.notPE")); //$NON-NLS-1$
}
idx += 4;
}
@ -491,7 +492,7 @@ public class PE {
if (isValidMachine(filehdr.f_magic)) {
return getAttributes(filehdr);
}
throw new IOException("not a PE format");
throw new IOException(CCorePlugin.getResourceString("Util.exception.notPE")); //$NON-NLS-1$
}
public static Attribute getAttribute(String file) throws IOException {

View file

@ -10,6 +10,8 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Vector;
import org.eclipse.cdt.core.CCorePlugin;
/**
* The <code>AR</code> class is used for parsing standard ELF archive (ar) files.
*
@ -226,7 +228,7 @@ public class PEArchive {
String hdr = rfile.readLine();
if (hdr == null || hdr.compareTo("!<arch>") != 0) { //$NON-NLS-1$
rfile.close();
throw new IOException("Not a valid archive file.");
throw new IOException(CCorePlugin.getResourceString("Util.exception.invalidArchive")); //$NON-NLS-1$
}
}

View file

@ -15,6 +15,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;
@ -66,7 +67,7 @@ public class ARMember extends BinaryObject {
if (header != null) {
return header.getPE();
}
throw new IOException("No file assiocated with Binary");
throw new IOException(CCorePlugin.getResourceString("Util.exception.noFileAssociation")); //$NON-NLS-1$
}
protected void addSymbols(Coff.Symbol[] peSyms, byte[] table, Addr2line addr2line, CPPFilt cppfilt, CygPath cypath, List list) {

View file

@ -15,6 +15,7 @@ import java.io.EOFException;
import java.io.IOException;
import org.eclipse.cdt.core.AbstractCExtension;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.utils.coff.PE;
import org.eclipse.cdt.utils.coff.PEArchive;
@ -38,7 +39,7 @@ public class PEParser extends AbstractCExtension implements IBinaryParser {
*/
public IBinaryFile getBinary(byte[] hints, IPath path) throws IOException {
if (path == null) {
throw new IOException("path is null");
throw new IOException(CCorePlugin.getResourceString("Util.exception.nullPath")); //$NON-NLS-1$
}
BinaryFile binary = null;

View file

@ -20,6 +20,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.debug.DebugUnknownType;
import org.eclipse.cdt.utils.debug.IDebugEntryRequestor;
import org.eclipse.cdt.utils.debug.tools.DebugSym;
@ -192,11 +193,11 @@ public class Dwarf {
byte[] bytes = new byte[4];
int n = in.read(bytes, 0, bytes.length);
if (n != 4) {
throw new IOException("missing bytes");
throw new IOException(CCorePlugin.getResourceString("Util.exception.missingBytes")); //$NON-NLS-1$
}
return read_4_bytes(bytes, 0);
} catch (IndexOutOfBoundsException e) {
throw new IOException("missing bytes");
throw new IOException(CCorePlugin.getResourceString("Util.exception.missingBytes")); //$NON-NLS-1$
}
}
@ -221,11 +222,11 @@ public class Dwarf {
byte[] bytes = new byte[8];
int n = in.read(bytes, 0, bytes.length);
if (n != 8) {
throw new IOException("missing bytes");
throw new IOException(CCorePlugin.getResourceString("Util.exception.missingBytes")); //$NON-NLS-1$
}
return read_8_bytes(bytes, 0);
} catch (IndexOutOfBoundsException e) {
throw new IOException("missing bytes");
throw new IOException(CCorePlugin.getResourceString("Util.exception.missingBytes")); //$NON-NLS-1$
}
}
@ -258,11 +259,11 @@ public class Dwarf {
byte[] bytes = new byte[2];
int n = in.read(bytes, 0, bytes.length);
if (n != 2) {
throw new IOException("missing bytes");
throw new IOException(CCorePlugin.getResourceString("Util.exception.missingBytes")); //$NON-NLS-1$
}
return read_2_bytes(bytes, 0);
} catch (IndexOutOfBoundsException e) {
throw new IOException("missing bytes");
throw new IOException(CCorePlugin.getResourceString("Util.exception.missingBytes")); //$NON-NLS-1$
}
}
@ -309,7 +310,7 @@ public class Dwarf {
while (true) {
b = (short) in.read();
if (b == -1)
throw new IOException("no more data");
throw new IOException(CCorePlugin.getResourceString("Util.exception.noData")); //$NON-NLS-1$
num_leb128_read++;
result |= ((long) (b & 0x7f) << shift);
shift += 7;

View file

@ -11,6 +11,8 @@
package org.eclipse.cdt.utils.debug.stabs;
import org.eclipse.cdt.core.CCorePlugin;
/**
* Format: string_field = name ':' symbol-descriptor type-information
@ -78,7 +80,7 @@ public class StringField {
/* SunPRO (3.0 at least) static variable encoding. */
break;
default :
name = "unknown C++ encoded name";
name = CCorePlugin.getResourceString("StringField.unknownName"); //$NON-NLS-1$
break;
}
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.utils.debug.tools;
import java.io.IOException;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.debug.dwarf.Dwarf;
import org.eclipse.cdt.utils.debug.stabs.Stabs;
import org.eclipse.cdt.utils.elf.Elf;
@ -47,7 +48,7 @@ public class DebugAddr2line {
Dwarf dwarf = new Dwarf(elf);
dwarf.parse(symreq);
} else {
throw new IOException("Unknown debug format");
throw new IOException(CCorePlugin.getResourceString("Util.unknownFormat")); //$NON-NLS-1$
}
}

View file

@ -19,6 +19,7 @@ import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.debug.DebugBaseType;
import org.eclipse.cdt.utils.debug.DebugParameterKind;
import org.eclipse.cdt.utils.debug.DebugType;
@ -61,7 +62,7 @@ public class DebugDump implements IDebugEntryRequestor {
Dwarf dwarf = new Dwarf(elf);
dwarf.parse(this);
} else {
throw new IOException("Unknown debug format");
throw new IOException(CCorePlugin.getResourceString("Util.unknownFormat")); //$NON-NLS-1$
}
bwriter.flush();
}
@ -96,7 +97,7 @@ public class DebugDump implements IDebugEntryRequestor {
* @see org.eclipse.cdt.utils.debug.IDebugEntryRequestor#enterCompilationUnit(java.lang.String, long)
*/
public void enterCompilationUnit(String name, long address) {
write("/* Enter Compilation Unit " + name + " address " + Long.toHexString(address) + " */");
write("/* Enter Compilation Unit " + name + " address " + Long.toHexString(address) + " */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
currentCU = name;
}
@ -107,11 +108,11 @@ public class DebugDump implements IDebugEntryRequestor {
* @see org.eclipse.cdt.utils.debug.IDebugEntryRequestor#exitCompilationUnit(long)
*/
public void exitCompilationUnit(long address) {
write("/* Exit Compilation Unit ");
write("/* Exit Compilation Unit "); //$NON-NLS-1$
if (currentCU != null) {
write(currentCU + " address " + Long.toHexString(address));
write(currentCU + " address " + Long.toHexString(address)); //$NON-NLS-1$
}
write(" */");
write(" */"); //$NON-NLS-1$
newLine();newLine();
currentCU = null;
}
@ -122,8 +123,8 @@ public class DebugDump implements IDebugEntryRequestor {
* @see org.eclipse.cdt.utils.debug.IDebugEntryRequestor#enterInclude(java.lang.String)
*/
public void enterInclude(String name) {
write("#include \"" + name + "\" ");
write("/* Enter Include */");
write("#include \"" + name + "\" "); //$NON-NLS-1$ //$NON-NLS-2$
write("/* Enter Include */"); //$NON-NLS-1$
newLine();
}
@ -143,12 +144,12 @@ public class DebugDump implements IDebugEntryRequestor {
* @see org.eclipse.cdt.utils.debug.IDebugEntryRequestor#enterFunction(java.lang.String, int, boolean, long)
*/
public void enterFunction(String name, DebugType type, boolean isGlobal, long address) {
write("/* Func:" + name + " address " + Long.toHexString(address) + " */");
write("/* Func:" + name + " address " + Long.toHexString(address) + " */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
if (!isGlobal) {
write("static ");
write("static "); //$NON-NLS-1$
}
write(type.toString() + " " + name + "(");
write(type.toString() + " " + name + "("); //$NON-NLS-1$ //$NON-NLS-2$
paramCount = 0;
}
@ -160,16 +161,16 @@ public class DebugDump implements IDebugEntryRequestor {
public void exitFunction(long address) {
if (paramCount > -1) {
paramCount = -1;
write(")");
write(")"); //$NON-NLS-1$
newLine();
write("{");
write("{"); //$NON-NLS-1$
newLine();
bracket++;
}
for (; bracket > 0; bracket--) {
write("}");
write("}"); //$NON-NLS-1$
}
write(" /* Exit Func address " + Long.toHexString(address) + " */");
write(" /* Exit Func address " + Long.toHexString(address) + " */"); //$NON-NLS-1$ //$NON-NLS-2$
newLine();newLine();
}
@ -181,10 +182,10 @@ public class DebugDump implements IDebugEntryRequestor {
public void enterCodeBlock(long offset) {
if (paramCount > -1) {
paramCount = -1;
write(")");
write(")"); //$NON-NLS-1$
newLine();
}
write(printTabs() + "{ " + "/* " + offset + " */");
write(printTabs() + "{ " + "/* " + offset + " */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
bracket++;
}
@ -196,7 +197,7 @@ public class DebugDump implements IDebugEntryRequestor {
*/
public void exitCodeBlock(long offset) {
bracket--;
write(printTabs() + "} " + "/* " + offset + " */");
write(printTabs() + "} " + "/* " + offset + " */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
}
@ -207,14 +208,14 @@ public class DebugDump implements IDebugEntryRequestor {
*/
public void acceptStatement(int line, long address) {
if (paramCount > -1) {
write(")");
write(")"); //$NON-NLS-1$
newLine();
write("{");
write("{"); //$NON-NLS-1$
newLine();
bracket++;
paramCount = -1;
}
write(printTabs() + "/* line " + line + " address " + address + " */");
write(printTabs() + "/* line " + line + " address " + address + " */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
}
@ -224,7 +225,7 @@ public class DebugDump implements IDebugEntryRequestor {
* @see org.eclipse.cdt.utils.debug.IDebugEntryRequestor#acceptIntegerConst(java.lang.String, long)
*/
public void acceptIntegerConst(String name, int value) {
write("const int " + name + " = " + value + ";");
write("const int " + name + " = " + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
}
@ -234,7 +235,7 @@ public class DebugDump implements IDebugEntryRequestor {
* @see org.eclipse.cdt.utils.debug.IDebugEntryRequestor#acceptFloatConst(java.lang.String, double)
*/
public void acceptFloatConst(String name, double value) {
write("const float " + name + " = " + value + ";");
write("const float " + name + " = " + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
}
@ -245,7 +246,7 @@ public class DebugDump implements IDebugEntryRequestor {
* org.eclipse.cdt.utils.debug.DebugType, int)
*/
public void acceptTypeConst(String name, DebugType type, int value) {
write("const " + type.toString() + " " + name + " = " + value + ";");
write("const " + type.toString() + " " + name + " = " + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
newLine();
}
@ -256,10 +257,10 @@ public class DebugDump implements IDebugEntryRequestor {
*/
public void acceptParameter(String name, DebugType type, DebugParameterKind kind, long offset) {
if (paramCount > 0) {
write(", ");
write(", "); //$NON-NLS-1$
}
paramCount++;
write(type.toString() + " " + name + "/* " + offset + " */");
write(type.toString() + " " + name + "/* " + offset + " */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/*
@ -268,7 +269,7 @@ public class DebugDump implements IDebugEntryRequestor {
* @see org.eclipse.cdt.utils.debug.IDebugEntryRequestor#acceptVariable(java.lang.String, int, int, long)
*/
public void acceptVariable(String name, DebugType type, DebugVariableKind kind, long address) {
write(printTabs() + type.toString() + " " + name + ";" + "/* " + Long.toHexString(address) + " */");
write(printTabs() + type.toString() + " " + name + ";" + "/* " + Long.toHexString(address) + " */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
newLine();
}
@ -288,11 +289,11 @@ public class DebugDump implements IDebugEntryRequestor {
*/
public void acceptTypeDef(String name, DebugType type) {
if (!name.equals(type.toString())) {
write("typedef " + type.toString() + " " + name + ";");
write("typedef " + type.toString() + " " + name + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
} else if (type instanceof DebugBaseType){
DebugBaseType baseType =(DebugBaseType)type;
write("/* " + name + ": " + baseType.sizeof() + " bytes */");
write("/* " + name + ": " + baseType.sizeof() + " bytes */"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
newLine();
} else {
//int x = 9;

View file

@ -42,12 +42,12 @@ public class DebugSym implements Comparable {
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("Type:").append(type).append("\n");
buf.append("Name: ").append(name).append("\n");
buf.append("\taddress:").append("0x").append(Long.toHexString(addr)).append("\n");
buf.append("\tstartLine:").append(startLine).append("\n");
buf.append("\tendLine:").append(endLine).append("\n");
buf.append("\tSize:").append(size).append("\n");
buf.append("Type:").append(type).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append("Name: ").append(name).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append("\taddress:").append("0x").append(Long.toHexString(addr)).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
buf.append("\tstartLine:").append(startLine).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append("\tendLine:").append(endLine).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append("\tSize:").append(size).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
return buf.toString();
}
}

View file

@ -10,6 +10,8 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Vector;
import org.eclipse.cdt.core.CCorePlugin;
/**
* The <code>AR</code> class is used for parsing standard ELF archive (ar) files.
*
@ -233,7 +235,7 @@ public class AR {
String hdr = efile.readLine();
if (hdr == null || hdr.compareTo("!<arch>") != 0) { //$NON-NLS-1$
efile.close();
throw new IOException("Not a valid archive file.");
throw new IOException(CCorePlugin.getResourceString("Util.exception.invalidArchive")); //$NON-NLS-1$
}
}

View file

@ -9,8 +9,9 @@ import java.io.EOFException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;
@ -125,7 +126,7 @@ public class Elf {
efile.readFully(e_ident);
if ( e_ident[ELFhdr.EI_MAG0] != 0x7f || e_ident[ELFhdr.EI_MAG1] != 'E' ||
e_ident[ELFhdr.EI_MAG2] != 'L' || e_ident[ELFhdr.EI_MAG3] != 'F' )
throw new IOException("Not ELF format");
throw new IOException(CCorePlugin.getResourceString("Util.exception.notELF")); //$NON-NLS-1$
efile.setEndian(e_ident[ELFhdr.EI_DATA] == ELFhdr.ELFDATA2LSB);
e_type = efile.readShortE();
e_machine = efile.readShortE();
@ -144,12 +145,12 @@ public class Elf {
protected ELFhdr(byte [] bytes) throws IOException {
if(bytes.length <= e_ident.length) {
throw new EOFException("Not ELF format");
throw new EOFException(CCorePlugin.getResourceString("Util.exception.notELF")); //$NON-NLS-1$
}
System.arraycopy(bytes, 0, e_ident, 0, e_ident.length);
if ( e_ident[ELFhdr.EI_MAG0] != 0x7f || e_ident[ELFhdr.EI_MAG1] != 'E' ||
e_ident[ELFhdr.EI_MAG2] != 'L' || e_ident[ELFhdr.EI_MAG3] != 'F' )
throw new IOException("Not ELF format");
throw new IOException(CCorePlugin.getResourceString("Util.exception.notELF")); //$NON-NLS-1$
boolean isle = (e_ident[ELFhdr.EI_DATA] == ELFhdr.ELFDATA2LSB);
int offset = e_ident.length;
e_type = makeShort(bytes, offset, isle); offset += 2;

View file

@ -15,6 +15,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.IToolsProvider;
@ -64,7 +65,7 @@ public class ARMember extends BinaryObject {
if (header != null) {
return new ElfHelper(header.getElf());
}
throw new IOException("No file assiocated with Binary");
throw new IOException(CCorePlugin.getResourceString("Util.exception.noFileAssociation")); //$NON-NLS-1$
}
protected void addSymbols(Elf.Symbol[] array, int type, Addr2line addr2line, CPPFilt cppfilt, List list) {

View file

@ -14,6 +14,7 @@ import java.io.EOFException;
import java.io.IOException;
import org.eclipse.cdt.core.AbstractCExtension;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.utils.elf.AR;
import org.eclipse.cdt.utils.elf.Elf;
@ -34,7 +35,7 @@ public class ElfParser extends AbstractCExtension implements IBinaryParser {
public IBinaryFile getBinary(byte[] hints, IPath path) throws IOException {
if (path == null) {
throw new IOException("path is null");
throw new IOException(CCorePlugin.getResourceString("Util.exception.nullPath")); //$NON-NLS-1$
}
BinaryFile binary = null;

View file

@ -4,6 +4,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.cdt.core.CCorePlugin;
/**
* @author alain
*
@ -42,7 +44,7 @@ public class PTY {
}
if (slave == null) {
throw new IOException("Can not create pty");
throw new IOException(CCorePlugin.getResourceString("Util.exception.cannotCreatePty")); //$NON-NLS-1$
}
in = new PTYInputStream(new MasterFD());

View file

@ -5,9 +5,10 @@ package org.eclipse.cdt.utils.pty;
* All Rights Reserved.
*/
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.pty.PTY.MasterFD;
class PTYInputStream extends InputStream {
@ -66,7 +67,7 @@ class PTYInputStream extends InputStream {
return;
int status = close0(master.getFD());
if (status == -1)
throw new IOException("close error");
throw new IOException(CCorePlugin.getResourceString("Util.exception.closeError")); //$NON-NLS-1$
master.setFD(-1);
}

View file

@ -11,6 +11,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.StringTokenizer;
import org.eclipse.cdt.core.CCorePlugin;
public class Spawner extends Process {
public int NOOP = 0;
@ -257,7 +259,7 @@ public class Spawner extends Process {
cmdarray = array;
envp = env;
dirpath = dir;
errMesg = new String("Cannot run " + cmdarray[0]);
errMesg = new String(CCorePlugin.getResourceString("Util.error.cannotRun") + cmdarray[0]); //$NON-NLS-1$
}
public void run() {

View file

@ -5,8 +5,10 @@ package org.eclipse.cdt.utils.spawner;
* All Rights Reserved.
*/
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.cdt.core.CCorePlugin;
class SpawnerInputStream extends InputStream {
private int fd;
@ -66,7 +68,7 @@ class SpawnerInputStream extends InputStream {
return;
int status = close0(fd);
if (status == -1)
throw new IOException("close error");
throw new IOException(CCorePlugin.getResourceString("Util.exception.closeError")); //$NON-NLS-1$
fd = -1;
}