1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Fix for 178033: Language names are used inconsistently

This commit is contained in:
Anton Leherbauer 2007-04-24 12:39:32 +00:00
parent 2d963989a0
commit d1713fd418
7 changed files with 31 additions and 50 deletions

View file

@ -7,7 +7,8 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.model;
@ -51,7 +52,18 @@ public abstract class AbstractLanguage extends PlatformObject implements ILangua
int style) throws CoreException {
throw new UnsupportedOperationException();
}
/*
* @see org.eclipse.cdt.core.model.ILanguage#getName()
*/
public String getName() {
ILanguageDescriptor languageDescriptor= LanguageManager.getInstance().getLanguageDescriptor(getId());
if (languageDescriptor != null) {
return languageDescriptor.getName();
}
return getId();
}
/**
* Construct an AST for the source code provided by <code>reader</code>.
* As an option you can supply

View file

@ -1,22 +0,0 @@
package org.eclipse.cdt.core.dom.ast.gnu;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.core.dom.ast.gnu.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
private Messages() {
}
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}

View file

@ -15,7 +15,6 @@
package org.eclipse.cdt.core.dom.ast.gnu.c;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.gnu.Messages;
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
import org.eclipse.cdt.core.dom.parser.c.AbstractCLanguage;
import org.eclipse.cdt.core.dom.parser.c.GCCParserExtensionConfiguration;
@ -42,23 +41,19 @@ public class GCCLanguage extends AbstractCLanguage {
public String getId() {
return ID;
}
public String getName() {
return Messages.getString("GCCLanguage.name"); //$NON-NLS-1$
}
/*
* @see org.eclipse.cdt.core.parser.AbstractCLanguage#getParserExtensionConfiguration()
*/
protected ICParserExtensionConfiguration getParserExtensionConfiguration() {
return C_GNU_PARSER_EXTENSION;
}
/*
* @see org.eclipse.cdt.core.parser.AbstractCLanguage#getScannerExtensionConfiguration()
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCLanguage#getScannerExtensionConfiguration()
*/
protected IScannerExtensionConfiguration getScannerExtensionConfiguration() {
return C_GNU_SCANNER_EXTENSION;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCLanguage#getParserExtensionConfiguration()
*/
protected ICParserExtensionConfiguration getParserExtensionConfiguration() {
return C_GNU_PARSER_EXTENSION;
}
}

View file

@ -14,7 +14,6 @@
package org.eclipse.cdt.core.dom.ast.gnu.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.gnu.Messages;
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
import org.eclipse.cdt.core.dom.parser.cpp.AbstractCPPLanguage;
import org.eclipse.cdt.core.dom.parser.cpp.AbstractCPPParserExtensionConfiguration;
@ -41,19 +40,15 @@ public class GPPLanguage extends AbstractCPPLanguage {
return ID;
}
public String getName() {
return Messages.getString("GPPLanguage.name"); //$NON-NLS-1$
}
/*
* @see org.eclipse.cdt.core.dom.ast.gnu.cpp.AbstractCPPLanguage#getScannerExtensionConfiguration()
* @see org.eclipse.cdt.core.dom.parser.cpp.AbstractCPPLanguage#getScannerExtensionConfiguration()
*/
protected IScannerExtensionConfiguration getScannerExtensionConfiguration() {
return CPP_GNU_SCANNER_EXTENSION;
}
/*
* @see org.eclipse.cdt.core.dom.ast.gnu.cpp.AbstractCPPLanguage#getParserExtensionConfiguration()
* @see org.eclipse.cdt.core.dom.parser.cpp.AbstractCPPLanguage#getParserExtensionConfiguration()
*/
protected AbstractCPPParserExtensionConfiguration getParserExtensionConfiguration() {
return CPP_GNU_PARSER_EXTENSION;

View file

@ -1,2 +0,0 @@
GPPLanguage.name=C++ for G++ compiler
GCCLanguage.name=C for GCC compiler

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2003, 2006 IBM Corporation and others.
# Copyright (c) 2003, 2007 IBM Corporation 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
@ -7,6 +7,7 @@
#
# Contributors:
# IBM Corporation - initial API and implementation
# Anton Leherbauer (Wind River Systems)
###############################################################################
pluginName=C/C++ Development Tools Core
providerName=Eclipse.org
@ -86,4 +87,6 @@ PDOMProviderName=PDOM Provider
fastIndexer.name=Fast Indexer
language.name=Language
# built-in languages
language.name.gcc= GNU C
language.name.gpp= GNU C++

View file

@ -575,14 +575,14 @@
<language
class="org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage"
id="gcc"
name="GNU C">
name="%language.name.gcc">
<contentType id="org.eclipse.cdt.core.cSource"/>
<contentType id="org.eclipse.cdt.core.cHeader"/>
</language>
<language
class="org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage"
id="g++"
name="GNU C++">
name="%language.name.gpp">
<contentType id="org.eclipse.cdt.core.cxxSource"/>
<contentType id="org.eclipse.cdt.core.cxxHeader"/>
</language>