1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-08-08 15:08:33 -07:00
parent 9e00dad206
commit dd039973ae
7 changed files with 424 additions and 467 deletions

View file

@ -1,13 +1,13 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others. * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Niefer (IBM Corporation) - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
@ -25,8 +25,8 @@ public interface ICPPClassScope extends ICPPScope {
/** /**
* Returns an array of methods that were implicitly added to this class * Returns an array of methods that were implicitly added to this class
* scope. These methods may or may not have been explicitly declared in the * scope. These methods may or may not have been explicitly declared in
* code. The methods that will be implicitly declared are: the default * the code. The methods that will be implicitly declared are: the default
* constructor, copy constructor, copy assignment operator, and destructor * constructor, copy constructor, copy assignment operator, and destructor
*/ */
public ICPPMethod[] getImplicitMethods(); public ICPPMethod[] getImplicitMethods();

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser; package org.eclipse.cdt.core.parser;
@ -19,11 +19,10 @@ import java.util.Map;
*/ */
public interface IScannerInfo { public interface IScannerInfo {
/** /**
* Returns a <code>Map</code> containing all the defined preprocessor * Returns a {@link Map} containing all the defined preprocessor symbols and their values.
* symbols and their values.
* Symbols defined without values have an empty string for a value. For * Symbols defined without values have an empty string for a value. For
* example,-Dsymbol=value would have a map entry (symbol,value). A symbol * example, -Dsymbol=value would have a map entry (symbol, value). A symbol
* defined as -Dsymbol= would have a map entry of (symbol,""). * defined as -Dsymbol= would have a map entry of (symbol, "").
*/ */
public Map<String, String> getDefinedSymbols(); public Map<String, String> getDefinedSymbols();
@ -41,9 +40,10 @@ public interface IScannerInfo {
* <br> E.g.: /System/Library/Frameworks/__framework__.framework/Headers/__header__, * <br> E.g.: /System/Library/Frameworks/__framework__.framework/Headers/__header__,
* /System/Library/Frameworks/__framework__.framework/PrivateHeaders/__header__ * /System/Library/Frameworks/__framework__.framework/PrivateHeaders/__header__
* would handle the framework search for '/System/Library/Frameworks' * would handle the framework search for '/System/Library/Frameworks'
* <br> The variables are handled only, if a search path element makes use of both of the variables. * <br> The variables are handled only, if a search path element makes use of both of
* The __framework__ variable will receive the first segment of the include, the __header__ variable * the variables. The __framework__ variable will receive the first segment of the include,
* the rest. Such a search path element is not used for directives with a single segment (e.g. 'header.h') * the __header__ variable the rest. Such a search path element is not used for directives
* with a single segment (e.g. 'header.h')
*/ */
public String[] getIncludePaths(); public String[] getIncludePaths();
} }

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser; package org.eclipse.cdt.core.parser;
import org.eclipse.cdt.core.parser.util.CharArrayUtils; import org.eclipse.cdt.core.parser.util.CharArrayUtils;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -40,8 +40,8 @@ import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent;
* C++-specific implementation of a translation-unit. * C++-specific implementation of a translation-unit.
*/ */
public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPASTTranslationUnit, IASTAmbiguityParent { public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPASTTranslationUnit, IASTAmbiguityParent {
private CPPNamespaceScope fScope = null; private CPPNamespaceScope fScope;
private ICPPNamespace fBinding = null; private ICPPNamespace fBinding;
private final CPPScopeMapper fScopeMapper= new CPPScopeMapper(this); private final CPPScopeMapper fScopeMapper= new CPPScopeMapper(this);
public CPPASTTranslationUnit() { public CPPASTTranslationUnit() {

View file

@ -95,7 +95,6 @@ import com.ibm.icu.text.MessageFormat;
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class CCorePlugin extends Plugin { public class CCorePlugin extends Plugin {
public static final int STATUS_CDTPROJECT_EXISTS = 1; public static final int STATUS_CDTPROJECT_EXISTS = 1;
public static final int STATUS_CDTPROJECT_MISMATCH = 2; public static final int STATUS_CDTPROJECT_MISMATCH = 2;
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3; public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
@ -299,7 +298,6 @@ public class CCorePlugin extends Plugin {
return fgCPlugin; return fgCPlugin;
} }
/** /**
* @see Plugin#shutdown * @see Plugin#shutdown
*/ */
@ -510,7 +508,6 @@ public class CCorePlugin extends Plugin {
getDefault().savePluginPreferences(); getDefault().savePluginPreferences();
} }
/** /**
* Create CDT console adapter for build console defined as an extension. * Create CDT console adapter for build console defined as an extension.
* See {@code org.eclipse.cdt.core.CBuildConsole} extension point. * See {@code org.eclipse.cdt.core.CBuildConsole} extension point.
@ -833,61 +830,61 @@ public class CCorePlugin extends Plugin {
final IProject projectHandle, final IProject projectHandle,
final String bsId, final String bsId,
IProgressMonitor monitor) IProgressMonitor monitor)
throws CoreException, OperationCanceledException { throws CoreException, OperationCanceledException {
getWorkspace().run(new IWorkspaceRunnable() { getWorkspace().run(new IWorkspaceRunnable() {
@Override @Override
public void run(IProgressMonitor monitor) throws CoreException { public void run(IProgressMonitor monitor) throws CoreException {
try { try {
if (monitor == null) { if (monitor == null) {
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
}
monitor.beginTask("Creating C Project...", 3); //$NON-NLS-1$
if (!projectHandle.exists()) {
projectHandle.create(description, new SubProgressMonitor(monitor, 1));
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
// Open first.
projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1));
// mapCProjectOwner(projectHandle, projectID, false);
// Add C Nature ... does not add duplicates
CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
if(bsId != null){
ICProjectDescription projDes = createProjectDescription(projectHandle, true);
ICConfigurationDescription cfgs[] = projDes.getConfigurations();
ICConfigurationDescription cfg = null;
for (ICConfigurationDescription cfg2 : cfgs) {
if(bsId.equals(cfg2.getBuildSystemId())){
cfg = cfg2;
break;
}
}
if(cfg == null){
ICConfigurationDescription prefCfg = getPreferenceConfiguration(bsId);
if(prefCfg != null){
cfg = projDes.createConfiguration(CDataUtil.genId(prefCfg.getId()), prefCfg.getName(), prefCfg);
}
}
if(cfg != null){
setProjectDescription(projectHandle, projDes);
}
}
} finally {
monitor.done();
} }
monitor.beginTask("Creating C Project...", 3); //$NON-NLS-1$
if (!projectHandle.exists()) {
projectHandle.create(description, new SubProgressMonitor(monitor, 1));
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
// Open first.
projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1));
// mapCProjectOwner(projectHandle, projectID, false);
// Add C Nature ... does not add duplicates
CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
if (bsId != null){
ICProjectDescription projDes = createProjectDescription(projectHandle, true);
ICConfigurationDescription cfgs[] = projDes.getConfigurations();
ICConfigurationDescription cfg = null;
for (ICConfigurationDescription cfg2 : cfgs) {
if (bsId.equals(cfg2.getBuildSystemId())){
cfg = cfg2;
break;
}
}
if (cfg == null){
ICConfigurationDescription prefCfg = getPreferenceConfiguration(bsId);
if (prefCfg != null){
cfg = projDes.createConfiguration(CDataUtil.genId(prefCfg.getId()), prefCfg.getName(), prefCfg);
}
}
if (cfg != null){
setProjectDescription(projectHandle, projDes);
}
}
} finally {
monitor.done();
} }
}, getWorkspace().getRoot(), 0, monitor); }
return projectHandle; }, getWorkspace().getRoot(), 0, monitor);
} return projectHandle;
}
/** /**
* Method convertProjectFromCtoCC converts * Method convertProjectFromCtoCC converts
@ -899,7 +896,6 @@ public class CCorePlugin extends Plugin {
* @param monitor * @param monitor
* @throws CoreException * @throws CoreException
*/ */
public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException { public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
if ((projectHandle != null) if ((projectHandle != null)
&& projectHandle.hasNature(CProjectNature.C_NATURE_ID) && projectHandle.hasNature(CProjectNature.C_NATURE_ID)
@ -974,7 +970,7 @@ public class CCorePlugin extends Plugin {
for (IConfigurationElement configElement : configElements) { for (IConfigurationElement configElement : configElements) {
if (configElement.getName().equals("processList")) { //$NON-NLS-1$ if (configElement.getName().equals("processList")) { //$NON-NLS-1$
String platform = configElement.getAttribute("platform"); //$NON-NLS-1$ String platform = configElement.getAttribute("platform"); //$NON-NLS-1$
if (platform == null ) { // first contributor found with not platform will be default. if (platform == null) { // first contributor found with not platform will be default.
if (defaultContributor == null) { if (defaultContributor == null) {
defaultContributor = configElement; defaultContributor = configElement;
} }
@ -985,12 +981,11 @@ public class CCorePlugin extends Plugin {
} }
} }
} }
if ( defaultContributor != null) { if (defaultContributor != null) {
return (IProcessList) defaultContributor.createExecutableExtension("class"); //$NON-NLS-1$ return (IProcessList) defaultContributor.createExecutableExtension("class"); //$NON-NLS-1$
} }
} }
return null; return null;
} }
/** /**
@ -1024,7 +1019,7 @@ public class CCorePlugin extends Plugin {
try { try {
// Look up in session property for previously created provider // Look up in session property for previously created provider
QualifiedName scannerInfoProviderName = new QualifiedName(PLUGIN_ID, SCANNER_INFO_PROVIDER2_NAME); QualifiedName scannerInfoProviderName = new QualifiedName(PLUGIN_ID, SCANNER_INFO_PROVIDER2_NAME);
provider = (IScannerInfoProvider)project.getSessionProperty(scannerInfoProviderName); provider = (IScannerInfoProvider) project.getSessionProperty(scannerInfoProviderName);
if (provider != null) if (provider != null)
return provider; return provider;
@ -1117,8 +1112,6 @@ public class CCorePlugin extends Plugin {
CContentTypes.setUseProjectSpecificContentTypes(project, val); CContentTypes.setUseProjectSpecificContentTypes(project, val);
} }
private static final String MODEL = CCorePlugin.PLUGIN_ID + "/debug/model" ; //$NON-NLS-1$ private static final String MODEL = CCorePlugin.PLUGIN_ID + "/debug/model" ; //$NON-NLS-1$
private static final String PARSER = CCorePlugin.PLUGIN_ID + "/debug/parser" ; //$NON-NLS-1$ private static final String PARSER = CCorePlugin.PLUGIN_ID + "/debug/parser" ; //$NON-NLS-1$
private static final String PARSER_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$ private static final String PARSER_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$
@ -1130,27 +1123,25 @@ public class CCorePlugin extends Plugin {
* Configure the plug-in with respect to option settings defined in ".options" file * Configure the plug-in with respect to option settings defined in ".options" file
*/ */
public void configurePluginDebugOptions() { public void configurePluginDebugOptions() {
if (CCorePlugin.getDefault().isDebugging()) {
if(CCorePlugin.getDefault().isDebugging()) {
String option = Platform.getDebugOption(PARSER); String option = Platform.getDebugOption(PARSER);
if(option != null) Util.VERBOSE_PARSER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ if (option != null) Util.VERBOSE_PARSER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
option = Platform.getDebugOption(PARSER_EXCEPTIONS); option = Platform.getDebugOption(PARSER_EXCEPTIONS);
if( option != null ) Util.PARSER_EXCEPTIONS = option.equalsIgnoreCase("true"); //$NON-NLS-1$ if (option != null) Util.PARSER_EXCEPTIONS = option.equalsIgnoreCase("true"); //$NON-NLS-1$
option = Platform.getDebugOption(SCANNER); option = Platform.getDebugOption(SCANNER);
if( option != null ) Util.VERBOSE_SCANNER = option.equalsIgnoreCase("true"); //$NON-NLS-1$ if (option != null) Util.VERBOSE_SCANNER = option.equalsIgnoreCase("true"); //$NON-NLS-1$
option = Platform.getDebugOption(MODEL); option = Platform.getDebugOption(MODEL);
if(option != null) Util.VERBOSE_MODEL = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ if (option != null) Util.VERBOSE_MODEL = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
option = Platform.getDebugOption(DELTA); option = Platform.getDebugOption(DELTA);
if(option != null) Util.VERBOSE_DELTA= option.equalsIgnoreCase("true") ; //$NON-NLS-1$ if (option != null) Util.VERBOSE_DELTA= option.equalsIgnoreCase("true") ; //$NON-NLS-1$
} }
} }
// Preference to turn on/off the use of structural parse mode to build the CModel // Preference to turn on/off the use of structural parse mode to build the CModel.
public void setStructuralParseMode(boolean useNewParser) { public void setStructuralParseMode(boolean useNewParser) {
getPluginPreferences().setValue(PREF_USE_STRUCTURAL_PARSE_MODE, useNewParser); getPluginPreferences().setValue(PREF_USE_STRUCTURAL_PARSE_MODE, useNewParser);
savePluginPreferences(); savePluginPreferences();

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Tomasz Wesolowski - initial API and implementation * Tomasz Wesolowski - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.editor; package org.eclipse.cdt.internal.ui.editor;
@ -52,13 +52,10 @@ import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI; import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
public class OverrideIndicatorManager implements ICReconcilingListener { public class OverrideIndicatorManager implements ICReconcilingListener {
static final String ANNOTATION_TYPE = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$ static final String ANNOTATION_TYPE = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$
private static final String MESSAGE_SEPARATOR = ";\n"; //$NON-NLS-1$ private static final String MESSAGE_SEPARATOR = ";\n"; //$NON-NLS-1$
public static class OverrideInfo { public static class OverrideInfo {
public int nodeOffset; public int nodeOffset;
public int resultType; public int resultType;
public String message; public String message;
@ -79,7 +76,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
public static final int RESULT_SHADOWS = 2; public static final int RESULT_SHADOWS = 2;
public class OverrideIndicator extends Annotation { public class OverrideIndicator extends Annotation {
public static final String ANNOTATION_TYPE_ID = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$ public static final String ANNOTATION_TYPE_ID = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$
private int type; private int type;
private ICElementHandle declaration; private ICElementHandle declaration;
@ -108,9 +104,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
CDTUITools.openInEditor(declaration, true, true); CDTUITools.openInEditor(declaration, true, true);
} catch (CoreException e) { } catch (CoreException e) {
} }
} }
} }
private IAnnotationModel fAnnotationModel; private IAnnotationModel fAnnotationModel;
@ -123,7 +117,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
} }
private void handleResult(OverrideInfo info, IIndex index) { private void handleResult(OverrideInfo info, IIndex index) {
Position position = new Position(info.nodeOffset, info.nodeLength); Position position = new Position(info.nodeOffset, info.nodeLength);
OverrideIndicator indicator = new OverrideIndicator(info.resultType, info.message, info.binding, index); OverrideIndicator indicator = new OverrideIndicator(info.resultType, info.message, info.binding, index);
@ -166,7 +159,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
} }
if (binding instanceof ICPPMethod) { if (binding instanceof ICPPMethod) {
method = (ICPPMethod) binding; method = (ICPPMethod) binding;
OverrideInfo overrideInfo = testForOverride(method, declaration.getFileLocation()); OverrideInfo overrideInfo = checkForOverride(method, declaration);
if (overrideInfo != null) { if (overrideInfo != null) {
handleResult(overrideInfo, index); handleResult(overrideInfo, index);
} }
@ -209,7 +202,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
return PROCESS_SKIP; return PROCESS_SKIP;
} }
ICPPMethod method = (ICPPMethod) definitionBinding; ICPPMethod method = (ICPPMethod) definitionBinding;
OverrideInfo overrideInfo = testForOverride(method, definition.getFileLocation()); OverrideInfo overrideInfo = checkForOverride(method, definition);
if (overrideInfo != null) { if (overrideInfo != null) {
handleResult(overrideInfo, index); handleResult(overrideInfo, index);
} }
@ -223,8 +216,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
ast.accept(new MethodDefinitionFinder()); ast.accept(new MethodDefinitionFinder());
} }
public static OverrideInfo testForOverride(ICPPMethod testedOverride, IASTFileLocation location) throws DOMException { private static OverrideInfo checkForOverride(ICPPMethod testedOverride, IASTNode node) throws DOMException {
IASTFileLocation location = node.getFileLocation();
testedOverride.getClassOwner().getBases(); testedOverride.getClassOwner().getBases();
boolean onlyPureVirtual = true; boolean onlyPureVirtual = true;
@ -301,7 +294,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
return info; return info;
} }
return null; return null;
} }
/** /**
@ -314,8 +306,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
* @throws DOMException * @throws DOMException
*/ */
private static void handleBaseClass(ICPPClassType aClass, ICPPMethod testedOverride, private static void handleBaseClass(ICPPClassType aClass, ICPPMethod testedOverride,
Set<ICPPMethod> foundMethods, Set<ICPPMethod> shadowedMethods, Set<ICPPClassType> alreadyTestedBases) throws DOMException { Set<ICPPMethod> foundMethods, Set<ICPPMethod> shadowedMethods,
Set<ICPPClassType> alreadyTestedBases) throws DOMException {
if (alreadyTestedBases.contains(aClass)) { if (alreadyTestedBases.contains(aClass)) {
return; return;
} else { } else {
@ -427,5 +419,4 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
} }
return annotationModel; return annotationModel;
} }
} }