Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/src/org')
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java30
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java46
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java520
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java1153
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java48
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CDescriptorEvent.java73
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java116
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java198
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ConsoleOutputStream.java44
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java485
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java131
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java84
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java264
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptor.java34
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorListener.java15
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java64
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorOperation.java20
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java18
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionDescriptor.java17
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionReference.java93
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICLogConstants.java26
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwner.java18
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwnerInfo.java17
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IConsoleParser.java33
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IErrorParser.java21
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IMarkerGenerator.java30
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionConverter.java63
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java64
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessInfo.java16
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessList.java15
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ISymbolReader.java22
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java46
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ToolFactory.java88
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java88
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableException.java115
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableStatus.java220
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariable.java80
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableManager.java151
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableStatus.java85
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariablesContributor.java19
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/CDOM.java173
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IASTServiceProvider.java112
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvirinmentVariable.java88
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IContributedEnvironment.java35
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentContributor.java17
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariable.java69
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariableManager.java80
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/CodeFormatter.java104
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java3012
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java319
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoChangeListener.java26
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoProvider.java44
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java126
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java176
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java93
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/FileStorage.java95
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IConsole.java25
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStore.java58
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStoreListener.java25
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableChangeListener.java42
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableManager.java137
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryStoreChangedEvent.java57
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryVariableChangeEvent.java90
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerInfo.java66
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerProvider.java221
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java257
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java413
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java191
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCoreInternals.java22
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties80
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java61
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java216
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptor.java650
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java399
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionDescriptor.java36
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java43
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionReference.java87
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwner.java66
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwnerConfiguration.java61
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ConsoleOutputSniffer.java182
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/InternalCExtension.java37
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java271
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java43
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTracker.java601
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java206
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java208
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ProcessClosure.java233
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java58
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/BuildSystemVariableSupplier.java99
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java495
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtVariableManager.java204
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreMacroSupplierBase.java39
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java53
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/DefaultVariableContextInfo.java139
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EclipseVariablesVariableSupplier.java183
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java182
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/ICoreVariableContextInfo.java39
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java156
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariables.java378
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/UserDefinedVariableSupplier.java399
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/InternalASTServiceProvider.java275
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/NullCodeReaderFactory.java65
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java94
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/SavedCodeReaderFactory.java99
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/WorkingCopyCodeReaderFactory.java46
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/BuildSustemEnvironmentSupplier.java252
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ContributedEnvironment.java140
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/DefaultEnvironmentContextInfo.java85
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java66
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java128
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarDescriptor.java118
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java426
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ICoreEnvironmentVariableSupplier.java39
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/IEnvironmentContextInfo.java43
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/UserDefinedEnvironmentSupplier.java364
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/parser/ParserLogService.java67
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java36
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java177
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java69
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java65
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java39
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java64
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java41
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java33
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties25
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/AbortFormatting.java32
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java177
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java2121
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java2114
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Location.java54
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/OptimizedReplaceEdit.java28
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java1579
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java418
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/AlignmentException.java55
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Scanner.java211
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/ScannerContext.java83
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/SimpleScanner.java861
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Token.java509
138 files changed, 0 insertions, 27845 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java
deleted file mode 100644
index 484d3abbb18..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.cdt.internal.core.InternalCExtension;
-import org.eclipse.core.resources.IProject;
-
-public abstract class AbstractCExtension extends InternalCExtension implements ICExtension {
-
- /**
- * Returns the project for which this extrension is defined.
- *
- * @return the project
- */
- public final IProject getProject() {
- return super.getProject();
- }
-
- public final ICExtensionReference getExtensionReference() {
- return super.getExtensionReference();
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java
deleted file mode 100644
index 0e23aff49aa..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-public class CCProjectNature extends CProjectNature {
-
- 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);
- }
-
- public static void removeCCNature(IProject project, IProgressMonitor mon) throws CoreException {
- removeNature(project, CC_NATURE_ID, mon);
- }
-
- /**
- * Checks to ensure that a cnature already exists,
- * if not throw a CoreException. Does NOT add a default builder
- * @see IProjectNature#configure
- */
- public void configure() throws CoreException {
- if (!getProject().hasNature(CProjectNature.C_NATURE_ID)){
- IStatus status = new Status(IStatus.ERROR,
- CCorePlugin.PLUGIN_ID,
- CCorePlugin.CDT_PROJECT_NATURE_ID_MISMATCH,
- CCorePlugin.getResourceString("CCProjectNature.exception.noNature"), null); // $NON_NLS //$NON-NLS-1$
- throw new CoreException(status);
- }
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
deleted file mode 100644
index d14f7c77a54..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rational Software - initial implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ScannerInfo;
-import org.eclipse.cdt.internal.core.CharOperation;
-import org.eclipse.cdt.internal.core.Util;
-import org.eclipse.cdt.internal.core.model.CModelStatus;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-
-/**
- * @author hamer
- */
-public class CConventions {
- private final static String scopeResolutionOperator= "::"; //$NON-NLS-1$
- private final static char fgDot= '.';
-
- private final static String ILLEGAL_FILE_CHARS = "/\\:<>?*|\""; //$NON-NLS-1$
-
- public static boolean isLegalIdentifier(String name) {
- if (name == null) {
- return false;
- }
-
- if (name.indexOf(' ') != -1) {
- return false;
- }
-
- int length = name.length();
- char c;
-
- if (length == 0) {
- return false;
- }
-
- c = name.charAt(0);
- if ((!Character.isLetter(c)) && (c != '_')) {
- return false;
- }
-
- for (int i = 1; i < length; ++i) {
- c = name.charAt(i);
- if ((!Character.isLetterOrDigit(c)) && (c != '_')) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Validate the given CPP class name, either simple or qualified. For
- * example, <code>"A::B::C"</code>, or <code>"C"</code>.
- * <p>
- *
- * @param name the name of a class
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a CPP class name,
- * a status with code <code>IStatus.WARNING</code>
- * indicating why the given name is discouraged,
- * otherwise a status object indicating what is wrong with
- * the name
- */
- public static IStatus validateClassName(String name) {
- if (name == null) {
- 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) ){ //$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);
- char[] scannedID;
- if (index == -1) {
- // simple name
- IStatus status = validateIdentifier(name);
- if (!status.isOK()){
- return status;
- }
-
- scannedID = name.toCharArray();
- } else {
- // qualified name
- String pkg = name.substring(0, index).trim();
- IStatus status = validateScopeName(pkg);
- if (!status.isOK()) {
- return status;
- }
- String type = name.substring(index + scopeResolutionOperator.length()).trim();
- status = validateIdentifier(type);
- if (!status.isOK()){
- return status;
- }
- scannedID = type.toCharArray();
- }
-
- if (scannedID != null) {
- if (CharOperation.contains('$', scannedID)) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.class.dollarName"), null); //$NON-NLS-1$
- }
- if (scannedID.length > 0 && scannedID[0] == '_') {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.class.leadingUnderscore"), null); //$NON-NLS-1$
- }
- if (scannedID.length > 0 && Character.isLowerCase(scannedID[0])) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.class.lowercaseName"), null); //$NON-NLS-1$
- }
- return CModelStatus.VERIFIED_OK;
- }
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.class.invalidName", name), null); //$NON-NLS-1$
- }
-
- /**
- * Validate the given CPP namespace name, either simple or qualified. For
- * example, <code>"A::B::C"</code>, or <code>"C"</code>.
- * <p>
- *
- * @param name the name of a namespace
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a CPP class name,
- * a status with code <code>IStatus.WARNING</code>
- * indicating why the given name is discouraged,
- * otherwise a status object indicating what is wrong with
- * the name
- */
- public static IStatus validateNamespaceName(String name) {
- if (name == null) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.namespace.nullName"), null); //$NON-NLS-1$
- }
- String trimmed = name.trim();
- if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){ //$NON-NLS-1$
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.namespace.nameWithBlanks"), null); //$NON-NLS-1$
- }
- int index = name.lastIndexOf(scopeResolutionOperator);
- char[] scannedID;
- if (index == -1) {
- // simple name
- IStatus status = validateIdentifier(name);
- if (!status.isOK()){
- return status;
- }
-
- scannedID = name.toCharArray();
- } else {
- // qualified name
- String pkg = name.substring(0, index).trim();
- IStatus status = validateScopeName(pkg);
- if (!status.isOK()) {
- return status;
- }
- String type = name.substring(index + scopeResolutionOperator.length()).trim();
- status = validateIdentifier(type);
- if (!status.isOK()){
- return status;
- }
- scannedID = type.toCharArray();
- }
-
- if (scannedID != null) {
- if (CharOperation.contains('$', scannedID)) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.namespace.dollarName"), null); //$NON-NLS-1$
- }
- if (scannedID.length > 0 && scannedID[0] == '_') {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.namespace.leadingUnderscore"), null); //$NON-NLS-1$
- }
-// if (scannedID.length > 0 && Character.isLowerCase(scannedID[0])) {
-// return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.namespace.lowercaseName"), null); //$NON-NLS-1$
-// }
- return CModelStatus.VERIFIED_OK;
- }
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.class.invalidName", name), null); //$NON-NLS-1$
- }
-
- /**
- * Validate the given scope name.
- * <p>
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a class name, otherwise a status
- * object indicating what is wrong with the name
- */
- public static IStatus validateScopeName(String name) {
-
- if (name == null) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.scope.nullName"), null); //$NON-NLS-1$
- }
- int length;
- if ((length = name.length()) == 0) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.scope.emptyName"), null); //$NON-NLS-1$
- }
- if (name.charAt(0) == fgDot || name.charAt(length-1) == fgDot) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.scope.dotName"), null); //$NON-NLS-1$
- }
- if (CharOperation.isWhitespace(name.charAt(0)) || CharOperation.isWhitespace(name.charAt(name.length() - 1))) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.scope.nameWithBlanks"), null); //$NON-NLS-1$
- }
-
- StringTokenizer st = new StringTokenizer(name, scopeResolutionOperator);
- boolean firstToken = true;
- while (st.hasMoreTokens()) {
- String typeName = st.nextToken();
- typeName = typeName.trim(); // grammar allows spaces
- char[] scannedID = typeName.toCharArray();
- if (scannedID == null) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", typeName), null); //$NON-NLS-1$
- }
- if (firstToken && scannedID.length > 0 && scannedID[0] == '_') {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.scope.leadingUnderscore"), null); //$NON-NLS-1$
- }
- if (firstToken && scannedID.length > 0 && Character.isLowerCase(scannedID[0])) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.scope.lowercaseName"), null); //$NON-NLS-1$
- }
- firstToken = false;
- }
- return CModelStatus.VERIFIED_OK;
- }
- /**
- * Validate the given field name.
- * <p>
- * Syntax of a field name corresponds to VariableDeclaratorId (JLS2 8.3).
- * For example, <code>"x"</code>.
- *
- * @param name the name of a field
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a field name, otherwise a status
- * object indicating what is wrong with the name
- */
- public static IStatus validateFieldName(String name) {
- return validateIdentifier(name);
- }
-
- /**
- * Validate the given C identifier.
- * The identifier must not have the same spelling as a C keyword,
- * boolean literal (<code>"true"</code>, <code>"false"</code>), or null literal (<code>"null"</code>).
- * See section 3.8 of the <em>C Language Specification, Second Edition</em> (JLS2).
- * A valid identifier can act as a simple type name, method name or field name.
- *
- * @param id the C identifier
- * @return a status object with code <code>IStatus.OK</code> if
- * the given identifier is a valid C identifier, otherwise a status
- * object indicating what is wrong with the identifier
- */
- public static IStatus validateIdentifier(String id) {
- if (!isLegalIdentifier(id)) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", id), null); //$NON-NLS-1$
- }
-
- if (!isValidIdentifier(id)) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.invalid", id), null); //$NON-NLS-1$
- }
-
- return CModelStatus.VERIFIED_OK;
- }
-
- /**
- * Validate the given method name.
- * The special names "&lt;init&gt;" and "&lt;clinit&gt;" are not valid.
- * <p>
- * The syntax for a method name is defined by Identifier
- * of MethodDeclarator (JLS2 8.4). For example "println".
- *
- * @param name the name of a method
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a method name, otherwise a status
- * object indicating what is wrong with the name
- */
- public static IStatus validateMethodName(String name) {
- if(name.startsWith("~")) { //$NON-NLS-1$
- return validateIdentifier(name.substring(1));
- }
- return validateIdentifier(name);
- }
-
- /**
- * Validate the given include name.
- * <p>
- * The name of an include without the surroounding double quotes or brakets
- * For example, <code>stdio.h</code> or <code>iostream</code>.
- *
- * @param name the include declaration
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as an include name, otherwise a status
- * object indicating what is wrong with the name
- */
-
- public static IStatus validateIncludeName(IProject project, String name) {
- String[] segments = new Path(name).segments();
- for (int i = 0; i < segments.length; ++i) {
- IStatus status;
- if (i == (segments.length - 1)) {
- status = validateHeaderFileName(project, segments[i]);
- } else {
- status = validateFileName(segments[i]);
- }
- if (!status.isOK()) {
- return status;
- }
- }
- return CModelStatus.VERIFIED_OK;
- }
-
- public static boolean isValidIdentifier(String name){
- // create a scanner and get the type of the token
- // assuming that you are given a valid identifier
- IToken token = null;
- IScanner scanner = ParserFactory.createScanner(
- new CodeReader(name.toCharArray()),
- new ScannerInfo(),
- ParserMode.QUICK_PARSE,
- ParserLanguage.CPP,
- null,
- null,
- null
- );
-
- try {
- token = scanner.nextToken();
- } catch (Exception e) {
- }
-
- if ((token != null) && (token.getType() == IToken.tIDENTIFIER)) {
- try {
- scanner.nextToken();
- } catch (EndOfFileException e) {
- return true;
- } catch (Exception e) {
- }
- }
-
- return false;
- }
-
- private static boolean isLegalFilename(String name) {
- if (name == null || name.length() == 0) {
- return false;
- }
-
- //TODO we need platform-independent validation, see bug#24152
-
- int len = name.length();
-// if (Character.isWhitespace(name.charAt(0)) || Character.isWhitespace(name.charAt(len - 1))) {
-// return false;
-// }
- for (int i = 0; i < len; i++) {
- char c = name.charAt(i);
- if (ILLEGAL_FILE_CHARS.indexOf(c) != -1) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Validate the given file name.
- * The name must be the short file name (including the extension).
- * It should not contain any prefix or path delimiters.
- *
- * @param name the file name
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a C/C++ file name,
- * a status with code <code>IStatus.WARNING</code>
- * indicating why the given name is discouraged,
- * otherwise a status object indicating what is wrong with
- * the name
- */
- public static IStatus validateFileName(String name) {
- //TODO could use a prefs option for file naming conventions
- if (name == null || name.length() == 0) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.filename.nullName"), null); //$NON-NLS-1$
- }
- if (!isLegalFilename(name)) {
- //TODO we need platform-independent validation, see bug#24152
- //return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.filename.invalid"), null); //$NON-NLS-1$
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.filename.possiblyInvalid"), null); //$NON-NLS-1$
- }
-
- String trimmed = name.trim();
- if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1)) { //$NON-NLS-1$
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.filename.nameWithBlanks"), null); //$NON-NLS-1$
- }
-
- return CModelStatus.VERIFIED_OK;
- }
-
- /**
- * Validate the given header file name.
- * The name must be the short file name (including the extension).
- * It should not contain any prefix or path delimiters.
- *
- * @param name the header file name
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a C/C++ header file name,
- * a status with code <code>IStatus.WARNING</code>
- * indicating why the given name is discouraged,
- * otherwise a status object indicating what is wrong with
- * the name
- */
- public static IStatus validateHeaderFileName(IProject project, String name) {
- //TODO could use a prefs option for header file naming conventions
- IStatus val = validateFileName(name);
- if (val.getSeverity() == IStatus.ERROR) {
- return val;
- }
-
- if (!CoreModel.isValidHeaderUnitName(project, name)) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.headerFilename.filetype"), null); //$NON-NLS-1$
- }
-
- return val;
- }
-
- /**
- * Validate the given source file name.
- * The name must be the short file name (including the extension).
- * It should not contain any prefix or path delimiters.
- *
- * @param name the source file name
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a C/C++ source file name,
- * a status with code <code>IStatus.WARNING</code>
- * indicating why the given name is discouraged,
- * otherwise a status object indicating what is wrong with
- * the name
- */
- public static IStatus validateSourceFileName(IProject project, String name) {
- //TODO could use a prefs option for source file naming conventions
- IStatus val = validateFileName(name);
- if (val.getSeverity() == IStatus.ERROR) {
- return val;
- }
-
- if (!CoreModel.isValidSourceUnitName(project, name)) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.sourceFilename.filetype"), null); //$NON-NLS-1$
- }
-
- return val;
- }
-
- /**
- * Validate the given CPP enum name, either simple or qualified. For
- * example, <code>"A::B::C"</code>, or <code>"C"</code>.
- * <p>
- *
- * @param name the name of a enum
- * @return a status object with code <code>IStatus.OK</code> if
- * the given name is valid as a CPP enum name,
- * a status with code <code>IStatus.WARNING</code>
- * indicating why the given name is discouraged,
- * otherwise a status object indicating what is wrong with
- * the name
- * @since 4.0
- */
- public static IStatus validateEnumName(String name) {
- if (name == null) {
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.enum.nullName"), null); //$NON-NLS-1$
- }
- String trimmed = name.trim();
- if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){ //$NON-NLS-1$
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.enum.nameWithBlanks"), null); //$NON-NLS-1$
- }
- int index = name.lastIndexOf(scopeResolutionOperator);
- char[] scannedID;
- if (index == -1) {
- // simple name
- IStatus status = validateIdentifier(name);
- if (!status.isOK()){
- return status;
- }
-
- scannedID = name.toCharArray();
- } else {
- // qualified name
- String pkg = name.substring(0, index).trim();
- IStatus status = validateScopeName(pkg);
- if (!status.isOK()) {
- return status;
- }
- String type = name.substring(index + scopeResolutionOperator.length()).trim();
- status = validateIdentifier(type);
- if (!status.isOK()){
- return status;
- }
- scannedID = type.toCharArray();
- }
-
- if (scannedID != null) {
- if (CharOperation.contains('$', scannedID)) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.enum.dollarName"), null); //$NON-NLS-1$
- }
- if (scannedID.length > 0 && scannedID[0] == '_') {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.enum.leadingUnderscore"), null); //$NON-NLS-1$
- }
- if (scannedID.length > 0 && Character.isLowerCase(scannedID[0])) {
- return new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.enum.lowercaseName"), null); //$NON-NLS-1$
- }
- return CModelStatus.VERIFIED_OK;
- }
- return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.enum.invalidName"), null); //$NON-NLS-1$
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
deleted file mode 100644
index bd81cc91892..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ /dev/null
@@ -1,1153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Markus Schorn (Wind River Systems)
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
-import org.eclipse.cdt.core.dom.CDOM;
-import org.eclipse.cdt.core.dom.IPDOMManager;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
-import org.eclipse.cdt.core.index.IIndexManager;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.core.parser.IScannerInfoProvider;
-import org.eclipse.cdt.core.resources.IConsole;
-import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
-import org.eclipse.cdt.core.resources.ScannerProvider;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.core.settings.model.WriteAccessException;
-import org.eclipse.cdt.internal.core.CConfigBasedDescriptorManager;
-import org.eclipse.cdt.internal.core.CContentTypes;
-import org.eclipse.cdt.internal.core.CDTLogWriter;
-import org.eclipse.cdt.internal.core.PathEntryVariableManager;
-import org.eclipse.cdt.internal.core.PositionTrackerManager;
-import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
-import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
-import org.eclipse.cdt.internal.core.model.BufferManager;
-import org.eclipse.cdt.internal.core.model.CModelManager;
-import org.eclipse.cdt.internal.core.model.DeltaProcessor;
-import org.eclipse.cdt.internal.core.model.IBufferFactory;
-import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.internal.core.pdom.PDOMManager;
-import org.eclipse.cdt.internal.core.pdom.indexer.fast.PDOMFastIndexer;
-import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.content.IContentType;
-import org.osgi.framework.BundleContext;
-
-public class CCorePlugin extends Plugin {
-
- public static final int STATUS_CDTPROJECT_EXISTS = 1;
- 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"; //$NON-NLS-1$
-
- 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 PREF_USE_NEW_MODEL_BUILDER = "useNewModelBuilder"; //$NON-NLS-1$
-
- public static final String INDEXER_SIMPLE_ID = "CIndexer"; //$NON-NLS-1$
- public static final String INDEXER_UNIQ_ID = PLUGIN_ID + "." + INDEXER_SIMPLE_ID; //$NON-NLS-1$
- public static final String PREF_INDEXER = "indexer"; //$NON-NLS-1$
- public static final String DEFAULT_INDEXER = PDOMFastIndexer.ID;
-
- public final static String ERROR_PARSER_SIMPLE_ID = "ErrorParser"; //$NON-NLS-1$
-
- // default store for pathentry
- public final static String DEFAULT_PATHENTRY_STORE_ID = PLUGIN_ID + ".cdtPathEntryStore"; //$NON-NLS-1$
-
- // Build Model Interface Discovery
- 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$
-
- /**
- * Name of the extension point for contributing a source code formatter
- */
- public static final String FORMATTER_EXTPOINT_ID = "CodeFormatter" ; //$NON-NLS-1$
-
- /**
- * Possible configurable option value for TRANSLATION_TASK_PRIORITIES.
- * @see #getDefaultOptions
- */
- public static final String TRANSLATION_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$
- /**
- * Possible configurable option value for TRANSLATION_TASK_PRIORITIES.
- * @see #getDefaultOptions
- */
- public static final String TRANSLATION_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$
- /**
- * Possible configurable option value for TRANSLATION_TASK_PRIORITIES.
- * @see #getDefaultOptions
- */
- public static final String TRANSLATION_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions
- */
- public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$
-
- /**
- * IContentType id for C Source Unit
- */
- public final static String CONTENT_TYPE_CSOURCE = "org.eclipse.cdt.core.cSource"; //$NON-NLS-1$
- /**
- * IContentType id for C Header Unit
- */
- public final static String CONTENT_TYPE_CHEADER = "org.eclipse.cdt.core.cHeader"; //$NON-NLS-1$
- /**
- * IContentType id for C++ Source Unit
- */
- public final static String CONTENT_TYPE_CXXSOURCE = "org.eclipse.cdt.core.cxxSource"; //$NON-NLS-1$
- /**
- * IContentType id for C++ Header Unit
- */
- public final static String CONTENT_TYPE_CXXHEADER = "org.eclipse.cdt.core.cxxHeader"; //$NON-NLS-1$
- /**
- * IContentType id for ASM Unit
- */
- public final static String CONTENT_TYPE_ASMSOURCE = "org.eclipse.cdt.core.asmSource"; //$NON-NLS-1$
-
- /**
- * Possible configurable option value.
- * @see #getDefaultOptions()
- */
- public static final String INSERT = "insert"; //$NON-NLS-1$
- /**
- * Possible configurable option value.
- * @see #getDefaultOptions()
- */
- public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$
- /**
- * Possible configurable option value.
- * @see #getDefaultOptions()
- */
- public static final String TAB = "tab"; //$NON-NLS-1$
- /**
- * Possible configurable option value.
- * @see #getDefaultOptions()
- */
- public static final String SPACE = "space"; //$NON-NLS-1$
-
- public CDTLogWriter cdtLog = null;
-
- private static CCorePlugin fgCPlugin;
- private static ResourceBundle fgResourceBundle;
-
- private CConfigBasedDescriptorManager/*CDescriptorManager*/ fDescriptorManager;// = new CDescriptorManager();
-
- private CProjectDescriptionManager fNewCProjectDescriptionManager = CProjectDescriptionManager.getInstance();
-
- private CoreModel fCoreModel;
-
- private PDOMManager pdomManager;
-
- private PathEntryVariableManager fPathEntryVariableManager;
-
- // -------- static methods --------
-
- static {
- try {
- fgResourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.internal.core.CCorePluginResources"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- fgResourceBundle = null;
- }
- }
-
- /**
- * Answers the shared working copies currently registered for this buffer factory.
- * Working copies can be shared by several clients using the same buffer factory,see
- * <code>IWorkingCopy.getSharedWorkingCopy</code>.
- *
- * @param factory the given buffer factory
- * @return the list of shared working copies for a given buffer factory
- * @see IWorkingCopy
- */
- public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){
-
- // if factory is null, default factory must be used
- if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory();
- Map sharedWorkingCopies = CModelManager.getDefault().sharedWorkingCopies;
-
- Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory);
- if (perFactoryWorkingCopies == null) return CModelManager.NoWorkingCopy;
- Collection copies = perFactoryWorkingCopies.values();
- IWorkingCopy[] result = new IWorkingCopy[copies.size()];
- copies.toArray(result);
- return result;
- }
-
- public static String getResourceString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- } catch (NullPointerException e) {
- return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- public static String getFormattedString(String key, String arg) {
- return MessageFormat.format(getResourceString(key), new String[] { arg });
- }
-
- public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getResourceString(key), args);
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-
- public static IPositionTrackerManager getPositionTrackerManager() {
- return PositionTrackerManager.getInstance();
- }
-
- public static CCorePlugin getDefault() {
- return fgCPlugin;
- }
-
- public static void log(String e) {
- log(createStatus(e));
- }
-
- public static void log(Throwable e) {
- if ( e instanceof CoreException ) {
- log(((CoreException)e).getStatus());
- } else {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$
- }
- }
-
- public static IStatus createStatus(String msg) {
- return createStatus(msg, null);
- }
-
- public static IStatus createStatus(String msg, Throwable e) {
- return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, msg, e);
- }
-
- public static void log(IStatus status) {
- ((Plugin) getDefault()).getLog().log(status);
- }
-
- // ------ CPlugin
-
- public CCorePlugin() {
- super();
- fgCPlugin = this;
- }
-
- /**
- * @see Plugin#shutdown
- */
- public void stop(BundleContext context) throws Exception {
- try {
- PositionTrackerManager.getInstance().uninstall();
-
-// if (fDescriptorManager != null) {
-// fDescriptorManager.shutdown();
-// }
-
- if (fCoreModel != null) {
- fCoreModel.shutdown();
- }
-
- if (cdtLog != null) {
- cdtLog.shutdown();
- }
-
- if (fPathEntryVariableManager != null) {
- fPathEntryVariableManager.shutdown();
- }
-
- fNewCProjectDescriptionManager.shutdown();
- fDescriptorManager = null;
-
- savePluginPreferences();
- } finally {
- super.stop(context);
- }
- }
-
- /**
- * @see Plugin#startup
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- fNewCProjectDescriptionManager.startup();
- fDescriptorManager = fNewCProjectDescriptionManager.getDescriptorManager();
-
- // Start file type manager first !!
- fPathEntryVariableManager = new PathEntryVariableManager();
- fPathEntryVariableManager.startup();
-
- cdtLog = new CDTLogWriter(CCorePlugin.getDefault().getStateLocation().append(".log").toFile()); //$NON-NLS-1$
-
- //Set debug tracing options
- configurePluginDebugOptions();
-
-// fDescriptorManager.startup();
-// CProjectDescriptionManager.getInstance().startup();
-
- // Fired up the model.
- fCoreModel = CoreModel.getDefault();
- fCoreModel.startup();
-
- // Fire up the PDOM
- pdomManager = new PDOMManager();
- pdomManager.startup();
-
- // Set the default for using the structual parse mode to build the CModel
- getPluginPreferences().setDefault(PREF_USE_STRUCTURAL_PARSE_MODE, false);
- // Set the default for using the new model builder to build the CModel
- getPluginPreferences().setDefault(PREF_USE_NEW_MODEL_BUILDER, true);
-
- PositionTrackerManager.getInstance().install();
- }
-
-
- /**
- * TODO: Add all options here
- * Returns a table of all known configurable options with their default values.
- * These options allow to configure the behaviour of the underlying components.
- * The client may safely use the result as a template that they can modify and
- * then pass to <code>setOptions</code>.
- *
- * Helper constants have been defined on CCorePlugin for each of the option ID and
- * their possible constant values.
- *
- * Note: more options might be added in further releases.
- * <pre>
- * RECOGNIZED OPTIONS:
- * TRANSLATION / Define the Automatic Task Tags
- * When the tag list is not empty, translation will issue a task marker whenever it encounters
- * one of the corresponding tags inside any comment in C/C++ source code.
- * Generated task messages will include the tag, and range until the next line separator or comment ending.
- * Note that tasks messages are trimmed. If a tag is starting with a letter or digit, then it cannot be leaded by
- * another letter or digit to be recognized ("fooToDo" will not be recognized as a task for tag "ToDo", but "foo#ToDo"
- * will be detected for either tag "ToDo" or "#ToDo"). Respectively, a tag ending with a letter or digit cannot be followed
- * by a letter or digit to be recognized ("ToDofoo" will not be recognized as a task for tag "ToDo", but "ToDo:foo" will
- * be detected either for tag "ToDo" or "ToDo:").
- * - option id: "org.eclipse.cdt.core.translation.taskTags"
- * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces
- * - default: ""
- *
- * TRANSLATION / Define the Automatic Task Priorities
- * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
- * of the task markers issued by the translation.
- * If the default is specified, the priority of each task marker is "NORMAL".
- * - option id: "org.eclipse.cdt.core.transltaion.taskPriorities"
- * - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
- * - default: ""
- *
- * CORE / Specify Default Source Encoding Format
- * Get the encoding format for translated sources. This setting is read-only, it is equivalent
- * to 'ResourcesPlugin.getEncoding()'.
- * - option id: "org.eclipse.cdt.core.encoding"
- * - possible values: { any of the supported encoding names}.
- * - default: <platform default>
- * </pre>
- *
- * @return a mutable map containing the default settings of all known options
- * (key type: <code>String</code>; value type: <code>String</code>)
- * @see #setOptions
- */
-
- public static HashMap getDefaultOptions()
- {
- HashMap defaultOptions = new HashMap(10);
-
- // see #initializeDefaultPluginPreferences() for changing default settings
- Preferences preferences = getDefault().getPluginPreferences();
- HashSet optionNames = CModelManager.OptionNames;
-
- // get preferences set to their default
- String[] defaultPropertyNames = preferences.defaultPropertyNames();
- for (int i = 0; i < defaultPropertyNames.length; i++){
- String propertyName = defaultPropertyNames[i];
- if (optionNames.contains(propertyName)) {
- defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
- }
- }
- // get preferences not set to their default
- String[] propertyNames = preferences.propertyNames();
- for (int i = 0; i < propertyNames.length; i++){
- String propertyName = propertyNames[i];
- if (optionNames.contains(propertyName)) {
- defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
- }
- }
- // get encoding through resource plugin
- defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
-
- return defaultOptions;
- }
-
-
- /**
- * Helper method for returning one option value only. Equivalent to <code>(String)CCorePlugin.getOptions().get(optionName)</code>
- * Note that it may answer <code>null</code> if this option does not exist.
- * <p>
- * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
- * </p>
- *
- * @param optionName the name of an option
- * @return the String value of a given option
- * @see CCorePlugin#getDefaultOptions
- */
- public static String getOption(String optionName) {
-
- if (CORE_ENCODING.equals(optionName)){
- return ResourcesPlugin.getEncoding();
- }
- if (CModelManager.OptionNames.contains(optionName)){
- Preferences preferences = getDefault().getPluginPreferences();
- return preferences.getString(optionName).trim();
- }
- return null;
- }
-
- /**
- * Returns the table of the current options. Initially, all options have their default values,
- * and this method returns a table that includes all known options.
- * <p>
- * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
- * </p>
- *
- * @return table of current settings of all options
- * (key type: <code>String</code>; value type: <code>String</code>)
- * @see CCorePlugin#getDefaultOptions
- */
- public static HashMap getOptions() {
-
- HashMap options = new HashMap(10);
-
- // see #initializeDefaultPluginPreferences() for changing default settings
- Plugin plugin = getDefault();
- if (plugin != null) {
- Preferences preferences = plugin.getPluginPreferences();
- HashSet optionNames = CModelManager.OptionNames;
-
- // get preferences set to their default
- String[] defaultPropertyNames = preferences.defaultPropertyNames();
- for (int i = 0; i < defaultPropertyNames.length; i++){
- String propertyName = defaultPropertyNames[i];
- if (optionNames.contains(propertyName)){
- options.put(propertyName, preferences.getDefaultString(propertyName));
- }
- }
- // get preferences not set to their default
- String[] propertyNames = preferences.propertyNames();
- for (int i = 0; i < propertyNames.length; i++){
- String propertyName = propertyNames[i];
- if (optionNames.contains(propertyName)){
- options.put(propertyName, preferences.getString(propertyName).trim());
- }
- }
- // get encoding through resource plugin
- options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
- }
- return options;
- }
-
- /**
- * Sets the current table of options. All and only the options explicitly included in the given table
- * are remembered; all previous option settings are forgotten, including ones not explicitly
- * mentioned.
- * <p>
- * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
- * </p>
- *
- * @param newOptions the new options (key type: <code>String</code>; value type: <code>String</code>),
- * or <code>null</code> to reset all options to their default values
- * @see CCorePlugin#getDefaultOptions
- */
- public static void setOptions(HashMap newOptions) {
-
- // see #initializeDefaultPluginPreferences() for changing default settings
- Preferences preferences = getDefault().getPluginPreferences();
-
- if (newOptions == null){
- newOptions = getDefaultOptions();
- }
- Iterator keys = newOptions.keySet().iterator();
- while (keys.hasNext()){
- String key = (String)keys.next();
- if (!CModelManager.OptionNames.contains(key)) continue; // unrecognized option
- if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs
- String value = (String)newOptions.get(key);
- preferences.setValue(key, value);
- }
-
- // persist options
- getDefault().savePluginPreferences();
- }
-
-
- public IConsole getConsole(String id) {
- try {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "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 consoleID = configElements[j].getAttribute("id"); //$NON-NLS-1$
- if ((id == null && consoleID == null) || (id != null && id.equals(consoleID))) {
- return (IConsole) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- }
- }
- }
- }
- } catch (CoreException e) {
- log(e);
- }
- return new IConsole() { // return a null console
- private ConsoleOutputStream nullStream = new ConsoleOutputStream() {
- public void write(byte[] b) throws IOException {
- }
- public void write(byte[] b, int off, int len) throws IOException {
- }
- public void write(int c) throws IOException {
- }
- };
-
- public void start(IProject project) {
- }
- // this can be a null console....
- public ConsoleOutputStream getOutputStream() {
- return nullStream;
- }
- public ConsoleOutputStream getInfoStream() {
- return nullStream;
- }
- public ConsoleOutputStream getErrorStream() {
- return nullStream;
- }
- };
- }
-
- public IConsole getConsole() {
- String consoleID = System.getProperty("org.eclipse.cdt.core.console"); //$NON-NLS-1$
- return getConsole(consoleID);
- }
-
- public ICExtensionReference[] getBinaryParserExtensions(IProject project) throws CoreException {
- ICExtensionReference ext[] = new ICExtensionReference[0];
- if (project != null) {
- try {
- ICDescriptor cdesc = getCProjectDescription(project);
- ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID, true);
- if (cextensions.length > 0) {
- ArrayList list = new ArrayList(cextensions.length);
- for (int i = 0; i < cextensions.length; i++) {
- list.add(cextensions[i]);
- }
- ext = (ICExtensionReference[])list.toArray(ext);
- }
- } catch (CoreException e) {
- log(e);
- }
- }
- return ext;
- }
-
- /**
- * @param project
- * @return
- * @throws CoreException
- * @deprecated - use getBinaryParserExtensions(IProject project)
- */
- public IBinaryParser[] getBinaryParser(IProject project) throws CoreException {
- IBinaryParser parsers[] = null;
- if (project != null) {
- try {
- ICDescriptor cdesc = getCProjectDescription(project);
- ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID, true);
- if (cextensions.length > 0) {
- ArrayList list = new ArrayList(cextensions.length);
- for (int i = 0; i < cextensions.length; i++) {
- IBinaryParser parser = null;
- try {
- parser = (IBinaryParser) cextensions[i].createExtension();
- } catch (ClassCastException e) {
- //
- }
- if (parser != null) {
- list.add(parser);
- }
- }
- parsers = new IBinaryParser[list.size()];
- list.toArray(parsers);
- }
- } catch (CoreException e) {
- // ignore since we fall back to a default....
- }
- }
- if (parsers == null) {
- IBinaryParser parser = getDefaultBinaryParser();
- if (parser != null) {
- parsers = new IBinaryParser[] {parser};
- }
- }
- return parsers;
- }
-
- public IBinaryParser getDefaultBinaryParser() throws CoreException {
- IBinaryParser parser = null;
- String id = getPluginPreferences().getDefaultString(PREF_BINARY_PARSER);
- if (id == null || id.length() == 0) {
- id = DEFAULT_BINARY_PARSER_UNIQ_ID;
- }
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, BINARY_PARSER_SIMPLE_ID);
- IExtension extension = extensionPoint.getExtension(id);
- if (extension != null) {
- IConfigurationElement element[] = extension.getConfigurationElements();
- for (int i = 0; i < element.length; i++) {
- 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, CCorePlugin.getResourceString("CCorePlugin.exception.noBinaryFormat"), null); //$NON-NLS-1$
- throw new CoreException(s);
- }
- return parser;
- }
-
- public CoreModel getCoreModel() {
- return fCoreModel;
- }
-
- public static IPDOMManager getPDOMManager() {
- return getDefault().pdomManager;
- }
-
- public static IIndexManager getIndexManager() {
- return getDefault().pdomManager;
- }
-
- public IPathEntryVariableManager getPathEntryVariableManager() {
- return fPathEntryVariableManager;
- }
-
- /**
- * @param project
- * @return
- * @throws CoreException
- * @deprecated use getCProjetDescription(IProject project, boolean create)
- */
- public ICDescriptor getCProjectDescription(IProject project) throws CoreException {
- return fDescriptorManager.getDescriptor(project);
- }
-
- /**
- * Get the ICDescriptor for the given project, if <b>create</b> is <b>true</b> then a descriptor will be created
- * if one does not exist.
- *
- * @param project
- * @param create
- * @return ICDescriptor or <b>null</b> if <b>create</b> is <b>false</b> and no .cdtproject file exists on disk.
- * @throws CoreException
- */
- public ICDescriptor getCProjectDescription(IProject project, boolean create) throws CoreException {
- return fDescriptorManager.getDescriptor(project, create);
- }
-
- public void mapCProjectOwner(IProject project, String id, boolean override) throws CoreException {
- if (!override) {
- fDescriptorManager.configure(project, id);
- } else {
- fDescriptorManager.convert(project, id);
- }
- }
-
- public ICDescriptorManager getCDescriptorManager() {
- return fDescriptorManager;
- }
-
- /**
- * Creates a C project resource given the project handle and description.
- *
- * @param description the project description to create a project resource for
- * @param projectHandle the project handle to create a project resource for
- * @param monitor the progress monitor to show visual progress with
- * @param projectID required for mapping the project to an owner
- *
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- * @deprecated
- */
- public IProject createCProject(
- final IProjectDescription description,
- final IProject projectHandle,
- IProgressMonitor monitor,
- final String projectID)
- throws CoreException, OperationCanceledException {
-
- getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- if (monitor == null) {
- 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));
- } finally {
- monitor.done();
- }
- }
- }, getWorkspace().getRoot(), 0, monitor);
- return projectHandle;
- }
-
- public IProject createCDTProject(
- final IProjectDescription description,
- final IProject projectHandle,
- IProgressMonitor monitor)
- throws CoreException, OperationCanceledException {
-
- getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- if (monitor == null) {
- 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));
- } finally {
- monitor.done();
- }
- }
- }, getWorkspace().getRoot(), 0, monitor);
- return projectHandle;
- }
-
- /**
- * Method convertProjectFromCtoCC converts
- * a C Project to a C++ Project
- * The newProject MUST, not be null, already have a C Nature
- * && must NOT already have a C++ Nature
- *
- * @param projectHandle
- * @param monitor
- * @throws CoreException
- */
-
- public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
- if ((projectHandle != null)
- && projectHandle.hasNature(CProjectNature.C_NATURE_ID)
- && !projectHandle.hasNature(CCProjectNature.CC_NATURE_ID)) {
- // Add C++ Nature ... does not add duplicates
- CCProjectNature.addCCNature(projectHandle, monitor);
- }
- }
-
- /**
- * Method to convert a project to a C nature
- * All checks should have been done externally
- * (as in the Conversion Wizards).
- * This method blindly does the conversion.
- *
- * @param project
- * @param String targetNature
- * @param monitor
- * @param projectID
- * @exception CoreException
- */
-
- public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID)
- throws CoreException {
- if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
- return;
- }
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProjectDescription description = workspace.newProjectDescription(projectHandle.getName());
- description.setLocation(projectHandle.getFullPath());
- createCProject(description, projectHandle, monitor, projectID);
- }
-
- /**
- * Method to convert a project to a C++ nature
- *
- * @param project
- * @param String targetNature
- * @param monitor
- * @param projectID
- * @exception CoreException
- */
-
- public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID)
- throws CoreException {
- if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
- return;
- }
- createCProject(projectHandle.getDescription(), projectHandle, monitor, projectID);
- // now add C++ nature
- convertProjectFromCtoCC(projectHandle, monitor);
- }
-
- /**
- * Get the IProcessList contributed interface for the platform.
- * @return IProcessList
- */
- public IProcessList getProcessList() throws CoreException {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "ProcessList"); //$NON-NLS-1$
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- IConfigurationElement defaultContributor = null;
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- if (configElements[j].getName().equals("processList")) { //$NON-NLS-1$
- String platform = configElements[j].getAttribute("platform"); //$NON-NLS-1$
- if (platform == null ) { // first contrbutor found with not platform will be default.
- if (defaultContributor == null) {
- defaultContributor = configElements[j];
- }
- } else if (platform.equals(Platform.getOS())) {
- // found explicit contributor for this platform.
- return (IProcessList) configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
- }
- }
- }
- }
- if ( defaultContributor != null) {
- return (IProcessList) defaultContributor.createExecutableExtension("class"); //$NON-NLS-1$
- }
- }
- return null;
-
- }
-
- /**
- * Array of error parsers ids.
- * @return
- */
- public String[] getAllErrorParsersIDs() {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, ERROR_PARSER_SIMPLE_ID);
- String[] empty = new String[0];
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- ArrayList list = new ArrayList(extensions.length);
- for (int i = 0; i < extensions.length; i++) {
- list.add(extensions[i].getUniqueIdentifier());
- }
- return (String[]) list.toArray(empty);
- }
- return empty;
- }
-
- public IErrorParser[] getErrorParser(String id) {
- IErrorParser[] empty = new IErrorParser[0];
- try {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, ERROR_PARSER_SIMPLE_ID);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- List list = new ArrayList(extensions.length);
- for (int i = 0; i < extensions.length; i++) {
- String parserID = extensions[i].getUniqueIdentifier();
- if ((id == null && parserID != null) || (id != null && id.equals(parserID))) {
- IConfigurationElement[] configElements = extensions[i]. getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- IErrorParser parser = (IErrorParser)configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- list.add(parser);
- }
- }
- }
- return (IErrorParser[]) list.toArray(empty);
- }
- } catch (CoreException e) {
- log(e);
- }
- return empty;
- }
-
- public IScannerInfoProvider getScannerInfoProvider(IProject project) {
- return fNewCProjectDescriptionManager.getScannerInfoProviderProxy(project);
-// IScannerInfoProvider provider = null;
-// if (project != null) {
-// try {
-// ICDescriptor desc = getCProjectDescription(project);
-// ICExtensionReference[] extensions = desc.get(BUILD_SCANNER_INFO_UNIQ_ID, true);
-// if (extensions.length > 0)
-// provider = (IScannerInfoProvider) extensions[0].createExtension();
-// } catch (CoreException e) {
-// // log(e);
-// }
-// if ( provider == null) {
-// return getDefaultScannerInfoProvider(project);
-// }
-// }
-// return provider;
- }
-
-// private IScannerInfoProvider getDefaultScannerInfoProvider(IProject project){
-// if(fNewCProjectDescriptionManager.isNewStyleIndexCfg(project))
-// return fNewCProjectDescriptionManager.getScannerInfoProvider(project);
-// return ScannerProvider.getInstance();
-// }
-
- /**
- * Helper function, returning the contenttype for a filename
- * Same as: <p><p>
- * getContentType(null, filename)
- * <br>
- * @param project
- * @param name
- * @return
- */
- public static IContentType getContentType(String filename) {
- return CContentTypes.getContentType(null, filename);
- }
-
- /**
- * Returns the content type for a filename. The method respects project
- * project specific content type definitions. The lookup prefers case-
- * sensitive matches over the others.
- * @param project a project with possible project specific settings. Can be <code>null</code>
- * @param filename a filename to compute the content type for
- * @return the content type found or <code>null</code>
- */
- public static IContentType getContentType(IProject project, String filename) {
- return CContentTypes.getContentType(project, filename);
- }
-
- /**
- * Tests whether the given project uses its project specific content types.
- */
- public static boolean usesProjectSpecificContentTypes(IProject project) {
- return CContentTypes.usesProjectSpecificContentTypes(project);
- }
-
- /**
- * Enables or disables the project specific content types.
- */
- public static void setUseProjectSpecificContentTypes(IProject project, boolean val) {
- CContentTypes.setUseProjectSpecificContentTypes(project, val);
- }
-
-
-
- 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_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$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" ; //$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
- */
- public void configurePluginDebugOptions() {
-
- if(CCorePlugin.getDefault().isDebugging()) {
- String option = Platform.getDebugOption(PARSER);
- if(option != null) Util.VERBOSE_PARSER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
-
- option = Platform.getDebugOption(PARSER_EXCEPTIONS);
- if( option != null ) Util.PARSER_EXCEPTIONS = option.equalsIgnoreCase("true"); //$NON-NLS-1$
-
- option = Platform.getDebugOption(SCANNER);
- 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$
-
- option = Platform.getDebugOption(DELTA);
- if(option != null) DeltaProcessor.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
-
- }
- }
-
- // Preference to turn on/off the use of structural parse mode to build the CModel
- public void setStructuralParseMode(boolean useNewParser) {
- getPluginPreferences().setValue(PREF_USE_STRUCTURAL_PARSE_MODE, useNewParser);
- savePluginPreferences();
- }
-
- public boolean useStructuralParseMode() {
- return getPluginPreferences().getBoolean(PREF_USE_STRUCTURAL_PARSE_MODE);
- }
-
- public CDOM getDOM() {
- return CDOM.getInstance();
- }
-
- public ICdtVariableManager getCdtVariableManager(){
- return CdtVariableManager.getDefault();
- }
-
- public IEnvironmentVariableManager getBuildEnvironmentManager(){
- return EnvironmentVariableManager.getDefault();
- }
-
- public ICConfigurationDescription getPreferenceConfiguration(String buildSystemId) throws CoreException{
- return fNewCProjectDescriptionManager.getPreferenceConfiguration(buildSystemId);
- }
-
- public ICConfigurationDescription getPreferenceConfiguration(String buildSystemId, boolean write) throws CoreException{
- return fNewCProjectDescriptionManager.getPreferenceConfiguration(buildSystemId, write);
- }
-
- public void setPreferenceConfiguration(String buildSystemId, ICConfigurationDescription des) throws CoreException {
- fNewCProjectDescriptionManager.setPreferenceConfiguration(buildSystemId, des);
- }
-
- /**
- * the method creates and returns a writable project description
- *
- * @param project project for which the project description is requested
- * @param loadIfExists if true the method first tries to load and return the project description
- * from the settings file (.cproject)
- * if false, the stored settings are ignored and the new (empty) project description is created
- * NOTE: changes made to the returned project description will not be applied untill the {@link #setProjectDescription(IProject, ICProjectDescription)} is called
- * @return {@link ICProjectDescription}
- * @throws CoreException
- */
- public ICProjectDescription createProjectDescription(IProject project, boolean loadIfExists) throws CoreException{
- return fNewCProjectDescriptionManager.createProjectDescription(project, loadIfExists);
- }
-
- /**
- * returns the project description associated with this project
- * this is a convenience method fully equivalent to getProjectDescription(project, true)
- * see {@link #getProjectDescription(IProject, boolean)} for more detail
- * @param project
- * @return a writable copy of the ICProjectDescription or null if the project does not contain the
- * CDT data associated with it.
- * Note: changes to the project description will not be reflected/used by the core
- * untill the {@link #setProjectDescription(IProject, ICProjectDescription)} is called
- *
- * @see #getProjectDescription(IProject, boolean)
- */
- public ICProjectDescription getProjectDescription(IProject project){
- return fNewCProjectDescriptionManager.getProjectDescription(project);
- }
-
- /**
- * this method is called to save/apply the project description
- * the method should be called to apply changes made to the project description
- * returned by the {@link #getProjectDescription(IProject, boolean)} or {@link #createProjectDescription(IProject, boolean)}
- *
- * @param project
- * @param des
- * @throws CoreException
- *
- * @see {@link #getProjectDescription(IProject, boolean)}
- * @see #createProjectDescription(IProject, boolean)
- */
- public void setProjectDescription(IProject project, ICProjectDescription des) throws CoreException {
- fNewCProjectDescriptionManager.setProjectDescription(project, des);
- }
-
- /**
- * returns the project description associated with this project
- *
- * @param project project for which the description is requested
- * @param write if true, the writable description copy is returned.
- * If false the cached read-only description is returned.
- *
- * CDT core maintains the cached project description settings. If only read access is needed to description,
- * then the read-only project description should be obtained.
- * This description always operates with cached data and thus it is better to use it for performance reasons
- * All set* calls to the read-only description result in the {@link WriteAccessException}
- *
- * When the writable description is requested, the description copy is created.
- * Changes to this description will not be reflected/used by the core and Build System untill the
- * {@link #setProjectDescription(IProject, ICProjectDescription)} is called
- *
- * Each getProjectDescription(project, true) returns a new copy of the project description
- *
- * The writable description uses the cached data untill the first set call
- * after that the description communicates directly to the Build System
- * i.e. the implementer of the org.eclipse.cdt.core.CConfigurationDataProvider extension
- * This ensures the Core<->Build System settings integrity
- *
- * @return {@link ICProjectDescription}
- */
- public ICProjectDescription getProjectDescription(IProject project, boolean write){
- return fNewCProjectDescriptionManager.getProjectDescription(project, write);
- }
-
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java
deleted file mode 100644
index d60fccc193d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-
-public class CCorePreferenceConstants {
-
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions
- */
- public static final String TRANSLATION_TASK_TAGS = CCorePlugin.PLUGIN_ID + ".translation.taskTags"; //$NON-NLS-1$
-
- /**
- * Default task tag
- */
- public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$
-
- /**
- * Default task priority
- */
- public static final String DEFAULT_TASK_PRIORITY = CCorePlugin.TRANSLATION_TASK_PRIORITY_NORMAL;
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions
- */
- public static final String TRANSLATION_TASK_PRIORITIES = CCorePlugin.PLUGIN_ID + ".translation.taskPriorities"; //$NON-NLS-1$
-
- /**
- * Active code formatter ID.
- * @see #getDefaultOptions
- */
- public static final String CODE_FORMATTER = CCorePlugin.PLUGIN_ID + ".code_formatter"; //$NON-NLS-1$
-
- /**
- * Default code formatter
- */
- public static final String DEFAULT_CODE_FORMATTER = CCorePlugin.PLUGIN_ID + ".defaultCodeFormatter"; //$NON-NLS-1$
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CDescriptorEvent.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CDescriptorEvent.java
deleted file mode 100644
index ef3136ab60b..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CDescriptorEvent.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import java.util.EventObject;
-
-public class CDescriptorEvent extends EventObject {
-
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 3257009869059143225L;
- public static final int CDTPROJECT_CHANGED = 1;
- public static final int CDTPROJECT_ADDED = 2;
- public static final int CDTPROJECT_REMOVED = 3;
-
- public static final int OWNER_CHANGED = 0x10;
- public static final int EXTENSION_CHANGED = 0x20;
-
- private static final int FLAGS_MASK = 0xf;
-
- int fType;
-
- public CDescriptorEvent(ICDescriptor descriptor, int type, int flags) {
- super(descriptor);
- fType = type | flags;
- }
-
- public ICDescriptor getDescriptor() {
- return (ICDescriptor) getSource();
- }
-
- public int getType() {
- return fType & FLAGS_MASK;
- }
-
- public int getFlags() {
- return fType & ~FLAGS_MASK;
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer();
- switch (getType()) {
- case CDTPROJECT_ADDED :
- buf.append("CDTPROJECT_ADDED"); //$NON-NLS-1$
- break;
- case CDTPROJECT_REMOVED :
- buf.append("CDTPROJECT_REMOVED"); //$NON-NLS-1$
- break;
- case CDTPROJECT_CHANGED :
- buf.append("CDTPROJECT_CHANGED"); //$NON-NLS-1$
- break;
- }
- if ( (getFlags() & OWNER_CHANGED) != 0 ) {
- buf.append("[OWNER CHANGED]"); //$NON-NLS-1$
- }
- if ( (getFlags() & EXTENSION_CHANGED) != 0 ) {
- buf.append("[EXTENSION CHANGED]"); //$NON-NLS-1$
- }
- if (getFlags() == 0) {
- buf.append("[UNSPECIFIED]"); //$NON-NLS-1$
- }
- return buf.toString();
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java
deleted file mode 100644
index 88b72176e6f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class CProjectNature implements IProjectNature {
-
- public static final String C_NATURE_ID = CCorePlugin.PLUGIN_ID + ".cnature"; //$NON-NLS-1$
-
- private IProject fProject;
-
- public CProjectNature() {
- }
-
- public CProjectNature(IProject project) {
- setProject(project);
- }
-
- public static void addCNature(IProject project, IProgressMonitor mon) throws CoreException {
- addNature(project, C_NATURE_ID, mon);
- }
-
- public static void removeCNature(IProject project, IProgressMonitor mon) throws CoreException {
- removeNature(project, C_NATURE_ID, mon);
- }
-
- /**
- * Utility method for adding a nature to a project.
- *
- * @param proj
- * the project to add the nature
- * @param natureId
- * the id of the nature to assign to the project
- * @param monitor
- * a progress monitor to indicate the duration of the operation,
- * or <code>null</code> if progress reporting is not required.
- *
- */
- public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
- IProjectDescription description = project.getDescription();
- String[] prevNatures = description.getNatureIds();
- for (int i = 0; i < prevNatures.length; i++) {
- if (natureId.equals(prevNatures[i]))
- return;
- }
- String[] newNatures = new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length] = natureId;
- description.setNatureIds(newNatures);
- project.setDescription(description, monitor);
- }
-
- /**
- * Utility method for removing a project nature from a project.
- *
- * @param proj
- * the project to remove the nature from
- * @param natureId
- * the nature id to remove
- * @param monitor
- * a progress monitor to indicate the duration of the operation,
- * or <code>null</code> if progress reporting is not required.
- */
- public static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
- IProjectDescription description = project.getDescription();
- String[] prevNatures = description.getNatureIds();
- List newNatures = new ArrayList(Arrays.asList(prevNatures));
- newNatures.remove(natureId);
- description.setNatureIds((String[]) newNatures.toArray(new String[newNatures.size()]));
- project.setDescription(description, monitor);
- }
-
- /**
- * @see IProjectNature#configure
- */
- public void configure() throws CoreException {
- }
-
- /**
- * @see IProjectNature#deconfigure
- */
- public void deconfigure() throws CoreException {
- }
-
- /**
- * @see IProjectNature#getProject
- */
- public IProject getProject() {
- return fProject;
- }
-
- /**
- * @see IProjectNature#setProject
- */
- public void setProject(IProject project) {
- fProject = project;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java
deleted file mode 100644
index 1ff92b24297..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
- */
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Properties;
-
-import org.eclipse.cdt.internal.core.ProcessClosure;
-import org.eclipse.cdt.utils.spawner.EnvironmentReader;
-import org.eclipse.cdt.utils.spawner.ProcessFactory;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class CommandLauncher {
-
- public final static int COMMAND_CANCELED = 1;
- public final static int ILLEGAL_COMMAND = -1;
- public final static int OK = 0;
-
- protected Process fProcess;
- protected boolean fShowCommand;
- protected String[] fCommandArgs;
-
- protected String fErrorMessage = ""; //$NON-NLS-1$
-
- private String lineSeparator;
-
- /**
- * The number of milliseconds to pause between polling.
- */
- protected static final long DELAY = 50L;
-
- /**
- * Creates a new launcher Fills in stderr and stdout output to the given
- * streams. Streams can be set to <code>null</code>, if output not
- * required
- */
- public CommandLauncher() {
- fProcess = null;
- fShowCommand = false;
- lineSeparator = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Sets if the command should be printed out first before executing
- */
- public void showCommand(boolean show) {
- fShowCommand = show;
- }
-
- public String getErrorMessage() {
- return fErrorMessage;
- }
-
- public void setErrorMessage(String error) {
- fErrorMessage = error;
- }
-
- public String[] getCommandArgs() {
- return fCommandArgs;
- }
-
- public Properties getEnvironment() {
- return EnvironmentReader.getEnvVars();
- }
-
- /**
- * return the constructed Command line.
- *
- * @return
- */
- public String getCommandLine() {
- return getCommandLine(getCommandArgs());
- }
-
- /**
- * Constructs a command array that will be passed to the process
- */
- protected String[] constructCommandArray(String command, String[] commandArgs) {
- String[] args = new String[1 + commandArgs.length];
- args[0] = command;
- System.arraycopy(commandArgs, 0, args, 1, commandArgs.length);
- return args;
- }
-
- /**
- * Execute a command
- */
- public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory) {
- try {
- // add platform specific arguments (shell invocation)
- fCommandArgs = constructCommandArray(commandPath.toOSString(), args);
- fProcess = ProcessFactory.getFactory().exec(fCommandArgs, env, changeToDirectory.toFile());
- fErrorMessage = ""; //$NON-NLS-1$
- } catch (IOException e) {
- setErrorMessage(e.getMessage());
- fProcess = null;
- }
- return fProcess;
- }
-
- /**
- * Reads output form the process to the streams.
- */
- public int waitAndRead(OutputStream out, OutputStream err) {
- if (fShowCommand) {
- printCommandLine(out);
- }
-
- if (fProcess == null) {
- return ILLEGAL_COMMAND;
- }
-
- ProcessClosure closure = new ProcessClosure(fProcess, out, err);
- closure.runBlocking(); // a blocking call
- return OK;
- }
-
- /**
- * Reads output form the process to the streams. A progress monitor is
- * polled to test if the cancel button has been pressed. Destroys the
- * process if the monitor becomes canceled override to implement a different
- * way to read the process inputs
- */
- public int waitAndRead(OutputStream output, OutputStream err, IProgressMonitor monitor) {
- if (fShowCommand) {
- printCommandLine(output);
- }
-
- if (fProcess == null) {
- return ILLEGAL_COMMAND;
- }
-
- ProcessClosure closure = new ProcessClosure(fProcess, output, err);
- closure.runNonBlocking();
- while (!monitor.isCanceled() && closure.isAlive()) {
- try {
- Thread.sleep(DELAY);
- } catch (InterruptedException ie) {
- // ignore
- }
- }
-
- int state = OK;
-
- // Operation canceled by the user, terminate abnormally.
- if (monitor.isCanceled()) {
- closure.terminate();
- state = COMMAND_CANCELED;
- setErrorMessage(CCorePlugin.getResourceString("CommandLauncher.error.commandCanceled")); //$NON-NLS-1$
- }
-
- try {
- fProcess.waitFor();
- } catch (InterruptedException e) {
- // ignore
- }
- return state;
- }
-
- protected void printCommandLine(OutputStream os) {
- if (os != null) {
- String cmd = getCommandLine(getCommandArgs());
- try {
- os.write(cmd.getBytes());
- os.flush();
- } catch (IOException e) {
- // ignore;
- }
- }
- }
-
- protected String getCommandLine(String[] commandArgs) {
- StringBuffer buf = new StringBuffer();
- if (fCommandArgs != null) {
- for (int i = 0; i < commandArgs.length; i++) {
- buf.append(commandArgs[i]);
- buf.append(' ');
- }
- buf.append(lineSeparator);
- }
- return buf.toString();
- }
-
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ConsoleOutputStream.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ConsoleOutputStream.java
deleted file mode 100644
index d866ed59bf2..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ConsoleOutputStream.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-
-/**
- * Output stream which storing the console output
- */
-public class ConsoleOutputStream extends OutputStream {
-
- protected StringBuffer fBuffer;
-
- public ConsoleOutputStream() {
- fBuffer= new StringBuffer();
- }
-
- public synchronized String readBuffer() {
- String buf = fBuffer.toString();
- fBuffer.setLength(0);
- return buf;
- }
-
- public synchronized void write(int c) throws IOException {
- byte ascii[] = new byte[1];
- ascii[0] = (byte) c;
- fBuffer.append(new String(ascii));
- }
-
- public synchronized void write(byte[] b, int off, int len) throws IOException {
- fBuffer.append(new String(b, off, len));
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
deleted file mode 100644
index e6b0e32e3cf..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.eclipse.cdt.core.resources.ACBuilder;
-import org.eclipse.cdt.utils.CygPath;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-
-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 IProject fProject;
- private IMarkerGenerator fMarkerGenerator;
- private Map fFilesInProject;
- private List fNameConflicts;
-
- private Map fErrorParsers;
- private ArrayList fErrors;
-
- private Vector fDirectoryStack;
- private IPath fBaseDirectory;
-
- private String previousLine;
- private OutputStream outputStream;
- private StringBuffer currentLine = new StringBuffer();
-
- private StringBuffer scratchBuffer = new StringBuffer();
-
- private boolean hasErrors = false;
-
- // Cygpath helpers
- private CygPath cygpath;
- private boolean cygpathInstalled = Platform.getOS().equals(Platform.OS_WIN32);
-
- public ErrorParserManager(ACBuilder builder) {
- this(builder.getProject(), builder);
- }
-
- public ErrorParserManager(IProject project, IMarkerGenerator markerGenerator) {
- this(project, markerGenerator, null);
- }
-
- public ErrorParserManager(IProject project, IMarkerGenerator markerGenerator, String[] parsersIDs) {
- this(project, project.getLocation(), markerGenerator, parsersIDs);
- }
-
- public ErrorParserManager(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator, String[] parsersIDs) {
- fProject = project;
- if (parsersIDs == null) {
- enableAllParsers();
- } else {
- fErrorParsers = new LinkedHashMap(parsersIDs.length);
- for (int i = 0; i < parsersIDs.length; i++) {
- IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parsersIDs[i]);
- fErrorParsers.put(parsersIDs[i], parsers);
- }
- }
- fMarkerGenerator = markerGenerator;
- initErrorParserManager(workingDirectory);
- }
-
- private void initErrorParserManager(IPath workingDirectory) {
- fFilesInProject = new HashMap();
- fNameConflicts = new ArrayList();
- fDirectoryStack = new Vector();
- fErrors = new ArrayList();
-
- List collectedFiles = new ArrayList();
- fBaseDirectory = (workingDirectory == null || workingDirectory.isEmpty()) ? fProject.getLocation() : workingDirectory;
- collectFiles(fProject, collectedFiles);
-
- for (int i = 0; i < collectedFiles.size(); i++) {
- IFile file = (IFile) collectedFiles.get(i);
- Object existing = fFilesInProject.put(file.getName(), file);
- if (existing != null) {
- fNameConflicts.add(file.getName());
- }
- }
- }
-
- public IProject getProject() {
- return fProject;
- }
-
- public IPath getWorkingDirectory() {
- if (fDirectoryStack.size() != 0) {
- return (IPath) fDirectoryStack.lastElement();
- }
- // Fallback to the Project Location
- return fBaseDirectory;
- }
-
- public void pushDirectory(IPath dir) {
- if (dir != null) {
- IPath pwd = null;
- if (fBaseDirectory.isPrefixOf(dir)) {
- int segments = fBaseDirectory.matchingFirstSegments(dir);
- pwd = dir.removeFirstSegments(segments);
- } else {
- pwd = dir;
- }
- fDirectoryStack.addElement(pwd);
- }
- }
-
- public IPath popDirectory() {
- int i = fDirectoryStack.size();
- if (i != 0) {
- IPath dir = (IPath) fDirectoryStack.lastElement();
- fDirectoryStack.removeElementAt(i - 1);
- return dir;
- }
- return new Path(""); //$NON-NLS-1$
- }
-
- public int getDirectoryLevel() {
- return fDirectoryStack.size();
- }
-
- private void enableAllParsers() {
- fErrorParsers = new LinkedHashMap();
- String[] parserIDs = CCorePlugin.getDefault().getAllErrorParsersIDs();
- for (int i = 0; i < parserIDs.length; i++) {
- IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parserIDs[i]);
- fErrorParsers.put(parserIDs[i], parsers);
- }
- if (fErrorParsers.size() == 0) {
- initErrorParsersMap();
- CCorePlugin.getDefault().getPluginPreferences().setValue(OLD_PREF_ERROR_PARSER, ""); // remove old prefs //$NON-NLS-1$
- }
- }
-
- private void initErrorParsersMap() {
- String[] parserIDs = CCorePlugin.getDefault().getAllErrorParsersIDs();
- for (int i = 0; i < parserIDs.length; i++) {
- IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parserIDs[i]);
- fErrorParsers.put(parserIDs[i], parsers);
- }
- }
-
- protected void collectFiles(IProject parent, final List result) {
- try {
- parent.accept(new IResourceProxyVisitor() {
- public boolean visit(IResourceProxy proxy) throws CoreException {
- if (proxy.getType() == IResource.FILE) {
- result.add(proxy.requestResource());
- return false;
- }
- return true;
- }
- }, IResource.NONE);
- } catch (CoreException e) {
- CCorePlugin.log(e.getStatus());
- }
- }
-
- /**
- * Parses the input and try to generate error or warning markers
- */
- private void processLine(String line) {
- if (fErrorParsers.size() == 0)
- return;
-
- // If the line is too long, it is most likely a command line and not an error message
- // Don't process it since it'll probably be really slow and won't find an error anyway
- if (line.length() > 1000)
- return;
-
- String[] parserIDs = new String[fErrorParsers.size()];
- Iterator items = fErrorParsers.keySet().iterator();
- for (int i = 0; items.hasNext(); i++) {
- parserIDs[i] = (String) items.next();
- }
-
- for (int i = 0; i <parserIDs.length; ++i) {
- IErrorParser[] parsers = (IErrorParser[])fErrorParsers.get(parserIDs[i]);
- for (int j = 0; j < parsers.length; j++) {
- IErrorParser curr = parsers[j];
- if (curr.processLine(line, this)) {
- return;
- }
- }
- }
-
-// This old way of doing was trouble because it did not
-// respect the ordering provide by the users.
-//
-// int top = parserIDs.length - 1;
-// int i = top;
-// do {
-// IErrorParser[] parsers = (IErrorParser[]) fErrorParsers.get(parserIDs[i]);
-// for (int j = 0; j < parsers.length; j++) {
-// IErrorParser curr = parsers[j];
-// if (curr.processLine(line, this)) {
-// if (i != top) {
-// // move to top
-// Object used = fErrorParsers.remove(parserIDs[i]);
-// fErrorParsers.put(parserIDs[i], used);
-// //savePreferences();
-// }
-// return;
-// }
-// }
-// i--;
-// } while (i >= 0);
- }
-
- /**
- * Called by the error parsers.
- */
- public IFile findFileName(String fileName) {
- IPath path = new Path(fileName);
- return (IFile) fFilesInProject.get(path.lastSegment());
- }
-
- protected IFile findFileInWorkspace(IPath path) {
- IFile file = null;
- if (path.isAbsolute()) {
- IWorkspaceRoot root = fProject.getWorkspace().getRoot();
- file = root.getFileForLocation(path);
- // It may be a link resource so we must check it also.
- if (file == null) {
- IFile[] files = root.findFilesForLocation(path);
- for (int i = 0; i < files.length; i++) {
- if (files[i].getProject().equals(fProject)) {
- file = files[i];
- break;
- }
- }
- }
-
- } else {
- file = fProject.getFile(path);
- }
- return file;
- }
-
- /**
- * Called by the error parsers.
- */
- public boolean isConflictingName(String fileName) {
- IPath path = new Path(fileName);
- return fNameConflicts.contains(path.lastSegment());
- }
-
- /**
- * Called by the error parsers.
- */
- public IFile findFilePath(String filePath) {
- IPath path = null;
- IPath fp = new Path(filePath);
- if (fp.isAbsolute()) {
- if (fBaseDirectory.isPrefixOf(fp)) {
- int segments = fBaseDirectory.matchingFirstSegments(fp);
- path = fp.removeFirstSegments(segments);
- } else {
- path = fp;
- }
- } else {
- path = getWorkingDirectory().append(filePath);
- }
-
- IFile file = null;
- // The workspace may throw an IllegalArgumentException
- // Catch it and the parser should fallback to scan the entire project.
- try {
- file = findFileInWorkspace(path);
- } catch (Exception e) {
- }
-
- // That didn't work, see if it is a cygpath
- if (file == null && cygpathInstalled) {
- try {
- if (cygpath == null)
- cygpath = new CygPath();
- fp = new Path(cygpath.getFileName(filePath));
- if (fBaseDirectory.isPrefixOf(fp)) {
- int segments = fBaseDirectory.matchingFirstSegments(fp);
- path = fp.removeFirstSegments(segments);
- } else {
- path = fp;
- }
- file = findFileInWorkspace(path);
- } catch (IOException e) {
- // cygpath must not be installed, don't try this again
- cygpathInstalled = false;
- } catch (Exception e) {
- }
- }
-
- // We have to do another try, on Windows for cases like "TEST.C" vs "test.c"
- // We use the java.io.File canonical path.
- if (file == null || !file.exists()) {
- File f = path.toFile();
- try {
- String canon = f.getCanonicalPath();
- path = new Path(canon);
- file = findFileInWorkspace(path);
- } catch (IOException e1) {
- }
- }
- return (file != null && file.exists()) ? file : null;
- }
-
- /**
- * Called by the error parsers.
- */
- public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
- generateExternalMarker(file, lineNumber, desc, severity, varName, null);
- }
-
- /**
- * Called by the error parsers for external problem markers
- */
- public void generateExternalMarker(IResource file, int lineNumber, String desc, int severity, String varName, IPath externalPath) {
- ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, desc, severity, varName, externalPath);
- fErrors.add(problemMarkerInfo);
- if (severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE)
- hasErrors = true;
- }
-
-
- /**
- * Called by the error parsers. Return the previous line, save in the working buffer.
- */
- public String getPreviousLine() {
- return new String((previousLine) == null ? "" : previousLine); //$NON-NLS-1$
- }
-
- /**
- * Method setOutputStream.
- * @param cos
- */
- public void setOutputStream(OutputStream os) {
- outputStream = os;
- }
-
- /**
- * Method getOutputStream. It has a reference count
- * the stream must be close the same number of time this method was call.
- * @return OutputStream
- */
- public OutputStream getOutputStream() {
- nOpens++;
- return this;
- }
-
- /**
- * @see java.io.OutputStream#close()
- */
- public void close() throws IOException {
- if (nOpens > 0 && --nOpens == 0) {
- checkLine(true);
- fDirectoryStack.removeAllElements();
- fBaseDirectory = null;
- if (outputStream != null)
- outputStream.close();
- }
- }
-
- /**
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- if (outputStream != null)
- outputStream.flush();
- }
-
- /**
- * @see java.io.OutputStream#write(int)
- */
- public synchronized void write(int b) throws IOException {
- currentLine.append((char) b);
- checkLine(false);
- if (outputStream != null)
- outputStream.write(b);
- }
-
- public synchronized void write(byte[] b, int off, int len) throws IOException {
- if (b == null) {
- throw new NullPointerException();
- } else if (off != 0 || (len < 0) || (len > b.length)) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0) {
- return;
- }
- currentLine.append(new String(b, 0, len));
- checkLine(false);
- if (outputStream != null)
- outputStream.write(b, off, len);
- }
-
- private void checkLine(boolean flush) {
- String buffer = currentLine.toString();
- int i = 0;
- while ((i = buffer.indexOf('\n')) != -1) {
- String line = buffer.substring(0, i).trim(); // get rid of any trailing \r
- processLine(line);
- previousLine = line;
- buffer = buffer.substring(i + 1); // skip the \n and advance
- }
- currentLine.setLength(0);
- if (flush) {
- if (buffer.length() > 0) {
- processLine(buffer);
- previousLine = buffer;
- }
- } else {
- currentLine.append(buffer);
- }
- }
-
- public boolean reportProblems() {
- boolean reset = false;
- if (nOpens == 0) {
- Iterator iter = fErrors.iterator();
- while (iter.hasNext()) {
- ProblemMarkerInfo problemMarkerInfo = (ProblemMarkerInfo) iter.next();
- if (problemMarkerInfo.severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) {
- reset = true;
- }
- fMarkerGenerator.addMarker(problemMarkerInfo);
- }
- fErrors.clear();
- }
- return reset;
- }
-
- /**
- *
- */
- public String getScratchBuffer() {
- return scratchBuffer.toString();
- }
-
- /**
- * @param line
- */
- public void appendToScratchBuffer(String line) {
- scratchBuffer.append(line);
- }
-
- /**
- *
- */
- public void clearScratchBuffer() {
- scratchBuffer.setLength(0);
- }
-
- public boolean hasErrors() {
- return hasErrors;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java
deleted file mode 100644
index cc74b907255..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- * Mark Mitchell, CodeSourcery - Bug 136896: View variables in binary format
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import java.math.BigInteger;
-
-/**
- * Represents C/C++ address in CDT. All implementors of this inteface should be
- * immutable, i.e. all methods should not modify objects, they should return
- * new object.
- *
- * Please see Addr32 and Addr64 classes to see how this interface should
- * be extended
- */
-public interface IAddress extends Comparable {
- /**
- * Adds offset to address and returns new address object
- * which is the result
- * @param offset to add
- * @return the new address
- */
- IAddress add(BigInteger offset);
-
- /**
- * Adds offset to address and returns new address object
- * which is the result
- * <br><br>Note: This method has an offset limit of Long.MAX and Long.MIN, which under some addressing schems
- * may impose an unnesseary limitation, see <code>IAddressa.add(BigInteger offset)</code> to handle larger offsets.
- * @param offset to add
- * @return the new address
- */
- IAddress add(long offset);
-
- /**
- * Returns maximal offset possible for address. The offset
- * should be Identicall for all addresses of given class.
- * @return the max offset for this address class
- */
- BigInteger getMaxOffset();
-
- /**
- * Returns distance to address. Distance may be positive or negative
- * @param other address which distance is calculated to.
- * @return distance to address
- */
- BigInteger distanceTo(IAddress other);
-
- /**
- * Returns the value of the address.
- * @return
- */
- BigInteger getValue();
-
- /**
- * Returns whether this address equals the given object.
- *
- * @param obj the other object
- * @return <code>true</code> if the addresses are equivalent,
- * and <code>false</code> if they are not
- */
- boolean equals(Object addr);
-
- /**
- * Return true if address is zero, i.e. minimal possible
- * @return true is address is zero
- */
- boolean isZero();
-
- /**
- * Return true if address is maximal, i.e. maximal possible
- * @return true if address is maximal
- */
- boolean isMax();
-
- /**
- * Converts address to string as an unsigned number with given radix
- * @param radix to use for strng conversion
- * @return a string representation of address
- */
- String toString(int radix);
-
- /**
- * Identical to toString(10)
- * @return a string representation of address using a radix of 10
- */
- String toString();
-
- /**
- * Converts address to the hex representation with '0x' prefix and
- * with all leading zeros. The length of returned string should be
- * the same for all addresses of given class. I.e. 10 for 32-bit
- * addresses and 18 for 64-bit addresses
- * @return
- */
- String toHexAddressString();
-
-
- /**
- * Converts address to the binary representation with '0b' prefix and
- * with all leading zeros. The length of returned string should be
- * the same for all addresses of given class. I.e. 34 for 32-bit
- * addresses and 66 for 64-bit addresses
- * @return
- */
- String toBinaryAddressString();
-
- /**
- * Returns amount of symbols in hex representation. Is identical to
- * toHexAddressString().length(). It is present for perfomance purpose.
- *
- * @return the nmber os chararcter symbols to represent this address in hex.
- */
- int getCharsNum();
-
- /**
- * Returns the address size in bytes.
- *
- * @return the number of bytes required to hold this address.
- */
- int getSize();
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java
deleted file mode 100644
index 586773feb55..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import java.math.BigInteger;
-
-/**
- * This inteface serves as an address factory. If you need to
- * implement your own addresses, you should extend this.
- *
- * Please see Addr32Factory and Addr64Factory to see how it can be implemented.
- */
-public interface IAddressFactory
-{
- /**
- * Returns zero address, i.e. minimal possible address
- * @return
- */
- IAddress getZero();
-
- /**
- * Returns maximal address.
- * @return
- */
- IAddress getMax();
-
- /**
- * Creates address from string representation.
- *
- * 1. Method should be able to create address from hex
- * address string (string produced with
- * IAddress.toHexAddressString() method).
- * 2. Method should be case insensetive
- * 3. Method should be able to create address from decimal address
- * representation
- * 4. Method should throw NumberFormatException if the given string
- * cannot be decoded.
- * 5. Method should not attempt to evaluate string as expression (i.e.,
- * "0x1000 + 5" should not result in an IAddress for 0x1005.) Input
- * must be a straightforward, absolute value.
- *
- * Please see Addr32Factory.createAddress() for reference implementation.
- *
- * @param addr
- * @return
- */
- IAddress createAddress(String addr);
-
- /**
- * Creates address from string with given radix.
- *
- * Given string should not contain any prefixes or sign numbers.
- *
- * Method should be case insensetive
- *
- * Method should throw NumberFormatException if the given string
- * cannot be decoded.
- *
- * Method should not attempt to evaluate string as expression (i.e.,
- * "1000 + 5" should not result in an IAddress for 1005.) Input
- * must be a straightforward, absolute value.
- *
- * @param addr
- * @param radix
- * @return
- */
- IAddress createAddress(String addr, int radix);
-
- /**
- * Create address from a BigInteger
- *
- * @param addr
- * @return
- */
- IAddress createAddress(BigInteger addr);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java
deleted file mode 100644
index 45ac4d75b9d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-
-/**
- */
-public interface IBinaryParser extends IAdaptable {
-
- /**
- * Represents a binary file for example an ELF executable.
- */
- interface IBinaryFile extends IAdaptable {
- /**
- * Binary is an object, can be safely typecast to IBinaryObject
- */
- static final int OBJECT = 0x1;
-
- /**
- * Binary is an executable, can be typecast to IBinaryExectuable
- */
- static final int EXECUTABLE = 0x02;
-
- /**
- * Binary is a DLL, can be use as a IBinaryShared
- */
- static final int SHARED = 0x04;
-
- /**
- * Binary is an archive, IBinaryArchive
- */
- static final int ARCHIVE = 0x08;
-
- /**
- * Binary is a core file, an IBinaryFile
- */
- static final int CORE = 0x10;
-
- /**
- * Filename of the binary
- * @return the path
- */
- IPath getPath();
-
- /**
- * Binary type
- * @return the type of the binary
- */
- int getType();
-
- /**
- *
- * @return the binary contents.
- */
- InputStream getContents() throws IOException;
-
- /**
- * Return the binary parser
- * @return
- */
- IBinaryParser getBinaryParser();
- }
-
- /**
- * Represents an archive.
- */
- interface IBinaryArchive extends IBinaryFile {
- IBinaryObject[] getObjects();
- }
-
- /**
- * Represents a binary, for example an ELF excutable.
- */
- interface IBinaryObject extends IBinaryFile {
-
- /**
- * True if the binary contains debug information
- * @return true if debug information
- */
- boolean hasDebug();
-
- /**
- * CPU name
- * @return String - cpu name
- */
- String getCPU();
-
- long getText();
-
- long getData();
-
- long getBSS();
-
- /**
- * The endian
- * @return boolean - true for little endian
- */
- boolean isLittleEndian();
-
- /**
- * Symbols of the object
- * @return ISymbol[] arrays of symbols
- */
- ISymbol[] getSymbols();
-
- /**
- * Symbo at this address.
- * @param addr
- * @return ISymbol
- */
- ISymbol getSymbol(IAddress addr);
-
- /**
- * The name of the object
- * @return String
- */
- String getName();
-
- IAddressFactory getAddressFactory();
- }
-
- /**
- * An executable.
- */
- interface IBinaryExecutable extends IBinaryObject {
-
- /**
- * Needed shared libraries for this executable
- * @return String[] array
- */
- String[] getNeededSharedLibs();
- }
-
- /**
- * A DLL.
- */
- interface IBinaryShared extends IBinaryExecutable {
- /**
- * The Share Object name.
- * @return
- */
- String getSoName();
- }
-
- interface ISymbol extends Comparable {
-
- /**
- * Symbol is type function.
- */
- static final int FUNCTION = 0x01;
-
- /**
- * Symbol is type variable
- */
- static final int VARIABLE = 0x02;
-
- /**
- * Name of the Symbol
- * @return
- */
- String getName();
-
- /**
- * Address of the symbol
- * @return
- */
- IAddress getAddress();
-
- /**
- * Size of the symbol.
- * @return
- */
- long getSize();
-
- /**
- * Start linenumber of the symbol in the source
- * @return
- */
- int getStartLine();
-
- /**
- * End line number of the symbol in the source
- * @return
- */
- int getEndLine();
-
- /**
- * Source filename of the symbol.
- * @return
- */
- IPath getFilename();
-
- /**
- * Type of the symbol
- * @return
- */
- int getType();
-
- /**
- * Line number corresponding to the address offset.
- * @param offset
- * @return
- */
- int getLineNumber(long offset);
-
- /**
- * Return the binary object this symbol is from.
- * @return
- */
- IBinaryObject getBinaryObject();
- }
-
- /**
- * Creates an IBinaryFile.
- * @param hints - array byte that can be use to recognise the file.
- * Can be null or empty array when no hints are passed.
- * @param path
- * @return
- * @throws IOException
- */
- IBinaryFile getBinary(byte[] hints, IPath path) throws IOException;
-
- /**
- * Creates an IBinaryFile.
- *
- * @param path
- * @return
- * @throws IOException
- */
- IBinaryFile getBinary(IPath path) throws IOException;
-
- /**
- * Returns the name of the Format.
- * @return
- */
- String getFormat();
-
- /**
- * True if the resource is a binary.
- * @param hints
- * @param path
- * @return
- */
- boolean isBinary(byte[] hints, IPath path);
-
- /**
- * Get a hint of the needed buffer size to recognise the file.
- * @return
- */
- int getHintBufferSize();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptor.java
deleted file mode 100644
index 3ea38c10b3e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.w3c.dom.Element;
-
-public interface ICDescriptor {
- public ICOwnerInfo getProjectOwner();
- public String getPlatform();
- public IProject getProject();
-
- public ICExtensionReference[] get(String extensionPoint);
- public ICExtensionReference[] get(String extensionPoint, boolean update) throws CoreException;
- public ICExtensionReference create(String extensionPoint, String id) throws CoreException;
-
- public void remove(ICExtensionReference extension) throws CoreException;
- public void remove(String extensionPoint) throws CoreException;
-
- public Element getProjectData(String id) throws CoreException;
- public void saveProjectData() throws CoreException;
-
- ICConfigurationDescription getConfigurationDescription();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorListener.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorListener.java
deleted file mode 100644
index 0f00b60c2b7..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorListener.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-public interface ICDescriptorListener {
- public void descriptorChanged(CDescriptorEvent event);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java
deleted file mode 100644
index 98989e1e03e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface ICDescriptorManager {
-
- /**
- * @param project
- * @param id
- * @throws CoreException
- */
- public void configure(IProject project, String id) throws CoreException;
- /**
- * @param project
- * @param id
- * @throws CoreException
- */
- public void convert(IProject project, String id) throws CoreException;
-
- /**
- * @param project
- * @return
- * @throws CoreException
- */
- public ICDescriptor getDescriptor(IProject project) throws CoreException;
-
- /**
- * @param project
- * @param forceCreation
- * @return
- * @throws CoreException
- */
- public ICDescriptor getDescriptor(IProject project, boolean create) throws CoreException;
-
- /**
- * @param project
- * @param op
- * @param monitor
- * @throws CoreException
- */
- public void runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) throws CoreException;
-
- /**
- * @param listener
- */
- public void addDescriptorListener(ICDescriptorListener listener);
-
- /**
- * @param listener
- */
- public void removeDescriptorListener(ICDescriptorListener listener);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorOperation.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorOperation.java
deleted file mode 100644
index d6e542f6e24..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorOperation.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface ICDescriptorOperation {
-
- void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException;
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java
deleted file mode 100644
index 63cedfa610f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.resources.IProject;
-
-public interface ICExtension {
- public IProject getProject();
- public ICExtensionReference getExtensionReference();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionDescriptor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionDescriptor.java
deleted file mode 100644
index 0d88e4a589f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionDescriptor.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-public interface ICExtensionDescriptor {
- String getName();
-
- String getId();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionReference.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionReference.java
deleted file mode 100644
index 7bf9bb57d07..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionReference.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-public interface ICExtensionReference {
-
- /**
- * Return the extension point of this reference.
- *
- * @return String
- */
- public String getExtension();
-
- /**
- * Return the extension ID of this reference.
- *
- * @return String
- */
- public String getID();
-
- /**
- * Sets a name/value data pair on this reference in the .cdtproject file
- */
- public void setExtensionData(String key, String value) throws CoreException;
-
- /**
- * Gets a value of the key from the .cdtproject file set by
- * setExtensionData()
- */
- public String getExtensionData(String key);
-
- /**
- * Returns the project descriptor which this extension reference belongs to.
- * @return the ICDescriptor
- */
- public ICDescriptor getCDescriptor();
-
- /**
- * Creates and returns a new instance of the cextension executable
- * identified by the &lt;run&gt; attribute of the cextension.
- * <p>
- * The ICExtension is instantiated using its 0-argument public
- * constructor. If the class implements the
- * <code>org.eclipse.core.runtime.IExecutableExtension</code> interface, the method
- * <code>setInitializationData</code> is called, passing to the object
- * the configuration information that was used to create it.
- * </p>
- * <p>
- * Unlike other methods on this object, invoking this method may activate
- * the plug-in.
- * </p>
- *
- * @return the executable ICExtension instance
- * @exception CoreException if an instance of the executable extension
- * could not be created for any reason.
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData
- */
- public ICExtension createExtension() throws CoreException;
-
- /**
- * Returns all configuration elements that are children of the
- * cextension element. Returns an empty array if this configuration
- * element has no children.
- * <p>
- * Each child corresponds to a nested XML element in the configuration
- * markup. For example, the configuration markup
- *
- * <pre>
- * &lt;view&gt;
- * &amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;verticalHint&gt;top&lt;/verticalHint&gt;
- * &amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;horizontalHint&gt;left&lt;/horizontalHint&gt;
- * &lt;/view&gt;
- * </pre>
- *
- * corresponds to a configuration element, named <code>"view"</code>,
- * with two children.
- * </p>
- *
- * @return the child configuration elements
- */
- public IConfigurationElement[] getExtensionElements() throws CoreException;
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICLogConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICLogConstants.java
deleted file mode 100644
index 81c95437921..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICLogConstants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * Markus Schorn (Wind River Systems)
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-/**
- * @author bgheorgh
- */
-public interface ICLogConstants {
- public class LogConst {
- private LogConst() {
- }
- }
-
- public static final LogConst PDE = new LogConst();
- public static final LogConst CDT = new LogConst();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwner.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwner.java
deleted file mode 100644
index 0d69ba85934..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwner.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.runtime.CoreException;
-
-public interface ICOwner {
- public void configure(ICDescriptor cproject) throws CoreException;
- public void update(ICDescriptor cproject, String extensionID) throws CoreException;
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwnerInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwnerInfo.java
deleted file mode 100644
index 5bebbcf0d3d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwnerInfo.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-public interface ICOwnerInfo {
- public String getID();
- public String getName();
- public String getPlatform();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IConsoleParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IConsoleParser.java
deleted file mode 100644
index f12ea00aeac..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IConsoleParser.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-/**
- * A basic interface for console parsers
- *
- * @author vhirsl
- */
-public interface IConsoleParser {
- /**
- * Parse one line of output.
- *
- * @param line
- * @return true if line was successfully processed; skip other console parsers<p>
- * false - try other console parsers
- */
- public boolean processLine(String line);
-
- /**
- * Finalization of a console parser when the stream is closed.
- */
- public void shutdown();
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IErrorParser.java
deleted file mode 100644
index 65387cccf54..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IErrorParser.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-public interface IErrorParser {
- /**
- * Finds error or warnings on the given line
- */
- boolean processLine(String line, ErrorParserManager eoParser);
-
-}
-
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IMarkerGenerator.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IMarkerGenerator.java
deleted file mode 100644
index aa5df64177e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IMarkerGenerator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * @author sam.robb
- */
-public interface IMarkerGenerator {
- int SEVERITY_INFO = 0;
- int SEVERITY_WARNING = 1;
- int SEVERITY_ERROR_RESOURCE = 2;
- int SEVERITY_ERROR_BUILD = 3;
-
- /**
- * callback from Output Parser
- * @deprecated Use public void addMarker(org.eclipse.cdt.core.ProblemMarkerInfo problem) instead.
- */
- void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar);
- void addMarker(ProblemMarkerInfo problemMarkerInfo);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionConverter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionConverter.java
deleted file mode 100644
index 34d2fa40665..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionConverter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-import org.eclipse.jface.text.IRegion;
-
-
-/**
- * Allows for converting character ranges of files previously stored on disk to the
- * range where the characters are found in the current version of the file. The
- * current version can be the content of a dirty editor, or if there is none, the
- * latest verison of the file as stored on disk.
- *
- * As long as the underlying text of the character range has not been modified the
- * converted range will have the same underlying text. Insertions at the beginning
- * or the end of the text are not added to the converted range.
- *
- * An insertion inside the underlying text will increase the length of the converted
- * range, a deletion of one of the characters will decrease it.
- *
- * An deletion followed by an insertion without saving the file inbetween, will cancel
- * the deletion as far as possible.
- *
- * <p> This interface is not intended to be implemented by clients. </p>
- *
- * <p>
- * <strong>EXPERIMENTAL</strong>. This interface has been added as
- * part of a work in progress. There is no guarantee that this API will
- * work or that it will remain the same. Please do not use this API without
- * consulting with the CDT team.
- * </p>
- *
- * @since 4.0
- */
-
-public interface IPositionConverter {
- /**
- * Converts an actual character range to the range where the underlying text
- * was originally found.
- * @param actualPosition a range as found in the current text buffer for the file.
- * @return a range suitable for the version of the file for which the converter
- * was obtained.
- */
- IRegion actualToHistoric(IRegion actualPosition);
-
- /**
- * Converts a historic character range to the range where the underlying text
- * currently can be found.
- * @param historicPosition a range as found in the version of the file for which
- * the converter was obtained.
- * @return a range suitable for the current text buffer of the file.
- */
- IRegion historicToActual(IRegion historicPosition);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java
deleted file mode 100644
index e3fab3d600a..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * An interface to manage the position tracking. It allows for mapping character
- * offsets from a file previously stored on disk to the offset in the current document
- * for the file.
- *
- * <p> This interface is not intended to be implemented by clients. </p>
- *
- * <p>
- * <strong>EXPERIMENTAL</strong>. This interface has been added as
- * part of a work in progress. There is no guarantee that this API will
- * work or that it will remain the same. Please do not use this API without
- * consulting with the CDT team.
- * </p>
- * @since 4.0
- */
-public interface IPositionTrackerManager {
- /**
- * Returns the position converter suitable for mapping character offsets of the
- * given translation unit to the current version of it.
- *
- * @param file a file for which the position adapter is requested.
- * @param timestamp identifies the version of the file stored on disk.
- * @return the requested position converter or <code>null</code>.
- */
- public IPositionConverter findPositionConverter(ITranslationUnit tu, long timestamp);
- /**
- * Returns the position converter suitable for mapping character offsets of the
- * given file/timestamp to the current version of it.
- *
- * @param file a file for which the position adapter is requested.
- * @param timestamp identifies the version of the file stored on disk.
- * @return the requested position converter or <code>null</code>.
- */
- public IPositionConverter findPositionConverter(IFile file, long timestamp);
-
- /**
- * Returns the position tracker suitable for mapping character offsets of the
- * given external file/timestamp to the current version of it. <p>
- * The method can be used for resources by supplying the <b>full path</b>. However,
- * it does not work if you supply the location of a resource.
- *
- * @param externalLocationOrFullPath an external location for which the position adapter is requested.
- * @param timestamp identifies the version of the file stored on disk.
- * @return the requested position converter or <code>null</code>.
- */
- public IPositionConverter findPositionConverter(IPath fullPathOrExternalLocation, long timestamp);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessInfo.java
deleted file mode 100644
index fbddcb461e3..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessInfo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-public interface IProcessInfo {
- public int getPid();
- public String getName();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessList.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessList.java
deleted file mode 100644
index 046afbbbc82..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IProcessList.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-public interface IProcessList {
- public IProcessInfo[] getProcessList();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ISymbolReader.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ISymbolReader.java
deleted file mode 100644
index 014d0984986..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ISymbolReader.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Nokia and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nokia - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core;
-
-/**
- * A reader that's able to decipher debug symbol formats.
- *
- * This initial version only returns a list of source files.
- *
- */
-public interface ISymbolReader {
-
- String[] getSourceFiles();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java
deleted file mode 100644
index ab018846e00..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Siemens AG.
- * All rights reserved. This content and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Norbert Ploett - Initial implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-public class ProblemMarkerInfo {
-
- public IResource file;
- public int lineNumber;
- public String description;
- public int severity;
- public String variableName;
- public IPath externalPath ;
-
- public ProblemMarkerInfo(IResource file, int lineNumber, String desciption, int severity, String variableName) {
- this.file = file;
- this.lineNumber = lineNumber;
- this.description = desciption;
- this.severity = severity;
- this.variableName = variableName;
- this.externalPath = null ;
- }
-
-
- public ProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName, IPath externalPath) {
- super();
- this.file = file;
- this.lineNumber = lineNumber;
- this.description = description;
- this.severity = severity;
- this.variableName = variableName;
- this.externalPath = externalPath;
- }
-
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ToolFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ToolFactory.java
deleted file mode 100644
index 3641553158b..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ToolFactory.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-
-package org.eclipse.cdt.core;
-
-import java.util.Map;
-
-import org.eclipse.cdt.core.formatter.CodeFormatter;
-import org.eclipse.cdt.internal.formatter.CCodeFormatter;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-
-/**
- */
-public class ToolFactory {
-
- /**
- * Create an instance of a code formatter. A code formatter implementation can be contributed via the
- * extension point "org.eclipse.cdt.core.CodeFormatter". If unable to find a registered extension, the factory
- * will default to using the default code formatter.
- * @param options - the options map to use for formatting with the code formatter. Recognized options
- * are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use
- * the current settings from <code>CCorePlugin.getOptions()</code>.
- * @return an instance of either a contributed the built-in code formatter
- * @see CodeFormatter
- * @see DefaultCodeFormatterConstants
- * @see CCorePlugin#getOptions()
- */
- public static CodeFormatter createCodeFormatter(Map options){
- if (options == null)
- options = CCorePlugin.getOptions();
- String formatterID = (String)options.get(CCorePreferenceConstants.CODE_FORMATTER);
- String extID = CCorePlugin.FORMATTER_EXTPOINT_ID;
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, extID);
- 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 initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$
- if (initializerID != null && initializerID.equals(formatterID)){
- try {
- Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- if (execExt instanceof CodeFormatter){
- CodeFormatter formatter = (CodeFormatter)execExt;
- formatter.setOptions(options);
- return formatter;
- }
- } catch(CoreException e) {
- CCorePlugin.log(e.getStatus());
- break;
- }
- }
- }
- }
- }
- return createDefaultCodeFormatter(options);
- }
-
- /**
- * Create an instance of the built-in code formatter.
- *
- * @param options - the options map to use for formatting with the default code formatter. Recognized options
- * are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use
- * the current settings from <code>CCorePlugin.getOptions()</code>.
- * @return an instance of the built-in code formatter
- * @see CodeFormatter
- * @see DefaultCodeFormatterConstants
- * @see CCorePlugin#getOptions()
- */
- public static CodeFormatter createDefaultCodeFormatter(Map options){
- if (options == null)
- options = CCorePlugin.getOptions();
- return new CCodeFormatter(options);
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java
deleted file mode 100644
index a9f487f5869..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.cdtvariables;
-
-import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
-
-/**
- * This is the trivial implementation of the IBuildMacro used internaly by the MBS
- *
- * @since 3.0
- */
-public class CdtVariable implements ICdtVariable {
- protected String fName;
- protected int fType;
- protected String fStringValue;
- protected String fStringListValue[];
-
- protected CdtVariable(){
-
- }
-
- public CdtVariable(String name, int type, String value){
- fName = name;
- fType = type;
- fStringValue = value;
- }
-
- public CdtVariable(String name, int type, String value[]){
- fName = name;
- fType = type;
- fStringListValue = value;
- }
-
- public CdtVariable(ICdtVariable var){
- fName = var.getName();
- fType = var.getValueType();
- try {
- if(CdtVariableResolver.isStringListVariable(fType))
- fStringListValue = var.getStringListValue();
- else
- fStringValue = var.getStringValue();
- } catch (CdtVariableException e) {
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacro#getName()
- */
- public String getName() {
- return fName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacro#getMacroValueType()
- */
- public int getValueType() {
- return fType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacro#getStringValue()
- */
- public String getStringValue() throws CdtVariableException {
- if(CdtVariableResolver.isStringListVariable(fType))
- throw new CdtVariableException(ICdtVariableStatus.TYPE_MACRO_NOT_STRING,fName,null,fName);
-
- return fStringValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacro#getStringListValue()
- */
- public String[] getStringListValue() throws CdtVariableException {
- if(!CdtVariableResolver.isStringListVariable(fType))
- throw new CdtVariableException(ICdtVariableStatus.TYPE_MACRO_NOT_STRINGLIST,fName,null,fName);
-
- return fStringListValue;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableException.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableException.java
deleted file mode 100644
index c60676a4136..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableException.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.cdtvariables;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * This exception is thrown in the case of some build macros-related operation failure
- * The exception typically contains one or more IBuildMacroStatus statuses
- *
- * @since 3.0
- */
-public class CdtVariableException extends CoreException {
- /**
- * All serializable objects should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 3976741380246681395L;
-
- /**
- * Creates a new exception with the given status object.
- *
- * @param status the status object to be associated with this exception.
- * Typically this is either the IBuildMacroStatus or the MultiStatus that holds
- * the list of the IBuildMacroStatus statuses
- */
- public CdtVariableException(IStatus status) {
- super(status);
- }
-
- /**
- * Creates an exception containing a single IBuildMacroStatus status with the IStatus.ERROR severity
- *
- * @param code one of the IBuildMacroStatus.TYPE_xxx statusses
- * @param message message, can be null. In this case the default message will
- * be generated base upon the other status info
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- * @param macroName the name of the build macro whose resolution caused this status creation or null if none
- * @param expression the string whose resolutinon caused caused this status creation or null if none
- * @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
- * @param contextType the context type used in the operation
- * @param contextData the context data used in the operation
- */
- public CdtVariableException(int code,
- String message,
- Throwable exception,
- String macroName,
- String expression,
- String referencedName//,
- //int contextType,
- //Object contextData
- ) {
- super(new CdtVariableStatus(code, message, exception, macroName, expression, referencedName/*, contextType, contextData*/));
- }
-
- /**
- * Creates an exception containing a single IBuildMacroStatus status with the IStatus.ERROR severity and with the default message
- *
- * @param code one of the IBuildMacroStatus.TYPE_xxx statusses
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- * @param macroName the name of the build macro whose resolution caused this status creation or null if none
- * @param expression the string whose resolutinon caused caused this status creation or null if none
- * @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
- * @param contextType the context type used in the operation
- * @param contextData the context data used in the operation
- */
- public CdtVariableException(int code,
- String macroName,
- String expression,
- String referencedName//,
- //int contextType,
- //Object contextData
- ) {
- super(new CdtVariableStatus(code, macroName, expression, referencedName/*, contextType, contextData*/));
- }
-
- /**
- * Returns an array of the IBuildMacroStatus statuses this exception holds
- *
- * @return IBuildMacroStatus[]
- */
- public ICdtVariableStatus[] getVariableStatuses(){
- IStatus status = getStatus();
- if(status instanceof ICdtVariableStatus)
- return new ICdtVariableStatus[]{(ICdtVariableStatus)status};
- else if(status.isMultiStatus()){
- IStatus children[] = status.getChildren();
- ICdtVariableStatus result[] = new ICdtVariableStatus[children.length];
- int num = 0;
- for(int i = 0; i < children.length; i++){
- if(children[i] instanceof ICdtVariableStatus)
- result[num++]=(ICdtVariableStatus)children[i];
- }
- if(num != children.length){
- ICdtVariableStatus tmp[] = new ICdtVariableStatus[num];
- for(int i = 0; i < num; i++)
- tmp[i] = result[i];
- result = tmp;
- }
- return result;
- }
- return new ICdtVariableStatus[0];
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableStatus.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableStatus.java
deleted file mode 100644
index 8af3880b04f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariableStatus.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.cdtvariables;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * This class implements the IBuildMacroStatus interface
- *
- * @since 3.0
- */
-public class CdtVariableStatus extends Status implements ICdtVariableStatus {
- /*
- * String constants
- */
- private static final String PREFIX = "BuildMacroStatus"; //$NON-NLS-1$
- private static final String STATUS = PREFIX + ".status"; //$NON-NLS-1$
- private static final String STATUS_MACRO_UNDEFINED = STATUS + ".macro.undefined"; //$NON-NLS-1$
- private static final String STATUS_MACROS_REFERENCE_EACHOTHER = STATUS + ".reference.eachother"; //$NON-NLS-1$
- private static final String STATUS_MACRO_REFERENCE_INCORRECT = STATUS + ".reference.incorrect"; //$NON-NLS-1$
- private static final String STATUS_MACRO_NOT_STRING = STATUS + ".macro.not.string"; //$NON-NLS-1$
- private static final String STATUS_MACRO_NOT_STRINGLIST = STATUS + ".macro.not.stringlist"; //$NON-NLS-1$
- private static final String STATUS_ERROR = STATUS + ".error"; //$NON-NLS-1$
- private static final String VALUE_UNDEFINED = PREFIX + ".value.undefined"; //$NON-NLS-1$
-
- private String fMacroName;
- private String fExpression;
- private String fReferencedName;
-// private int fContextType;
-// private Object fContextData;
-// private Object fContext;
-
- /**
- *
- * @param severity one of the IStatus.xxx severity statuses
- * @param code one of the IBuildMacroStatus.TYPE_xxx statusses
- * @param message message, can be null. In this case the default message will
- * be generated base upon the other status info
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- * @param macroName the name of the build macro whose resolution caused this status creation or null if none
- * @param expression the string whose resolutinon caused caused this status creation or null if none
- * @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
- * @param contextType the context type used in the operation
- * @param contextData the context data used in the operation
- */
- public CdtVariableStatus(int severity,
- int code,
- String message,
- Throwable exception,
- String macroName,
- String expression,
- String referencedName//,
-// int contextType,
-// Object contextData
-// Object context
- ) {
- super(severity,CCorePlugin.PLUGIN_ID,code,message != null ? message : "",exception); //$NON-NLS-1$
- fExpression = expression;
- fReferencedName = referencedName;
-// fContextType = contextType;
-// fContextData = contextData;
-// fContext = context;
- fMacroName = macroName;
- if(message == null)
- setMessage(generateMessage());
- }
-
- /**
- * Creates status with the IStatus.ERROR severity
- *
- * @param code one of the IBuildMacroStatus.TYPE_xxx statusses
- * @param message message, can be null. In this case the default message will
- * be generated base upon the other status info
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- * @param macroName the name of the build macro whose resolution caused this status creation or null if none
- * @param expression the string whose resolutinon caused caused this status creation or null if none
- * @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
- * @param contextType the context type used in the operation
- * @param contextData the context data used in the operation
- */
- public CdtVariableStatus(
- int code,
- String message,
- Throwable exception,
- String macroName,
- String expression,
- String referencedName//,
-// int contextType,
-// Object contextData
-// Object context
- ) {
- this(IStatus.ERROR,code,message,exception,macroName,expression,referencedName/*,contextType,contextData*/);
- }
-
- /**
- * Creates status with the IStatus.ERROR severity and with the default message
- *
- * @param code one of the IBuildMacroStatus.TYPE_xxx statusses
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- * @param macroName the name of the build macro whose resolution caused this status creation or null if none
- * @param expression the string whose resolutinon caused caused this status creation or null if none
- * @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
- * @param contextType the context type used in the operation
- * @param contextData the context data used in the operation
- */
- public CdtVariableStatus(
- int code,
- String macroName,
- String expression,
- String referencedName//,
-// int contextType,
-// Object contextData
- ) {
- this(IStatus.ERROR,code,null,null,macroName,expression,referencedName/*,contextType,contextData*/);
- }
-
- /**
- * generates and returns the default status message based upon then status data
- *
- * @return String
- */
- protected String generateMessage(){
- String message = null;
-/* switch(getCode()){
- case TYPE_MACRO_UNDEFINED:{
- String refName = fReferencedName;
- if(refName == null)
- refName = ManagedMakeMessages.getResourceString(VALUE_UNDEFINED);
- message = ManagedMakeMessages.getFormattedString(STATUS_MACRO_UNDEFINED,refName);
- }
- break;
- case TYPE_MACROS_REFERENCE_EACHOTHER:{
- String name = fMacroName;
- String refName = fReferencedName;
- if(name == null)
- name = ManagedMakeMessages.getResourceString(VALUE_UNDEFINED);
- if(refName == null)
- refName = ManagedMakeMessages.getResourceString(VALUE_UNDEFINED);
- message = ManagedMakeMessages.getFormattedString(STATUS_MACROS_REFERENCE_EACHOTHER,new String[]{name,refName});
- }
- break;
- case TYPE_MACRO_REFERENCE_INCORRECT:{
- String refName = fReferencedName;
- if(refName == null)
- refName = ManagedMakeMessages.getResourceString(VALUE_UNDEFINED);
- message = ManagedMakeMessages.getFormattedString(STATUS_MACRO_REFERENCE_INCORRECT,refName);
- }
- break;
- case TYPE_MACRO_NOT_STRING:{
- String refName = fReferencedName;
- if(refName == null)
- refName = ManagedMakeMessages.getResourceString(VALUE_UNDEFINED);
- message = ManagedMakeMessages.getFormattedString(STATUS_MACRO_NOT_STRING,refName);
- }
- break;
- case TYPE_MACRO_NOT_STRINGLIST:{
- String refName = fReferencedName;
- if(refName == null)
- refName = ManagedMakeMessages.getResourceString(VALUE_UNDEFINED);
- message = ManagedMakeMessages.getFormattedString(STATUS_MACRO_NOT_STRINGLIST,refName);
- }
- break;
- case TYPE_ERROR:
- default:
- message = ManagedMakeMessages.getResourceString(STATUS_ERROR);
- }*/
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroStatus#getMacroName()
- */
- public String getVariableName() {
- return fMacroName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroStatus#getExpression()
- */
- public String getExpression() {
- return fExpression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroStatus#getReferencedName()
- */
- public String getReferencedMacroName() {
- return fReferencedName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroStatus#getContextType()
- */
-// public int getContextType() {
-// return fContextType;
-// }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroStatus#getContextData()
- */
-// public Object getContextData() {
-// return fContextData;
-// }
-
-
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariable.java
deleted file mode 100644
index 9b7a157d159..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariable.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.cdtvariables;
-
-
-/**
- * this interface represents the given build macro
- * @since 3.0
- */
-public interface ICdtVariable{
- /**
- * can hold any text string
- */
- public static final int VALUE_TEXT = 1;
-
- /**
- * can hold the array of text string values
- */
- public static final int VALUE_TEXT_LIST = 2;
-
- /**
- * can hold file path
- */
- public static final int VALUE_PATH_FILE = 3;
-
- /**
- * can hold the array of file path values
- */
- public static final int VALUE_PATH_FILE_LIST = 4;
-
- /**
- * can hold dir path
- */
- public static final int VALUE_PATH_DIR = 5;
-
- /**
- * can hold the array of dir path values
- */
- public static final int VALUE_PATH_DIR_LIST = 6;
-
- /**
- * can hold both file and dir path
- */
- public static final int VALUE_PATH_ANY = 7;
-
- /**
- * can hold the array of PATH_ANY values
- */
- public static final int VALUE_PATH_ANY_LIST = 8;
-
- /**
- * Returns the macro name
- * @return
- */
- String getName();
-
- /**
- * @return IBuildMacro.VALUE_xxx
- */
- int getValueType();
-
- /**
- * @throws CdtVariableException if macro holds StringList-type value
- */
- String getStringValue() throws CdtVariableException;
-
- /**
- * @throws CdtVariableException if macro holds single String-type value
- */
- String[] getStringListValue() throws CdtVariableException;
-}
-
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableManager.java
deleted file mode 100644
index 2f29b6eaa93..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableManager.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.cdtvariables;
-
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.core.variables.IStringVariable;
-
-/**
- *
- * @since 3.0
- */
-public interface ICdtVariableManager{
-/* public final static int CONTEXT_FILE = 1;
- public final static int CONTEXT_OPTION = 2;
- public final static int CONTEXT_CONFIGURATION = 3;
- public final static int CONTEXT_PROJECT = 4;
- public final static int CONTEXT_WORKSPACE = 5;
- public final static int CONTEXT_INSTALLATIONS = 6;
- public final static int CONTEXT_ECLIPSEENV = 7;
- public final static int CONTEXT_TOOL = 8;
-*/
- /**
- *
- * Returns reference to the IBuildMacro interface representing Macro of the
- * specified name or null if there is there is no such macro
- * @param macroName macro name
- * @param contextType represents the context type. Should be set to one of the the
- * IBuildMacroProvider. CONTEXT_xxx constants
- * @param contextData represents the additional data needed by the Build Macro Provider
- * and Macro Suppliers in order to obtain the macro value. The type of the context data
- * differs depending on the context type and can be one of the following:
- * 1. IFileContextData interface � used to represent currently selected file context
- * the IFileContextData interface is defined as follows:
- * pulic interface IFileContextData{
- * IFile getFile();
- * IOption getOption();
- * }
- * NOTE: the IFileContextData is passed that represents the current file and the option
- * for that file because Macro Value Provider needs to know what option should be used
- * as a context in case macro is not found for �current file� context
- * 2. IOptionContextData interface used to represent the currently selected option context
- * 3. IConfiguration � used to represent the currently selected configuration context
- * 4. IProject � used to represent current project context
- * 5. IWorkspace � used to represent current workspace context
- * 6. null � to represent the CDT and Eclipse installation context
- * 7. null � to represent process environment context
- * @param includeParentContext specifies whether lower-precedence context macros should
- * be included
- */
- public ICdtVariable getVariable(String name, ICConfigurationDescription cfg);
-
- /**
- *
- * @return the array of the IBuildMacro representing all available macros
- */
- public ICdtVariable[] getVariables(ICConfigurationDescription cfg);
-
-
- /**
- * This method is defined to be used primarily by the UI classes and should not be used by the
- * tool-integrator
- * @return the array of the provider-internal suppliers for the given context
- */
-/* public IBuildMacroSupplier[] getSuppliers(int contextType,
- Object contextData);
-*/
-
- /**
- *
- * converts StringList value into String of the following format:
- * "<value_1>< listDelimiter ><value_2>< listDelimiter > ... <value_n>"
- */
- public String convertStringListToString (String value[], String listDelimiter);
-
- /**
- *
- * resolves all macros in the string.
- * @param value the value to be resolved
- * @param nonexistentMacrosValue specifies the value that inexistent macro references will be
- * expanded to. If null the BuildMacroException is thrown in case the string to be resolved
- * references inexistent macros
- * @param listDelimiter if not null, StringList macros are expanded as
- * �<value_1>< listDelimiter ><value_2>< listDelimiter > ... <value_n>�
- * otherwise the BuildMacroException is thrown in case the string to be resolved references
- * string-list macros
- * @param contextType context from which the macro search should be started
- * @param contextData context data
- */
- public String resolveValue(String value,
- String nonexistentMacrosValue,
- String listDelimiter,
- ICConfigurationDescription cfg) throws CdtVariableException;
-
- /**
- *
- * if the string contains a value that can be treated as a StringList resolves it to arrays of strings
- * otherwise throws the BuildMacroException exception
- * @see isStringListValue
- */
- public String[] resolveStringListValue(String value,
- String nonexistentMacrosValue,
- String listDelimiter,
- ICConfigurationDescription cfg) throws CdtVariableException;
-
- /**
- *
- * resolves macros in the array of string-list values
- *
- * @see isStringListValue
- */
- public String[] resolveStringListValues(String value[],
- String nonexistentMacrosValue,
- String listDelimiter,
- ICConfigurationDescription cfg) throws CdtVariableException;
-
- /**
- *
- * @return true if the specified expression can be treated as StringList
- * 1. The string value is �${<some_StringList_Macro_name>}�
- */
- public boolean isStringListValue(String value, ICConfigurationDescription cfg)
- throws CdtVariableException;
-
- /**
- *
- * checks the integrity of the Macros
- * If there are inconsistencies, such as when a macro value refers to a nonexistent macro
- * or when two macros refer to each other, this method will throw the BuildMacroException exception
- * The BuildMacroException will contain the human-readable string describing
- * the inconsistency and the array of the IBuildMacro interfaces that will represent the macros that
- * caused the inconsistency. This information will be used in the UI to notify the user about
- * the macro inconsistencies (see also the �User interface for viewing and editing Build Macros�
- * section of this design)
- */
- public void checkVariableIntegrity(ICConfigurationDescription cfg) throws CdtVariableException;
-
- public boolean isEnvironmentVariable(ICdtVariable variable, ICConfigurationDescription cfg);
-
- public boolean isUserVariable(ICdtVariable variable, ICConfigurationDescription cfg);
-
- public IStringVariable toEclipseVariable(ICdtVariable variable, ICConfigurationDescription cfg);
-}
-
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableStatus.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableStatus.java
deleted file mode 100644
index 13d366be192..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariableStatus.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.cdtvariables;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * This interface represents the status of a build macro operation
- *
- * @since 3.0
- */
-public interface ICdtVariableStatus extends IStatus {
- /**
- * This type is used to present that the inexistent macro reference
- * is encountered while resolving macros in some expression
- */
- public static final int TYPE_MACRO_UNDEFINED = 1;
-
- /**
- * This type is used to present that two macros reference each other
- */
- public static final int TYPE_MACROS_REFERENCE_EACHOTHER = 2;
-
- /**
- * This type is used to present that the incorrect macro reference
- * is encountered while resolving macros in some expression
- */
- public static final int TYPE_MACRO_REFERENCE_INCORRECT = 3;
-
- /**
- * The status of this type is created by the Build Macro of the String-List type
- * when the String value is requested
- */
- public static final int TYPE_MACRO_NOT_STRING = 4;
-
- /**
- * The status of this type is created by the Build Macro of the String type
- * when the String-List value is requested
- */
- public static final int TYPE_MACRO_NOT_STRINGLIST = 5;
-
- /**
- * This type is used to present that some error other than the one represented
- * by other TYPE_xxx has occured
- */
- public static final int TYPE_ERROR = -1;
-
- /**
- * returns the name of the build macro whose resolution caused this status creation or null if none
- * @return IBuildMacro
- */
- public String getVariableName();
-
- /**
- * returns the string whose resolutinon caused caused this status creation or null if none
- * @return String
- */
- public String getExpression();
-
- /**
- * returns the macro name referenced in the resolution string that caused this this status creation or null if none
- * @return String
- */
- public String getReferencedMacroName();
-
- /**
- * returns the context type used in the operation
- * @return int
- */
-// public int getContextType();
-
- /**
- * returns the context data used in the operation
- * @return Object
- */
-// public Object getContextData();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariablesContributor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariablesContributor.java
deleted file mode 100644
index 4d02040eb94..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/ICdtVariablesContributor.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.cdtvariables;
-
-
-
-public interface ICdtVariablesContributor {
- ICdtVariable getVariable(String name, ICdtVariableManager provider);
-
- ICdtVariable[] getVariables(ICdtVariableManager provider);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/CDOM.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/CDOM.java
deleted file mode 100644
index b0378263ff1..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/CDOM.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.dom;
-import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
-import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.cdt.internal.core.dom.InternalASTServiceProvider;
-import org.eclipse.cdt.internal.core.dom.PartialWorkingCopyCodeReaderFactory;
-import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
-import org.eclipse.cdt.internal.core.dom.WorkingCopyCodeReaderFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IStorage;
-
-/**
- * @author jcamelon
- *
- * This class serves as the manager of the AST/DOM mechanisms for the CDT.
- * It should be eventually added to CCorePlugin for startup.
- */
-public class CDOM implements IASTServiceProvider {
-
- /**
- * Singleton - Constructor is private.
- */
- private CDOM()
- {
- }
-
- /**
- * <code>instance</code> is the singleton.
- */
- private static CDOM instance = new CDOM();
-
- /**
- * accessor for singleton instance
- * @return instance
- */
- public static CDOM getInstance()
- {
- return instance;
- }
-
- /**
- * Currently, only one AST Service is provided.
- */
- private IASTServiceProvider defaultService = new InternalASTServiceProvider();
-
-
- /**
- * @return IASTServiceProvider, the mechanism for obtaining an AST
- */
- public IASTServiceProvider getASTService() {
- //CDOM itself is not so much "the" AST service as it acts as a proxy
- //to different AST services
- //Should we see the need to provide an extension point for this
- //rather than purely proxying the calls to IASTServiceProvider#*
- //we would have to do some discovery and co-ordination on behalf of the
- //client
- return this;
- }
-
-
- /**
- * Constant <code>PARSE_SAVED_RESOURCES</code> - Parse saved resources in the workspace
- */
- public static final int PARSE_SAVED_RESOURCES = 0;
- /**
- * Constant <code>PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS</code> - Parse working copy for
- * translation unit, saved resources for all header files.
- */
- public static final int PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS = 1;
- /**
- * Constant <code>PARSE_WORKING_COPY_WHENEVER_POSSIBLE</code> - Parse working copy whenever possible for both
- * header files and the file in question as a translation unit.
- */
- public static final int PARSE_WORKING_COPY_WHENEVER_POSSIBLE = 2;
-
-
- /**
- * <code>provider</code> is registered by the UI as a IWorkingCopyProvider.
- */
- private IWorkingCopyProvider provider;
-
- /**
- * This is the factory function that returns an ICodeReaderFactory instance based upon the key provided.
- *
- * @param key one of PARSE_SAVED_RESOURCES, PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS, PARSE_WORKING_COPY_WHENEVER_POSSIBLE
- * @return an implementation that works according to the key specified or null for an invalid key
- */
- public ICodeReaderFactory getCodeReaderFactory( int key )
- {
- //TODO - eventually these factories will need to hook into the
- //CodeReader caches
- switch( key )
- {
- case PARSE_SAVED_RESOURCES:
- return SavedCodeReaderFactory.getInstance();
- case PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS:
- return new PartialWorkingCopyCodeReaderFactory( provider );
- case PARSE_WORKING_COPY_WHENEVER_POSSIBLE:
- return new WorkingCopyCodeReaderFactory( provider );
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getTranslationUnit(org.eclipse.core.resources.IFile)
- */
- public IASTTranslationUnit getTranslationUnit(IFile fileToParse) throws UnsupportedDialectException {
- //TODO - At this time, we purely delegate blindly
- //In the future, we may need to delegate based upon context provided
- return defaultService.getTranslationUnit(fileToParse);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getTranslationUnit(org.eclipse.core.resources.IFile, org.eclipse.cdt.core.dom.ICodeReaderFactory)
- */
- public IASTTranslationUnit getTranslationUnit(IFile fileToParse, ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- //TODO - At this time, we purely delegate blindly
- //In the future, we may need to delegate based upon context provided
- return defaultService.getTranslationUnit(fileToParse, fileCreator );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getTranslationUnit(org.eclipse.core.resources.IFile, org.eclipse.cdt.core.dom.ICodeReaderFactory, org.eclipse.cdt.core.dom.IParserConfiguration)
- */
- public IASTTranslationUnit getTranslationUnit(IFile fileToParse, ICodeReaderFactory fileCreator, IParserConfiguration configuration) throws UnsupportedDialectException {
- //TODO - At this time, we purely delegate blindly
- //In the future, we may need to delegate based upon context provided
- return defaultService.getTranslationUnit(fileToParse, fileCreator, configuration );
- }
-
- public ASTCompletionNode getCompletionNode(IFile fileToParse, int offset,
- ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- //TODO - At this time, we purely delegate blindly
- //In the future, we may need to delegate based upon context provided
- return defaultService.getCompletionNode(fileToParse, offset, fileCreator);
- }
-
- public ASTCompletionNode getCompletionNode(IStorage fileToParse, IProject project, int offset,
- ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- //TODO - At this time, we purely delegate blindly
- //In the future, we may need to delegate based upon context provided
- return defaultService.getCompletionNode(fileToParse, project, offset, fileCreator);
- }
-
- /**
- * This method allows a UI component to register its IWorkingCopyProvider to the CDOM.
- *
- * @param workingCopyProvider - UI components buffer manager
- */
- public void setWorkingCopyProvider(IWorkingCopyProvider workingCopyProvider) {
- this.provider = workingCopyProvider;
- }
-
- public IASTTranslationUnit getTranslationUnit(IStorage fileToParse, IProject project, ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- return defaultService.getTranslationUnit( fileToParse, project, fileCreator );
- }
-
- public IASTTranslationUnit getTranslationUnit(IStorage fileToParse, IProject project) throws UnsupportedDialectException {
- return defaultService.getTranslationUnit( fileToParse, project );
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IASTServiceProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IASTServiceProvider.java
deleted file mode 100644
index 3432db83382..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IASTServiceProvider.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.dom;
-
-import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
-import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IStorage;
-
-/**
- * This is the mechanism that represents a parser service in the CDT.
- *
- * IASTTranslationUnits and ASTCompletionNodes are artifacts that this service returns.
- *
- * @author jcamelon
- */
-public interface IASTServiceProvider {
-
- /**
- * This exception is thrown when there is not a service provider that can handle
- * the request due to dialect mis-match.
- *
- * @author jcamelon
- */
- public static class UnsupportedDialectException extends Exception
- {
- public static final long serialVersionUID = 0;
- }
-
- /**
- * Returns a parse tree that represents the content provided as parameters.
- *
- * @param fileToParse the file in question
- * @return syntactical parse tree
- * @throws UnsupportedDialectException
- */
- public IASTTranslationUnit getTranslationUnit( IFile fileToParse) throws UnsupportedDialectException;
-
- /**
- * Returns a parse tree that represents the content provided as parameters.
- *
- * @param fileToParse the file in question
- * @param project project handle to help us figure out build settings
- * @param fileCreator @see CDOM#getCodeReaderFactory(int)
- * @return syntactical parse tree
- * @throws UnsupportedDialectException
- */
- public IASTTranslationUnit getTranslationUnit( IStorage fileToParse, IProject project, ICodeReaderFactory fileCreator ) throws UnsupportedDialectException;
-
- /**
- * Returns a parse tree that represents the content provided as parameters.
- *
- * @param fileToParse the file in question
- * @param project project handle to help us figure out build settings
- * @return syntactical parse tree
- * @throws UnsupportedDialectException
- */
- public IASTTranslationUnit getTranslationUnit( IStorage fileToParse, IProject project ) throws UnsupportedDialectException;
- /**
- * Returns a parse tree that represents the content provided as parameters.
- *
- * @param fileToParse the file in question
- * @param fileCreator @see CDOM#getCodeReaderFactory(int)
- * @return syntactical parse tree
- * @throws UnsupportedDialectException
- */
- public IASTTranslationUnit getTranslationUnit( IFile fileToParse, ICodeReaderFactory fileCreator )throws UnsupportedDialectException;
-
- /**
- * Returns a parse tree that represents the content provided as parameters.
- *
- * @param fileToParse the file in question
- * @param fileCreator @see CDOM#getCodeReaderFactory(int)
- * @param configuration parser configuration provided rather than discovered by service
- * @return syntactical parse tree
- * @throws UnsupportedDialectException
- */
- public IASTTranslationUnit getTranslationUnit( IFile fileToParse, ICodeReaderFactory fileCreator, IParserConfiguration configuration )throws UnsupportedDialectException;
-
- /**
- * Returns a parse tree that represents the content provided as parameters.
- *
- * @param fileToParse the file in question
- * @param offset the offset at which you require completion at
- * @param fileCreator @see CDOM#getCodeReaderFactory(int)
- * @return syntactical parse tree
- * @throws UnsupportedDialectException
- */
- public ASTCompletionNode getCompletionNode( IFile fileToParse, int offset, ICodeReaderFactory fileCreator) throws UnsupportedDialectException;
-
- /**
- * Returns a parse tree that represents the content provided as parameters.
- *
- * @param fileToParse the file in question
- * @param project the project containing the scanner info
- * @param offset the offset at which you require completion at
- * @param fileCreator @see CDOM#getCodeReaderFactory(int)
- * @return syntactical parse tree
- * @throws UnsupportedDialectException
- */
- public ASTCompletionNode getCompletionNode( IStorage fileToParse, IProject project, int offset, ICodeReaderFactory fileCreator) throws UnsupportedDialectException;
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvirinmentVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvirinmentVariable.java
deleted file mode 100644
index 06da5a9a75c..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvirinmentVariable.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.envvar;
-
-
-
-/**
- * a trivial implementation of the IBuildEnvironmentVariable
- *
- * @since 3.0
- */
-public class EnvirinmentVariable implements IEnvironmentVariable, Cloneable {
- protected String fName;
- protected String fValue;
- protected String fDelimiter;
- protected int fOperation;
-
- public EnvirinmentVariable(String name, String value, int op, String delimiter){
- fName = name;
- fOperation = op;
- fValue = value;
- fDelimiter = delimiter;
- }
-
- protected EnvirinmentVariable(){
-
- }
-
- public EnvirinmentVariable(String name){
- this(name,null,ENVVAR_REPLACE,null);
- }
-
- public EnvirinmentVariable(String name, String value){
- this(name,value,ENVVAR_REPLACE,null);
- }
-
- public EnvirinmentVariable(String name, String value, String delimiter){
- this(name,value,ENVVAR_REPLACE,delimiter);
- }
-
- public EnvirinmentVariable(IEnvironmentVariable var){
- this(var.getName(),var.getValue(),var.getOperation(),var.getDelimiter());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getName()
- */
- public String getName(){
- return fName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getValue()
- */
- public String getValue(){
- return fValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getOperation()
- */
- public int getOperation(){
- return fOperation;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getDelimiter()
- */
- public String getDelimiter(){
- return fDelimiter;
- }
-
- public Object clone(){
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- }
- return null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IContributedEnvironment.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IContributedEnvironment.java
deleted file mode 100644
index 376e1c73427..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IContributedEnvironment.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.envvar;
-
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-
-public interface IContributedEnvironment {
- IEnvironmentVariable[] getVariables(ICConfigurationDescription des);
-
- IEnvironmentVariable getVariable(String name, ICConfigurationDescription des);
-
- boolean appendEnvironment(ICConfigurationDescription des);
-
- void setAppendEnvironment(boolean append, ICConfigurationDescription des);
-
- IEnvironmentVariable addVariable(String name,
- String value,
- int op,
- String delimiter,
- ICConfigurationDescription des);
-
- IEnvironmentVariable removeVariable(String name, ICConfigurationDescription des);
-
- void restoreDefaults(ICConfigurationDescription des);
-
- boolean isUserVariable(ICConfigurationDescription des, IEnvironmentVariable var);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentContributor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentContributor.java
deleted file mode 100644
index 42bfe5ea036..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentContributor.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.envvar;
-
-public interface IEnvironmentContributor {
- IEnvironmentVariable getVariable(String name, IEnvironmentVariableManager provider);
-
- IEnvironmentVariable[] getVariables(IEnvironmentVariableManager provider);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariable.java
deleted file mode 100644
index 28d2dfe4210..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariable.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.envvar;
-
-/**
- * this interface represents the given environment variable
- * @since 3.0
- */
-public interface IEnvironmentVariable{
- public static final int ENVVAR_REPLACE = 1;
- public static final int ENVVAR_REMOVE = 2;
- public static final int ENVVAR_PREPEND = 3;
- public static final int ENVVAR_APPEND = 4;
-
- /**
- *
- * @return the variable name
- */
- public String getName();
-
- /**
- *
- * @return the variable value
- */
- public String getValue();
-
- /**
- * @return one of the IBuildEnvironmentVariable.ENVVAR_* operation types
- */
- public int getOperation();
-
- /**
- * @return if the variable can hold the list of values this method returns the String representing
- * the delimiter that is used to separate values. This information is used for the following:
- *
- * 1. in append and prepend operations:
- * If the variable already exists and contains some value the new
- * value will be calculated in the following way:
- * For the "prepend" operation:
- * <New value> = <the value from the getValue() method><delimiter><Old value>
- * For the "append" operation:
- * <New value> = <Old value><delimiter><the value from the getValue() method>
- *
- * The Environment Variable Provider will also remove the duplicates of "sub-values"
- * in the resulting value.
- * For example:
- * If the current value is "string1:string2:string3", the getDelimiter() method returns ":"
- * and getValue() method returns "string4:string2" the new value will contain:
- * For the "prepend" operation: "string4:string2:string1:string3"
- * For the "append" operation: "string1:string3:string4:string2"
- *
- * 2. Since the environment variables are also treated as build macros the delimiter is also used
- * by the BuildMacroProvider to determine the type of the macro used to represent the
- * given environment variable. If the variable has the delimiter it is treated as the Text-List macro
- * otherwise it is treated as the Text macro. (See Build Macro design for more details)
- *
- * To specify that no delimiter should be used, the getDelimiter() method should
- * return null or an empty string
- */
- public String getDelimiter();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariableManager.java
deleted file mode 100644
index e76be1059a4..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/IEnvironmentVariableManager.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.envvar;
-
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-
-
-
-/**
- *
- * this interface represent the environment variable provider - the main entry-point
- * to be used for querying the build environment
- *
- * @since 3.0
- */
-public interface IEnvironmentVariableManager{
-
- /**
- *
- *
- * @return the reference to the IBuildEnvironmentVariable interface representing
- * the variable of a given name
- * @param variableName environment variable name
- * if environment variable names are case insensitive in the current OS,
- * the environment variable provider will query the getVariable method of suppliers always
- * passing it the uppercase variable name not depending on the case of the variableName
- * passed to the IEnvironmentVariableProvider.getVariable() method. This will prevent the
- * supplier from answering different values for the same variable given the names that differ
- * only by case. E.g. if the current OS does not support case sensitive variables both of the
- * calls below:
- *
- * provider.getVariable("FOO",level,includeParentContexts);
- * provider.getVariable("foo",level,includeParentContexts);
- *
- * will result in asking suppliers for the "FOO" variable
- *
- * @param level could be one of the following:
- * 1. IConfiguration to represent the configuration
- * 2. IManagedProject to represent the managed project
- * 3. IWorkspace to represent the workspace
- * 4. null to represent the system environment passed to eclipse
- */
- public IEnvironmentVariable getVariable(String name, ICConfigurationDescription cfg, boolean resolveMacros);
-
- /**
- *
- * if environment variable names are case insensitive in the current OS,
- * the environment variable provider will remove the duplicates of the variables if their names
- * differ only by case
- *
- * @return the array of IBuildEnvironmentVariable that represents the environment variables
- */
- public IEnvironmentVariable[] getVariables(ICConfigurationDescription cfg, boolean resolveMacros);
-
- /**
- *
- * @return the String representing default system delimiter. That is the ":" for Unix-like
- * systems and the ";" for Win32 systems. This method will be used by the
- * tool-integrator provided variable supplier e.g. in order to concatenate the list of paths into the
- * environment variable, etc.
- */
- public String getDefaultDelimiter();
-
- /**
- * @return true if the OS supports case sensitive variables (Unix-like systems) or false
- * if it does not (Win32 systems)
- */
- public boolean isVariableCaseSensitive();
-
- public IContributedEnvironment getContributedEnvironment();
-}
-
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/CodeFormatter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/CodeFormatter.java
deleted file mode 100644
index 161b83acef9..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/CodeFormatter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.formatter;
-
-import java.util.Map;
-
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Specification for a generic source code formatter.
- *
- * @since 3.0
- */
-public abstract class CodeFormatter {
-
- public static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
- /**
- * Unknown kind
- */
- public static final int K_UNKNOWN = 0x00;
-
- /**
- * Kind used to format an expression
- */
- public static final int K_EXPRESSION = 0x01;
-
- /**
- * Kind used to format a set of statements
- */
- public static final int K_STATEMENTS = 0x02;
-
- /**
- * Kind used to format a set of class body declarations
- */
- public static final int K_CLASS_BODY_DECLARATIONS = 0x04;
-
- /**
- * Kind used to format a compilation unit
- */
- public static final int K_COMPILATION_UNIT = 0x08;
-
- /**
- * Kind used to format a single-line comment
- */
- public static final int K_SINGLE_LINE_COMMENT = 0x10;
- /**
- * Kind used to format a multi-line comment
- */
- public static final int K_MULTI_LINE_COMMENT = 0x20;
-
- /**
- * Format <code>source</code>,
- * and returns a text edit that correspond to the difference between the given string and the formatted string.
- * It returns null if the given string cannot be formatted.
- *
- * If the offset position is matching a whitespace, the result can include whitespaces. It would be up to the
- * caller to get rid of preceeding whitespaces.
- *
- * @param kind Use to specify the kind of the code snippet to format. It can be any of these:
- * K_EXPRESSION, K_STATEMENTS, K_CLASS_BODY_DECLARATIONS, K_COMPILATION_UNIT, K_UNKNOWN
- * @param file - file associated with this source (null if no file is associated)
- * @param source the document to format
- * @param offset the given offset to start recording the edits (inclusive).
- * @param length the given length to stop recording the edits (exclusive).
- * @param indentationLevel the initial indentation level, used
- * to shift left/right the entire source fragment. An initial indentation
- * level of zero or below has no effect.
- * @param lineSeparator the line separator to use in formatted source,
- * if set to <code>null</code>, then the platform default one will be used.
- * @return the text edit
- * @throws IllegalArgumentException if offset is lower than 0, length is lower than 0 or
- * length is greater than source length.
- */
- public abstract TextEdit format(int kind, String source, int offset, int length, int indentationLevel, String lineSeparator);
-
- /**
- * @param options - general formatter options
- */
- public abstract void setOptions(Map options);
-
- /**
- * Answers the string that corresponds to the indentation to the given indentation level or an empty string
- * if the indentation cannot be computed.
- * <p>This method needs to be overriden in a subclass.</p>
- *
- * <p>The default implementation returns an empty string.</p>
- *
- * @param indentationLevel the given indentation level
- * @return the string corresponding to the right indentation level
- * @exception IllegalArgumentException if the given indentation level is lower than zero
- */
- public String createIndentationString(int indentationLevel) {
- return EMPTY_STRING;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java
deleted file mode 100644
index cf74c436986..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java
+++ /dev/null
@@ -1,3012 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Sergey Prigogin, Google
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.core.formatter;
-
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions;
-import org.eclipse.cdt.internal.formatter.align.Alignment;
-
-
-/**
- * Constants used to set up the options of the code formatter.
- * <p>
- * This class is not intended to be instantiated or subclassed by clients.
- * </p>
- *
- * @since 4.0
- */
-public class DefaultCodeFormatterConstants {
-
- /**
- * <pre>
- * FORMATTER / Option for the language
- * - option id: "org.eclipse.cdt.core.formatter.language"
- * - possible values: object of class <code>ILanguage</code> or <code>null</code>
- * - default: null
- * </pre>
- */
- public static final String FORMATTER_LANGUAGE = CCorePlugin.PLUGIN_ID + ".formatter.language"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option for the current file
- * - option id: "org.eclipse.cdt.core.formatter.current_file"
- * - possible values: object of class <code>IFile</code> or <code>null</code>
- * - default: null
- * </pre>
- */
- public static final String FORMATTER_CURRENT_FILE = CCorePlugin.PLUGIN_ID + ".formatter.current_file"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option for the translation unit
- * - option id: "org.eclipse.cdt.core.formatter.current_translation_unit"
- * - possible values: object of class <code>ITranslationUnit</code> or <code>null</code>
- * - default: null
- * </pre>
- */
- public static final String FORMATTER_TRANSLATION_UNIT = CCorePlugin.PLUGIN_ID + ".formatter.current_translation_unit"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Value to set a brace location at the end of a line.
- * </pre>
- * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
- * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
- * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
- * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
- */
- public static final String END_OF_LINE = "end_of_line"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Value to set an option to false.
- * </pre>
- */
- public static final String FALSE = "false"; //$NON-NLS-1$
-
-// /**
-// * <pre>
-// * FORMATTER / Option to align type members of a type declaration on column
-// * - option id: "org.eclipse.cdt.core.formatter.formatter.align_type_members_on_columns"
-// * - possible values: { TRUE, FALSE }
-// * - default: FALSE
-// * </pre>
-// * @see #TRUE
-// * @see #FALSE
-// */
-// public static final String FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS = CCorePlugin.PLUGIN_ID + ".formatter.align_type_members_on_columns"; //$NON-NLS-1$
-//
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of arguments in allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_allocation_expression"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_allocation_expression"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of arguments in enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_enum_constant"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_enum_constant"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of arguments in explicit constructor call
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_explicit_constructor_call"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option for alignment of arguments in method invocation
- * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation"
- * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
- * </pre>
- * @see #createAlignmentValue(boolean, int, int)
- */
- public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_method_invocation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of arguments in qualified allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_qualified_allocation_expression"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of assignment
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_assignment"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, M_NO_ALIGNMENT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_ASSIGNMENT = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_assignment"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of binary expression
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_binary_expression"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_binary_expression"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of compact if
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_compact_if"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_compact_if"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option for alignment of conditional expression
- * - option id: "org.eclipse.cdt.core.formatter.alignment_for_conditional_expression"
- * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
- * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_DEFAULT)
- * </pre>
- * @see #createAlignmentValue(boolean, int, int)
- */
- public static final String FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_conditional_expression"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of enum constants
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_enum_constants"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_NO_SPLIT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_enum_constants"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option for alignment of expressions in array initializer
- * - option id: "org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer"
- * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
- * </pre>
- * @see #createAlignmentValue(boolean, int, int)
- */
- public static final String FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_expressions_in_array_initializer"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of multiple fields
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_multiple_fields"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_multiple_fields";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of parameters in constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_parameters_in_constructor_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option for alignment of parameters in method declaration
- * - option id: "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration"
- * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
- * </pre>
- * @see #createAlignmentValue(boolean, int, int)
- */
- public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_parameters_in_method_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of selector in method invocation
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_selector_in_method_invocation"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_selector_in_method_invocation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of superclass in type declaration
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_superclass_in_type_declaration"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superclass_in_type_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of throws clause in constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_constructor_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option for alignment of throws clause in method declaration
-// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
-// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
-// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
-// * </pre>
-// * @see #createAlignmentValue(boolean, int, int)
-// */
-// public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_method_declaration"; //$NON-NLS-1$
-//
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines after #include directive
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_after_includes"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_AFTER_INCLUDES = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_after_includes"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines at the beginning of the method body
-// * - option id: "org.eclipse.cdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY = CCorePlugin.PLUGIN_ID + ".formatter.number_of_blank_lines_at_beginning_of_method_body"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines before a field declaration
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_before_field"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_BEFORE_FIELD = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_field"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines before the first class body declaration
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_before_first_class_body_declaration"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_first_class_body_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines before #include directive
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_before_includes"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_BEFORE_INCLUDES = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_includes"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines before a member type declaration
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_before_member_type"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_member_type"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines before a method declaration
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_before_method"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_BEFORE_METHOD = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_method"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines before a new chunk
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_before_new_chunk"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_new_chunk"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to add blank lines between type declarations
-// * - option id: "org.eclipse.cdt.core.formatter.blank_lines_between_type_declarations"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "0"
-// * </pre>
-// */
-// public static final String FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_between_type_declarations"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option to position the braces of array initializer
- * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_annotation_array_initializer"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
- * </pre>
- * @see #END_OF_LINE
- * @see #NEXT_LINE
- * @see #NEXT_LINE_SHIFTED
- * @see #NEXT_LINE_ON_WRAP
- */
- public static final String FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_array_initializer"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to position the braces of a block
- * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_block"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
- * </pre>
- * @see #END_OF_LINE
- * @see #NEXT_LINE
- * @see #NEXT_LINE_SHIFTED
- * @see #NEXT_LINE_ON_WRAP
- */
- public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_block"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to position the braces of a block in a case statement when the block is the first statement following
- * the case
- * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_block_in_case"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
- * </pre>
- * @see #END_OF_LINE
- * @see #NEXT_LINE
- * @see #NEXT_LINE_SHIFTED
- * @see #NEXT_LINE_ON_WRAP
- */
- public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_block_in_case"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to position the braces of a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_constructor_declaration"
-// * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
-// * - default: END_OF_LINE
-// * </pre>
-// * @see #END_OF_LINE
-// * @see #NEXT_LINE
-// * @see #NEXT_LINE_SHIFTED
-// * @see #NEXT_LINE_ON_WRAP
-// */
-// public static final String FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_constructor_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to position the braces of an enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_enum_constant"
-// * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
-// * - default: END_OF_LINE
-// * </pre>
-// * @see #END_OF_LINE
-// * @see #NEXT_LINE
-// * @see #NEXT_LINE_SHIFTED
-// * @see #NEXT_LINE_ON_WRAP
-// */
-// public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_enum_constant"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to position the braces of an enum declaration
-// * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_enum_declaration"
-// * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
-// * - default: END_OF_LINE
-// * </pre>
-// * @see #END_OF_LINE
-// * @see #NEXT_LINE
-// * @see #NEXT_LINE_SHIFTED
-// * @see #NEXT_LINE_ON_WRAP
-// */
-// public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_enum_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to position the braces of a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_method_declaration"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
- * </pre>
- * @see #END_OF_LINE
- * @see #NEXT_LINE
- * @see #NEXT_LINE_SHIFTED
- * @see #NEXT_LINE_ON_WRAP
- */
- public static final String FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_method_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to position the braces of a switch statement
- * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_switch"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
- * </pre>
- * @see #END_OF_LINE
- * @see #NEXT_LINE
- * @see #NEXT_LINE_SHIFTED
- * @see #NEXT_LINE_ON_WRAP
- */
- public static final String FORMATTER_BRACE_POSITION_FOR_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_switch"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to position the braces of a type declaration
- * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_type_declaration"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
- * </pre>
- * @see #END_OF_LINE
- * @see #NEXT_LINE
- * @see #NEXT_LINE_SHIFTED
- * @see #NEXT_LINE_ON_WRAP
- */
- public static final String FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_type_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to position the braces of a namespace declaration
- * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
- * </pre>
- * @see #END_OF_LINE
- * @see #NEXT_LINE
- * @see #NEXT_LINE_SHIFTED
- * @see #NEXT_LINE_ON_WRAP
- */
- public static final String FORMATTER_BRACE_POSITION_FOR_NAMESPACE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_namespace_declaration"; //$NON-NLS-1$
-
-// /**
-// * <pre>
-// * FORMATTER / Option to control whether blank lines are cleared inside comments
-// * - option id: "org.eclipse.cdt.core.formatter.comment.clear_blank_lines"
-// * - possible values: { TRUE, FALSE }
-// * - default: FALSE
-// * </pre>
-// * @see #TRUE
-// * @see #FALSE
-// */
-// public final static String FORMATTER_COMMENT_CLEAR_BLANK_LINES = CCorePlugin.PLUGIN_ID + ".formatter.comment.clear_blank_lines"; //$NON-NLS-1$
-//
-// /**
-// * <pre>
-// * FORMATTER / Option to control whether comments are formatted
-// * - option id: "org.eclipse.cdt.core.formatter.comment.format_comments"
-// * - possible values: { TRUE, FALSE }
-// * - default: TRUE
-// * </pre>
-// * @see #TRUE
-// * @see #FALSE
-// */
-// public final static String FORMATTER_COMMENT_FORMAT = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_comments"; //$NON-NLS-1$
-//
-// /**
-// * <pre>
-// * FORMATTER / Option to control whether the header comment of a C/C++ source file is formatted
-// * - option id: "org.eclipse.cdt.core.formatter.comment.format_header"
-// * - possible values: { TRUE, FALSE }
-// * - default: FALSE
-// * </pre>
-// * @see #TRUE
-// * @see #FALSE
-// */
-// public final static String FORMATTER_COMMENT_FORMAT_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_header"; //$NON-NLS-1$
-//
-// /**
-// * <pre>
-// * FORMATTER / Option to control whether code snippets are formatted in comments
-// * - option id: "org.eclipse.cdt.core.formatter.comment.format_source_code"
-// * - possible values: { TRUE, FALSE }
-// * - default: TRUE
-// * </pre>
-// * @see #TRUE
-// * @see #FALSE
-// */
-// public final static String FORMATTER_COMMENT_FORMAT_SOURCE = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_source_code"; //$NON-NLS-1$
-//
-// /**
-// * <pre>
-// * FORMATTER / Option to specify the line length for comments.
-// * - option id: "org.eclipse.cdt.core.formatter.comment.line_length"
-// * - possible values: "&lt;n&gt;", where n is zero or a positive integer
-// * - default: "80"
-// * </pre>
-// */
-// public final static String FORMATTER_COMMENT_LINE_LENGTH = CCorePlugin.PLUGIN_ID + ".formatter.comment.line_length"; //$NON-NLS-1$
-//
- /**
- * <pre>
- * FORMATTER / Option to compact else/if
- * - option id: "org.eclipse.cdt.core.formatter.compact_else_if"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_COMPACT_ELSE_IF = CCorePlugin.PLUGIN_ID + ".formatter.compact_else_if"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option to set the continuation indentation
- * - option id: "org.eclipse.cdt.core.formatter.continuation_indentation"
- * - possible values: "&lt;n&gt;", where n is zero or a positive integer
- * - default: "2"
- * </pre>
- */
- public static final String FORMATTER_CONTINUATION_INDENTATION = CCorePlugin.PLUGIN_ID + ".formatter.continuation_indentation"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to set the continuation indentation inside array initializer
- * - option id: "org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer"
- * - possible values: "&lt;n&gt;", where n is zero or a positive integer
- * - default: "2"
- * </pre>
- */
- public static final String FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.continuation_indentation_for_array_initializer"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to indent body declarations compare to its enclosing enum constant header
-// * - option id: "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header"
-// * - possible values: { TRUE, FALSE }
-// * - default: TRUE
-// * </pre>
-// * @see #TRUE
-// * @see #FALSE
-// */
-// public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_enum_constant_header"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to indent body declarations compare to its enclosing enum declaration header
-// * - option id: "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header"
-// * - possible values: { TRUE, FALSE }
-// * - default: TRUE
-// * </pre>
-// * @see #TRUE
-// * @see #FALSE
-// */
-// public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_enum_declaration_header"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent body declarations compare to its enclosing type header
- * - option id: "org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_access_specifier_compare_to_type_header"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent body declarations compare to access specifiers (visibility labels)
- * - option id: "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_access_specifier"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent body declarations compare to its enclosing namespace header
- * - option id: "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_NAMESPACE_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_namespace_header"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent breaks compare to cases
- * - option id: "org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES = CCorePlugin.PLUGIN_ID + ".formatter.indent_breaks_compare_to_cases"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent empty lines
- * - option id: "org.eclipse.cdt.core.formatter.indent_empty_lines"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_EMPTY_LINES = CCorePlugin.PLUGIN_ID + ".formatter.indent_empty_lines"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent inside line comments at column 0
- * - option id: "org.eclipse.cdt.core.formatter.indent_inside_line_comments"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_INSIDE_LINE_COMMENTS = CCorePlugin.PLUGIN_ID + ".formatter.indent_inside_line_comments"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent statements inside a block
- * - option id: "org.eclipse.cdt.core.formatter.indent_statements_compare_to_block"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.indent_statements_compare_to_block"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent statements inside the body of a method or a constructor
- * - option id: "org.eclipse.cdt.core.formatter.indent_statements_compare_to_body"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY = CCorePlugin.PLUGIN_ID + ".formatter.indent_statements_compare_to_body"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent switch statements compare to cases
- * - option id: "org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES = CCorePlugin.PLUGIN_ID + ".formatter.indent_switchstatements_compare_to_cases"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to indent switch statements compare to switch
- * - option id: "org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.indent_switchstatements_compare_to_switch"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option to specify the equivalent number of spaces that represents one indentation
- * - option id: "org.eclipse.cdt.core.formatter.indentation.size"
- * - possible values: "&lt;n&gt;", where n is zero or a positive integer
- * - default: "4"
- * </pre>
- * <p>This option is used only if the tab char is set to MIXED.
- * </p>
- * @see #FORMATTER_TAB_CHAR
- */
- public static final String FORMATTER_INDENTATION_SIZE = CCorePlugin.PLUGIN_ID + ".formatter.indentation.size"; //$NON-NLS-1$
-
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line after an annotation
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_after_annotation"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_after_annotation";//$NON-NLS-1$
-//
- /**
- * <pre>
- * FORMATTER / Option to insert a new line after the opening brace in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_after_opening_brace_in_array_initializer";//$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option to insert a new line at the end of the current file if missing
- * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_at_end_of_file_if_missing";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line before the catch keyword in try statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_catch_in_try_statement"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a new line before the closing brace in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_closing_brace_in_array_initializer";//$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a new line before the else keyword in if statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_else_in_if_statement"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line before the finally keyword in try statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_before_finally_in_try_statement"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_finally_in_try_statement"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a new line before while in do statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_while_in_do_statement"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line in an empty anonymous type declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_anonymous_type_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a new line in an empty block
- * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_block"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line in an empty enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_enum_constant"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_enum_constant"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line in an empty enum declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_enum_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_enum_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line in an empty method body
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_method_body"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_method_body"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a new line in an empty type declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_type_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_type_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after and in type parameter
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_and_in_type_parameter"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_and_in_type_parameter"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after an assignment operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_assignment_operator"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after a binary operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_binary_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_binary_operator"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the closing angle bracket in type arguments
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_angle_bracket_in_type_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the closing angle bracket in type parameters
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_angle_bracket_in_type_parameters"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the closing brace of a block
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_brace_in_block"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the closing parenthesis of a cast expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
- public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_paren_in_cast"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after colon in a case statement when a opening brace follows the colon
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_case"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the colon in a conditional expression
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_conditional"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after colon in a for statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_for"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_for"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the colon in a labeled statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_labeled_statement"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in an allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_allocation_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_allocation_expression"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in annotation
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_annotation"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_annotation"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the comma in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_array_initializer"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in the parameters of a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in the arguments of an enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_enum_constant_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in enum declarations
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_enum_declarations"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in the arguments of an explicit constructor call
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in the increments of a for statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_for_increments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_increments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in the initializations of a for statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_for_inits"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_inits"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the comma in the parameters of a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_parameters"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a method declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_throws"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the comma in the arguments of a method invocation
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_invocation_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in multiple field declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_field_declarations"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in multiple local declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_local_declarations"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in parameterized type reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_parameterized_type_reference"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in superinterfaces names of a type header
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_superinterfaces"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_superinterfaces"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in type arguments
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_type_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_type_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the comma in type parameters
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_type_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_type_parameters"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after ellipsis
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_ellipsis"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_ellipsis"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening angle bracket in parameterized type reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening angle bracket in type arguments
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_type_arguments";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening angle bracket in type parameters
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_type_parameters";//$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the opening brace in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_brace_in_array_initializer"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening bracket inside an array allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening bracket inside an array reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_reference";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening parenthesis in annotation
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_annotation"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_annotation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening parenthesis in a cast expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_cast"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening parenthesis in a catch
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_catch"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening parenthesis in a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_constructor_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening parenthesis in enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_enum_constant"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_enum_constant"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the opening parenthesis in a for statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_for"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the opening parenthesis in an if statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_if"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the opening parenthesis in a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the opening parenthesis in a method invocation
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_invocation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after the opening parenthesis in a parenthesized expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the opening parenthesis in a switch statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_switch"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after the opening parenthesis in a while statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_while"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after a postfix operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_postfix_operator"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after a prefix operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_prefix_operator"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after question mark in a conditional expression
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_question_in_conditional"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space after semicolon in a for statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_semicolon_in_for"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space after an unary operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_unary_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_unary_operator"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before an assignment operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_assignment_operator"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before at in annotation type declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_at_in_annotation_type_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_at_in_annotation_type_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before an binary operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_binary_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_binary_operator"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing angle bracket in parameterized type reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing angle bracket in type arguments
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_type_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing angle bracket in type parameters
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_type_parameters"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the closing brace in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_brace_in_array_initializer"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing bracket in an array allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_allocation_expression";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing bracket in an array reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_reference";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing parenthesis in annotation
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_annotation"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_annotation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing parenthesis in a cast expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_cast"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing parenthesis in a catch
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_catch"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing parenthesis in a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_constructor_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing parenthesis in enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_enum_constant"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_enum_constant"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the closing parenthesis in a for statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_for"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the closing parenthesis in an if statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_if"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the closing parenthesis in a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the closing parenthesis in a method invocation
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_invocation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the closing parenthesis in a parenthesized expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_parenthesized_expression"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the closing parenthesis in a switch statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_switch"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the closing parenthesis in a while statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_while"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before colon in a case statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_case"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before colon in a conditional expression
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_conditional"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before colon in a default statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_default"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before colon in a labeled statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_labeled_statement"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in an allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_allocation_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_allocation_expression"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in annotation
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_annotation"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_annotation"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before comma in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_array_initializer"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the parameters of a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the arguments of enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_enum_constant_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in enum declarations
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_enum_declarations"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the arguments of an explicit constructor call
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the increments of a for statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_for_increments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_increments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the initializations of a for statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_for_inits"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_inits"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before comma in the parameters of a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_parameters"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a method declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_throws"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before comma in the arguments of a method invocation
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_invocation_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in a multiple field declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_field_declarations"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in a multiple local declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_local_declarations"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in parameterized type reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_parameterized_type_reference"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in the superinterfaces names in a type header
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_superinterfaces"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_superinterfaces"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in type arguments
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_type_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_type_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before comma in type parameters
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_type_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_type_parameters"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before ellipsis
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_ellipsis"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_ellipsis"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening angle bracket in parameterized type reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening angle bracket in type arguments
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_type_arguments"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening angle bracket in type parameters
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_type_parameters"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening brace in an annotation type declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_annotation_type_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening brace in an anonymous type declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening brace in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_array_initializer"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening brace in a block
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_block"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening brace in a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_constructor_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening brace in an enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_enum_constant"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_enum_constant"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening brace in an enum declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_enum_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening brace in a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_method_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening brace in a switch statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_switch"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening brace in a type declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_type_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening brace in a namespace declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_NAMESPACE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_namespace_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening bracket in an array allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening bracket in an array reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_reference";//$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening bracket in an array type reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_type_reference"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening parenthesis in annotation
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_annotation"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_annotation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening parenthesis in annotation type member declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening parenthesis in a catch
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_catch"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening parenthesis in a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_constructor_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening parenthesis in enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_enum_constant"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_enum_constant"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening parenthesis in a for statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_for"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening parenthesis in an if statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_if"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening parenthesis in a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_declaration"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening parenthesis in a method invocation
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_invocation"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before the opening parenthesis in a parenthesized expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening parenthesis in a switch statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_switch"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before the opening parenthesis in a while statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_while"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before parenthesized expression in return statement
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_parenthesized_expression_in_return"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: INSERT
-// * </pre>
-// *
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_parenthesized_expression_in_return"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before a postfix operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_postfix_operator"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before a prefix operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_prefix_operator"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before question mark in a conditional expression
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_question_in_conditional"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before semicolon
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_semicolon"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_semicolon"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space before semicolon in for statement
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_semicolon_in_for"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space before unary operator
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_unary_operator"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_unary_operator"; //$NON-NLS-1$
-//
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space between brackets in an array type reference
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_brackets_in_array_type_reference"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space between empty braces in an array initializer
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_braces_in_array_initializer"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space between empty brackets in an array allocation expression
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_brackets_in_array_allocation_expression"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space between empty parenthesis in an annotation type member declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space between empty parenthesis in a constructor declaration
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_constructor_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space between empty parenthesis in enum constant
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_enum_constant"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_enum_constant"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to insert a space between empty parenthesis in a method declaration
- * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
- * </pre>
- * @see CCorePlugin#INSERT
- * @see CCorePlugin#DO_NOT_INSERT
- */
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_declaration"; //$NON-NLS-1$
-// /**
-// * <pre>
-// * FORMATTER / Option to insert a space between empty parenthesis in a method invocation
-// * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
-// * - possible values: { INSERT, DO_NOT_INSERT }
-// * - default: DO_NOT_INSERT
-// * </pre>
-// * @see CCorePlugin#INSERT
-// * @see CCorePlugin#DO_NOT_INSERT
-// */
-// public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_invocation"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to keep else statement on the same line
- * - option id: "org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_else_statement_on_same_line"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to keep empty array initializer one one line
- * - option id: "org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_empty_array_initializer_on_one_line"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to keep guardian clause on one line
- * - option id: "org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.format_guardian_clause_on_one_line"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to keep simple if statement on the one line
- * - option id: "org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_imple_if_on_one_line"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to keep then statement on the same line
- * - option id: "org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_then_statement_on_same_line";//$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option to specify the length of the page. Beyond this length, the formatter will try to split the code
- * - option id: "org.eclipse.cdt.core.formatter.lineSplit"
- * - possible values: "&lt;n&gt;", where n is zero or a positive integer
- * - default: "80"
- * </pre>
- */
- public static final String FORMATTER_LINE_SPLIT = CCorePlugin.PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to specify the number of empty lines to preserve
- * - option id: "org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve"
- * - possible values: "&lt;n&gt;", where n is zero or a positive integer
- * - default: "0"
- * </pre>
- */
- public static final String FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE = CCorePlugin.PLUGIN_ID + ".formatter.number_of_empty_lines_to_preserve"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to specify whether or not empty statement should be on a new line
- * - option id: "org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE = CCorePlugin.PLUGIN_ID + ".formatter.put_empty_statement_on_new_line"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to specify the tabulation size
- * - option id: "org.eclipse.cdt.core.formatter.tabulation.char"
- * - possible values: { TAB, SPACE, MIXED }
- * - default: TAB
- * </pre>
- * More values may be added in the future.
- *
- * @see CCorePlugin#TAB
- * @see CCorePlugin#SPACE
- * @see #MIXED
- */
- public static final String FORMATTER_TAB_CHAR = CCorePlugin.PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Option to specify the equivalent number of spaces that represents one tabulation
- * - option id: "org.eclipse.cdt.core.formatter.tabulation.size"
- * - possible values: "&lt;n&gt;", where n is zero or a positive integer
- * - default: "4"
- * </pre>
- */
- public static final String FORMATTER_TAB_SIZE = CCorePlugin.PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / Option to use tabulations only for leading indentations
- * - option id: "org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
- * </pre>
- * @see #TRUE
- * @see #FALSE
- */
- public static final String FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS = CCorePlugin.PLUGIN_ID + ".formatter.use_tabs_only_for_leading_indentations"; //$NON-NLS-1$
-
- /**
- * <pre>
- * FORMATTER / The wrapping is done by indenting by one compare to the current indentation.
- * </pre>
- */
- public static final int INDENT_BY_ONE= 2;
-
- /**
- * <pre>
- * FORMATTER / The wrapping is done by using the current indentation.
- * </pre>
- */
- public static final int INDENT_DEFAULT= 0;
- /**
- * <pre>
- * FORMATTER / The wrapping is done by indenting on column under the splitting location.
- * </pre>
- */
- public static final int INDENT_ON_COLUMN = 1;
-
- /**
- * <pre>
- * FORMATTER / Possible value for the option FORMATTER_TAB_CHAR
- * </pre>
- * @see CCorePlugin#TAB
- * @see CCorePlugin#SPACE
- * @see #FORMATTER_TAB_CHAR
- */
- public static final String MIXED = "mixed"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Value to set a brace location at the start of the next line with
- * the right indentation.
- * </pre>
- * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
- * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
- * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
- * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
- */
- public static final String NEXT_LINE = "next_line"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Value to set a brace location at the start of the next line if a wrapping
- * occured.
- * </pre>
- * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
- * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
- * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
- * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
- */
- public static final String NEXT_LINE_ON_WRAP = "next_line_on_wrap"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Value to set a brace location at the start of the next line with
- * an extra indentation.
- * </pre>
- * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
- * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
- * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
- * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
- * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
- */
- public static final String NEXT_LINE_SHIFTED = "next_line_shifted"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / Value to set an option to true.
- * </pre>
- */
- public static final String TRUE = "true"; //$NON-NLS-1$
- /**
- * <pre>
- * FORMATTER / The wrapping is done using as few lines as possible.
- * </pre>
- */
- public static final int WRAP_COMPACT= 1;
- /**
- * <pre>
- * FORMATTER / The wrapping is done putting the first element on a new
- * line and then wrapping next elements using as few lines as possible.
- * </pre>
- */
- public static final int WRAP_COMPACT_FIRST_BREAK= 2;
- /**
- * <pre>
- * FORMATTER / The wrapping is done by putting each element on its own line
- * except the first element.
- * </pre>
- */
- public static final int WRAP_NEXT_PER_LINE= 5;
- /**
- * <pre>
- * FORMATTER / The wrapping is done by putting each element on its own line.
- * All elements are indented by one except the first element.
- * </pre>
- */
- public static final int WRAP_NEXT_SHIFTED= 4;
-
- /**
- * <pre>
- * FORMATTER / Value to disable alignment.
- * </pre>
- */
- public static final int WRAP_NO_SPLIT= 0;
- /**
- * <pre>
- * FORMATTER / The wrapping is done by putting each element on its own line.
- * </pre>
- */
- public static final int WRAP_ONE_PER_LINE= 3;
-
- /*
- * Private constants.
- */
- private static final IllegalArgumentException WRONG_ARGUMENT = new IllegalArgumentException();
-
- /**
- * Create a new alignment value according to the given values. This must be used to set up
- * the alignment options.
- *
- * @param forceSplit the given force value
- * @param wrapStyle the given wrapping style
- * @param indentStyle the given indent style
- *
- * @return the new alignement value
- */
- public static String createAlignmentValue(boolean forceSplit, int wrapStyle, int indentStyle) {
- int alignmentValue = 0;
- switch(wrapStyle) {
- case WRAP_COMPACT :
- alignmentValue |= Alignment.M_COMPACT_SPLIT;
- break;
- case WRAP_COMPACT_FIRST_BREAK :
- alignmentValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
- break;
- case WRAP_NEXT_PER_LINE :
- alignmentValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
- break;
- case WRAP_NEXT_SHIFTED :
- alignmentValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
- break;
- case WRAP_ONE_PER_LINE :
- alignmentValue |= Alignment.M_ONE_PER_LINE_SPLIT;
- break;
- }
- if (forceSplit) {
- alignmentValue |= Alignment.M_FORCE;
- }
- switch(indentStyle) {
- case INDENT_BY_ONE :
- alignmentValue |= Alignment.M_INDENT_BY_ONE;
- break;
- case INDENT_ON_COLUMN :
- alignmentValue |= Alignment.M_INDENT_ON_COLUMN;
- }
- return String.valueOf(alignmentValue);
- }
-
- /**
- * Returns the default formatter settings
- *
- * @return the default settings
- */
- public static Map getDefaultSettings() {
- return DefaultCodeFormatterOptions.getDefaultSettings().getMap();
- }
-
- /**
- * Returns the K&R formatter settings
- *
- * @return the K&R settings
- */
- public static Map getKandRSettings() {
- return DefaultCodeFormatterOptions.getKandRSettings().getMap();
- }
-
- /**
- * Returns the Allman formatter settings
- *
- * @return the Allman settings
- */
- public static Map getAllmanSettings() {
- return DefaultCodeFormatterOptions.getAllmanSettings().getMap();
- }
-
- /**
- * Returns the GNU formatter settings
- *
- * @return the GNU settings
- */
- public static Map getGNUSettings() {
- return DefaultCodeFormatterOptions.getGNUSettings().getMap();
- }
-
- /**
- * Returns the Whitesmiths formatter settings
- *
- * @return the Whitesmiths settings
- */
- public static Map getWhitesmithsSettings() {
- return DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap();
- }
-
- /**
- * <p>Return the force value of the given alignment value.
- * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
- * API.
- * </p>
- *
- * @param value the given alignment value
- * @return the force value of the given alignment value
- * @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
- */
- public static boolean getForceWrapping(String value) {
- if (value == null) {
- throw WRONG_ARGUMENT;
- }
- try {
- int existingValue = Integer.parseInt(value);
- return (existingValue & Alignment.M_FORCE) != 0;
- } catch (NumberFormatException e) {
- throw WRONG_ARGUMENT;
- }
- }
-
- /**
- * <p>Return the indentation style of the given alignment value.
- * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
- * API.
- * </p>
- *
- * @param value the given alignment value
- * @return the indentation style of the given alignment value
- * @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
- */
- public static int getIndentStyle(String value) {
- if (value == null) {
- throw WRONG_ARGUMENT;
- }
- try {
- int existingValue = Integer.parseInt(value);
- if ((existingValue & Alignment.M_INDENT_BY_ONE) != 0) {
- return INDENT_BY_ONE;
- } else if ((existingValue & Alignment.M_INDENT_ON_COLUMN) != 0) {
- return INDENT_ON_COLUMN;
- } else {
- return INDENT_DEFAULT;
- }
- } catch (NumberFormatException e) {
- throw WRONG_ARGUMENT;
- }
- }
-
- /**
- * <p>Return the wrapping style of the given alignment value.
- * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
- * API.
- * </p>
- *
- * @param value the given alignment value
- * @return the wrapping style of the given alignment value
- * @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
- */
- public static int getWrappingStyle(String value) {
- if (value == null) {
- throw WRONG_ARGUMENT;
- }
- try {
- int existingValue = Integer.parseInt(value) & Alignment.SPLIT_MASK;
- switch(existingValue) {
- case Alignment.M_COMPACT_SPLIT :
- return WRAP_COMPACT;
- case Alignment.M_COMPACT_FIRST_BREAK_SPLIT :
- return WRAP_COMPACT_FIRST_BREAK;
- case Alignment.M_NEXT_PER_LINE_SPLIT :
- return WRAP_NEXT_PER_LINE;
- case Alignment.M_NEXT_SHIFTED_SPLIT :
- return WRAP_NEXT_SHIFTED;
- case Alignment.M_ONE_PER_LINE_SPLIT :
- return WRAP_ONE_PER_LINE;
- default:
- return WRAP_NO_SPLIT;
- }
- } catch (NumberFormatException e) {
- throw WRONG_ARGUMENT;
- }
- }
- /**
- * <p>Set the force value of the given alignment value and return the new value.
- * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
- * API.
- * </p>
- *
- * @param value the given alignment value
- * @param force the given force value
- * @return the new alignment value
- * @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
- */
- public static String setForceWrapping(String value, boolean force) {
- if (value == null) {
- throw WRONG_ARGUMENT;
- }
- try {
- int existingValue = Integer.parseInt(value);
- // clear existing force bit
- existingValue &= ~Alignment.M_FORCE;
- if (force) {
- existingValue |= Alignment.M_FORCE;
- }
- return String.valueOf(existingValue);
- } catch (NumberFormatException e) {
- throw WRONG_ARGUMENT;
- }
- }
-
- /**
- * <p>Set the indentation style of the given alignment value and return the new value.
- * The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
- * API.
- * </p>
- *
- * @param value the given alignment value
- * @param indentStyle the given indentation style
- * @return the new alignment value
- * @see #INDENT_BY_ONE
- * @see #INDENT_DEFAULT
- * @see #INDENT_ON_COLUMN
- * @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, if the given
- * indentation style is not one of the possible indentation styles, or if the given
- * alignment value doesn't have a valid format.
- */
- public static String setIndentStyle(String value, int indentStyle) {
- if (value == null) {
- throw WRONG_ARGUMENT;
- }
- switch(indentStyle) {
- case INDENT_BY_ONE :
- case INDENT_DEFAULT :
- case INDENT_ON_COLUMN :
- break;
- default :
- throw WRONG_ARGUMENT;
- }
- try {
- int existingValue = Integer.parseInt(value);
- // clear existing indent bits
- existingValue &= ~(Alignment.M_INDENT_BY_ONE | Alignment.M_INDENT_ON_COLUMN);
- switch(indentStyle) {
- case INDENT_BY_ONE :
- existingValue |= Alignment.M_INDENT_BY_ONE;
- break;
- case INDENT_ON_COLUMN :
- existingValue |= Alignment.M_INDENT_ON_COLUMN;
- }
- return String.valueOf(existingValue);
- } catch (NumberFormatException e) {
- throw WRONG_ARGUMENT;
- }
- }
- /**
- * <p>Set the wrapping style of the given alignment value and return the new value.
- * The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
- * API.
- * </p>
- *
- * @param value the given alignment value
- * @param wrappingStyle the given wrapping style
- * @return the new alignment value
- * @see #WRAP_COMPACT
- * @see #WRAP_COMPACT_FIRST_BREAK
- * @see #WRAP_NEXT_PER_LINE
- * @see #WRAP_NEXT_SHIFTED
- * @see #WRAP_NO_SPLIT
- * @see #WRAP_ONE_PER_LINE
- * @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, if the given
- * wrapping style is not one of the possible wrapping styles, or if the given
- * alignment value doesn't have a valid format.
- */
- public static String setWrappingStyle(String value, int wrappingStyle) {
- if (value == null) {
- throw WRONG_ARGUMENT;
- }
- switch(wrappingStyle) {
- case WRAP_COMPACT :
- case WRAP_COMPACT_FIRST_BREAK :
- case WRAP_NEXT_PER_LINE :
- case WRAP_NEXT_SHIFTED :
- case WRAP_NO_SPLIT :
- case WRAP_ONE_PER_LINE :
- break;
- default:
- throw WRONG_ARGUMENT;
- }
- try {
- int existingValue = Integer.parseInt(value);
- // clear existing split bits
- existingValue &= ~(Alignment.SPLIT_MASK);
- switch(wrappingStyle) {
- case WRAP_COMPACT :
- existingValue |= Alignment.M_COMPACT_SPLIT;
- break;
- case WRAP_COMPACT_FIRST_BREAK :
- existingValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
- break;
- case WRAP_NEXT_PER_LINE :
- existingValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
- break;
- case WRAP_NEXT_SHIFTED :
- existingValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
- break;
- case WRAP_ONE_PER_LINE :
- existingValue |= Alignment.M_ONE_PER_LINE_SPLIT;
- break;
- }
- return String.valueOf(existingValue);
- } catch (NumberFormatException e) {
- throw WRONG_ARGUMENT;
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java
deleted file mode 100644
index 5165e3e3393..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.parser;
-
-import java.io.File;
-
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
-import org.eclipse.cdt.internal.core.util.ILRUCacheable;
-import org.eclipse.cdt.internal.core.util.LRUCache;
-import org.eclipse.cdt.internal.core.util.OverflowingLRUCache;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * This is the CodeReaderBuffer used to cache CodeReaders for the ICodeReaderFactory
- * when working with saved copies (primarily SavedCodeReaderFactory).
- *
- * @author dsteffle
- */
-public class CodeReaderCache implements ICodeReaderCache {
- /**
- * The string used to identify this CodeReaderCache. Mainly used for preferences.
- */
- public static final String CODE_READER_BUFFER="CODE_READER_CACHE"; //$NON-NLS-1$
-
- /**
- * The default size of the cache in MB.
- */
- public static final int DEFAULT_CACHE_SIZE_IN_MB = 64;
-
- /**
- * A String value of the default size of the cache.
- */
- public static final String DEFAULT_CACHE_SIZE_IN_MB_STRING = String.valueOf(DEFAULT_CACHE_SIZE_IN_MB);
- private static final int MB_TO_KB_FACTOR = 1024;
- private CodeReaderLRUCache cache = null; // the actual cache
- private IResourceChangeListener listener = new UpdateCodeReaderCacheListener(this);
-
- private class UpdateCodeReaderCacheListener implements IResourceChangeListener {
- ICodeReaderCache c = null;
-
- /**
- * Create the UpdateCodeReaderCacheListener used to dispatch events to remove CodeReaders
- * from the cache when a resource is changed and detected in Eclipse.
- * @param cache
- */
- public UpdateCodeReaderCacheListener(ICodeReaderCache cache) {
- this.c = cache;
- }
-
- private class RemoveCacheJob extends Job {
- private static final String REMOVE_CACHE = "Remove Cache"; //$NON-NLS-1$
- ICodeReaderCache cache1 = null;
- IResourceChangeEvent event = null;
-
- /**
- * Create a RemoveCacheJob used to run as a separate thread to remove a CodeReader from the cache.
- * @param cache
- * @param event
- * @param mutex
- */
- public RemoveCacheJob(ICodeReaderCache cache, IResourceChangeEvent event) {
- super(REMOVE_CACHE);
- this.cache1 = cache;
- this.event = event;
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- if (event.getSource() instanceof IWorkspace && event.getDelta() != null) {
- removeKeys(event.getDelta().getAffectedChildren());
- }
-
- return Status.OK_STATUS;
- }
-
- private void removeKeys(IResourceDelta[] deltas) {
- for(int j=0; j<deltas.length; j++) {
- if (deltas[j].getResource().getType() == IResource.PROJECT || deltas[j].getResource().getType() == IResource.FOLDER) {
- removeKeys(deltas[j].getAffectedChildren());
- } else if (deltas[j].getResource() instanceof IFile && ((IFile)deltas[j].getResource()).getLocation() != null) {
- removeKey(((IFile)deltas[j].getResource()).getLocation().toOSString());
- }
- }
- }
-
- private void removeKey(String key) {
- if (key != null && cache1 != null)
- cache1.remove(key);
- }
-
- }
-
- /**
- * Identifies when a resource was chaned and schedules a new RemoveCacheJob.
- */
- public void resourceChanged(IResourceChangeEvent event) {
- if (c instanceof CodeReaderCache)
- new RemoveCacheJob(c, event).schedule();
- }
- }
-
- /**
- * Creates a CodeReaderCache and sets the size of the CodeReaderCache in MB. Creating a new
- * CodeReaderCache also adds an UpdateCodeReaderCacheListener to the workspace so that when
- * a resource is changed then the CodeReader for that resource is removed from this cache.
- *
- * @param size initial size of the CodeReaderCache in terms of MB
- */
- public CodeReaderCache(int size) {
- cache = new CodeReaderLRUCache(size * MB_TO_KB_FACTOR);
- if (ResourcesPlugin.getWorkspace() != null)
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);
- }
-
- protected void finalize() throws Throwable {
- super.finalize();
-
- if (ResourcesPlugin.getWorkspace() != null)
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
- }
-
- /**
- * Get a CodeReader from the cache. The key is the char[] filename of the CodeReader to retrieve.
- * @param key the path of the CodeReader to retrieve
- * @return
- */
- public synchronized CodeReader get(String key) {
- CodeReader ret = null;
- if (cache.getSpaceLimit() > 0)
- ret = cache.get(key);
-
- // not in the cache
- if (ret == null) {
- // for efficiency: check File.exists before ParserUtil#createReader()
- // bug 100947 fix: don't want to attempt to create a code reader if there is no file for the key
- if (!(new File(key).exists()))
- return null;
-
- ret = ParserUtil.createReader(key, EmptyIterator.EMPTY_ITERATOR);
-
- if (cache.getSpaceLimit() > 0)
- put(ret);
- }
-
- return ret;
- }
-
- /**
- * Put a CodeReader into the Cache.
- * @param key
- * @param value
- * @return
- */
- private synchronized CodeReader put(CodeReader value) {
- if (value==null) return null;
- return cache.put(String.valueOf(value.filename), value);
- }
-
- /**
- * Sets the max cache size of this cache in terms of MB.
- * @param size
- */
- public void setCacheSize(int size) {
- cache.setSpaceLimit(size * MB_TO_KB_FACTOR);
- }
-
- /**
- * This class is a wrapper/implementor class for OverflowingLRUCache.
- *
- * It uses CodeReaderCacheEntry (which implements ILRUCacheable) to specify that the size of
- * the cache should be relative to the size of the entries and not the number of entries.
- *
- * @author dsteffle
- *
- */
- private class CodeReaderLRUCache extends OverflowingLRUCache {
-
- /**
- * This is a wrapper for entries to put into the OverflowingLRUCache (required to determine the
- * size of entries relative to the CodeReader's file size).
- *
- * Although the size of the CodeReaderCache is specified in terms of MB, the actual granularity of
- * the cache is KB.
- *
- * @author dsteffle
- *
- */
- private class CodeReaderCacheEntry implements ILRUCacheable {
-
- private static final double CHAR_TO_KB_FACTOR = 1024;
- CodeReader reader = null;
- int size = 0; // used to specify the size of the CodeReader in terms of KB
-
- public CodeReaderCacheEntry(CodeReader value) {
- this.reader = value;
- size = (int)Math.ceil(reader.buffer.length / CHAR_TO_KB_FACTOR); // get the size of the file in terms of KB
- }
-
- public int getCacheFootprint() {
- return size;
- }
-
- public CodeReader getCodeReader() {
- return reader;
- }
- }
-
- /**
- * Creates a new CodeReaderLRUCache with a specified initial maximum size.
- * @param size the maximum size of the cache in terms of MB
- */
- public CodeReaderLRUCache(int size) {
- super(); // need to initialize the LRUCache with super() so that the size of the hashtable isn't relative to the size in MB
- this.setSpaceLimit(size);
- }
-
- // must be overloaded, required to remove entries from the cache
- protected boolean close(LRUCacheEntry entry) {
- Object obj = remove(entry._fKey);
-
- if (obj != null)
- return true;
-
- return false;
- }
-
- protected LRUCache newInstance(int size, int overflow) {
- return null;
- }
-
- /**
- * Removes an entry from the cache and returns the entry that was removed if found.
- * Otherwise null is returned.
- * @param key
- * @return
- */
- public CodeReader remove(String key) {
- Object removed = removeKey(key);
-
- if (removed instanceof CodeReaderCacheEntry)
- return ((CodeReaderCacheEntry)removed).getCodeReader();
-
- return null;
- }
-
- /**
- * Puts a CodeReader into the cache by wrapping it with a CodeReaderCacheEntry first.
- * This way the proper size of the element in the cache can be determined
- * via the CodeReaderCacheEntry.
- * @param key
- * @param value
- * @return
- */
- public CodeReader put(Object key, CodeReader value) {
- Object entry = new CodeReaderCacheEntry(value);
-
- Object ret = put(key, entry);
-
- if (ret instanceof CodeReaderCacheEntry)
- return ((CodeReaderCacheEntry)ret).getCodeReader();
-
- return null;
- }
-
- /**
- * Retrieves a CodeReader from the cache corresponding to the path specified by the key.
- * @param key
- * @return
- */
- public CodeReader get(String key) {
- Object obj = peek(key);
- if (obj instanceof CodeReaderCacheEntry)
- return ((CodeReaderCacheEntry)obj).getCodeReader();
-
- return null;
- }
-
- }
-
- /**
- * Removes the CodeReader from the cache corresponding to the path specified by the key and
- * returns the CodeReader that was removed. If no CodeReader is removed then null is returned.
- * @param key
- */
- public synchronized CodeReader remove(String key) {
- return cache.remove(key);
- }
-
- /**
- * Returns the current size of the cache. For the CodeReaderCache this is in MB.
- * @return
- */
- public int getCurrentSpace() {
- return cache.getCurrentSpace();
- }
-
- public void flush() {
- cache.flush();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoChangeListener.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoChangeListener.java
deleted file mode 100644
index 222261f17c7..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoChangeListener.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.parser;
-
-import org.eclipse.core.resources.IResource;
-
-
-public interface IScannerInfoChangeListener {
-
- /**
- * The listener must implement this method in order to receive the new
- * information from the provider.
- *
- * @param info
- */
- public void changeNotification(IResource project, IScannerInfo info);
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoProvider.java
deleted file mode 100644
index bc9ffbc611d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/IScannerInfoProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.parser;
-
-import org.eclipse.core.resources.IResource;
-
-
-public interface IScannerInfoProvider {
-
- /**
- * The receiver will answer the current state of the build information for the
- * resource specified in the argument.
- *
- * @param resource
- * @return
- */
- public IScannerInfo getScannerInformation(IResource resource);
-
- /**
- * The receiver will register the listener specified in the argument
- * to receive change notifications when the information for the
- * <code>IResource</code> it is responsible for changes.
- *
- * @param listener
- */
- public void subscribe(IResource resource, IScannerInfoChangeListener listener);
-
- /**
- * The receiver will no longer notify the listener specified in
- * the argument when information about the reource it is responsible
- * for changes.
- *
- * @param listener
- */
- public void unsubscribe(IResource resource, IScannerInfoChangeListener listener);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java
deleted file mode 100644
index ffe1c914d0d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.parser;
-
-import org.eclipse.cdt.core.parser.IParser;
-
-/**
- * @author bgheorgh
- *
- */
-public class ParserTimeOut implements Runnable {
-
-
- protected Thread thread;
- protected boolean enabled;
- protected IParser cancellable;
- private int timeout = 0;
- private int threadPriority = Thread.MIN_PRIORITY + 1;
- boolean debug = false;
- private String threadName = null;
- boolean readyToRun = true;
-
- public ParserTimeOut(){
- reset();
- }
-
- public ParserTimeOut(String threadName){
- this.threadName = threadName;
- reset();
- }
-
- public void run() {
- while (this.thread != null) {
- try {
- synchronized(this){
- if (enabled){
- readyToRun = false;
- wait(timeout);
- if (enabled){
- if(cancellable != null)
- cancellable.cancel();
- enabled = false;
- }
- }
- else{
- while(!enabled){
- readyToRun = true;
- wait();
- }
- }
- }
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- public synchronized void startTimer(){
- enabled = true;
- notify();
- }
-
- public synchronized void stopTimer(){
- enabled= false;
- notify();
- }
-
-
-
- public void reset() {
- enabled=false;
- if (threadName!=null){
- thread = new Thread(this, threadName);
- }
- else{
- thread = new Thread(this, "Time Out Thread"); //$NON-NLS-1$
- }
- thread.setDaemon(true);
- thread.setPriority(threadPriority);
- thread.start();
- }
- /**
- * @return Returns the threadPriority.
- */
- public int getThreadPriority() {
- return threadPriority;
- }
- /**
- * @param threadPriority The threadPriority to set.
- */
- public void setThreadPriority(int threadPriority) {
- this.threadPriority = threadPriority;
- }
-
- /**
- * @param pm The pm to set.
- */
- public void setParser(IParser c) {
- this.cancellable = c;
- }
- /**
- * @return Returns the timeout.
- */
- public int getTimeout() {
- return timeout;
- }
- /**
- * @param timeout The timeout to set.
- */
- public void setTimeout(int timeout) {
- this.timeout = timeout;
- }
-
- public boolean isReadyToRun(){
- return readyToRun;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java
deleted file mode 100644
index c4657d00b6a..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.parser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.internal.core.model.IDebugLogConstants;
-import org.eclipse.cdt.internal.core.parser.InternalParserUtil;
-import org.eclipse.cdt.internal.core.parser.ParserLogService;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author jcamelon
- *
- */
-public class ParserUtil
-{
-
- public static IParserLogService getParserLogService()
- {
- return parserLogService;
- }
-
- private static IParserLogService parserLogService = new ParserLogService(IDebugLogConstants.PARSER );
- private static IParserLogService scannerLogService = new ParserLogService(IDebugLogConstants.SCANNER );
-
- /**
- * @return
- */
- public static IParserLogService getScannerLogService() {
- return scannerLogService;
- }
-
- public static char [] findWorkingCopyBuffer( String path, Iterator workingCopies )
- {
- IResource resultingResource = getResourceForFilename(path);
-
- if( resultingResource != null && resultingResource.getType() == IResource.FILE )
- {
- // this is the file for sure
- // check the working copy
- if( workingCopies.hasNext() )
- return findWorkingCopy( resultingResource, workingCopies );
- }
- return null;
- }
-
- public static CodeReader createReader( String finalPath, Iterator workingCopies )
- {
- // check to see if the file which this path points to points to an
- // IResource in the workspace
- try
- {
- IResource resultingResource = getResourceForFilename(finalPath);
-
- if( resultingResource != null && resultingResource.getType() == IResource.FILE )
- {
- // this is the file for sure
- // check the working copy
- if( workingCopies != null && workingCopies.hasNext() )
- {
- char[] buffer = findWorkingCopy( resultingResource, workingCopies );
- if( buffer != null )
- return new CodeReader(finalPath, buffer);
- }
- InputStream in = null;
- try
- {
- in = ((IFile)resultingResource).getContents();
- return new CodeReader(finalPath, ((IFile)resultingResource).getCharset(), in);
- } finally {
- if (in != null)
- {
- in.close();
- }
- }
- }
- }
- catch( CoreException ce )
- {
- }
- catch( IOException e )
- {
- }
- catch( IllegalStateException e )
- {
- }
- return InternalParserUtil.createFileReader(finalPath);
- }
-
- /**
- * @param finalPath
- * @return
- */
- public static IResource getResourceForFilename(String finalPath) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- if( workspace == null )
- return null;
- IPath path = new Path( finalPath );
- IPath initialPath = new Path( finalPath );
-
- IWorkspaceRoot root = workspace.getRoot();
- if( root.getLocation().isPrefixOf( path ) )
- path = path.removeFirstSegments(root.getLocation().segmentCount() );
-
- try
- {
- IFile resultingResource = root.getFile(path);
- if( resultingResource != null && resultingResource.exists() )
- return resultingResource;
- resultingResource = root.getFileForLocation( path );
- if( resultingResource != null && resultingResource.exists() )
- return resultingResource;
-
- // check for linked resources
- IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(initialPath);
-
- // note for findFilesForLocation(IPath): This method does not consider whether resources actually exist at the given locations.
- // so only return the first IFile found that is accessible
- for(int i=0; i<files.length; i++) {
- if (files[i].isAccessible())
- return files[i];
- }
-
- return null;
- }
- catch( IllegalArgumentException iae ) //thrown on invalid paths
- {
- return null;
- }
- }
-
- /**
- * @param resultingResource
- * @param workingCopies
- * @return
- */
- protected static char[] findWorkingCopy(IResource resultingResource, Iterator workingCopies) {
- if( parserLogService.isTracing() )
- parserLogService.traceLog( "Attempting to find the working copy for " + resultingResource.getName() ); //$NON-NLS-1$
- while( workingCopies.hasNext() )
- {
- Object next = workingCopies.next();
- if( !( next instanceof IWorkingCopy)) continue;
- IWorkingCopy copy = (IWorkingCopy) next;
- if( copy.getResource().equals(resultingResource ))
- {
- if( parserLogService.isTracing() )
- parserLogService.traceLog( "Working copy found!!" ); //$NON-NLS-1$
- return copy.getContents();
- }
- }
- if( parserLogService.isTracing() )
- parserLogService.traceLog( "Working copy not found." ); //$NON-NLS-1$
-
- return null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java
deleted file mode 100644
index 8328d5fe34a..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.resources;
-
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.IMarkerGenerator;
-import org.eclipse.cdt.core.ProblemMarkerInfo;
-import org.eclipse.cdt.core.model.ICModelMarker;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-
-public abstract class ACBuilder extends IncrementalProjectBuilder implements IMarkerGenerator {
-
- /**
- * Constructor for ACBuilder
- */
- public ACBuilder() {
- super();
- }
-
- public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
- ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar, null);
- addMarker(problemMarkerInfo);
- }
-
- /*
- * callback from Output Parser
- */
- public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
- try {
- IResource markerResource = problemMarkerInfo.file ;
- if (markerResource==null) {
- markerResource = getProject();
- }
- IMarker[] cur = markerResource.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_ONE);
- /*
- * Try to find matching markers and don't put in duplicates
- */
- if ((cur != null) && (cur.length > 0)) {
- for (int i = 0; i < cur.length; i++) {
- int line = ((Integer) cur[i].getAttribute(IMarker.LOCATION)).intValue();
- int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
- String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
- if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) {
- return;
- }
- }
- }
-
- IMarker marker = markerResource.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
- marker.setAttribute(IMarker.LOCATION, problemMarkerInfo.lineNumber);
- marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
- marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity));
- marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber);
- marker.setAttribute(IMarker.CHAR_START, -1);
- marker.setAttribute(IMarker.CHAR_END, -1);
- if (problemMarkerInfo.variableName != null) {
- marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName);
- }
- if (problemMarkerInfo.externalPath != null) {
- marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString());
- }
- }
- catch (CoreException e) {
- CCorePlugin.log(e.getStatus());
- }
-
- }
-
- int mapMarkerSeverity(int severity) {
- switch (severity) {
- case SEVERITY_ERROR_BUILD :
- case SEVERITY_ERROR_RESOURCE :
- return IMarker.SEVERITY_ERROR;
- case SEVERITY_INFO :
- return IMarker.SEVERITY_INFO;
- case SEVERITY_WARNING :
- return IMarker.SEVERITY_WARNING;
- }
- return IMarker.SEVERITY_ERROR;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/FileStorage.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/FileStorage.java
deleted file mode 100644
index e84878167a0..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/FileStorage.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.resources;
-
-
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.cdt.core.CCorePlugin;
-
-/**
- *
- * @see IStorage
- */
-public class FileStorage extends PlatformObject implements IStorage {
- IPath path;
- InputStream in = null;
-
- public InputStream getContents() throws CoreException {
- if (in == null) {
- try {
- return new FileInputStream(path.toFile());
- } catch (FileNotFoundException e) {
- throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
- IStatus.ERROR, e.toString(), e));
- }
- }
- return in;
- }
-
- /**
- * @see IStorage#getFullPath
- */
- public IPath getFullPath() {
- return this.path;
- }
-
- /**
- * @see IStorage#getName
- */
- public String getName() {
- return this.path.lastSegment();
- }
-
- /**
- * @see IStorage#isReadOnly()
- */
- public boolean isReadOnly() {
- return true;
- }
-
- public FileStorage(IPath path){
- this.path = path;
- }
-
- public FileStorage(InputStream in, IPath path){
- this.path = path;
- this.in = in;
- }
-
- /**
- * @see IStorage#isReadOnly()
- */
- public String toString() {
- return path.toOSString();
- }
-
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj instanceof IStorage) {
- IPath p= getFullPath();
- IPath objPath= ((IStorage)obj).getFullPath();
- if (p != null && objPath != null)
- return p.equals(objPath);
- }
- return super.equals(obj);
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IConsole.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IConsole.java
deleted file mode 100644
index 9c615904ab8..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IConsole.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.resources;
-
-
-import org.eclipse.cdt.core.ConsoleOutputStream;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-
-public interface IConsole {
- void start(IProject project);
- ConsoleOutputStream getOutputStream() throws CoreException;
- ConsoleOutputStream getInfoStream() throws CoreException;
- ConsoleOutputStream getErrorStream() throws CoreException;
-}
-
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStore.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStore.java
deleted file mode 100644
index 3d55448519b..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStore.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.resources;
-
-import org.eclipse.cdt.core.ICExtension;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * IPathEntryStore
- */
-public interface IPathEntryStore extends ICExtension {
-
- /**
- * Returns the path entries save on the project.
- * @param project
- * @return
- * @throws CoreException
- */
- IPathEntry[] getRawPathEntries() throws CoreException;
-
- /**
- * Save the entries on the project.
- * Setting paths should fire a CONTENT_CHANGED events to the listeners.
- * It is up to the listener to calculate the deltas.
- *
- * @param project
- * @param entries
- * @throws CoreException
- */
- void setRawPathEntries(IPathEntry[] entries) throws CoreException;
-
- /**
- * Add a listener to the store.
- *
- * @param listener
- */
- void addPathEntryStoreListener(IPathEntryStoreListener listener);
-
- /**
- * Remove the listener form the list.
- *
- * @param listener
- */
- void removePathEntryStoreListener(IPathEntryStoreListener listener);
-
- void close();
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStoreListener.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStoreListener.java
deleted file mode 100644
index 3d2a7e302cd..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryStoreListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.resources;
-
-import java.util.EventListener;
-
-/**
- * IPathEntryStoreListener
- */
-public interface IPathEntryStoreListener extends EventListener {
- /**
- *
- * @param event
- */
- void pathEntryStoreChanged(PathEntryStoreChangedEvent event);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableChangeListener.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableChangeListener.java
deleted file mode 100644
index 267e4ef3a37..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableChangeListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.resources;
-
-import java.util.EventListener;
-
-
-/**
- * An interface to be implemented by objects interested in path variable
- * creation, removal and value change events.
- *
- * <p>Clients may implement this interface.</p>
- *
- * @since 3.0
- */
-public interface IPathEntryVariableChangeListener extends EventListener {
- /**
- * Notification that a path variable has changed.
- * <p>
- * This method is called when a path variable is added, removed or has its value
- * changed in the observed <code>IPathVariableManager</code> object.
- * </p>
- *
- * @param event the path variable change event object describing which variable
- * changed and how
- * @see IPathEntryVariableManager#addChangeListener(IPathVariableChangeListener)
- * @see IPathEntryVariableManager#removeChangeListener(IPathVariableChangeListener)
- * @see PathEntryVariableChangeEvent
- */
- public void pathVariableChanged(PathEntryVariableChangeEvent event);
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableManager.java
deleted file mode 100644
index daec6bdf491..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPathEntryVariableManager.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.resources;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Manages a collection of variables
- * @since 3.0
- */
-public interface IPathEntryVariableManager {
-
- /**
- * Sets the variable with the given name to be the specified value.
- * Depending on the value given and if the variable is currently defined
- * or not, there are several possible outcomes for this operation:
- * <p>
- * <ul>
- * <li>A new variable will be created, if there is no variable defined with
- * the given name, and the given value is not <code>null</code>.
- * </li>
- *
- * <li>The referred variable's value will be changed, if it already exists
- * and the given value is not <code>null</code>.</li>
- *
- * <li>The referred variable will be removed, if a variable with the given
- * name is currently defined and the given value is <code>null</code>.
- * </li>
- *
- * <li>The call will be ignored, if a variable with the given name is not
- * currently defined and the given value is <code>null</code>, or if it is
- * defined but the given value is equal to its current value.
- * </li>
- * </ul>
- * <p>If a variable is effectively changed, created or removed by a call to
- * this method, notification will be sent to all registered listeners.</p>
- *
- * @param name the name of the variable
- * @param value the value for the variable (may be <code>null</code>)
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>The variable name is not valid</li>
- * <li>The variable value is relative</li>
- * </ul>
- */
- public void setValue(String name, IPath value) throws CoreException;
-
- /**
- * Returns the value of the variable with the given name. If there is
- * no variable defined with the given name, returns <code>null</code>.
- *
- * @param name the name of the variable to return the value for
- * @return the value for the variable, or <code>null</code> if there is no
- * variable defined with the given name
- */
- public IPath getValue(String name);
-
- /**
- * Returns an array containing all defined variable names.
- *
- * @return an array containing all defined variable names
- */
- public String[] getVariableNames();
-
- /**
- * Registers the given listener to receive notification of changes to
- * variables. The listener will be notified whenever a variable has been
- * added, removed or had its value changed. Has no effect if an identical
- * variable change listener is already registered.
- *
- * @param listener the listener
- * @see IPathEntryVariableChangeListener
- */
- public void addChangeListener(IPathEntryVariableChangeListener listener);
-
- /**
- * Removes the given variable change listener from the listeners list.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener the listener
- * @see IPathEntryVariableChangeListener
- */
- public void removeChangeListener(IPathEntryVariableChangeListener listener);
-
- /**
- * Resolves a <code>String</code> potentially containing a
- * variable reference, replacing the variable reference
- * (if any) with the variable's value (which is a concrete absolute path).
- * <p>
- * If the given String is <code>null</code> then <code>null</code> will be
- * returned. In all other cases the result will be non-<code>null</code>.
- * </p>
- *
- * <p>
- * For example, consider the following collection of path variables:
- * </p>
- * <ul>
- * <li>TEMP = c:/temp</li>
- * <li>BACKUP = /tmp/backup</li>
- * </ul>
- * <p>The following paths would be resolved as:
- * <p>c:/bin => c:/bin</p>
- * <p>c:${TEMP} => c:/temp</p>
- * <p>/TEMP => /TEMP</p>
- * <p>${TEMP}/foo => /temp/foo</p>
- * <p>${BACKUP} => /tmp/backup</p>
- * <p>${BACKUP}/bar.txt => /tmp/backup/bar.txt</p>
- * <p>SOMEPATH/foo => SOMEPATH/foo</p></p>
- *
- * @param path the path to be resolved
- * @return the resolved path or <code>null</code>
- */
- public IPath resolvePath(IPath path);
-
- /**
- * Returns <code>true</code> if the given variable is defined and
- * <code>false</code> otherwise. Returns <code>false</code> if the given
- * name is not a valid path variable name.
- *
- * @param name the variable's name
- * @return <code>true</code> if the variable exists, <code>false</code>
- * otherwise
- */
- public boolean isDefined(String name);
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryStoreChangedEvent.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryStoreChangedEvent.java
deleted file mode 100644
index cf4bce68c8f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryStoreChangedEvent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.resources;
-
-import java.util.EventObject;
-
-import org.eclipse.core.resources.IProject;
-
-/**
- * PathEntryChangedEvent
- */
-public class PathEntryStoreChangedEvent extends EventObject {
-
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 4051048549254706997L;
- public static final int CONTENT_CHANGED = 1;
- public static final int STORE_CLOSED = 2;
-
- private final int flags;
- private final IProject project;
-
- /**
- *
- */
- public PathEntryStoreChangedEvent(IPathEntryStore store, IProject project, int flags) {
- super(store);
- this.project = project;
- this.flags = flags;
- }
-
- public IPathEntryStore getPathEntryStore() {
- return (IPathEntryStore)getSource();
- }
-
- public IProject getProject() {
- return project;
- }
-
- public boolean hasContentChanged() {
- return (flags & CONTENT_CHANGED) != 0;
- }
-
- public boolean hasClosed() {
- return (flags & STORE_CLOSED) != 0;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryVariableChangeEvent.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryVariableChangeEvent.java
deleted file mode 100644
index fc0005b03da..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/PathEntryVariableChangeEvent.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.resources;
-
-import java.util.EventObject;
-
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Describes a change in path variable.
- */
-public class PathEntryVariableChangeEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- /** Event type constant (value = 1) that denotes a value change . */
- public final static int VARIABLE_CHANGED = 1;
-
- /** Event type constant (value = 2) that denotes a variable creation. */
- public final static int VARIABLE_CREATED = 2;
-
- /** Event type constant (value = 3) that denotes a variable deletion. */
- public final static int VARIABLE_DELETED = 3;
-
-
- /**
- * The name of the changed variable.
- */
- private String variableName;
-
- /**
- * The value of the changed variable (may be null).
- */
- private IPath value;
-
- /** The event type. */
- private int type;
-
- /**
- * Constructor for this class.
- */
- public PathEntryVariableChangeEvent(IPathEntryVariableManager source, String variableName, IPath value, int type) {
- super(source);
- if (type < VARIABLE_CHANGED || type > VARIABLE_DELETED)
- throw new IllegalArgumentException("Invalid event type: " + type); //$NON-NLS-1$
- this.variableName = variableName;
- this.value = value;
- this.type = type;
- }
-
- public IPath getValue() {
- return value;
- }
-
- public String getVariableName() {
- return variableName;
- }
-
- public int getType() {
- return type;
- }
-
- /**
- * Return a string representation of this object.
- */
- public String toString() {
- String[] typeStrings = {"VARIABLE_CHANGED", "VARIABLE_CREATED", "VARIABLE_DELETED"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- StringBuffer sb = new StringBuffer(getClass().getName());
- sb.append("[variable = "); //$NON-NLS-1$
- sb.append(variableName);
- sb.append(", type = "); //$NON-NLS-1$
- sb.append(typeStrings[type - 1]);
- if (type != VARIABLE_DELETED) {
- sb.append(", value = "); //$NON-NLS-1$
- sb.append(value);
- }
- sb.append("]"); //$NON-NLS-1$
- return sb.toString();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerInfo.java
deleted file mode 100644
index dc677fc4e87..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerInfo.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.resources;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
-
-public class ScannerInfo implements IExtendedScannerInfo {
-
- private final Map fMacroMap;
- private final String[] fSystemIncludePaths;
- private final String[] fMacroFiles;
- private final String[] fIncludeFiles;
- private final String[] fLocalIncludePaths;
- final static String[] EMPTY_ARRAY_STRING = new String[0];
-
- protected ScannerInfo(String[] systemIncludePaths, String[] localIncludePaths, String[] includeFiles,
- Map macroMap, String[] macroFiles) {
- fSystemIncludePaths = (systemIncludePaths == null) ? EMPTY_ARRAY_STRING : systemIncludePaths;
- fLocalIncludePaths = (localIncludePaths == null) ? EMPTY_ARRAY_STRING : localIncludePaths;
- fIncludeFiles = (includeFiles == null) ? EMPTY_ARRAY_STRING : includeFiles;
- fMacroFiles = (macroFiles == null) ? EMPTY_ARRAY_STRING : macroFiles;
- fMacroMap = (macroMap == null) ? Collections.EMPTY_MAP : macroMap;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
- */
- public synchronized String[] getIncludePaths() {
- return fSystemIncludePaths;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
- */
- public synchronized Map getDefinedSymbols() {
- return fMacroMap;
- }
-
- public String[] getMacroFiles() {
- return fMacroFiles;
- }
-
- public String[] getIncludeFiles() {
- return fIncludeFiles;
- }
-
- public String[] getLocalIncludePath() {
- return fLocalIncludePaths;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerProvider.java
deleted file mode 100644
index feeb5d66da6..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ScannerProvider.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.core.AbstractCExtension;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ElementChangedEvent;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementDelta;
-import org.eclipse.cdt.core.model.IElementChangedListener;
-import org.eclipse.cdt.core.model.IIncludeEntry;
-import org.eclipse.cdt.core.model.IIncludeFileEntry;
-import org.eclipse.cdt.core.model.IMacroEntry;
-import org.eclipse.cdt.core.model.IMacroFileEntry;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
-import org.eclipse.cdt.core.parser.IScannerInfoProvider;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-public class ScannerProvider extends AbstractCExtension implements IScannerInfoProvider, IElementChangedListener {
-
- // Listeners interested in build model changes
- private static Map listeners;
-
- private static ScannerProvider fProvider;
-
- // Map of the cache scannerInfos
-
- public static synchronized IScannerInfoProvider getInstance() {
- if ( fProvider == null) {
- fProvider = new ScannerProvider();
- CoreModel.getDefault().addElementChangedListener(fProvider);
- }
- return fProvider;
- }
-
- /*
- * @return
- */
- private static Map getListeners() {
- if (listeners == null) {
- listeners = new HashMap();
- }
- return listeners;
- }
-
- /**
- * @param project
- * @param info
- */
- protected static void notifyInfoListeners(IProject project, IScannerInfo info) {
- // Call in the cavalry
- List listeners = (List)getListeners().get(project);
- if (listeners == null) {
- return;
- }
- IScannerInfoChangeListener[] observers = new IScannerInfoChangeListener[listeners.size()];
- listeners.toArray(observers);
- for (int i = 0; i < observers.length; i++) {
- observers[i].changeNotification(project, info);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
- */
- public IScannerInfo getScannerInformation(IResource resource) {
- IPath resPath = resource.getFullPath();
-
- try {
- // get the includes
- IIncludeEntry[] includeEntries = CoreModel.getIncludeEntries(resPath);
- int localCount = 0, systemCount = 0;
- for (int i = 0; i < includeEntries.length; ++i) {
- if (includeEntries[i].isSystemInclude()) {
- ++systemCount;
- } else {
- ++localCount;
- }
- }
- String[] localIncludes = new String[localCount];
- String[] systemIncludes = new String[systemCount];
- for (int i = 0, j = 0, k = 0; i < includeEntries.length; ++i) {
- if (includeEntries[i].isSystemInclude()) {
- systemIncludes[j++] = includeEntries[i].getFullIncludePath().toOSString();
- } else {
- localIncludes[k++] = includeEntries[i].getFullIncludePath().toOSString();
- }
- }
-
- // get the includeFile
- IIncludeFileEntry[] includeFileEntries = CoreModel.getIncludeFileEntries(resPath);
- String[] includeFiles = new String[includeFileEntries.length];
- for (int i = 0; i < includeFiles.length; ++i) {
- includeFiles[i] = includeFileEntries[i].getFullIncludeFilePath().toOSString();
- }
-
- // get the macros
- IMacroEntry[] macros = CoreModel.getMacroEntries(resPath);
- Map symbolMap = new HashMap();
- for (int i = 0; i < macros.length; ++i) {
- symbolMap.put(macros[i].getMacroName(), macros[i].getMacroValue());
- }
-
- // get the macro files
- IMacroFileEntry[] macroFileEntries = CoreModel.getMacroFileEntries(resPath);
- String[] macroFiles = new String[macroFileEntries.length];
- for (int i = 0; i < macroFiles.length; ++i) {
- macroFiles[i] = macroFileEntries[i].getFullMacroFilePath().toOSString();
- }
- return new ScannerInfo(systemIncludes, localIncludes, includeFiles, symbolMap, macroFiles);
- } catch (CModelException e) {
- //
- }
- return new ScannerInfo(null, null, null, null, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#subscribe(org.eclipse.core.resources.IResource,
- * org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
- */
- public synchronized void subscribe(IResource resource, IScannerInfoChangeListener listener) {
- if (resource == null || listener == null) {
- return;
- }
- IProject project = resource.getProject();
- // Get listeners for this resource
- Map map = getListeners();
- List list = (List)map.get(project);
- if (list == null) {
- // Create a new list
- list = new ArrayList();
- map.put(project, list);
- }
- if (!list.contains(listener)) {
- // Add the new listener for the resource
- list.add(listener);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#unsubscribe(org.eclipse.core.resources.IResource,
- * org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
- */
- public synchronized void unsubscribe(IResource resource, IScannerInfoChangeListener listener) {
- if (resource == null || listener == null) {
- return;
- }
- IProject project = resource.getProject();
- // Remove the listener
- Map map = getListeners();
- List list = (List)map.get(project);
- if (list != null && !list.isEmpty()) {
- // The list is not empty so try to remove listener
- list.remove(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.model.IElementChangedListener#elementChanged(org.eclipse.cdt.core.model.ElementChangedEvent)
- */
- public void elementChanged(ElementChangedEvent event) {
- try {
- processDelta(event.getDelta());
- } catch(CModelException e) {
- }
- }
-
- protected boolean isPathEntryChange(ICElementDelta delta) {
- int flags= delta.getFlags();
- return (delta.getKind() == ICElementDelta.CHANGED &&
- ((flags & ICElementDelta.F_CHANGED_PATHENTRY_INCLUDE) != 0 ||
- (flags & ICElementDelta.F_CHANGED_PATHENTRY_MACRO) != 0 ||
- (flags & ICElementDelta.F_PATHENTRY_REORDER) !=0));
- }
-
- /**
- * Processes a delta recursively.
- */
- protected void processDelta(ICElementDelta delta) throws CModelException {
- ICElement element= delta.getElement();
-
- if (isPathEntryChange(delta)) {
- IResource res = element.getResource();
- IProject project = element.getCProject().getProject();
- if (res == null) {
- res = project;
- }
- IScannerInfo info = getScannerInformation(res);
- notifyInfoListeners(project, info);
- }
-
- ICElementDelta[] affectedChildren= delta.getAffectedChildren();
- for (int i= 0; i < affectedChildren.length; i++) {
- processDelta(affectedChildren[i]);
- }
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java
deleted file mode 100644
index 49577c134d2..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICExtension;
-import org.eclipse.cdt.core.ICExtensionReference;
-import org.eclipse.cdt.core.ICOwnerInfo;
-import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.util.CExtensionUtil;
-import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescription;
-import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
-import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
-import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
-import org.eclipse.cdt.internal.core.settings.model.InternalXmlStorageElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.w3c.dom.Element;
-
-public class CConfigBasedDescriptor implements ICDescriptor {
- private static final String CEXTENSION_NAME = "cextension"; //$NON-NLS-1$
-
- private ICConfigurationDescription fCfgDes;
- private IProject fProject;
- private COwner fOwner;
- private HashMap fDesMap = new HashMap();
- private HashMap fStorageDataElMap = new HashMap();
- private boolean fApplyOnChange = true;
- private boolean fIsDirty;
-
- class CConfigBaseDescriptorExtensionReference implements ICExtensionReference{
- private ICConfigExtensionReference fCfgExtRef;
- CConfigBaseDescriptorExtensionReference(ICConfigExtensionReference cfgRef){
- fCfgExtRef = cfgRef;
- }
-
- public ICExtension createExtension() throws CoreException {
- InternalCExtension cExtension = null;
- IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(fCfgExtRef, CEXTENSION_NAME, false);
- cExtension = (InternalCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$
- cExtension.setExtensionReference(this);
- cExtension.setProject(fProject);
- return (ICExtension)cExtension;
- }
-
- public ICDescriptor getCDescriptor() {
- return CConfigBasedDescriptor.this;
- }
-
- public String getExtension() {
- return fCfgExtRef.getExtensionPoint();
- }
-
- public String getExtensionData(String key) {
- return fCfgExtRef.getExtensionData(key);
- }
-
- public IConfigurationElement[] getExtensionElements()
- throws CoreException {
- IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(fCfgExtRef, CEXTENSION_NAME, false);
- if(el != null)
- return el.getChildren();
- return new IConfigurationElement[0];
- }
-
- public String getID() {
- return fCfgExtRef.getID();
- }
-
- public void setExtensionData(String key, String value)
- throws CoreException {
- fCfgExtRef.setExtensionData(key, value);
- checkApply();
- }
- }
-
- public CConfigBasedDescriptor(ICConfigurationDescription des) throws CoreException{
- updateConfiguration(des);
- }
-
- public void setApplyOnChange(boolean apply){
- if(fApplyOnChange == apply)
- return;
-
- fApplyOnChange = apply;
- }
-
- public boolean isApplyOnChange(){
- return fApplyOnChange;
- }
-
- public void apply(boolean force) throws CoreException{
- if(force || fIsDirty){
- CProjectDescriptionManager.getInstance().setProjectDescription(fProject, fCfgDes.getProjectDescription());
- fIsDirty = false;
- }
- }
-
- private void checkApply() throws CoreException {
- if(fApplyOnChange){
- CProjectDescriptionManager.getInstance().setProjectDescription(fProject, fCfgDes.getProjectDescription());
- fIsDirty = false;
- } else {
- fIsDirty = true;
- }
- }
-
- public ICExtensionReference create(String extensionPoint, String id)
- throws CoreException {
- ICConfigExtensionReference ref = fCfgDes.create(extensionPoint, id);
- ICExtensionReference r = create(ref);
- checkApply();
- return r;
- }
-
- public void updateConfiguration(ICConfigurationDescription des) throws CoreException{
- fCfgDes = des;
- fProject = fCfgDes.getProjectDescription().getProject();
- fOwner = ((IInternalCCfgInfo)fCfgDes).getSpecSettings().getCOwner();
- }
-
- private CConfigBaseDescriptorExtensionReference create(ICConfigExtensionReference ref){
- CConfigBaseDescriptorExtensionReference dr = new CConfigBaseDescriptorExtensionReference(ref);
- ArrayList list = (ArrayList)fDesMap.get(ref.getExtensionPoint());
- if(list == null){
- list = new ArrayList(1);
- fDesMap.put(ref.getExtensionPoint(), list);
- } else {
- list.ensureCapacity(list.size() + 1);
- }
- list.add(dr);
- return dr;
- }
-
- public ICExtensionReference[] get(String extensionPoint) {
- ICConfigExtensionReference cfgRefs[] = fCfgDes.get(extensionPoint);
- if(cfgRefs.length == 0){
- return new ICExtensionReference[0];
- }
-
- ICExtensionReference[] extRefs = new ICExtensionReference[cfgRefs.length];
- ArrayList list = (ArrayList)fDesMap.get(extensionPoint);
-// if(list == null){
-// list = new ArrayList(cfgRefs.length);
-// fDesMap.put(extensionPoint, list);
-// }
-
-// list = (ArrayList)list.clone();
-//
-// CConfigBaseDescriptorExtensionReference[] refs = (CConfigBaseDescriptorExtensionReference[])list.
-// toArray(new CConfigBaseDescriptorExtensionReference[list.size()]);
- int num = cfgRefs.length - 1;
-
- for(int i = cfgRefs.length - 1; i >= 0; i--){
- ICConfigExtensionReference ref = cfgRefs[i];
- int k = list != null ? list.size() - 1 : -1;
-
- for(; k >= 0; k--){
- CConfigBaseDescriptorExtensionReference r = (CConfigBaseDescriptorExtensionReference)list.get(k);
- if(r.fCfgExtRef == ref){
- extRefs[num--] = r;
- list.remove(k);
- break;
- }
- }
- if(k < 0){
- extRefs[num--] = new CConfigBaseDescriptorExtensionReference(ref);
- }
- }
-
- if(list == null){
- list = new ArrayList(cfgRefs.length);
- fDesMap.put(extensionPoint, list);
- } else {
- list.clear();
- list.ensureCapacity(cfgRefs.length);
- }
-
- list.addAll(Arrays.asList(extRefs));
- list.trimToSize();
- return extRefs;
- }
-
- public ICExtensionReference[] get(String extensionPoint, boolean update)
- throws CoreException {
- if(update)
- fOwner.update(fProject, this, extensionPoint);
- return get(extensionPoint);
- }
-
- public String getPlatform() {
- return fOwner.getPlatform();
- }
-
- public IProject getProject() {
- return fProject;
- }
-
- public Element getProjectData(String id) throws CoreException {
- Element el = (Element)fStorageDataElMap.get(id);
- if(el == null){
- InternalXmlStorageElement storageEl = (InternalXmlStorageElement)fCfgDes.getStorage(id, true);
- el = CProjectDescriptionManager.getInstance().createXmlElementCopy(storageEl);
- fStorageDataElMap.put(id, el);
- }
- return el;
- }
-
- public ICOwnerInfo getProjectOwner() {
- return fOwner;
- }
-
- public void remove(ICExtensionReference extension) throws CoreException {
- ICConfigExtensionReference ref =((CConfigBaseDescriptorExtensionReference)extension).fCfgExtRef;
- fCfgDes.remove(ref);
- checkApply();
- }
-
- public void remove(String extensionPoint) throws CoreException {
- fCfgDes.remove(extensionPoint);
- checkApply();
- }
-
- public void saveProjectData() throws CoreException {
- CConfigurationSpecSettings specSettings = ((IInternalCCfgInfo)fCfgDes).getSpecSettings();
- for(Iterator iter = fStorageDataElMap.entrySet().iterator(); iter.hasNext();){
- Map.Entry entry = (Map.Entry)iter.next();
- String id = (String)entry.getKey();
- Element el = (Element)entry.getValue();
- InternalXmlStorageElement storEl = new InternalXmlStorageElement(el, false);
- specSettings.importStorage(id, storEl);
- iter.remove();
- }
- checkApply();
- }
-
- public ICConfigurationDescription getConfigurationDescription() {
- return fCfgDes;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java
deleted file mode 100644
index 2d2526fc5b3..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CDescriptorEvent;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorListener;
-import org.eclipse.cdt.core.ICDescriptorManager;
-import org.eclipse.cdt.core.ICDescriptorOperation;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.core.settings.model.ICSettingObject;
-import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
-import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescription;
-import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
-import org.eclipse.cdt.internal.core.settings.model.CProjectDescription;
-import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionEvent;
-import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
-import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
-import org.eclipse.cdt.internal.core.settings.model.ICDescriptionDelta;
-import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionListener;
-import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
-import org.eclipse.cdt.internal.core.settings.model.PathEntryConfigurationDataProvider;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
-
-public class CConfigBasedDescriptorManager implements ICDescriptorManager {
- private static CConfigBasedDescriptorManager fInstance;
- public static final String NULL_OWNER_ID = ""; //$NON-NLS-1$
- private Map fOwnerConfigMap = null;
- private ICProjectDescriptionListener fDescriptionListener;
-
- private static final QualifiedName DESCRIPTOR_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, "CDescriptor"); //$NON-NLS-1$
-
- private List fListeners = Collections.synchronizedList(new Vector());
-
-
- private CConfigBasedDescriptorManager(){
- }
-
- public static CConfigBasedDescriptorManager getInstance(){
- if(fInstance == null){
- fInstance = new CConfigBasedDescriptorManager();
- }
- return fInstance;
- }
-
- private static final COwnerConfiguration NULLCOwner = new COwnerConfiguration(NULL_OWNER_ID,
- CCorePlugin.getResourceString("CDescriptorManager.internal_owner")); //$NON-NLS-1$
-
- public void configure(IProject project, String id) throws CoreException {
- CConfigBasedDescriptor dr;
- if (id.equals(NULLCOwner.getOwnerID())) { //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1,
- CCorePlugin.getResourceString("CDescriptorManager.exception.invalid_ownerID"), //$NON-NLS-1$
- (Throwable)null);
- throw new CoreException(status);
- }
- synchronized (this) {
- dr = findDescriptor(project, false);
- if (dr != null) {
- if (dr.getProjectOwner().getID().equals(NULLCOwner.getOwnerID())) { //$NON-NLS-1$
- // non owned descriptors are simply configure to the new owner no questions ask!
- dr = updateDescriptor(project, dr, id);
- dr.apply(true);
- } else if (!dr.getProjectOwner().getID().equals(id)) {
- IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_EXISTS,
- CCorePlugin.getResourceString("CDescriptorManager.exception.alreadyConfigured"), //$NON-NLS-1$
- (Throwable)null);
- throw new CoreException(status);
- } else {
- return; // already configured with same owner.
- }
- } else {
-// try {
- dr = findDescriptor(project, true);
- dr = updateDescriptor(project, dr, id);
- dr.apply(true);
-// } catch (CoreException e) { // if .cdtproject already exists we'll use that
-// IStatus status = e.getStatus();
-// if (status.getCode() == CCorePlugin.STATUS_CDTPROJECT_EXISTS) {
-// descriptor = new CDescriptor(this, project);
-// } else
-// throw e;
-// }
- }
- }
- }
-
- private CConfigBasedDescriptor updateDescriptor(IProject project, CConfigBasedDescriptor dr, String ownerId) throws CoreException{
- ICConfigurationDescription cfgDes = dr.getConfigurationDescription();
- ICProjectDescription projDes = cfgDes.getProjectDescription();
- CConfigurationSpecSettings settings = ((IInternalCCfgInfo)cfgDes).getSpecSettings();
- settings.setCOwner(ownerId);
- COwner owner = settings.getCOwner();
- setLoaddedDescriptor(projDes, null);
- dr = findDescriptor(projDes);
- dr.setApplyOnChange(false);
- owner.configure(project, dr);
- dr.setApplyOnChange(true);
-
- return dr;
- }
-
- public void convert(IProject project, String id) throws CoreException {
- CConfigBasedDescriptor dr = findDescriptor(project, false);
- if(dr == null){
- throw ExceptionFactory.createCoreException("the project is not a CDT project");
- }
-
-
-
-// boolean applyOnChange = dr.isApplyOnChange();
-// CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(project);
-// if(des == null){
-// throw ExceptionFactory.createCoreException("the project is not a CDT project");
-// }
-// ICConfigurationDescription cfgDes = des.getIndexConfiguration();
-// if(cfgDes == null){
-// throw ExceptionFactory.createCoreException("the projecty does not contain valid configurations");
-// }
-
- dr = updateDescriptor(project, dr, id);
- dr.apply(true);
- }
-
- public ICDescriptor getDescriptor(IProject project) throws CoreException {
- return getDescriptor(project, true);
- }
-
- public ICDescriptor getDescriptor(IProject project, boolean create)
- throws CoreException {
- return findDescriptor(project, create);
- }
-
- public void addDescriptorListener(ICDescriptorListener listener) {
- fListeners.add(listener);
- }
-
- public void removeDescriptorListener(ICDescriptorListener listener) {
- fListeners.remove(listener);
- }
-
- public void runDescriptorOperation(IProject project,
- ICDescriptorOperation op, IProgressMonitor monitor)
- throws CoreException {
- CConfigBasedDescriptor dr = findDescriptor(project, true);
- if (dr == null) {
- throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Failed to create descriptor", null)); //$NON-NLS-1$
- }
-
- synchronized (dr) {
- dr.setApplyOnChange(false);
- try {
- op.execute(dr, monitor);
- } finally {
- dr.setApplyOnChange(true);
- }
- }
-
- dr.apply(false);
- }
-
- private CConfigBasedDescriptor getLoaddedDescriptor(ICProjectDescription des){
- return (CConfigBasedDescriptor)des.getSessionProperty(DESCRIPTOR_PROPERTY);
- }
-
- private void setLoaddedDescriptor(ICProjectDescription des, CConfigBasedDescriptor dr){
- des.setSessionProperty(DESCRIPTOR_PROPERTY, dr);
- }
-
- private CConfigBasedDescriptor findDescriptor(IProject project, boolean create) throws CoreException{
- ICProjectDescription des = CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
- CConfigBasedDescriptor dr = null;
- if(des == null && create){
- des = createProjDescriptionForDescriptor(project);
- }
- if(des != null){
- dr = findDescriptor(des);
- }
- return dr;
- }
-
- private CConfigBasedDescriptor findDescriptor(ICProjectDescription des) throws CoreException{
- CConfigBasedDescriptor dr = getLoaddedDescriptor(des);
- if(dr == null){
- dr = loadDescriptor((CProjectDescription)des);
- if(dr != null){
- setLoaddedDescriptor(des, dr);
- }
- }
- return dr;
- }
-
- private CProjectDescription createProjDescriptionForDescriptor(IProject project) throws CoreException{
- CProjectDescriptionManager mngr = CProjectDescriptionManager.getInstance();
- CProjectDescription des = (CProjectDescription)mngr.createProjectDescription(project, false);
-
- CConfigurationData data = mngr.createDefaultConfigData(project, PathEntryConfigurationDataProvider.getDataFactory());
- des.createConfiguration(CProjectDescriptionManager.DEFAULT_PROVIDER_ID, data);
-
- return des;
- }
-
- private CConfigBasedDescriptor loadDescriptor(CProjectDescription des) throws CoreException{
- CConfigBasedDescriptor dr = null;
-
- if(des != null){
- if(des.isReadOnly())
- des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(des.getProject(), true);
-
- ICConfigurationDescription cfgDes = des.getIndexConfiguration();
-
-
- if(cfgDes != null){
- dr = new CConfigBasedDescriptor((CConfigurationDescription)cfgDes);
- } else {
- throw ExceptionFactory.createCoreException("the project does not contain valid configurations");
- }
- }
-
- return dr;
- }
-
- public COwnerConfiguration getOwnerConfiguration(String id) {
- if (id.equals(NULLCOwner.getOwnerID())) { //$NON-NLS-1$
- return NULLCOwner;
- }
- if (fOwnerConfigMap == null) {
- initializeOwnerConfiguration();
- }
- COwnerConfiguration config = (COwnerConfiguration)fOwnerConfigMap.get(id);
- if (config == null) { // no install owner, lets create place holder config for it.
- config = new COwnerConfiguration(id, CCorePlugin.getResourceString("CDescriptorManager.owner_not_Installed")); //$NON-NLS-1$
- fOwnerConfigMap.put(id, config);
- }
- return config;
- }
-
- private void initializeOwnerConfiguration() {
- IExtensionPoint extpoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "CProject"); //$NON-NLS-1$
- IExtension extension[] = extpoint.getExtensions();
- fOwnerConfigMap = new HashMap(extension.length);
- for (int i = 0; i < extension.length; i++) {
- IConfigurationElement element[] = extension[i].getConfigurationElements();
- for (int j = 0; j < element.length; j++) {
- if (element[j].getName().equalsIgnoreCase("cproject")) { //$NON-NLS-1$
- fOwnerConfigMap.put(extension[i].getUniqueIdentifier(), new COwnerConfiguration(element[j]));
- break;
- }
- }
- }
- }
-
- public void startup(){
- if(fDescriptionListener == null){
- fDescriptionListener = new ICProjectDescriptionListener(){
-
- public void handleEvent(CProjectDescriptionEvent event) {
- doHandleEvent(event);
- }
-
- };
- CProjectDescriptionManager.getInstance().addListener(fDescriptionListener, CProjectDescriptionEvent.APPLIED | CProjectDescriptionEvent.LOADDED);
- }
- }
-
- public void shutdown(){
- if(fDescriptionListener != null){
- CProjectDescriptionManager.getInstance().removeListener(fDescriptionListener);
- }
- }
-
- private void doHandleEvent(CProjectDescriptionEvent event){
- try {
- switch(event.getEventType()){
- case CProjectDescriptionEvent.LOADDED:{
- CProjectDescription des = (CProjectDescription)event.getNewCProjectDescription();
- CConfigBasedDescriptor dr = getLoaddedDescriptor(des);
- if(dr != null){
- //the descriptor was requested while load process
- des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(des.getProject(), true);
- ICConfigurationDescription cfgDescription = des.getIndexConfiguration();
- if(cfgDescription != null)
- dr.updateConfiguration((CConfigurationDescription)cfgDescription);
- else
- setLoaddedDescriptor(des, null);
- }
- }
- break;
- case CProjectDescriptionEvent.APPLIED:
- CProjectDescription newDes = (CProjectDescription)event.getNewCProjectDescription();
- CProjectDescription oldDes = (CProjectDescription)event.getOldCProjectDescription();
- CDescriptorEvent desEvent = null;
- CConfigBasedDescriptor dr = null;
- ICConfigurationDescription updatedCfg = null;
- if(oldDes == null){
- dr = findDescriptor(newDes);
- updatedCfg = newDes.getIndexConfiguration();
- if(dr != null){
- desEvent = new CDescriptorEvent(dr, CDescriptorEvent.CDTPROJECT_ADDED, 0);
- }
- } else if(newDes == null) {
- dr = findDescriptor(oldDes);
- if(dr != null){
- desEvent = new CDescriptorEvent(dr, CDescriptorEvent.CDTPROJECT_REMOVED, 0);
- }
- } else {
- dr = findDescriptor(newDes);
- updatedCfg = newDes.getIndexConfiguration();
- if(dr != null){
- ICConfigurationDescription newCfg = newDes.getIndexConfiguration();
- ICConfigurationDescription oldCfg = oldDes.getIndexConfiguration();
- int flags = 0;
- if(newCfg.getId().equals(oldCfg.getId())){
- ICDescriptionDelta cfgDelta = findCfgDelta(event.getProjectDelta(), newCfg.getId());
- if(cfgDelta != null){
- flags = cfgDelta.getChangeFlags() & (ICDescriptionDelta.EXT_REF | ICDescriptionDelta.OWNER);
- }
- } else {
- flags = CProjectDescriptionManager.getInstance().calculateDescriptorFlags(newCfg, oldCfg);
- }
-
- int drEventFlags = descriptionFlagsToDescriptorFlags(flags);
- if(drEventFlags != 0){
- desEvent = new CDescriptorEvent(dr, CDescriptorEvent.CDTPROJECT_CHANGED, drEventFlags);
- }
- }
- }
-
- if(updatedCfg != null && dr != null){
- CProjectDescription writableDes = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(event.getProject(), true);
- ICConfigurationDescription indexCfg = writableDes.getIndexConfiguration();
- dr.updateConfiguration((CConfigurationDescription)indexCfg);
- }
- if(desEvent != null){
- notifyListeners(desEvent);
- }
- break;
- }
- } catch (CoreException e){
- }
- }
-
- private int descriptionFlagsToDescriptorFlags(int flags){
- int result = 0;
- if((flags & ICDescriptionDelta.EXT_REF) != 0){
- result |= CDescriptorEvent.EXTENSION_CHANGED;
- }
-// if((flags & ICDescriptionDelta.OWNER) != 0){
- result |= CDescriptorEvent.OWNER_CHANGED;
-// }
- return result;
- }
- private ICDescriptionDelta findCfgDelta(ICDescriptionDelta delta, String id){
- if(delta == null)
- return null;
- ICDescriptionDelta children[] = delta.getChildren();
- for(int i = 0; i < children.length; i++){
- ICSettingObject s = children[i].getNewSetting();
- if(s != null && id.equals(s.getId()))
- return children[i];
- }
- return null;
- }
-
- protected void notifyListeners(final CDescriptorEvent event) {
- final ICDescriptorListener[] listeners;
- synchronized (fListeners) {
- listeners = (ICDescriptorListener[])fListeners.toArray(new ICDescriptorListener[fListeners.size()]);
- }
- for (int i = 0; i < listeners.length; i++) {
- final int index = i;
- Platform.run(new ISafeRunnable() {
-
- public void handleException(Throwable exception) {
- IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1,
- CCorePlugin.getResourceString("CDescriptorManager.exception.listenerError"), exception); //$NON-NLS-1$
- CCorePlugin.log(status);
- }
-
- public void run() throws Exception {
- listeners[index].descriptorChanged(event);
- }
- });
- }
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java
deleted file mode 100644
index f20d65e37f3..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeMatcher;
-import org.eclipse.core.runtime.content.IContentTypeSettings;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * Handles the access to the content types of the platform.
- * @author markus.schorn@windriver.com
- */
-public class CContentTypes {
- private static final String PREF_LOCAL_CONTENT_TYPE_SETTINGS = "enabled"; //$NON-NLS-1$
- private static final Preferences PROJECT_SCOPE = Platform.getPreferencesService().getRootNode().node(ProjectScope.SCOPE);
- private static final String CONTENT_TYPE_PREF_NODE = "content-types"; //$NON-NLS-1$
- private static final String FULLPATH_CONTENT_TYPE_PREF_NODE = Platform.PI_RUNTIME + IPath.SEPARATOR + CONTENT_TYPE_PREF_NODE;
-
- /**
- * Implementation for {@link CCorePlugin#getContentType(IProject, String)}.
- */
- public static IContentType getContentType(IProject project, String filename) {
- IContentTypeMatcher matcher= null;
- IScopeContext scopeCtx= null;
- boolean preferCpp= true;
- if (project != null) {
- // try with the project settings
- try {
- matcher= project.getContentTypeMatcher();
- if (usesProjectSpecificContentTypes(project)) {
- scopeCtx= new ProjectScope(project);
- }
- preferCpp= CoreModel.hasCCNature(project);
- } catch (CoreException e) {
- // fallback to workspace wide definitions.
- matcher= Platform.getContentTypeManager();
- }
- }
- else {
- matcher= Platform.getContentTypeManager();
- }
-
- IContentType[] cts = matcher.findContentTypesFor(filename);
- switch (cts.length) {
- case 0:
- return null;
- case 1:
- return cts[0];
- }
-
- int maxPossiblePriority= scopeCtx == null ? 11 : 101;
- int bestPriority= -1;
- IContentType bestResult= null;
-
- for (int i = 0; i < cts.length; i++) {
- IContentType candidate= cts[i];
- int priority= 0;
- try {
- if (scopeCtx != null) {
- IContentTypeSettings settings= candidate.getSettings(scopeCtx);
- if (isStrictlyAssociatedWith(settings, filename)) {
- priority= 100;
- }
- }
- if (priority == 0 && bestPriority < 100) {
- if (isStrictlyAssociatedWith(candidate, filename)) {
- priority= 10;
- }
- }
- if (isPreferredContentType(candidate, preferCpp)) {
- priority+= 1;
- }
- }
- catch (CoreException e) {
- // skip it
- }
- if (priority > bestPriority) {
- if (priority == maxPossiblePriority) {
- return candidate;
- }
- bestPriority= priority;
- bestResult= candidate;
- }
- }
- return bestResult;
- }
-
- private static boolean isPreferredContentType(IContentType candidate, boolean preferCpp) {
- while (candidate != null) {
- String id= candidate.getId();
- if (CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(id) ||
- CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(id)) {
- return preferCpp;
- }
-
- if (CCorePlugin.CONTENT_TYPE_CHEADER.equals(id) ||
- CCorePlugin.CONTENT_TYPE_CSOURCE.equals(id)) {
- return !preferCpp;
- }
- candidate= candidate.getBaseType();
- }
- return false;
- }
-
- private static boolean isStrictlyAssociatedWith(IContentTypeSettings settings, String filename) {
- String[] namespecs= settings.getFileSpecs(IContentType.FILE_NAME_SPEC);
- for (int i = 0; i < namespecs.length; i++) {
- String name = namespecs[i];
- if (name.equals(filename)) {
- return true;
- }
- }
- // check the file extensions only
- int dotPosition = filename.lastIndexOf('.');
- if (dotPosition >= 0 && dotPosition < filename.length()-1) {
- String fileExtension= filename.substring(dotPosition + 1);
- String[] extensions= settings.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
- for (int i = 0; i < extensions.length; i++) {
- String ext = extensions[i];
- if (ext.equals(fileExtension)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * This method is copied from the resources plugin and figures out whether
- * project specific settings are enabled or not.
- * Implementation for {@link CCorePlugin#usesProjectSpecificContentTypes(IProject)}.
- */
- public static boolean usesProjectSpecificContentTypes(IProject project) {
- String projectName= project.getName();
- try {
- // be careful looking up for our node so not to create any nodes as side effect
- Preferences node = PROJECT_SCOPE;
- //TODO once bug 90500 is fixed, should be simpler
- // for now, take the long way
- if (!node.nodeExists(projectName))
- return false;
- node = node.node(projectName);
- if (!node.nodeExists(Platform.PI_RUNTIME))
- return false;
- node = node.node(Platform.PI_RUNTIME);
- if (!node.nodeExists(CONTENT_TYPE_PREF_NODE))
- return false;
- node = node.node(CONTENT_TYPE_PREF_NODE);
- return node.getBoolean(PREF_LOCAL_CONTENT_TYPE_SETTINGS, false);
- } catch (BackingStoreException e) {
- // exception treated when retrieving the project preferences
- }
- return false;
- }
-
- /**
- * Implementation for {@link CCorePlugin#setUseProjectSpecificContentTypes(IProject, boolean)}.
- */
- public static void setUseProjectSpecificContentTypes(IProject project, boolean val) {
- ProjectScope projectScope = new ProjectScope(project);
- Preferences contentTypePrefs = projectScope.getNode(FULLPATH_CONTENT_TYPE_PREF_NODE);
- if (usesProjectSpecificContentTypes(project) != val) {
- // enable project-specific settings for this project
- contentTypePrefs.putBoolean(PREF_LOCAL_CONTENT_TYPE_SETTINGS, val);
- try {
- contentTypePrefs.flush();
- } catch (BackingStoreException e) {
- // ignore ??
- }
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCoreInternals.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCoreInternals.java
deleted file mode 100644
index 8fdb807f357..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCoreInternals.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.internal.core.pdom.PDOMManager;
-
-public class CCoreInternals {
-
- public static PDOMManager getPDOMManager() {
- return (PDOMManager) CCorePlugin.getPDOMManager();
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties
deleted file mode 100644
index 3a067836af0..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties
+++ /dev/null
@@ -1,80 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 QNX Software Systems and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# QNX Software Systems - Initial API and implementation
-###############################################################################
-CBuilder.build_error= Build Error
-CoreModel.BinaryRunner.Binary_Search_Thread=Searching for Binaries
-CoreModel.CModelBuilder.Parser_Construction_Failure=Parser/Scanner construction failure.
-CoreModel.CModelBuilder.Parse_Failure=Parse failure
-CoreModel.ArchiveContainer.Archives=Archives
-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
-
-CoreModel.PathEntry.IllegalContainerPath= Illegal container entry
-CoreModel.PathEntry.DuplicateEntry= Duplicate path entries
-CoreModel.PathEntry.NestedEntry= Nested path entries
-CoreModel.PathEntry.InvalidPathEntry= Invalid path
-
-CommandLauncher.error.commandCanceled=Command canceled
-
-CCProjectNature.exception.noNature=Project must have a cnature
-
-CCorePlugin.exception.noBinaryFormat=No Binary Format
-
-CDescriptorManager.exception.invalid_ownerID=Invalid CDT Project owner ID
-CDescriptorManager.exception.alreadyConfigured=CDT Project already configured
-CDescriptorManager.exception.listenerError=An exception occurred during descriptor notification
-CDescriptorManager.internal_owner=No CDT Project owner
-CDescriptorManager.async_updater=CDT Project async save
-CDescriptorManager.owner_not_Installed=CDT Project owner not installed
-
-CDescriptor.exception.projectAlreadyExists=CDTProject already exists
-CDescriptor.exception.unmatchedOwnerId=CDTProject already exists but does not match owner ID
-CDescriptor.exception.fileNotFound=CDTProject file not found
-CDescriptor.exception.missingOwnerId=Missing owner id
-CDescriptor.exception.missingElement=Missing cdtproject element
-CDescriptor.exception.providerNotFound=Extension not found.
-CDescriptor.extension.internalError=Internal Error
-
-ResolverModel.exception.listenerError=An exception occurred during resolver model change notification
-
-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.notXCOFF32=Not XCOFF32 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
-
-PathEntryVariableResolver.0=CDT PathEntry variable not specified
-
-CTagsIndexMarker.fileMissing=CTags output file missing
-CTagsIndexMarker.CTagsMissing=CTags not installed or not in path
-DOMIndexerMarker.EmptyScannerInfo=File not indexed because it was not built
-
-dom.languageError=Language not found
-indexer.notFound = Indexer not found
-
-pdom.requestTooLarge=Request too large
-pdom.indexer.name=C/C++ Indexer
-pdom.indexer.task=Indexing
-pdom.indexer.filling=Counting files
-pdom.indexer.message=file {0} of {1}: {2}
-PDOMIndexerJob.updateMonitorJob=Update Monitor
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java
deleted file mode 100644
index 1493ea1f45d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Sergey Prigogin, Google
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CCorePreferenceConstants;
-import org.eclipse.cdt.core.dom.IPDOMManager;
-import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
-import org.eclipse.cdt.internal.core.model.CModelManager;
-import org.eclipse.cdt.internal.core.pdom.PDOMManager;
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-
-
-public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences() {
- HashSet optionNames = CModelManager.OptionNames;
-
- // Formatter settings
- Map defaultOptionsMap = DefaultCodeFormatterConstants.getDefaultSettings(); // code formatter defaults
-
- // Compiler settings
- defaultOptionsMap.put(CCorePreferenceConstants.TRANSLATION_TASK_TAGS, CCorePreferenceConstants.DEFAULT_TASK_TAG);
- defaultOptionsMap.put(CCorePreferenceConstants.TRANSLATION_TASK_PRIORITIES, CCorePreferenceConstants.DEFAULT_TASK_PRIORITY);
- defaultOptionsMap.put(CCorePreferenceConstants.CODE_FORMATTER, CCorePreferenceConstants.DEFAULT_CODE_FORMATTER);
-
-
- // Store default values to default preferences
- IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(CCorePlugin.PLUGIN_ID);
- for (Iterator iter = defaultOptionsMap.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- String optionName = (String) entry.getKey();
- defaultPreferences.put(optionName, (String)entry.getValue());
- optionNames.add(optionName);
- }
-
- // indexer defaults
- defaultPreferences.putBoolean(PDOMManager.INDEX_ALL_FILES, false);
- defaultPreferences.put(PDOMManager.INDEXER_ID_KEY, IPDOMManager.ID_FAST_INDEXER);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java
deleted file mode 100644
index f3e6d9d3f4c..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-
-public class CDTLogWriter {
- protected File logFile = null;
- protected Writer log = null;
- protected boolean newSession = true;
-
- protected static final String SESSION = "*** SESSION";//$NON-NLS-1$
- protected static final String ENTRY = "ENTRY";//$NON-NLS-1$
- protected static final String SUBENTRY = "SUBENTRY";//$NON-NLS-1$
- protected static final String MESSAGE = "MESSAGE";//$NON-NLS-1$
- protected static final String STACK = "STACK";//$NON-NLS-1$
-
- protected static final String LINE_SEPARATOR;
- protected static final String TAB_STRING = "\t";//$NON-NLS-1$
- protected static final long MAXLOG_SIZE = 10000000;
- static {
- String s = System.getProperty("line.separator");//$NON-NLS-1$
- LINE_SEPARATOR = s == null ? "\n" : s;//$NON-NLS-1$
- }
- /**
- *
- */
- public CDTLogWriter(File log) {
- this.logFile = log;
- if(log.length() > MAXLOG_SIZE){
- log.delete();
- this.logFile = CCorePlugin.getDefault().getStateLocation().append(".log").toFile(); //$NON-NLS-1$
- }
- openLogFile();
- }
-
- protected void closeLogFile() throws IOException {
- try {
- if (log != null) {
- log.flush();
- log.close();
- }
- } finally {
- log = null;
- }
- }
-
- protected void openLogFile() {
- try {
- log = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile.getAbsolutePath(), true), "UTF-8"));//$NON-NLS-1$
- if (newSession) {
- writeHeader();
- newSession = false;
- }
- } catch (IOException e) {
- // there was a problem opening the log file so log to the console
- //log = logForStream(System.err);
- }
- }
- protected void writeHeader() throws IOException {
- write(SESSION);
- writeSpace();
- String date = getDate();
- write(date);
- writeSpace();
- for (int i=SESSION.length()+date.length(); i<78; i++) {
- write("-");//$NON-NLS-1$
- }
- writeln();
- }
-
- protected String getDate() {
- try {
- DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$
- return formatter.format(new Date());
- } catch (Exception e) {
- // If there were problems writing out the date, ignore and
- // continue since that shouldn't stop us from losing the rest
- // of the information
- }
- return Long.toString(System.currentTimeMillis());
- }
- protected Writer logForStream(OutputStream output) {
- try {
- return new BufferedWriter(new OutputStreamWriter(output, "UTF-8"));//$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- return new BufferedWriter(new OutputStreamWriter(output));
- }
- }
- /**
- * Writes the given string to the log, followed by the line terminator string.
- */
- protected void writeln(String s) throws IOException {
- write(s);
- writeln();
- }
- /**
- * Shuts down the log.
- */
- public synchronized void shutdown() {
- try {
- if (logFile != null) {
- closeLogFile();
- logFile = null;
- } else {
- if (log != null) {
- Writer old = log;
- log = null;
- old.flush();
- old.close();
- }
- }
- } catch (Exception e) {
- //we've shutdown the log, so not much else we can do!
- e.printStackTrace();
- }
- }
-
- protected void write(Throwable throwable) throws IOException {
- if (throwable == null)
- return;
- write(STACK);
- writeSpace();
- boolean isCoreException = throwable instanceof CoreException;
- if (isCoreException)
- writeln("1");//$NON-NLS-1$
- else
- writeln("0");//$NON-NLS-1$
- throwable.printStackTrace(new PrintWriter(log));
- if (isCoreException) {
- CoreException e = (CoreException) throwable;
- write(e.getStatus(), 0);
- }
- }
-
- public synchronized void log(IStatus status){
- try {
- this.write(status, 0);
- } catch (IOException e) {
- }
- }
- protected void write(IStatus status, int depth) throws IOException {
- if (depth == 0) {
- write(ENTRY);
- } else {
- write(SUBENTRY);
- writeSpace();
- write(Integer.toString(depth));
- }
- writeSpace();
- write(status.getPlugin());
- writeSpace();
- write(Integer.toString(status.getSeverity()));
- writeSpace();
- write(Integer.toString(status.getCode()));
- writeSpace();
- write(getDate());
- writeln();
-
- write(MESSAGE);
- writeSpace();
- writeln(status.getMessage());
-
- //Took out the stack dump - too much space
- //write(status.getException());
-
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- write(children[i], depth+1);
- }
- }
- }
-
- protected void writeln() throws IOException {
- write(LINE_SEPARATOR);
- }
- protected void write(String message) throws IOException {
- if (message != null)
- log.write(message);
- }
- protected void writeSpace() throws IOException {
- write(" ");//$NON-NLS-1$
- }
-
- public synchronized void flushLog(){
- try {
- log.flush();
- } catch (IOException e) {}
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptor.java
deleted file mode 100644
index 701a0641a50..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptor.java
+++ /dev/null
@@ -1,650 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CDescriptorEvent;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICExtension;
-import org.eclipse.cdt.core.ICExtensionReference;
-import org.eclipse.cdt.core.ICOwnerInfo;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceRuleFactory;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ProcessingInstruction;
-
-public class CDescriptor /*implements ICDescriptor */{
- private CDescriptor(){
- }
-
-// final CDescriptorManager fManager;
-// final IProject fProject;
-// private COwner fOwner;
-//
-// private HashMap extMap = new HashMap(4);
-// private HashMap extInfoMap = new HashMap(4);
-// private Document dataDoc;
-//
-// protected static final String DESCRIPTION_FILE_NAME = ".cdtproject"; //$NON-NLS-1$
-//
-// private static final String CEXTENSION_NAME = "cextension"; //$NON-NLS-1$
-//
-// private static final String PROJECT_DESCRIPTION = "cdtproject"; //$NON-NLS-1$
-// private static final String PROJECT_OWNER_ID = "id"; //$NON-NLS-1$
-// private static final String PROJECT_EXTENSION = "extension"; //$NON-NLS-1$
-// private static final String PROJECT_EXTENSION_ATTR_POINT = "point"; //$NON-NLS-1$
-// private static final String PROJECT_EXTENSION_ATTR_ID = "id"; //$NON-NLS-1$
-// private static final String PROJECT_EXTENSION_ATTRIBUTE = "attribute"; //$NON-NLS-1$
-// private static final String PROJECT_EXTENSION_ATTRIBUTE_KEY = "key"; //$NON-NLS-1$
-// private static final String PROJECT_EXTENSION_ATTRIBUTE_VALUE = "value"; //$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$
-//
-// boolean fUpdating;
-// boolean isInitializing = true;
-// boolean bDirty = false;
-//
-// protected CDescriptor(CDescriptorManager manager, IProject project, String id) throws CoreException {
-// fProject = project;
-// fManager = manager;
-// IPath projectLocation = project.getDescription().getLocation();
-//
-// if (projectLocation == null) {
-// projectLocation = getProjectDefaultLocation(project);
-// }
-// IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
-//
-// if (descriptionPath.toFile().exists()) {
-// IStatus status;
-// String ownerID = readCDTProjectFile(descriptionPath);
-// if (!ownerID.equals("")) { //$NON-NLS-1$
-// if (ownerID.equals(id)) {
-// status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_EXISTS,
-// CCorePlugin.getResourceString("CDescriptor.exception.projectAlreadyExists"), (Throwable)null); //$NON-NLS-1$
-// } else {
-// status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_MISMATCH,
-// CCorePlugin.getResourceString("CDescriptor.exception.unmatchedOwnerId") + "<requested:" +id +"/ In file:" +ownerID+">", (Throwable)null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// }
-// throw new CoreException(status);
-// }
-// }
-// fOwner = new COwner(manager.getOwnerConfiguration(id));
-// fOwner.configure(project, this);
-// isInitializing = false;
-// save();
-// }
-//
-// protected CDescriptor(CDescriptorManager manager, IProject project) throws CoreException {
-// fProject = project;
-// fManager = manager;
-// IPath projectLocation = project.getDescription().getLocation();
-//
-// if (projectLocation == null) {
-// projectLocation = getProjectDefaultLocation(project);
-// }
-// IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
-//
-// if (!descriptionPath.toFile().exists()) {
-// fOwner = new COwner(manager.getOwnerConfiguration(project));
-// fOwner.configure(project, this);
-// fManager.updateDescriptor(this);
-// } else {
-// String ownerId = readCDTProjectFile(descriptionPath);
-// fOwner = new COwner(manager.getOwnerConfiguration(ownerId));
-// }
-// isInitializing = false;
-// }
-//
-// protected CDescriptor(CDescriptorManager manager, IProject project, COwner owner) throws CoreException {
-// fProject = project;
-// fManager = manager;
-// IPath projectLocation = project.getDescription().getLocation();
-//
-// if (projectLocation == null) {
-// projectLocation = getProjectDefaultLocation(project);
-// }
-// IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
-//
-// if (descriptionPath.toFile().exists()) {
-// readCDTProjectFile(descriptionPath);
-// }
-// fOwner = owner;
-// fOwner.configure(project, this);
-// isInitializing = false;
-// save();
-// }
-//
-// private String readCDTProjectFile(IPath descriptionPath) throws CoreException {
-// String ownerID = ""; //$NON-NLS-1$
-// try {
-// DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-// Document document = parser.parse(descriptionPath.toFile());
-// NodeList nodeList = document.getElementsByTagName(PROJECT_DESCRIPTION);
-// if (nodeList != null && nodeList.getLength() > 0) {
-// Node node = nodeList.item(0);
-// if (node.hasAttributes()) {
-// ownerID = node.getAttributes().getNamedItem(PROJECT_OWNER_ID).getNodeValue();
-// }
-// readProjectDescription(node);
-// return ownerID;
-// }
-// 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.toString(), e);
-// throw new CoreException(status);
-// }
-// }
-//
-// private static IPath getProjectDefaultLocation(IProject project) {
-// return Platform.getLocation().append(project.getFullPath());
-// }
-//
-// public ICOwnerInfo getProjectOwner() {
-// return fOwner;
-// }
-//
-// public String getPlatform() {
-// return fOwner.getPlatform();
-// }
-//
-// public IProject getProject() {
-// return fProject;
-// }
-//
-// synchronized public ICExtensionReference[] get(String extensionID) {
-// CExtensionReference[] refs = (CExtensionReference[])extMap.get(extensionID);
-// if (refs == null)
-// return new ICExtensionReference[0];
-// return refs;
-// }
-//
-// synchronized public ICExtensionReference[] get(String extensionID, boolean update) throws CoreException {
-// ICExtensionReference[] refs = get(extensionID);
-// if (refs.length == 0 && update) {
-// boolean oldIsInitializing = isInitializing;
-// isInitializing = true;
-// fOwner.update(fProject, this, extensionID);
-// isInitializing = oldIsInitializing;
-// updateIfDirty();
-// refs = get(extensionID);
-// }
-// return refs;
-// }
-//
-// private CExtensionReference createRef(String extensionPoint, String extension) {
-// CExtensionReference extensions[] = (CExtensionReference[])extMap.get(extensionPoint);
-// if (extensions == null) {
-// extensions = new CExtensionReference[1];
-// extMap.put(extensionPoint, extensions);
-// } else {
-// CExtensionReference[] newExtensions = new CExtensionReference[extensions.length + 1];
-// System.arraycopy(extensions, 0, newExtensions, 0, extensions.length);
-// extensions = newExtensions;
-// extMap.put(extensionPoint, extensions);
-// }
-// extensions[extensions.length - 1] = new CExtensionReference(this, extensionPoint, extension);
-// return extensions[extensions.length - 1];
-// }
-//
-// synchronized public ICExtensionReference create(String extensionPoint, String extension) throws CoreException {
-// boolean fireEvent = false;
-// CExtensionReference extRef;
-// synchronized (this) {
-// extRef = createRef(extensionPoint, extension);
-// updateOnDisk();
-// if (!isInitializing) {
-// fireEvent = true;
-// }
-// }
-// if (fireEvent) {
-// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
-// }
-// return extRef;
-// }
-//
-// synchronized public void remove(ICExtensionReference ext) throws CoreException {
-// boolean fireEvent = false;
-// synchronized (this) {
-// CExtensionReference extensions[] = (CExtensionReference[])extMap.get(ext.getExtension());
-// for (int i = 0; i < extensions.length; i++) {
-// if (extensions[i] == ext) {
-// System.arraycopy(extensions, i, extensions, i + 1, extensions.length - 1 - i);
-// if (extensions.length > 1) {
-// CExtensionReference[] newExtensions = new CExtensionReference[extensions.length - 1];
-// System.arraycopy(extensions, 0, newExtensions, 0, newExtensions.length);
-// extMap.put(ext.getExtension(), newExtensions);
-// } else {
-// extMap.remove(ext.getExtension());
-// }
-// updateOnDisk();
-// if (!isInitializing) {
-// fireEvent = true;
-// }
-// }
-// }
-// }
-// if (fireEvent) {
-// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
-// }
-// }
-//
-// public void remove(String extensionPoint) throws CoreException {
-// boolean fireEvent = false;
-// synchronized (this) {
-// CExtensionReference extensions[] = (CExtensionReference[])extMap.get(extensionPoint);
-// if (extensions != null) {
-// extMap.remove(extensionPoint);
-// updateOnDisk();
-// if (!isInitializing) {
-// fireEvent = true;
-// }
-// }
-// }
-// if (fireEvent) {
-// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
-// }
-// }
-//
-// synchronized CExtensionInfo getInfo(CExtensionReference cProjectExtension) {
-// CExtensionInfo info = (CExtensionInfo)extInfoMap.get(cProjectExtension);
-// if (info == null) {
-// info = new CExtensionInfo();
-// extInfoMap.put(cProjectExtension, info);
-// }
-// return info;
-// }
-//
-// protected IFile getFile() {
-// return getProject().getFile(DESCRIPTION_FILE_NAME);
-// }
-//
-// void save() throws CoreException {
-// IResourceRuleFactory ruleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
-// ISchedulingRule rule;
-// IFile rscFile = getFile();
-// if (rscFile.exists()) {
-// rule = ruleFactory.modifyRule(rscFile);
-// } else {
-// rule = ruleFactory.createRule(rscFile);
-// }
-// fManager.getWorkspace().run(new IWorkspaceRunnable() {
-//
-// public void run(IProgressMonitor mon) throws CoreException {
-// String xml;
-// bDirty = false;
-// if (!fProject.isAccessible()) {
-// return;
-// }
-// fUpdating = true;
-//
-// try {
-// xml = getAsXML();
-// } catch (IOException e) {
-// IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e);
-// throw new CoreException(s);
-// } catch (TransformerException e) {
-// IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e);
-// throw new CoreException(s);
-// } catch (ParserConfigurationException e) {
-// IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e);
-// throw new CoreException(s);
-// }
-//
-// IFile rscFile = getFile();
-// InputStream inputStream;
-// try {
-// inputStream = new ByteArrayInputStream(xml.getBytes("UTF8")); //$NON-NLS-1$
-// if (rscFile.exists()) {
-// if (rscFile.isReadOnly()) {
-// // provide opportunity to checkout read-only .cdtproject file
-// fManager.getWorkspace().validateEdit(new IFile[]{rscFile}, null);
-// }
-// rscFile.setContents(inputStream, IResource.FORCE, null);
-// } else {
-// rscFile.create(inputStream, IResource.FORCE, null);
-// }
-// } catch (UnsupportedEncodingException e) {
-// IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e);
-// throw new CoreException(s);
-// }
-// fUpdating = false;
-// }
-// }, rule, IWorkspace.AVOID_UPDATE, null);
-// }
-//
-// boolean isUpdating() {
-// return fUpdating;
-// }
-//
-// void updateIfDirty() {
-// if ( bDirty ) {
-// updateOnDisk();
-// }
-// }
-//
-// synchronized void updateOnDisk() {
-// if (isUpdating()) {
-// return;
-// }
-// if (isInitializing) {
-// bDirty = true;
-// return;
-// }
-// fUpdating = true;
-// fManager.updateDescriptor(this);
-// }
-//
-// void updateFromDisk() throws CoreException {
-// COwner origOwner;
-// HashMap origExtMap;
-// HashMap origExtInfoMap;
-// Document origDataDoc;
-// synchronized (this) {
-// IPath projectLocation = fProject.getDescription().getLocation();
-//
-// if (projectLocation == null) {
-// projectLocation = getProjectDefaultLocation(fProject);
-// }
-// IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
-// if (!descriptionPath.toFile().exists()) {
-// updateOnDisk();
-// return;
-// }
-//
-// origOwner = fOwner;
-// origExtMap = extMap;
-// origExtInfoMap = extInfoMap;
-// origDataDoc = dataDoc;
-//
-// extMap = new HashMap(4);
-// extInfoMap = new HashMap(4);
-// dataDoc = null;
-//
-// try {
-// String ownerId = readCDTProjectFile(descriptionPath);
-// fOwner = new COwner(fManager.getOwnerConfiguration(ownerId));
-// } catch (CoreException e) {
-// CCorePlugin.log(e);
-// fOwner = origOwner;
-// extMap = origExtMap;
-// extInfoMap = origExtInfoMap;
-// dataDoc = origDataDoc;
-// }
-// }
-// if (!fOwner.equals(origOwner)) {
-// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.OWNER_CHANGED));
-// } else {
-// boolean extChanges = true;
-// if (extMap.size() == origExtMap.size() && extInfoMap.size() == origExtInfoMap.size()) {
-// extChanges = false;
-// Iterator entries = extMap.entrySet().iterator();
-// while (entries.hasNext()) {
-// Entry entry = (Entry)entries.next();
-// if (!origExtMap.containsKey(entry.getKey())) {
-// extChanges = true;
-// break;
-// }
-// CExtensionReference origExt[] = (CExtensionReference[])origExtMap.get(entry.getKey());
-// CExtensionReference newExt[] = (CExtensionReference[])entry.getValue();
-// if (!Arrays.equals(origExt, newExt)) {
-// extChanges = true;
-// break;
-// }
-// }
-// }
-// if (extChanges) {
-// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED,
-// CDescriptorEvent.EXTENSION_CHANGED));
-// } else {
-// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, 0));
-// }
-// }
-// }
-//
-// private void readProjectDescription(Node node) {
-// Node childNode;
-// NodeList list = node.getChildNodes();
-// for (int i = 0; i < list.getLength(); i++) {
-// childNode = list.item(i);
-// if (childNode.getNodeType() == Node.ELEMENT_NODE) {
-// if (childNode.getNodeName().equals(PROJECT_EXTENSION)) {
-// try {
-// decodeProjectExtension((Element)childNode);
-// } catch (CoreException e) {
-// CCorePlugin.log(e);
-// }
-// } else if (childNode.getNodeName().equals(PROJECT_DATA)) {
-// try {
-// decodeProjectData((Element)childNode);
-// } catch (CoreException e) {
-// CCorePlugin.log(e);
-// }
-// }
-// }
-// }
-// }
-//
-// private void decodeProjectExtension(Element element) throws CoreException {
-// String point = element.getAttribute(PROJECT_EXTENSION_ATTR_POINT);
-// String id = element.getAttribute(PROJECT_EXTENSION_ATTR_ID);
-// CExtensionReference ext = createRef(point, id);
-// 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();
-// getInfo(ext).setAttribute(attrib.getNamedItem(PROJECT_EXTENSION_ATTRIBUTE_KEY).getNodeValue(),
-// attrib.getNamedItem(PROJECT_EXTENSION_ATTRIBUTE_VALUE).getNodeValue());
-// }
-// }
-// }
-//
-// private void encodeProjectExtensions(Document doc, Element configRootElement) {
-// Element element;
-// Iterator extIterator = extMap.values().iterator();
-// while (extIterator.hasNext()) {
-// CExtensionReference extension[] = (CExtensionReference[])extIterator.next();
-// for (int i = 0; i < extension.length; i++) {
-// configRootElement.appendChild(element = doc.createElement(PROJECT_EXTENSION));
-// element.setAttribute(PROJECT_EXTENSION_ATTR_POINT, extension[i].getExtension());
-// element.setAttribute(PROJECT_EXTENSION_ATTR_ID, extension[i].getID());
-// 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(PROJECT_EXTENSION_ATTRIBUTE_KEY, (String)entry.getKey());
-// extAttributes.setAttribute(PROJECT_EXTENSION_ATTRIBUTE_VALUE, (String)entry.getValue());
-// element.appendChild(extAttributes);
-// }
-// }
-// }
-// }
-// }
-//
-// String getAsXML() throws IOException, TransformerException, ParserConfigurationException {
-// DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
-// DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
-// Document doc = docBuilder.newDocument();
-// ProcessingInstruction version = doc.createProcessingInstruction("eclipse-cdt", "version=\"2.0\""); //$NON-NLS-1$ //$NON-NLS-2$
-// doc.appendChild(version);
-// Element configRootElement = doc.createElement(PROJECT_DESCRIPTION);
-// doc.appendChild(configRootElement);
-// if (fOwner.getID().length() > 0) {
-// configRootElement.setAttribute(PROJECT_OWNER_ID, fOwner.getID());
-// }
-// encodeProjectExtensions(doc, configRootElement);
-// encodeProjectData(doc, configRootElement);
-// return serializeDocument(doc);
-// }
-//
-// protected ICExtension createExtensions(ICExtensionReference ext) throws CoreException {
-// InternalCExtension cExtension = null;
-// IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
-// IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(ext.getExtension());
-// IExtension extension = extensionPoint.getExtension(ext.getID());
-// if (extension == null) {
-// throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1,
-// CCorePlugin.getResourceString("CDescriptor.exception.providerNotFound") + ":" + ext.getID(), null)); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-// IConfigurationElement element[] = extension.getConfigurationElements();
-// for (int i = 0; i < element.length; i++) {
-// if (element[i].getName().equalsIgnoreCase(CEXTENSION_NAME)) {
-// cExtension = (InternalCExtension)element[i].createExecutableExtension("run"); //$NON-NLS-1$
-// cExtension.setExtensionReference(ext);
-// cExtension.setProject(fProject);
-// break;
-// }
-// }
-// return (ICExtension)cExtension;
-// }
-//
-// protected IConfigurationElement[] getConfigurationElement(ICExtensionReference ext) throws CoreException {
-// IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
-// IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(ext.getExtension());
-// IExtension extension = extensionPoint.getExtension(ext.getID());
-// if (extension == 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_NAME)) {
-// return element[i].getChildren();
-// }
-// }
-// return new IConfigurationElement[0];
-// }
-//
-// public synchronized Element getProjectData(String id) throws CoreException {
-// Document doc = getProjectDataDoc();
-// NodeList nodes = doc.getDocumentElement().getElementsByTagName(PROJECT_DATA_ITEM);
-// for (int i = 0; i < nodes.getLength(); ++i) {
-// Element element = (Element)nodes.item(i);
-// if (element != null && element.getAttribute(PROJECT_DATA_ID).equals(id))
-// return element;
-// }
-//
-// // Not found, make a new one
-// Element element = doc.createElement(PROJECT_DATA_ITEM);
-// element.setAttribute(PROJECT_DATA_ID, id);
-// doc.getDocumentElement().appendChild(element);
-// return element;
-// }
-//
-// public void saveProjectData() throws CoreException {
-// save();
-// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, 0));
-// }
-//
-// // The project data allows for the storage of any structured information
-// // into the cdtproject file.
-// synchronized private Document getProjectDataDoc() throws CoreException {
-// if (dataDoc == null) {
-// try {
-// dataDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
-// } catch (ParserConfigurationException e) {
-// throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR,
-// CCorePlugin.getResourceString("CDescriptor.extension.internalError"), e)); //$NON-NLS-1$
-// }
-// Element rootElem = dataDoc.createElement(PROJECT_DATA);
-// dataDoc.appendChild(rootElem);
-// }
-// return dataDoc;
-// }
-//
-// private void decodeProjectData(Element data) throws CoreException {
-// Document doc = getProjectDataDoc();
-// doc.replaceChild(doc.importNode(data, true), doc.getDocumentElement());
-// }
-//
-// private void encodeProjectData(Document doc, Element root) {
-// // Don't create or encode the doc if it isn't there already
-// if (dataDoc != null) {
-// Element dataElements = dataDoc.getDocumentElement();
-// NodeList nodes = dataElements.getElementsByTagName(PROJECT_DATA_ITEM);
-// for (int i = 0; i < nodes.getLength(); ++i) {
-// Element item = (Element)nodes.item(i);
-// if (!item.hasChildNodes()) { // remove any empty item tags
-// dataElements.removeChild(item);
-// i--; //nodeList is live.... removeal changes nodelist
-// }
-// }
-// root.appendChild(doc.importNode(dataDoc.getDocumentElement(), true));
-// }
-// }
-//
-// private String serializeDocument(Document doc) throws IOException, TransformerException {
-// ByteArrayOutputStream s = new ByteArrayOutputStream();
-//
-// TransformerFactory factory = TransformerFactory.newInstance();
-// Transformer transformer = factory.newTransformer();
-// transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
-// transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
-// transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
-//
-// DOMSource source = new DOMSource(doc);
-// StreamResult outputTarget = new StreamResult(s);
-// transformer.transform(source, outputTarget);
-//
-// return s.toString("UTF8"); //$NON-NLS-1$
-// }
-//
-// public ICConfigurationDescription getConfigurationDescription() {
-// // TODO Auto-generated method stub
-// return null;
-// }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java
deleted file mode 100644
index 8cf785df4e2..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import java.util.Map.Entry;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CDescriptorEvent;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorListener;
-import org.eclipse.cdt.core.ICDescriptorManager;
-import org.eclipse.cdt.core.ICDescriptorOperation;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-public class CDescriptorManager /*implements ICDescriptorManager, IResourceChangeListener */{
- private CDescriptorManager(){
-
- }
-//
-// Map fOperationMap = new HashMap(1);
-// Map fDescriptorMap = new HashMap();
-// Map fOwnerConfigMap = null;
-// List listeners = Collections.synchronizedList(new Vector());
-//
-// private static final COwnerConfiguration NULLCOwner = new COwnerConfiguration("", //$NON-NLS-1$
-// CCorePlugin.getResourceString("CDescriptorManager.internal_owner")); //$NON-NLS-1$
-//
-// class CDescriptorUpdater extends Job {
-//
-// CDescriptor fDescriptor;
-//
-// public CDescriptorUpdater(CDescriptor descriptor) {
-// super(CCorePlugin.getResourceString("CDescriptorManager.async_updater")); //$NON-NLS-1$
-// fDescriptor = descriptor;
-// setPriority(Job.INTERACTIVE);
-// setSystem(true);
-// setRule(descriptor.getProject());
-// }
-//
-// protected IStatus run(IProgressMonitor monitor) {
-// try {
-// fDescriptor.save();
-// } catch (CoreException e) {
-// return e.getStatus();
-// }
-// return Status.OK_STATUS;
-// }
-//
-// }
-//
-//
-// IWorkspace getWorkspace() {
-// return ResourcesPlugin.getWorkspace();
-// }
-//
-// public void shutdown() {
-// getWorkspace().removeResourceChangeListener(this);
-// }
-//
-// public void startup() throws CoreException {
-// getWorkspace().getRoot().accept(new IResourceVisitor() {
-//
-// public boolean visit(IResource resource) {
-// if (resource.getType() == IResource.PROJECT) {
-// IProject project = (IProject)resource;
-// try { // seed in memory descriptor map
-// if (project.isAccessible() && project.findMember(CDescriptor.DESCRIPTION_FILE_NAME) != null) {
-// getDescriptor(project);
-// }
-// } catch (CoreException e) {
-// CCorePlugin.log(e);
-// }
-// return false;
-// }
-// return resource.getType() == IResource.ROOT;
-// }
-// });
-// getWorkspace().addResourceChangeListener(this,
-// IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE);
-// }
-//
-// /**
-// * Watch for changes/deletions of the .cdtproject file.
-// *
-// * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
-// */
-// public void resourceChanged(IResourceChangeEvent event) {
-// if (event.getSource() instanceof IWorkspace) {
-// IResource resource = event.getResource();
-//
-// switch (event.getType()) {
-// case IResourceChangeEvent.PRE_DELETE :
-// case IResourceChangeEvent.PRE_CLOSE :
-// if (resource.getType() == IResource.PROJECT) {
-// CDescriptor descriptor = (CDescriptor)fDescriptorMap.remove(resource);
-// if (descriptor != null) {
-// fireEvent(new CDescriptorEvent(descriptor, CDescriptorEvent.CDTPROJECT_REMOVED, 0));
-// }
-// }
-// break;
-// case IResourceChangeEvent.PRE_BUILD :
-// IResourceDelta resDelta = event.getDelta();
-// if (resDelta == null) {
-// break;
-// }
-// try {
-// resDelta.accept(new IResourceDeltaVisitor() {
-//
-// public boolean visit(IResourceDelta delta) throws CoreException {
-// IResource dResource = delta.getResource();
-// if (dResource.getType() == IResource.PROJECT) {
-// if (0 != (delta.getFlags() & IResourceDelta.OPEN)) {
-// IProject project = (IProject)dResource;
-// if (project.isAccessible() && project.findMember(CDescriptor.DESCRIPTION_FILE_NAME) != null
-// && fDescriptorMap.get(project) == null) {
-// getDescriptor(project); // file on disk but not in memory...read
-// } else {
-// CDescriptor descriptor = (CDescriptor)fDescriptorMap.remove(project);
-// if (descriptor != null) {
-// fireEvent(new CDescriptorEvent(descriptor, CDescriptorEvent.CDTPROJECT_REMOVED, 0));
-// }
-// }
-// return false;
-// }
-// return true;
-// } else if (dResource.getType() == IResource.FILE) {
-// if (dResource.getName().equals(CDescriptor.DESCRIPTION_FILE_NAME)) {
-// CDescriptor descriptor = (CDescriptor)fDescriptorMap.get(dResource.getProject());
-// if (descriptor != null) {
-// if ( (delta.getKind() & IResourceDelta.REMOVED) != 0) {
-// // the file got deleted lets try
-// // and restore for memory.
-// descriptor.updateOnDisk();
-// } else if ( (delta.getFlags() & IResourceDelta.CONTENT) != 0) {
-// // content change lets try to
-// // read and update
-// descriptor.updateFromDisk();
-// }
-// }
-// return false;
-// }
-// return true;
-// }
-// return dResource.getType() == IResource.ROOT;
-// }
-// });
-// } catch (CoreException e) {
-// CCorePlugin.log(e);
-// }
-// break;
-// }
-// }
-// }
-//
-// private void initializeOwnerConfiguration() {
-// IExtensionPoint extpoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "CProject"); //$NON-NLS-1$
-// IExtension extension[] = extpoint.getExtensions();
-// fOwnerConfigMap = new HashMap(extension.length);
-// for (int i = 0; i < extension.length; i++) {
-// IConfigurationElement element[] = extension[i].getConfigurationElements();
-// for (int j = 0; j < element.length; j++) {
-// if (element[j].getName().equalsIgnoreCase("cproject")) { //$NON-NLS-1$
-// fOwnerConfigMap.put(extension[i].getUniqueIdentifier(), new COwnerConfiguration(element[j]));
-// break;
-// }
-// }
-// }
-// }
-//
-// COwnerConfiguration getOwnerConfiguration(String id) {
-// if (id.equals(NULLCOwner.getOwnerID())) { //$NON-NLS-1$
-// return NULLCOwner;
-// }
-// if (fOwnerConfigMap == null) {
-// initializeOwnerConfiguration();
-// }
-// COwnerConfiguration config = (COwnerConfiguration)fOwnerConfigMap.get(id);
-// if (config == null) { // no install owner, lets create place holder config for it.
-// config = new COwnerConfiguration(id, CCorePlugin.getResourceString("CDescriptorManager.owner_not_Installed")); //$NON-NLS-1$
-// fOwnerConfigMap.put(id, config);
-// }
-// return config;
-// }
-//
-// COwnerConfiguration getOwnerConfiguration(IProject project) throws CoreException {
-// if (fOwnerConfigMap == null) {
-// initializeOwnerConfiguration();
-// }
-// IProjectDescription description = project.getDescription();
-// String natureIDs[] = description.getNatureIds();
-// Iterator configs = fOwnerConfigMap.entrySet().iterator();
-// while (configs.hasNext()) {
-// Entry entry = (Entry)configs.next();
-// COwnerConfiguration config = (COwnerConfiguration)entry.getValue();
-// if (config.getNature() != null) {
-// if (Arrays.asList(natureIDs).lastIndexOf(config.getNature()) != -1) {
-// return config;
-// }
-// }
-// }
-// return NULLCOwner;
-// }
-//
-// synchronized public ICDescriptor getDescriptor(IProject project) throws CoreException {
-// return getDescriptor(project, true);
-// }
-//
-// synchronized public ICDescriptor getDescriptor(IProject project, boolean create) throws CoreException {
-// CDescriptor descriptor = (CDescriptor)fDescriptorMap.get(project);
-// if (descriptor == null) {
-// if (create) {
-// descriptor = new CDescriptor(this, project);
-// fDescriptorMap.put(project, descriptor);
-// } else {
-// IPath projectLocation = project.getDescription().getLocation();
-//
-// if (projectLocation == null) {
-// projectLocation = Platform.getLocation().append(project.getFullPath());
-// }
-// IPath descriptionPath = projectLocation.append(CDescriptor.DESCRIPTION_FILE_NAME);
-//
-// if (descriptionPath.toFile().exists()) {
-// descriptor = new CDescriptor(this, project);
-// fDescriptorMap.put(project, descriptor);
-// }
-// }
-// }
-// return descriptor;
-// }
-//
-// public void configure(IProject project, String id) throws CoreException {
-// CDescriptor descriptor;
-// if (id.equals(NULLCOwner.getOwnerID())) { //$NON-NLS-1$
-// IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1,
-// CCorePlugin.getResourceString("CDescriptorManager.exception.invalid_ownerID"), //$NON-NLS-1$
-// (Throwable)null);
-// throw new CoreException(status);
-// }
-// synchronized (this) {
-// descriptor = (CDescriptor)fDescriptorMap.get(project);
-// if (descriptor != null) {
-// if (descriptor.getProjectOwner().getID().equals(NULLCOwner.getOwnerID())) { //$NON-NLS-1$
-// // non owned descriptors are simply configure to the new owner no questions ask!
-// descriptor = new CDescriptor(this, project, new COwner(getOwnerConfiguration(id)));
-// } else if (!descriptor.getProjectOwner().getID().equals(id)) {
-// IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_EXISTS,
-// CCorePlugin.getResourceString("CDescriptorManager.exception.alreadyConfigured"), //$NON-NLS-1$
-// (Throwable)null);
-// throw new CoreException(status);
-// } else {
-// return; // already configured with same owner.
-// }
-// } else {
-// try {
-// descriptor = new CDescriptor(this, project, id);
-// } catch (CoreException e) { // if .cdtproject already exists we'll use that
-// IStatus status = e.getStatus();
-// if (status.getCode() == CCorePlugin.STATUS_CDTPROJECT_EXISTS) {
-// descriptor = new CDescriptor(this, project);
-// } else
-// throw e;
-// }
-// }
-// fDescriptorMap.put(project, descriptor);
-// }
-// fireEvent(new CDescriptorEvent(descriptor, CDescriptorEvent.CDTPROJECT_ADDED, 0));
-// }
-//
-// public void convert(IProject project, String id) throws CoreException {
-// CDescriptor descriptor;
-// synchronized (this) {
-// descriptor = new CDescriptor(this, project, new COwner(getOwnerConfiguration(id)));
-// fDescriptorMap.put(project, descriptor);
-// }
-// fireEvent(new CDescriptorEvent(descriptor, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.OWNER_CHANGED));
-// }
-//
-// public void addDescriptorListener(ICDescriptorListener listener) {
-// listeners.add(listener);
-// }
-//
-// public void removeDescriptorListener(ICDescriptorListener listener) {
-// listeners.remove(listener);
-// }
-//
-// protected void fireEvent(final CDescriptorEvent event) {
-// if (fOperationMap.containsKey(event.getDescriptor())) {
-// // lets just hold on to the important event in order of;
-// // ADD/REMOVE should not receive the remove but....
-// // OWNER_CHANGED
-// // EXT_CHANGED
-// // other
-// if (event.getType() == CDescriptorEvent.CDTPROJECT_ADDED) {
-// fOperationMap.put(event.getDescriptor(), event);
-// } else if (event.getType() == CDescriptorEvent.CDTPROJECT_REMOVED) {
-// fOperationMap.put(event.getDescriptor(), event);
-// } else {
-// CDescriptorEvent ev = (CDescriptorEvent)fOperationMap.get(event.getDescriptor());
-// if (ev == null) {
-// fOperationMap.put(event.getDescriptor(), event);
-// } else if ( (ev.getFlags() & event.getFlags()) != event.getFlags()) {
-// fOperationMap.put(event.getDescriptor(), new CDescriptorEvent(event.getDescriptor(), event.getType(),
-// ev.getFlags() | event.getFlags()));
-// }
-// }
-// return;
-// }
-// final ICDescriptorListener[] listener;
-// synchronized (listeners) {
-// listener = (ICDescriptorListener[])listeners.toArray(new ICDescriptorListener[listeners.size()]);
-// }
-// for (int i = 0; i < listener.length; i++) {
-// final int index = i;
-// Platform.run(new ISafeRunnable() {
-//
-// public void handleException(Throwable exception) {
-// IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1,
-// CCorePlugin.getResourceString("CDescriptorManager.exception.listenerError"), exception); //$NON-NLS-1$
-// CCorePlugin.log(status);
-// }
-//
-// public void run() throws Exception {
-// listener[index].descriptorChanged(event);
-// }
-// });
-// }
-// }
-//
-// public void runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) throws CoreException {
-// ICDescriptor descriptor = getDescriptor(project, true);
-// if (descriptor == null) {
-// throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Failed to create descriptor", null)); //$NON-NLS-1$
-// }
-// CDescriptorEvent event = null;
-// synchronized (descriptor) {
-// beginOperation(descriptor);
-// try {
-// op.execute(descriptor, monitor);
-// } finally {
-// event = endOperation(descriptor);
-// }
-// }
-// if (event != null) {
-// fireEvent(event);
-// }
-// }
-//
-// private void beginOperation(ICDescriptor descriptor) {
-// fOperationMap.put(descriptor, null);
-// }
-//
-// private CDescriptorEvent endOperation(ICDescriptor descriptor) {
-// return (CDescriptorEvent)fOperationMap.remove(descriptor);
-// }
-//
-// /*
-// * Perform a update of the ondisk .cdtproject file. This is nessecary to avoid deadlocking when the descriptor has change from a
-// * call to ICDescriptor.get(project, true) which may update the descriptor via the owner update method, while the workspace is
-// * locked (ie during a resourceChange event).
-// */
-// protected void updateDescriptor(CDescriptor descriptor) {
-// new CDescriptorUpdater(descriptor).schedule();
-// }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionDescriptor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionDescriptor.java
deleted file mode 100644
index b1522dd40d2..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionDescriptor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.ICExtensionDescriptor;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-public class CExtensionDescriptor implements ICExtensionDescriptor {
- private IConfigurationElement fElement;
- protected static final String ATTRIBUTE_ID = "id";
- protected static final String ATTRIBUTE_NAME = "name";
-
- public CExtensionDescriptor(IConfigurationElement el){
- fElement = el;
- }
-
- public String getId() {
- return fElement.getAttribute(ATTRIBUTE_ID);
- }
-
- public String getName() {
- return fElement.getAttribute(ATTRIBUTE_NAME);
- }
-
- public IConfigurationElement getConfigurationElement(){
- return fElement;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java
deleted file mode 100644
index 4106666ebfb..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.util.HashMap;
-
-public class CExtensionInfo {
-
- protected HashMap attribMap = new HashMap(4);
-
- public CExtensionInfo(){
-
- }
-
- public CExtensionInfo(CExtensionInfo base){
- attribMap.putAll(base.attribMap);
- }
-
- public HashMap getAttributes() {
- return attribMap;
- }
-
- public void setAttribute(String key, String value) {
- if (value == null) {
- attribMap.remove(key);
- } else {
- attribMap.put(key, value);
- }
- }
-
- public String getAttribute(String key) {
- return (String) attribMap.get(key);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionReference.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionReference.java
deleted file mode 100644
index 2ea8fe45c4e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionReference.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.CDescriptorEvent;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICExtension;
-import org.eclipse.cdt.core.ICExtensionReference;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-public class CExtensionReference /*implements ICExtensionReference */{
- private CExtensionReference(){
-
- }
-//
-// private CDescriptor fDescriptor;
-// private String fExtPoint;
-// private String fId;
-//
-// public CExtensionReference(CDescriptor descriptor, String extPoint, String id) {
-// fDescriptor = descriptor;
-// fExtPoint = extPoint;
-// fId = id;
-// }
-//
-// public String getExtension() {
-// return fExtPoint;
-// }
-//
-// public String getID() {
-// return fId;
-// }
-//
-// public ICDescriptor getCDescriptor() {
-// return fDescriptor;
-// }
-//
-// private CExtensionInfo getInfo() {
-// return fDescriptor.getInfo(this);
-// }
-//
-// public boolean equals(Object obj) {
-// if (obj == this) {
-// return true;
-// }
-// if (obj instanceof CExtensionReference) {
-// CExtensionReference ext = (CExtensionReference)obj;
-// if (ext.fExtPoint.equals(fExtPoint) && ext.fId.equals(fId)) {
-// return true;
-// }
-// }
-// return false;
-// }
-//
-// public int hashCode() {
-// return fExtPoint.hashCode() + fId.hashCode();
-// }
-//
-// public void setExtensionData(String key, String value) throws CoreException {
-// getInfo().setAttribute(key, value);
-// fDescriptor.updateOnDisk();
-// if (!fDescriptor.isInitializing) {
-// fDescriptor.fManager.fireEvent(new CDescriptorEvent(fDescriptor, CDescriptorEvent.CDTPROJECT_CHANGED, 0));
-// }
-// }
-//
-// public String getExtensionData(String key) {
-// return getInfo().getAttribute(key);
-// }
-//
-// public ICExtension createExtension() throws CoreException {
-// return fDescriptor.createExtensions(this);
-// }
-//
-// public IConfigurationElement[] getExtensionElements() throws CoreException {
-// return fDescriptor.getConfigurationElement(this);
-// }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwner.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwner.java
deleted file mode 100644
index 48dfca481b6..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwner.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICOwner;
-import org.eclipse.cdt.core.ICOwnerInfo;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-public class COwner implements ICOwnerInfo {
-
- final COwnerConfiguration fConfig;
-
- public COwner(COwnerConfiguration config) throws CoreException {
- fConfig = config;
- }
-
- public String getID() {
- return fConfig.getOwnerID();
- }
-
- public String getName() {
- return fConfig.getName();
- }
-
- public String getPlatform() {
- return fConfig.getPlatform();
- }
-
- void configure(IProject project, ICDescriptor cproject) throws CoreException {
- ICOwner owner = fConfig.createOwner();
- if (owner != null) {
- owner.configure(cproject);
- }
- }
-
- void update(IProject project, ICDescriptor cproject, String extensionID) throws CoreException {
- ICOwner owner = fConfig.createOwner();
- if (owner != null) {
- owner.update(cproject, extensionID);
- }
- }
-
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj instanceof COwner) {
- return ((COwner) obj).getID().equals(getID());
- }
- return false;
- }
-
- public int hashCode() {
- return getID().hashCode();
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwnerConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwnerConfiguration.java
deleted file mode 100644
index 56eeb09dc1f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwnerConfiguration.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.ICOwner;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-public class COwnerConfiguration {
-
- final IConfigurationElement fElement;
- final String fOwnerID, fName;
-
- public COwnerConfiguration(IConfigurationElement element) {
- fElement = element;
- fOwnerID = fElement.getDeclaringExtension().getUniqueIdentifier();
- fName = fElement.getDeclaringExtension().getLabel();
- }
-
- public COwnerConfiguration(String id, String name) {
- fElement = null;
- fOwnerID = id;
- fName = name;
- }
-
- public String getOwnerID() {
- return fOwnerID;
- }
-
- public String getName() {
- return fName;
- }
-
- public String getPlatform() {
- String platform = null;
- if (fElement != null) {
- platform = fElement.getAttribute("platform"); //$NON-NLS-1$
- }
- return platform == null ? "*" : platform; //$NON-NLS-1$
- }
-
- public ICOwner createOwner() throws CoreException {
- if (fElement != null) {
- return (ICOwner) fElement.createExecutableExtension("class"); //$NON-NLS-1$
- }
- return null;
- }
-
- public String getNature() {
- return fElement != null ? fElement.getAttribute("natureID") : null; //$NON-NLS-1$
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ConsoleOutputSniffer.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ConsoleOutputSniffer.java
deleted file mode 100644
index fcedffdc08c..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ConsoleOutputSniffer.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.eclipse.cdt.core.IConsoleParser;
-
-
-/**
- * Intercepts an output to console and forwards it to console parsers for processing
- *
- * @author vhirsl
- */
-public class ConsoleOutputSniffer {
-
- /*
- * Private class to sniffer the output stream for this snifffer.
- */
- private class ConsoleOutputStream extends OutputStream {
- // Stream's private buffer for the stream's read contents.
- private StringBuffer currentLine = new StringBuffer();
- private OutputStream outputStream = null;
-
- /**
- * @param consoleErrorStream
- */
- public ConsoleOutputStream(OutputStream outputStream) {
- this.outputStream = outputStream;
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- currentLine.append((char) b);
- checkLine(false);
-
- // Continue writing the bytes to the console's output.
- if (outputStream != null) {
- outputStream.write(b);
- }
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- public void write(byte[] b, int off, int len) throws IOException {
- if (b == null) {
- throw new NullPointerException();
- } else if (off != 0 || (len < 0) || (len > b.length)) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0) {
- return;
- }
- currentLine.append(new String(b, 0, len));
- checkLine(false);
-
- // Continue writing the bytes to the console's output.
- if (outputStream != null)
- outputStream.write(b, off, len);
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#close()
- */
- public void close() throws IOException {
- checkLine(true);
- closeConsoleOutputStream();
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- if (outputStream != null) {
- outputStream.flush();
- }
- }
-
- /*
- * Checks to see if the already read input constitutes
- * a complete line (e.g. does the sniffing). If so, then
- * send it to processLine.
- *
- * @param flush
- */
- private void checkLine(boolean flush) {
- String buffer = currentLine.toString();
- int i = 0;
- while ((i = buffer.indexOf('\n')) != -1) {
- String line = buffer.substring(0, i).trim(); // get rid of any trailing \r
- if (line.length() > 0)
- processLine(line);
- buffer = buffer.substring(i + 1); // skip the \n and advance
- }
- currentLine.setLength(0);
- if (flush) {
- if (buffer.length() > 0) {
- processLine(buffer);
- }
- } else {
- currentLine.append(buffer);
- }
- }
-
- } // end ConsoleOutputStream class
-
- private int nOpens = 0;
- private OutputStream consoleOutputStream;
- private OutputStream consoleErrorStream;
- private IConsoleParser[] parsers;
-
- public ConsoleOutputSniffer(IConsoleParser[] parsers) {
- this.parsers = parsers;
- }
-
- public ConsoleOutputSniffer(OutputStream outputStream, OutputStream errorStream, IConsoleParser[] parsers) {
- this(parsers);
- this.consoleOutputStream = outputStream;
- this.consoleErrorStream = errorStream;
- }
-
- /**
- * Returns an output stream that will be sniffed.
- * This stream should be hooked up so the command
- * output stream goes into here.
- *
- * @return
- */
- public OutputStream getOutputStream() {
- incNOpens();
- return new ConsoleOutputStream(consoleOutputStream);
- }
-
- /**
- * Returns an error stream that will be sniffed.
- * This stream should be hooked up so the command
- * error stream goes into here.
- *
- * @return
- */
- public OutputStream getErrorStream() {
- incNOpens();
- return new ConsoleOutputStream(consoleErrorStream);
- }
-
- private synchronized void incNOpens() {
- nOpens++;
- }
-
- /*
- */
- public synchronized void closeConsoleOutputStream() throws IOException {
- if (nOpens > 0 && --nOpens == 0) {
- for (int i = 0; i < parsers.length; ++i) {
- parsers[i].shutdown();
- }
- }
- }
-
- /*
- * Processes the line by passing the line to the parsers.
- *
- * @param line
- */
- private synchronized void processLine(String line) {
- for (int i = 0; i < parsers.length; ++i) {
- parsers[i].processLine(line);
- }
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/InternalCExtension.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/InternalCExtension.java
deleted file mode 100644
index e7cd974aad6..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/InternalCExtension.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.ICExtensionReference;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.PlatformObject;
-
-public abstract class InternalCExtension extends PlatformObject {
-
- private IProject fProject;
- private ICExtensionReference extensionRef;
-
- protected void setProject(IProject project) {
- fProject = project;
- }
-
- void setExtensionReference(ICExtensionReference extReference) {
- extensionRef = extReference;
- }
-
- protected IProject getProject() {
- return fProject;
- }
-
- protected ICExtensionReference getExtensionReference() {
- return extensionRef;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java
deleted file mode 100644
index 0dd51fc88d3..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * QNX Software Systems - Initial API and implementation
- * Markus Schorn (Wind River Systems)
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.resources.IPathEntryVariableChangeListener;
-import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
-import org.eclipse.cdt.core.resources.PathEntryVariableChangeEvent;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.SafeRunner;
-
-
-
-/**
- * Core's implementation of IPathEntryVariableManager.
- */
-public class PathEntryVariableManager implements IPathEntryVariableManager {
-
- private Set listeners;
- private Preferences preferences;
-
- static final String VARIABLE_PREFIX = "pathEntryVariable."; //$NON-NLS-1$
-
- /**
- * Constructor for the class.
- */
- public PathEntryVariableManager() {
- this.listeners = Collections.synchronizedSet(new HashSet());
- this.preferences = CCorePlugin.getDefault().getPluginPreferences();
- }
-
- /**
- * Note that if a user changes the key in the preferences file to be invalid
- * and then calls #getValue using that key, they will get the value back for
- * that. But then if they try and call #setValue using the same key it will throw
- * an exception. We may want to revisit this behaviour in the future.
- *
- * @see org.eclipse.core.resources.IPathEntryVariableManager#getValue(String)
- */
- public IPath getValue(String varName) {
- String key = getKeyForName(varName);
- String value = preferences.getString(key);
- return value.length() == 0 ? null : Path.fromPortableString(value);
- }
-
- /**
- * @see org.eclipse.core.resources.IPathEntryVariableManager#setValue(String, IPath)
- */
- public void setValue(String varName, IPath newValue) throws CoreException {
- //if the location doesn't have a device, see if the OS will assign one
- if (newValue != null && newValue.isAbsolute() && newValue.getDevice() == null) {
- newValue = new Path(newValue.toFile().getAbsolutePath());
- }
- int eventType;
- // read previous value and set new value atomically in order to generate the right event
- synchronized (this) {
- IPath currentValue = getValue(varName);
- boolean variableExists = currentValue != null;
- if (!variableExists && newValue == null) {
- return;
- }
- if (variableExists && currentValue.equals(newValue)) {
- return;
- }
- if (newValue == null) {
- preferences.setToDefault(getKeyForName(varName));
- eventType = PathEntryVariableChangeEvent.VARIABLE_DELETED;
- } else {
- preferences.setValue(getKeyForName(varName), newValue.toPortableString());
- eventType = variableExists ? PathEntryVariableChangeEvent.VARIABLE_CHANGED : PathEntryVariableChangeEvent.VARIABLE_CREATED;
- }
- }
- // notify listeners from outside the synchronized block to avoid deadlocks
- fireVariableChangeEvent(varName, newValue, eventType);
- }
-
- /**
- * Return a key to use in the Preferences.
- */
- private String getKeyForName(String varName) {
- return VARIABLE_PREFIX + varName;
- }
-
- /**
- * @see org.eclipse.core.resources.IPathEntryVariableManager#resolvePath(IPath)
- */
- public IPath resolvePath(IPath path) {
- if (path == null || path.segmentCount() == 0) {
- return path;
- }
- String variable = path.toPortableString();
- if (variable.indexOf('$') == -1) {
- return path;
- }
- String value = expandVariable(variable);
- return (value == null || value.length() == 0) ? Path.EMPTY : new Path(value);
- }
-
- /**
- * Fires a property change event corresponding to a change to the
- * current value of the variable with the given name.
- *
- * @param name the name of the variable, to be used as the variable
- * in the event object
- * @param value the current value of the path variable or <code>null</code> if
- * the variable was deleted
- * @param type one of <code>IPathVariableChangeEvent.VARIABLE_CREATED</code>,
- * <code>PathEntryVariableChangeEvent.VARIABLE_CHANGED</code>, or
- * <code>PathEntryVariableChangeEvent.VARIABLE_DELETED</code>
- * @see PathEntryVariableChangeEvent
- * @see PathEntryVariableChangeEvent#VARIABLE_CREATED
- * @see PathEntryVariableChangeEvent#VARIABLE_CHANGED
- * @see PathEntryVariableChangeEvent#VARIABLE_DELETED
- */
- private void fireVariableChangeEvent(String name, IPath value, int type) {
- if (this.listeners.size() == 0)
- return;
- // use a separate collection to avoid interference of simultaneous additions/removals
- Object[] listenerArray = this.listeners.toArray();
- final PathEntryVariableChangeEvent pve = new PathEntryVariableChangeEvent(this, name, value, type);
- for (int i = 0; i < listenerArray.length; ++i) {
- final IPathEntryVariableChangeListener l = (IPathEntryVariableChangeListener) listenerArray[i];
- ISafeRunnable job = new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // already being logged in Platform#run()
- }
-
- public void run() throws Exception {
- l.pathVariableChanged(pve);
- }
- };
- SafeRunner.run(job);
- }
- }
-
- /**
- * @see org.eclipse.core.resources.IPathVariableManager#getPathVariableNames()
- */
- public String[] getVariableNames() {
- List result = new LinkedList();
- String[] names = preferences.propertyNames();
- for (int i = 0; i < names.length; i++) {
- if (names[i].startsWith(VARIABLE_PREFIX)) {
- String key = names[i].substring(VARIABLE_PREFIX.length());
- result.add(key);
- }
- }
- return (String[]) result.toArray(new String[result.size()]);
- }
-
- /**
- * @see org.eclipse.core.resources.
- * IPathEntryVariableManager#addChangeListener(IPathEntryVariableChangeListener)
- */
- public void addChangeListener(IPathEntryVariableChangeListener listener) {
- listeners.add(listener);
- }
-
- /**
- * @see org.eclipse.core.resources.
- * IPathEntryVariableManager#removeChangeListener(IPathEntryVariableChangeListener)
- */
- public void removeChangeListener(IPathEntryVariableChangeListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * @see org.eclipse.core.resources.IPathVariableManager#isDefined(String)
- */
- public boolean isDefined(String varName) {
- return getValue(varName) != null;
- }
-
- public void startup() {
- }
-
- public void shutdown() {
- }
-
- /**
- * Expand the variable with the format ${key}. example:
- * with variable HOME=/foobar
- * ${HOME}/project
- * The the return value will be /foobar/project.
- */
- protected String expandVariable(String variable) {
- StringBuffer sb = new StringBuffer();
- StringBuffer param = new StringBuffer();
- char prev = '\n';
- char ch = prev;
- boolean inMacro = false;
- boolean inSingleQuote = false;
-
- for (int i = 0; i < variable.length(); i++) {
- ch = variable.charAt(i);
- switch (ch) {
- case '\'':
- if (prev != '\\') {
- inSingleQuote = !inSingleQuote;
- }
- break;
-
- case '$' :
- if (!inSingleQuote && prev != '\\') {
- if (i < variable.length() && variable.indexOf('}', i) > 0) {
- char c = variable.charAt(i + 1);
- if (c == '{') {
- param.setLength(0);
- inMacro = true;
- prev = ch;
- continue;
- }
- }
- }
- break;
-
- case '}' :
- if (inMacro) {
- inMacro = false;
- String p = param.toString();
- IPath path = getValue(p);
- if (path != null) {
- String v = path.toPortableString();
- if (v != null) {
- sb.append(v);
- }
- }
- param.setLength(0);
- /* Skip the trailing } */
- prev = ch;
- continue;
- }
- break;
- } /* switch */
-
- if (!inMacro) {
- sb.append(ch);
- } else {
- /* Do not had the '{' */
- if (!(ch == '{' && prev == '$')) {
- param.append(ch);
- }
- }
- prev = (ch == '\\' && prev == '\\') ? '\n' : ch;
- } /* for */
- return sb.toString();
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java
deleted file mode 100644
index b2889bcc244..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.IDynamicVariable;
-import org.eclipse.core.variables.IDynamicVariableResolver;
-
-public class PathEntryVariableResolver implements IDynamicVariableResolver {
-
- public PathEntryVariableResolver() {
- super();
- }
-
- public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
- if (argument == null) {
- throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR, CCorePlugin.getResourceString("PathEntryVariableResolver.0"), null)); //$NON-NLS-1$
- }
- IPathEntryVariableManager manager = CCorePlugin.getDefault().getPathEntryVariableManager();
- IPath path = manager.getValue(argument);
- if (path == null) {
- path = Path.EMPTY;
- }
- return path.toPortableString();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTracker.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTracker.java
deleted file mode 100644
index feefb5b9815..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTracker.java
+++ /dev/null
@@ -1,601 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-import java.io.PrintStream;
-
-import org.eclipse.cdt.core.IPositionConverter;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-
-/**
- * Tracks changes made to a text buffer, to afterwards recalculate positions.
- * @author markus.schorn@windriver.com
- */
-public class PositionTracker implements IPositionConverter {
- private static final int MEMORY_SIZE = 48;
- private static final int NODE_MEMORY_SIZE= 32;
-
- private Node fAboveRoot = new Node(0, 0, 0);
- private PositionTracker fFollowedBy = null;
- private long fTimeStamp;
-
- /**
- * Resets the tracker to a state reflecting no changes.
- */
- public synchronized void clear() {
- fAboveRoot = new Node(0, 0, 0);
- fFollowedBy = null;
- }
-
- /**
- * Undo the retirement to make this the head of a tracker chain again.
- */
- synchronized void revive() {
- fFollowedBy = null;
- }
-
- /**
- * Notifies the tracker of the insertion of characters.
- * It is assumed that character get inserted before the offset.
- * @param offset offset of the character in front of which insertion occurs.
- * @param count amount of characters inserted.
- */
- public synchronized void insert(int offset, int count) {
- assert fFollowedBy == null;
- assert offset >= 0;
- if (count == 0 || offset < 0) {
- return;
- }
- fAboveRoot.addChars(offset, count, 0);
- }
-
- /**
- * Notifies the tracker of the removal of characters.
- * delete(0,1) removes the first character,
- * for convenience delete(1,-1) does the same.
- * @param offset offset of the first character deleted.
- * @param count amount of characters deleted.
- */
- public synchronized void delete(int offset, int count) {
- assert fFollowedBy == null;
- assert offset >= 0;
- if (count < 0) {
- delete(offset + count, -count);
- }
- else {
- if (count == 0 || offset < 0) {
- return;
- }
- fAboveRoot.removeChars(offset, count, 0, true);
- }
- }
-
- /**
- * Calculates the position in the original unmodified text.
- * @param currentOffset position in the modified text.
- * @return position in the unmodified text.
- */
- public synchronized int historicOffset(int currentOffset) {
- return historicOffset(currentOffset, true);
- }
-
- private synchronized int historicOffset(int currentOffset, boolean nextOnDelete) {
- int orig = currentOffset;
- if (fFollowedBy != null) {
- orig = fFollowedBy.historicOffset(orig, nextOnDelete);
- }
- orig = fAboveRoot.calculateOriginalOffset(orig, 0, nextOnDelete);
- return orig;
- }
-
- /**
- * Calculates the position in the modified text.
- * @param historicOffset position in the unmodified text.
- * @return position in the modified text.
- */
- public synchronized int currentOffset(int historicOffset) {
- return currentOffset(historicOffset, true);
- }
-
- private synchronized int currentOffset(int historicOffset, boolean nextOnDelete) {
- int current = fAboveRoot.calculateCurrentOffset(historicOffset, 0, nextOnDelete);
- if (fFollowedBy != null) {
- current = fFollowedBy.currentOffset(current, nextOnDelete);
- }
- return current;
- }
-
- /**
- * Makes this tracker final. Future changes are tracked by the tracker
- * supplied and will be taken into acoount when converting positions.
- * @param inFavourOf tracker that tracks changes from now on.
- */
- public synchronized void retire(PositionTracker inFavourOf) {
- assert fFollowedBy == null;
- fFollowedBy = inFavourOf;
- }
-
- /**
- * For the purpose of testing.
- */
- public synchronized void print(PrintStream out) {
- fAboveRoot.print(0, out, 0);
- }
-
- /**
- * For the purpose of testing.
- */
- public synchronized int depth() {
- return fAboveRoot.depth() - 1;
- }
-
- public synchronized boolean isModified() {
- return fAboveRoot.fLeft != null || fAboveRoot.fRight!=null;
- }
-
- public synchronized long getTimeStamp() {
- return fTimeStamp;
- }
-
- public synchronized void setTimeStamp(long timeStamp) {
- fTimeStamp = timeStamp;
- }
-
- public synchronized long getRetiredTimeStamp() {
- if (fFollowedBy == null) {
- return Long.MAX_VALUE;
- }
- return fFollowedBy.getTimeStamp();
- }
-
- public synchronized int getMemorySize() {
- return MEMORY_SIZE + NODE_MEMORY_SIZE * countNodes();
- }
-
- private synchronized int countNodes() {
- return fAboveRoot.countNodes();
- }
-
- public synchronized IRegion actualToHistoric(IRegion actualPosition) {
- int actual= actualPosition.getOffset();
- int len= actualPosition.getLength();
-
- int historic= historicOffset(actual, true);
- if (len > 0) {
- len= historicOffset(actual+len-1, false) - historic + 1;
- }
- assert len >= 0;
- return new Region(historic, len);
- }
-
- public synchronized IRegion historicToActual(IRegion historicPosition) {
- int historic= historicPosition.getOffset();
- int len= historicPosition.getLength();
-
- int actual= currentOffset(historic, true);
- if (len > 0) {
- len= currentOffset(historic+len-1, false) - actual + 1;
- }
- assert len >= 0;
- return new Region(actual, len);
- }
-
- /**
- * Nodes implementing a red black binary tree.
- * @author markus.schorn@windriver.com
- */
- private static class Node {
- private static final boolean RED = true;
- private static final boolean BLACK = false;
-
- private int fDeltaPos2; // sum of this and pos2 of parent yields pos2.
- private int fPos1;
- private int fChange; // lenght of text change (+ add, - remove)
-
- private boolean fColor;
- private Node fLeft;
- private Node fRight;
- private Node fParent;
-
- Node(int pos1, int deltaPos2, int change) {
- fDeltaPos2 = deltaPos2;
- fPos1 = pos1;
- fChange = change;
- fLeft = fRight = fParent = null;
- fColor = RED;
- }
-
- int depth() {
- if (fLeft == null) {
- if (fRight == null) {
- return 1;
- }
- return fRight.depth() + 1;
- }
- if (fRight == null) {
- return fLeft.depth() + 1;
- }
- return StrictMath.max(fLeft.depth(), fRight.depth()) + 1;
- }
-
- // forward calculation
- int calculateCurrentOffset(int value1, int parentPos2, boolean nextOnDelete) {
- int fPos2 = parentPos2 + fDeltaPos2;
- int rel1 = value1 - fPos1;
-
- // is value ahead of this change?
- if (rel1 < 0) {
- if (fLeft != null) {
- return fLeft.calculateCurrentOffset(value1, fPos2, nextOnDelete);
- }
-
- // value is directly ahead of this change.
- return rel1 + fPos2;
- }
-
- // is value deleted by this?
- if (rel1 < -fChange) {
- return nextOnDelete ? fPos2 : fPos2-1;
- }
-
- // value is after this change.
- if (fRight != null) {
- return fRight.calculateCurrentOffset(value1, fPos2, nextOnDelete);
- }
-
- // value is directly after this change.
- return rel1 + fPos2 + fChange;
- }
-
- // backward calculation
- int calculateOriginalOffset(int value2, int parentPos2, boolean nextOnDelete) {
- int fPos2 = parentPos2 + fDeltaPos2;
- int rel2 = value2 - fPos2;
-
- // is value ahead of this change?
- if (rel2 < 0) {
- if (fLeft != null) {
- return fLeft.calculateOriginalOffset(value2, fPos2, nextOnDelete);
- }
-
- // value is directly ahead of this change.
- return rel2 + fPos1;
- }
-
- // is value added by this?
- if (rel2 < fChange) {
- return nextOnDelete ? fPos1 : fPos1-1;
- }
-
- // offset is behind this change.
- if (fRight != null) {
- return fRight.calculateOriginalOffset(value2, fPos2, nextOnDelete);
- }
-
- // offset is directly behind this change.
- return rel2 + fPos1 - fChange;
- }
-
- void addChars(int value2, int add, int fPos2) {
- int rel2 = value2 - fPos2;
-
- if (fParent != null) {
- fParent.balance(); // this may change both the parent and fDeltaPos2;
- }
-
- // added ahead of this change?
- if (rel2 < 0) {
- fDeltaPos2 += add; // advance
- if (fLeft != null) {
- int childPos2 = fPos2 + fLeft.fDeltaPos2;
- fLeft.fDeltaPos2 -= add; // unadvance
- fLeft.addChars(value2, add, childPos2); // use modified parent pos
- return;
- }
-
- addLeft(rel2 + fPos1, rel2 - add, add); // modify delta pos
- return;
- }
-
- // added inside range of another change?
- int range2 = (fChange > 0) ? fChange : 0;
- if (rel2 <= range2 && !isHolder()) {
- fChange += add;
- // insert in a deletion at the end
- if (fChange<=0) {
- fPos1+= add;
- fDeltaPos2+= add;
- if (fLeft != null) {
- fLeft.fDeltaPos2 -= add;
- }
- }
- else if (fRight != null) {
- fRight.fDeltaPos2 += add; // advance right branch
- }
- return;
- }
-
- // added behind this change.
- if (fRight != null) {
- fRight.addChars(value2, add, fPos2 + fRight.fDeltaPos2);
- return;
- }
-
- // added directly behind this change
- addRight(rel2 + fPos1 - fChange, rel2, add);
- }
-
- boolean removeChars(int firstChar2, int remove, int fPos2, boolean mustRemove) {
- int relFirstChar2 = firstChar2 - fPos2;
- int relAfterLastChar2 = relFirstChar2 + remove;
-
- // no insertion - no balancing
- if (mustRemove && fParent != null) {
- fParent.balance();
- }
-
- // ahead and no merge possible
- if (relAfterLastChar2 < 0) {
- fDeltaPos2 -= remove; // advance
- if (fLeft != null) {
- fLeft.fDeltaPos2 += remove; // unadvance
- return fLeft.removeChars(firstChar2, remove, fPos2 - remove + fLeft.fDeltaPos2, mustRemove);
- }
-
- if (mustRemove) {
- addLeft(relFirstChar2 + fPos1, relFirstChar2 + remove, -remove);
- return true;
- }
- return false;
- }
-
- // behind and no merge possible
- int range2 = (fChange > 0) ? fChange : 0;
- if (relFirstChar2 > range2 || isHolder()) {
- if (fRight != null) {
- fRight.removeChars(firstChar2, remove, fPos2 + fRight.fDeltaPos2, mustRemove);
- return true;
- }
-
- if (mustRemove) {
- addRight(relFirstChar2 + fPos1 - fChange, relFirstChar2, -remove);
- return true;
- }
- return false;
- }
-
- int delAbove = 0;
- if (relFirstChar2 < 0) {
- delAbove = -relFirstChar2;
- }
- int delBelow = relAfterLastChar2 - range2;
- if (delBelow < 0) {
- delBelow = 0;
- }
- int delInside = remove - delAbove - delBelow;
-
- // delegate above to left children
- if (delAbove > 0 && fLeft != null) {
- if (fLeft.removeChars(firstChar2, delAbove, fPos2 + fLeft.fDeltaPos2, false)) {
- fDeltaPos2 -= delAbove;
- fLeft.fDeltaPos2 += delAbove;
- fPos2 -= delAbove;
- delAbove = 0;
- }
- }
- // delegate below to right children
- if (delBelow > 0 && fRight != null) {
- if (fRight.removeChars(fPos2 + range2, delBelow, fPos2 + fRight.fDeltaPos2, false)) {
- delBelow = 0;
- }
- }
-
- // do the adjustments in this node
- fChange -= delAbove + delInside + delBelow;
- fDeltaPos2 -= delAbove;
- fPos1 -= delAbove;
- assert fPos1 >= 0;
-
- if (fLeft != null) {
- fLeft.fDeltaPos2 += delAbove; // lhs is unaffected, undo
- }
- if (fRight != null) {
- fRight.fDeltaPos2 -= delInside; // rhs is additionally affected.
- }
- return true;
- }
-
- private void balance() {
- if (fParent == null) {
- if (fRight != null) {
- fRight.fColor = BLACK;
- }
- return;
- }
- Node grandParent = fParent.fParent;
- if (fLeft == null || fRight == null) {
- return;
- }
-
- if (fLeft.isRed() && fRight.isRed()) {
- fLeft.fColor = fRight.fColor = BLACK;
- if (grandParent != null) {
- fColor = RED;
- if (fParent.isRed()) {
- rotateAround(grandParent);
- }
- }
- }
- }
-
- private void rotateAround(Node grandParent) {
- if (grandParent.fLeft == fParent) {
- rotateRightAround(grandParent);
- } else {
- rotateLeftAround(grandParent);
- }
- }
-
- private void rotateRightAround(Node grandParent) {
- if (fParent.fLeft == this) {
- grandParent.rotateRight();
- fParent.fColor = BLACK;
- fParent.fRight.fColor = RED;
- } else {
- fParent.rotateLeft();
- grandParent.rotateRight();
- fColor = BLACK;
- grandParent.fColor = RED;
- }
- }
-
- private void rotateLeftAround(Node grandParent) {
- if (fParent.fRight == this) {
- grandParent.rotateLeft();
- fParent.fColor = BLACK;
- fParent.fLeft.fColor = RED;
- } else {
- fParent.rotateRight();
- grandParent.rotateLeft();
- fColor = BLACK;
- grandParent.fColor = RED;
- }
- }
-
- private void rotateRight() {
- assert fLeft != null;
-
- Node root = this;
- Node left = fLeft;
- Node leftRight = left.fRight;
-
- int rootAbove = root.fDeltaPos2;
- int aboveLeft = -root.fDeltaPos2 - left.fDeltaPos2;
- int leftRoot = left.fDeltaPos2;
-
- // put under old parent
- if (fParent.fLeft == this) {
- fParent.putLeft(left);
- } else {
- fParent.putRight(left);
- }
- left.fDeltaPos2 += rootAbove;
-
- // change the right node
- left.putRight(root);
- root.fDeltaPos2 += aboveLeft;
-
- // change left of right node.
- root.putLeft(leftRight);
- if (leftRight != null) {
- leftRight.fDeltaPos2 += leftRoot;
- }
- }
-
- private void rotateLeft() {
- assert fRight != null;
-
- Node root = this;
- Node right = fRight;
- Node rightLeft = right.fLeft;
-
- int rootAbove = root.fDeltaPos2;
- int parentRight = -root.fDeltaPos2 - right.fDeltaPos2;
- int rightRoot = right.fDeltaPos2;
-
- // put under old parent
- if (fParent.fRight == this) {
- fParent.putRight(right);
- } else {
- fParent.putLeft(right);
- }
- right.fDeltaPos2 += rootAbove;
-
- // change the left node
- right.putLeft(root);
- root.fDeltaPos2 += parentRight;
-
- // change right of left node.
- root.putRight(rightLeft);
- if (rightLeft != null) {
- rightLeft.fDeltaPos2 += rightRoot;
- }
- }
-
- private boolean isRed() {
- return fColor == RED;
- }
-
- private void putLeft(Node add) {
- fLeft = add;
- if (fLeft != null) {
- fLeft.fParent = this;
- }
- }
-
- private void putRight(Node add) {
- fRight = add;
- if (fRight != null) {
- fRight.fParent = this;
- }
- }
-
- private void addLeft(int pos1, int pos2, int change) {
- fLeft = new Node(pos1, pos2, change);
- fLeft.fParent = this;
- if (isHolder()) {
- assert false;
- } else if (isRed()) {
- fLeft.rotateAround(fParent);
- }
- }
-
- private boolean isHolder() {
- return fParent == null;
- }
-
- private void addRight(int pos1, int pos2, int change) {
- fRight = new Node(pos1, pos2, change);
- fRight.fParent = this;
- if (isHolder()) {
- fRight.fColor = BLACK;
- } else if (isRed()) {
- fRight.rotateAround(fParent);
- }
- }
-
- public void print(int i, PrintStream out, int parentOffset) {
- parentOffset += fDeltaPos2;
- if (fRight != null) {
- fRight.print(i + 1, out, parentOffset);
- }
- for (int j = 0; j < i; j++)
- out.print(" "); //$NON-NLS-1$
- out.println(fPos1 + "<->" + parentOffset + " : " + fChange + (fColor ? " // red" : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- if (fLeft != null) {
- fLeft.print(i + 1, out, parentOffset);
- }
- }
-
- public int countNodes() {
- int count= 1;
- if (fLeft != null) {
- count += fLeft.countNodes();
- }
- if (fRight != null) {
- count += fRight.countNodes();
- }
- return count;
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java
deleted file mode 100644
index 193384e3bcd..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.ListIterator;
-
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-
-class PositionTrackerChain implements IDocumentListener {
- public static final int LINKED_LIST_SIZE = 64;
- public static final int LINKED_LIST_ENTRY_SIZE = 32;
- public static int MEMORY_SIZE= 32 + LINKED_LIST_SIZE;
-
- private static final int MAX_DEPTH = 100; // 100 saves
- private static final long MAX_AGE = 24 * 60 * 60 * 1000; // one day
-
- private LinkedList fTrackers= new LinkedList();
- private PositionTracker fActiveTracker;
- private IDocument fDocument;
-
- public PositionTrackerChain(long timestamp) {
- createCheckpoint(timestamp);
- }
-
- public int createCheckpoint(long timestamp) {
- // travel in time
- while (fActiveTracker != null && fActiveTracker.getTimeStamp() >= timestamp) {
- fTrackers.removeLast();
- if (fTrackers.isEmpty()) {
- fActiveTracker= null;
- }
- else {
- fActiveTracker= (PositionTracker) fTrackers.getLast();
- fActiveTracker.revive();
- }
- }
-
- int retiredMemsize= 0;
- PositionTracker newTracker= new PositionTracker();
- newTracker.setTimeStamp(timestamp);
- fTrackers.add(newTracker);
-
- if (fActiveTracker != null) {
- fActiveTracker.retire(newTracker);
- retiredMemsize= fActiveTracker.getMemorySize() + LINKED_LIST_ENTRY_SIZE;
- }
- fActiveTracker= newTracker;
- checkTrackerLimits();
- return retiredMemsize;
- }
-
- private void checkTrackerLimits() {
- while (fTrackers.size() >= MAX_DEPTH) {
- fTrackers.removeFirst();
- }
- long minTimeStamp= fActiveTracker.getTimeStamp() - MAX_AGE;
- for (Iterator iter = fTrackers.iterator(); iter.hasNext();) {
- PositionTracker tracker= (PositionTracker) iter.next();
- if (tracker.getRetiredTimeStamp() >= minTimeStamp) {
- break;
- }
- iter.remove();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IPositionUpdater#update(org.eclipse.jface.text.DocumentEvent)
- */
- private void update(DocumentEvent event) {
- String text = event.getText();
- int insertLen = text != null ? text.length() : 0;
- update(event.getOffset(), event.getLength(), insertLen);
- }
-
- void update(int offset, int deleteLen, int insertLen) {
- if (insertLen > deleteLen) {
- fActiveTracker.insert(offset + deleteLen, insertLen - deleteLen);
- } else if (insertLen < deleteLen) {
- fActiveTracker.delete(offset+insertLen, deleteLen - insertLen);
- }
- }
-
- /**
- * Find the nearest tracker created at or after the given time.
- * @param timestamp in milliseconds.
- * @return the tracker nearest to the timestamp, <code>null</code> if all were created before.
- */
- public PositionTracker findTrackerAtOrAfter(long timestamp) {
- PositionTracker candidate= null;
- for (ListIterator iter = fTrackers.listIterator(fTrackers.size()); iter.hasPrevious();) {
- PositionTracker tracker = (PositionTracker) iter.previous();
- long trackerTimestamp= tracker.getTimeStamp();
- if (trackerTimestamp >= timestamp) {
- candidate= tracker;
- }
- else {
- break;
- }
- }
- return candidate;
- }
-
- /**
- * Find the tracker created at the given time.
- * @param timestamp in milliseconds.
- * @return the tracker at the timestamp, <code>null</code> if none created at the given time.
- */
- public PositionTracker findTrackerAt(long timestamp) {
- for (ListIterator iter = fTrackers.listIterator(fTrackers.size()); iter.hasPrevious();) {
- PositionTracker tracker = (PositionTracker) iter.previous();
- long trackerTimestamp= tracker.getTimeStamp();
- if (trackerTimestamp == timestamp) {
- return tracker;
- }
- if (trackerTimestamp < timestamp) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * Destroy the tracker.
- */
- public void dispose() {
- stopTracking();
- fTrackers= null;
- fActiveTracker= null;
- }
-
- public void startTracking(IDocument doc) {
- stopTracking();
- fDocument= doc;
- if (fDocument != null) {
- fDocument.addDocumentListener(this);
- }
- }
-
- public void stopTracking() {
- if (fDocument != null) {
- fDocument.removeDocumentListener(this);
- fDocument= null;
- }
- }
-
- public void documentAboutToBeChanged(DocumentEvent event) {
- update(event);
- }
-
- public void documentChanged(DocumentEvent event) {
- // react before updateing the document
- }
-
- public IDocument getCurrentDocument() {
- return fDocument;
- }
-
- public PositionTracker getActiveTracker() {
- return fActiveTracker;
- }
-
- public boolean isModified() {
- return fTrackers.size() > 1 || fActiveTracker.isModified();
- }
-
- public int getMemorySize() {
- int size= MEMORY_SIZE;
- for (Iterator iter = fTrackers.iterator(); iter.hasNext();) {
- PositionTracker tracker = (PositionTracker) iter.next();
- size+= LINKED_LIST_ENTRY_SIZE;
- size+= tracker.getMemorySize();
- }
- return size;
- }
-
- public int removeOldest() {
- int memdiff= 0;
- if (fTrackers.size() > 1) {
- PositionTracker tracker= (PositionTracker) fTrackers.removeFirst();
- memdiff= tracker.getMemorySize() + LINKED_LIST_ENTRY_SIZE;
- tracker.clear();
- }
- return -memdiff;
- }
-
- public long getOldestRetirement() {
- if (fTrackers.size() > 1) {
- PositionTracker tracker= (PositionTracker) fTrackers.getFirst();
- return tracker.getRetiredTimeStamp();
- }
- return Long.MAX_VALUE;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java
deleted file mode 100644
index 7adf0b156dd..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.eclipse.cdt.core.IPositionConverter;
-import org.eclipse.cdt.core.IPositionTrackerManager;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.IFileBuffer;
-import org.eclipse.core.filebuffers.IFileBufferListener;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-
-public class PositionTrackerManager implements IPositionTrackerManager, IFileBufferListener {
- private static final int HASHMAP_ENTRY_SIZE = 56;
- private static final int MAX_MEMORY= 1024*512; // 512 kbytes
- private static final int MAX_MEMORY_AFTER_CLEANUP= (MAX_MEMORY * 7) / 10; // 70% of MAX_MEMORY
-
- private static PositionTrackerManager sManager= new PositionTrackerManager();
- public static PositionTrackerManager getInstance() {
- return sManager;
- }
-
- private int fMemoryCounter= 0;
- private int fInstalled= 0;
- private HashMap fPositionTrackerMap;
-
- private PositionTrackerManager() {
- fPositionTrackerMap= new HashMap();
- }
-
- public synchronized void install() {
- if (++fInstalled == 1) {
- ITextFileBufferManager mgr= FileBuffers.getTextFileBufferManager();
- mgr.addFileBufferListener(this);
- }
- }
-
- public synchronized void uninstall() {
- if (--fInstalled == 0) {
- FileBuffers.getTextFileBufferManager().removeFileBufferListener(this);
- fPositionTrackerMap.clear();
- fMemoryCounter= 0;
- }
- }
-
- public void bufferCreated(IFileBuffer buffer) {
- if (buffer instanceof ITextFileBuffer) {
- createCheckpoint((ITextFileBuffer) buffer);
- }
- }
-
- public void bufferDisposed(IFileBuffer buffer) {
- if (buffer instanceof ITextFileBuffer) {
- resetToLastCheckpoint((ITextFileBuffer) buffer);
- }
- }
-
- public void dirtyStateChanged(IFileBuffer buffer, boolean isDirty) {
- if (!isDirty && buffer instanceof ITextFileBuffer) {
- createCheckpoint((ITextFileBuffer) buffer);
- }
- }
-
- public void stateValidationChanged(IFileBuffer buffer, boolean isStateValidated) {
- if (isStateValidated && !buffer.isDirty()) {
- bufferCreated(buffer);
- }
- }
-
- public void bufferContentAboutToBeReplaced(IFileBuffer buffer) {}
- public void bufferContentReplaced(IFileBuffer buffer) {}
- public void underlyingFileMoved(IFileBuffer buffer, IPath path) {}
- public void underlyingFileDeleted(IFileBuffer buffer) {}
- public void stateChangeFailed(IFileBuffer buffer) {}
- public void stateChanging(IFileBuffer buffer) {}
-
- private synchronized void createCheckpoint(ITextFileBuffer buffer) {
- PositionTrackerChain chain= getChain(buffer);
- if (chain == null) {
- chain = new PositionTrackerChain(buffer.getModificationStamp());
- fPositionTrackerMap.put(buffer.getLocation(), chain);
- fMemoryCounter+= PositionTrackerChain.MEMORY_SIZE + HASHMAP_ENTRY_SIZE;
- }
- else {
- chain.stopTracking();
- fMemoryCounter+= chain.createCheckpoint(buffer.getModificationStamp());
- }
- chain.startTracking(buffer.getDocument());
-
- if (fMemoryCounter > MAX_MEMORY) {
- runCleanup();
- }
- }
-
- private synchronized PositionTrackerChain getChain(ITextFileBuffer buffer) {
- return (PositionTrackerChain) fPositionTrackerMap.get(buffer.getLocation());
- }
-
- private synchronized void resetToLastCheckpoint(ITextFileBuffer buffer) {
- PositionTrackerChain chain= getChain(buffer);
- if (chain != null) {
- chain.stopTracking();
- chain.getActiveTracker().clear();
-
- if (!chain.isModified()) {
- fPositionTrackerMap.remove(buffer.getLocation());
- chain.dispose();
- }
- }
- }
-
- private synchronized void runCleanup() {
- fMemoryCounter= 0;
- for (Iterator iter = fPositionTrackerMap.values().iterator(); iter.hasNext();) {
- PositionTrackerChain chain= (PositionTrackerChain) iter.next();
- fMemoryCounter+= HASHMAP_ENTRY_SIZE;
- fMemoryCounter+= chain.getMemorySize();
- }
- if (fMemoryCounter > MAX_MEMORY_AFTER_CLEANUP) {
- SortedMap map= new TreeMap();
- for (Iterator iter = fPositionTrackerMap.values().iterator(); iter.hasNext();) {
- PositionTrackerChain chain = (PositionTrackerChain) iter.next();
- addChain(map, chain);
- }
- while (!map.isEmpty()) {
- Long key= (Long) map.firstKey();
- List list= (List) map.remove(key);
- for (Iterator iter = list.iterator(); iter.hasNext();) {
- PositionTrackerChain chain = (PositionTrackerChain) iter.next();
- fMemoryCounter+= chain.removeOldest();
- addChain(map, chain);
- }
- if (fMemoryCounter <= MAX_MEMORY_AFTER_CLEANUP) {
- break;
- }
- }
- }
- }
-
- private synchronized void addChain(SortedMap map, PositionTrackerChain chain) {
- long or= chain.getOldestRetirement();
- if (or != Long.MAX_VALUE) {
- Long lor= new Long(or);
- List list= (List) map.get(lor);
- if (list == null) {
- list= new LinkedList();
- map.put(lor, list);
- }
- list.add(chain);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized IPositionConverter findPositionConverter(IFile file, long timestamp) {
- PositionTrackerChain chain= (PositionTrackerChain) fPositionTrackerMap.get(file.getFullPath());
- if (chain != null) {
- return chain.findTrackerAt(timestamp);
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized IPositionConverter findPositionConverter(IPath externalLocation, long timestamp) {
- PositionTrackerChain chain= (PositionTrackerChain) fPositionTrackerMap.get(externalLocation);
- if (chain != null) {
- return chain.findTrackerAt(timestamp);
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized IPositionConverter findPositionConverter(ITranslationUnit tu, long timestamp) {
- IFile file= (IFile) tu.getResource();
- if (file != null) {
- return findPositionConverter(file, timestamp);
- }
- IPath location= tu.getLocation();
- if (location != null) {
- return findPositionConverter(location, timestamp);
- }
- return null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ProcessClosure.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ProcessClosure.java
deleted file mode 100644
index 91d1c6ca33c..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ProcessClosure.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.core;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-
-/**
- * Bundled state of a launched process including the threads linking the process
- * in/output to console documents.
- */
-public class ProcessClosure {
-
- /**
- * Thread which continuously reads from a input stream and pushes the read
- * data to an output stream which is immediately flushed afterwards.
- */
- protected static class ReaderThread extends Thread {
-
- private InputStream fInputStream;
- private OutputStream fOutputStream;
- private boolean fFinished = false;
- private String lineSeparator;
- /*
- * outputStream can be null
- */
- public ReaderThread(ThreadGroup group, String name, InputStream in, OutputStream out) {
- super(group, name);
- fOutputStream = out;
- fInputStream = in;
- setDaemon(true);
- lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
- }
-
- public void run() {
- try {
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(fInputStream));
- String line;
- while ((line = reader.readLine()) != null) {
- line += lineSeparator;
- fOutputStream.write(line.getBytes());
- }
- } catch (IOException x) {
- // ignore
- } finally {
- try {
- // writer.flush();
- fOutputStream.flush();
- } catch (IOException e) {
- // ignore
- }
- try {
- fInputStream.close();
- } catch (IOException e) {
- // ignore
- }
- }
- } finally {
- complete();
- }
- }
-
- public synchronized boolean finished() {
- return fFinished;
- }
-
- public synchronized void waitFor() {
- while (!fFinished) {
- try {
- wait();
- } catch (InterruptedException e) {
- }
- }
- }
-
- public synchronized void complete() {
- fFinished = true;
- notify();
- }
-
- public void close() {
- try {
- fOutputStream.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
- protected static int fCounter = 0;
-
- protected Process fProcess;
-
- protected OutputStream fOutput;
- protected OutputStream fError;
-
- protected ReaderThread fOutputReader;
- protected ReaderThread fErrorReader;
-
- /**
- * Creates a process closure and connects the launched process with a
- * console document.
- *
- * @param outputStream
- * prcess stdout is written to this stream. Can be
- * <code>null</code>, if not interested in reading the output
- * @param errorStream
- * prcess stderr is written to this stream. Can be
- * <code>null</code>, if not interested in reading the output
- */
- public ProcessClosure(Process process, OutputStream outputStream, OutputStream errorStream) {
- fProcess = process;
- fOutput = outputStream;
- fError = errorStream;
- }
-
- /**
- * Live links the launched process with the configured in/out streams using
- * reader threads.
- */
- public void runNonBlocking() {
- ThreadGroup group = new ThreadGroup("CBuilder" + fCounter++); //$NON-NLS-1$
-
- InputStream stdin = fProcess.getInputStream();
- InputStream stderr = fProcess.getErrorStream();
-
- fOutputReader = new ReaderThread(group, "OutputReader", stdin, fOutput); //$NON-NLS-1$
- fErrorReader = new ReaderThread(group, "ErrorReader", stderr, fError); //$NON-NLS-1$
-
- fOutputReader.start();
- fErrorReader.start();
- }
-
- public void runBlocking() {
- runNonBlocking();
-
- boolean finished = false;
- while (!finished) {
- try {
- fProcess.waitFor();
- } catch (InterruptedException e) {
- //System.err.println("Closure exception " +e);
- }
- try {
- fProcess.exitValue();
- finished = true;
- } catch (IllegalThreadStateException e) {
- //System.err.println("Closure exception " +e);
- }
- }
-
- // @@@FIXME: Windows 2000 is screwed; double-check using output threads
- if (!fOutputReader.finished()) {
- fOutputReader.waitFor();
- }
-
- if (!fErrorReader.finished()) {
- fErrorReader.waitFor();
- }
-
- fOutputReader.close();
- fErrorReader.close();
- // it seems that thread termination and stream closing is working
- // without
- // any help
- fProcess = null;
- fOutputReader = null;
- fErrorReader = null;
- }
-
- public boolean isAlive() {
- if (fProcess != null) {
- if (fOutputReader.isAlive() || fErrorReader.isAlive()) {
- return true;
- }
- fProcess = null;
- fOutputReader.close();
- fErrorReader.close();
- fOutputReader = null;
- fErrorReader = null;
- }
- return false;
- }
-
- /**
- * The same functionality as "isAlive()"
- * but does not affect out streams,
- * because they can be shared among processes
- *
- * @return
- */
- public boolean isRunning() {
- if (fProcess != null) {
- if (fOutputReader.isAlive() || fErrorReader.isAlive()) {
- return true;
- }
- fProcess = null;
- }
- return false;
- }
- /**
- * Forces the termination the launched process
- */
- public void terminate() {
- if (fProcess != null) {
- fProcess.destroy();
- fProcess = null;
- }
- if (!fOutputReader.finished()) {
- fOutputReader.waitFor();
- }
- if (!fErrorReader.finished()) {
- fErrorReader.waitFor();
- }
- fOutputReader.close();
- fErrorReader.close();
- fOutputReader = null;
- fErrorReader = null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java
deleted file mode 100644
index 335cea9c72e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core;
-
-import org.eclipse.cdt.core.ConsoleOutputStream;
-import org.eclipse.cdt.core.resources.IConsole;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-
-public class SystemBuildConsole implements IConsole {
- final ConsoleOutputStream out;
- final ConsoleOutputStream err;
-
- public SystemBuildConsole() {
- out = new ConsoleOutputStream() {
- public synchronized void write(byte[] b, int off, int len) throws java.io.IOException {
- System.out.write(b, off, len);
- }
-
- public synchronized void write(int c) throws java.io.IOException {
- System.out.write(c);
- }
- };
- err = new ConsoleOutputStream() {
- public synchronized void write(byte[] b, int off, int len) throws java.io.IOException {
- System.err.write(b, off, len);
- }
-
- public synchronized void write(int c) throws java.io.IOException {
- System.err.write(c);
- }
- };
- }
-
- public void start(IProject project) {
- }
-
- public ConsoleOutputStream getOutputStream() throws CoreException {
- return out;
- }
-
- public ConsoleOutputStream getInfoStream() throws CoreException {
- return out;
- }
-
- public ConsoleOutputStream getErrorStream() throws CoreException {
- return err;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/BuildSystemVariableSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/BuildSystemVariableSupplier.java
deleted file mode 100644
index ab3bd5b8c2a..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/BuildSystemVariableSupplier.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableManager;
-
-public class BuildSystemVariableSupplier extends CoreMacroSupplierBase {
-
- private class ExtensionMacroProvider extends CdtVariableManager{
- private IVariableContextInfo fStartInfo;
- private int fContextType;
- private Object fContextData;
- private boolean fStartInitialized;
-
- public ExtensionMacroProvider(int contextType, Object contextData){
- fContextType = contextType;
- fContextData = contextData;
- }
-
- public IVariableContextInfo getMacroContextInfo(int contextType,Object contextData){
- IVariableContextInfo startInfo = getStartInfo();
- if(contextType == fContextType &&
- contextData == fContextData)
- return startInfo;
-
- IVariableContextInfo info = super.getMacroContextInfo(contextType, contextData);
- if(info == null)
- return null;
-
- if(SupplierBasedCdtVariableManager.checkParentContextRelation(startInfo,info))
- return info;
- return null;
- }
-
- protected IVariableContextInfo getStartInfo(){
- if(fStartInfo == null && !fStartInitialized){
- IVariableContextInfo info = super.getMacroContextInfo(fContextType,fContextData);
- if(info != null){
- ICdtVariableSupplier suppliers[] = info.getSuppliers();
- suppliers = filterValidSuppliers(suppliers);
- if(suppliers != null)
- fStartInfo = new DefaultVariableContextInfo(fContextType,fContextData,suppliers);
- else
- fStartInfo = info.getNext();
- fStartInitialized = true;
- }
- fStartInitialized = true;
- }
- return fStartInfo;
- }
-
- protected ICdtVariableSupplier[] filterValidSuppliers(ICdtVariableSupplier suppliers[]){
- if(suppliers == null)
- return null;
-
- int i = 0, j = 0;
- for(i = 0; i < suppliers.length; i++){
- if(suppliers[i] == this)
- break;
- }
-
-
- if(i >= suppliers.length)
- return null;
-
- int startNum = i + 1;
-
- ICdtVariableSupplier validSuppliers[] =
- new ICdtVariableSupplier[suppliers.length - startNum];
-
- for(i = startNum, j = 0; i < suppliers.length; i++, j++)
- validSuppliers[j] = suppliers[i];
-
- return validSuppliers;
- }
- }
-
- protected ICdtVariable getMacro(String name, int type, Object data) {
- ICConfigurationDescription des = (ICConfigurationDescription)data;
- return des.getBuildVariablesContributor().getVariable(name, new ExtensionMacroProvider(type, data));
- }
-
- protected ICdtVariable[] getMacros(int type, Object data) {
- ICConfigurationDescription des = (ICConfigurationDescription)data;
- return des.getBuildVariablesContributor().getVariables(new ExtensionMacroProvider(type, data));
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java
deleted file mode 100644
index f595b44ef6e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java
+++ /dev/null
@@ -1,495 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.cdtvariables.CdtVariable;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.utils.Platform;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * This supplier is used to suply MBS-predefined macros
- *
- * @since 3.0
- */
-public class CdtMacroSupplier extends CoreMacroSupplierBase {
- private static CdtMacroSupplier fInstance;
- public final static String DOT = "."; //$NON-NLS-1$
- public final static String EMPTY_STRING = ""; //$NON-NLS-1$
-
- private static final String fConfigurationMacros[] = new String[]{
- "ConfigName", //$NON-NLS-1$
- "ConfigDescription", //$NON-NLS-1$
-// "BuildArtifactFileName", //$NON-NLS-1$
-// "BuildArtifactFileExt", //$NON-NLS-1$
-// "BuildArtifactFileBaseName", //$NON-NLS-1$
-// "BuildArtifactFilePrefix", //$NON-NLS-1$
-// "TargetOsList", //$NON-NLS-1$
-// "TargetArchList", //$NON-NLS-1$
- };
-
- private static final String fWorkspaceMacros[] = new String[]{
- "WorkspaceDirPath", //$NON-NLS-1$
- "DirectoryDelimiter", //$NON-NLS-1$
- "PathDelimiter", //$NON-NLS-1$
- };
-
- private static final String fCDTEclipseMacros[] = new String[]{
- "EclipseVersion", //$NON-NLS-1$
- "CDTVersion", //$NON-NLS-1$
-// "MBSVersion", //$NON-NLS-1$
- "HostOsName", //$NON-NLS-1$
- "HostArchName", //$NON-NLS-1$
- "OsType", //$NON-NLS-1$
- "ArchType", //$NON-NLS-1$
- };
-
-
-/* private String getExplicitFileMacroValue(String name, IPath inputFileLocation, IPath outputFileLocation, IConfiguration cfg){
- String value = null;
- if("InputFileName".equals(name)){ //$NON-NLS-1$
- if(inputFileLocation != null && inputFileLocation.segmentCount() > 0)
- value = inputFileLocation.lastSegment();
- }else if("InputFileExt".equals(name)){ //$NON-NLS-1$
- if(inputFileLocation != null && inputFileLocation.segmentCount() > 0)
- value = getExtension(inputFileLocation.lastSegment());
- }else if("InputFileBaseName".equals(name)){ //$NON-NLS-1$
- if(inputFileLocation != null && inputFileLocation.segmentCount() > 0)
- value = getBaseName(inputFileLocation.lastSegment());
- }else if("InputFileRelPath".equals(name)){ //$NON-NLS-1$
- if(inputFileLocation != null && inputFileLocation.segmentCount() > 0){
- IPath workingDirectory = getBuilderCWD(cfg);
- if(workingDirectory != null){
- IPath filePath = ManagedBuildManager.calculateRelativePath(workingDirectory, inputFileLocation);
- if(filePath != null)
- value = filePath.toOSString();
- }
- }
- }
- else if("InputDirRelPath".equals(name)){ //$NON-NLS-1$
- if(inputFileLocation != null && inputFileLocation.segmentCount() > 0){
- IPath workingDirectory = getBuilderCWD(cfg);
- if(workingDirectory != null){
- IPath filePath = ManagedBuildManager.calculateRelativePath(workingDirectory, inputFileLocation.removeLastSegments(1).addTrailingSeparator());
- if(filePath != null)
- value = filePath.toOSString();
- }
- }
- }
- else if("OutputFileName".equals(name)){ //$NON-NLS-1$
- if(outputFileLocation != null && outputFileLocation.segmentCount() > 0)
- value = outputFileLocation.lastSegment();
- }else if("OutputFileExt".equals(name)){ //$NON-NLS-1$
- if(outputFileLocation != null && outputFileLocation.segmentCount() > 0)
- value = getExtension(outputFileLocation.lastSegment());
- }else if("OutputFileBaseName".equals(name)){ //$NON-NLS-1$
- if(outputFileLocation != null && outputFileLocation.segmentCount() > 0)
- value = getBaseName(outputFileLocation.lastSegment());
- }else if("OutputFileRelPath".equals(name)){ //$NON-NLS-1$
- if(outputFileLocation != null && outputFileLocation.segmentCount() > 0){
- IPath workingDirectory = getBuilderCWD(cfg);
- if(workingDirectory != null){
- IPath filePath = ManagedBuildManager.calculateRelativePath(workingDirectory, outputFileLocation);
- if(filePath != null)
- value = filePath.toOSString();
- }
- }
- }else if("OutputDirRelPath".equals(name)){ //$NON-NLS-1$
- if(outputFileLocation != null && outputFileLocation.segmentCount() > 0){
- IPath workingDirectory = getBuilderCWD(cfg);
- if(workingDirectory != null){
- IPath filePath = ManagedBuildManager.calculateRelativePath(workingDirectory, outputFileLocation.removeLastSegments(1).addTrailingSeparator());
- if(filePath != null)
- value = filePath.toOSString();
- }
- }
- }
-
- return value;
- }*/
-
- public String[] getMacroNames(int contextType){
- return getMacroNames(contextType,true);
- }
-
- private String[] getMacroNames(int contextType, boolean clone){
- String names[] = null;
- switch(contextType){
- case DefaultVariableContextInfo.CONTEXT_CONFIGURATION:
- names = fConfigurationMacros;
- break;
- case DefaultVariableContextInfo.CONTEXT_WORKSPACE:
- names = fWorkspaceMacros;
- break;
- case DefaultVariableContextInfo.CONTEXT_INSTALLATIONS:
- names = fCDTEclipseMacros;
- break;
- case DefaultVariableContextInfo.CONTEXT_ECLIPSEENV:
- break;
- }
- if(names != null)
- return clone ? (String[])names.clone() : names;
- return null;
- }
-
- private CdtMacroSupplier(){
-
- }
-
- public static CdtMacroSupplier getInstance(){
- if(fInstance == null)
- fInstance = new CdtMacroSupplier();
- return fInstance;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacro(java.lang.String, int, java.lang.Object)
- */
- public ICdtVariable getMacro(String macroName, int contextType,
- Object contextData) {
- ICdtVariable macro = null;
- switch(contextType){
- case DefaultVariableContextInfo.CONTEXT_CONFIGURATION:
- if(contextData instanceof ICConfigurationDescription){
- macro = getMacro(macroName, (ICConfigurationDescription)contextData);
- }
- break;
- case DefaultVariableContextInfo.CONTEXT_WORKSPACE:
- if(contextData == null || contextData instanceof IWorkspace){
- macro = getMacro(macroName, (IWorkspace)contextData);
- }
- break;
- case DefaultVariableContextInfo.CONTEXT_INSTALLATIONS:
- if(contextData == null){
- macro = getMacro(macroName);
- }
- break;
- case DefaultVariableContextInfo.CONTEXT_ECLIPSEENV:
- break;
- }
-
- return macro;
- }
-
- public ICdtVariable getMacro(String macroName, ICConfigurationDescription cfg){
- ICdtVariable macro = null;
- if("ConfigName".equals(macroName)){ //$NON-NLS-1$
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,cfg.getName());
- }
- else if("ConfigDescription".equals(macroName)){ //$NON-NLS-1$
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,cfg.getDescription());
- }
-/* else if("BuildArtifactFileName".equals(macroName)){ //$NON-NLS-1$
- String name = cfg.getArtifactName();
- String ext = cfg.getArtifactExtension();
- if(ext != null && !EMPTY_STRING.equals(ext))
- name = name + DOT + ext;
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,name);
- }*/
-/* else if("BuildArtifactFileExt".equals(macroName)){ //$NON-NLS-1$
- String ext = cfg.getArtifactExtension();
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,ext);
- }*/
-/* else if("BuildArtifactFileBaseName".equals(macroName)){ //$NON-NLS-1$
- String name = cfg.getArtifactName();
- ITool targetTool = cfg.calculateTargetTool();
- if(targetTool != null){
- IOutputType pot = targetTool.getPrimaryOutputType();
- String prefix = pot.getOutputPrefix();
-
-
- // Resolve any macros in the outputPrefix
- // Note that we cannot use file macros because if we do a clean
- // we need to know the actual
- // name of the file to clean, and cannot use any builder
- // variables such as $@. Hence
- // we use the next best thing, i.e. configuration context.
-
- // figure out the configuration we're using
- IBuildObject toolParent = targetTool.getParent();
- IConfiguration config = null;
- // if the parent is a config then we're done
- if (toolParent instanceof IConfiguration)
- config = (IConfiguration) toolParent;
- else if (toolParent instanceof IToolChain) {
- // must be a toolchain
- config = (IConfiguration) ((IToolChain) toolParent)
- .getParent();
- }
-
- else if (toolParent instanceof IResourceConfiguration) {
- config = (IConfiguration) ((IResourceConfiguration) toolParent)
- .getParent();
- }
-
- else {
- // bad
- throw new AssertionError(
- "tool parent must be one of configuration, toolchain, or resource configuration");
- }
-
- if (config != null) {
-
- try {
- prefix = ManagedBuildManager
- .getBuildMacroProvider()
- .resolveValueToMakefileFormat(
- prefix,
- "", //$NON-NLS-1$
- " ", //$NON-NLS-1$
- IBuildMacroProvider.CONTEXT_CONFIGURATION,
- config);
- }
-
- catch (BuildMacroException e) {
- }
-
- }
-
-
- if(prefix != null && !EMPTY_STRING.equals(prefix))
- name = prefix + name;
- }
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,name);
- }*/
-/* else if("BuildArtifactFilePrefix".equals(macroName)){ //$NON-NLS-1$
- ITool targetTool = cfg.calculateTargetTool();
- if(targetTool != null){
- IOutputType pot = targetTool.getPrimaryOutputType();
- String prefix = pot.getOutputPrefix();
-
- // Resolve any macros in the outputPrefix
- // Note that we cannot use file macros because if we do a clean
- // we need to know the actual
- // name of the file to clean, and cannot use any builder
- // variables such as $@. Hence
- // we use the next best thing, i.e. configuration context.
-
- // figure out the configuration we're using
- IBuildObject toolParent = targetTool.getParent();
- IConfiguration config = null;
- // if the parent is a config then we're done
- if (toolParent instanceof IConfiguration)
- config = (IConfiguration) toolParent;
- else if (toolParent instanceof IToolChain) {
- // must be a toolchain
- config = (IConfiguration) ((IToolChain) toolParent)
- .getParent();
- }
-
- else if (toolParent instanceof IResourceConfiguration) {
- config = (IConfiguration) ((IResourceConfiguration) toolParent)
- .getParent();
- }
-
- else {
- // bad
- throw new AssertionError(
- "tool parent must be one of configuration, toolchain, or resource configuration");
- }
-
- if (config != null) {
-
- try {
- prefix = ManagedBuildManager
- .getBuildMacroProvider()
- .resolveValueToMakefileFormat(
- prefix,
- "", //$NON-NLS-1$
- " ", //$NON-NLS-1$
- IBuildMacroProvider.CONTEXT_CONFIGURATION,
- config);
- }
-
- catch (BuildMacroException e) {
- }
-
- }
-
- if(prefix == null)
- prefix = EMPTY_STRING;
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,prefix);
- }
- }*/
-/* else if("TargetOsList".equals(macroName)){ //$NON-NLS-1$
- IToolChain toolChain = cfg.getToolChain();
- String osList[] = toolChain.getOSList();
- if(osList == null)
- osList = new String[0];
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT_LIST,osList);
- }*/
-/* else if("TargetArchList".equals(macroName)){ //$NON-NLS-1$
- IToolChain toolChain = cfg.getToolChain();
- String archList[] = toolChain.getArchList();
- if(archList == null)
- archList = new String[0];
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT_LIST,archList);
-
- }*/
-/* else if("ToolChainVersion".equals(macroName)){ //$NON-NLS-1$
- if(cfg.getToolChain().getVersion() != null)
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,cfg.getToolChain().getVersion().toString());
- }*/
-/* else if("BuilderVersion".equals(macroName)){ //$NON-NLS-1$
- PluginVersionIdentifier version = cfg.getToolChain().getBuilder().getVersion();
- if(version != null)
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,version.toString());
- }*/
- return macro;
- }
-
- private String getBaseName(String name){
- String value = null;
- int index = name.lastIndexOf('.');
- if(index == -1)
- value = name;
- else
- value = name.substring(0,index);
- return value;
- }
-
- private String getExtension(String name){
- String value = null;
- int index = name.lastIndexOf('.');
- if(index != -1)
- value = name.substring(index+1);
- return value;
- }
-
-/* public IBuildMacro getMacro(String macroName, IManagedProject mngProj){
- IBuildMacro macro = null;
- if("ProjName".equals(macroName)){ //$NON-NLS-1$
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,mngProj.getOwner().getName());
- }
- else if("ProjDirPath".equals(macroName)){ //$NON-NLS-1$
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_PATH_DIR,mngProj.getOwner().getLocation().toOSString());
- }
- return macro;
- }
-*/
- public ICdtVariable getMacro(String macroName, IWorkspace wsp){
- if(wsp == null)
- wsp = ResourcesPlugin.getWorkspace();
- ICdtVariable macro = null;
- if("WorkspaceDirPath".equals(macroName)){ //$NON-NLS-1$
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_PATH_DIR,wsp.getRoot().getLocation().toOSString());
- } else if("DirectoryDelimiter".equals(macroName)){ //$NON-NLS-1$
- if(isWin32()){
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,"\\"); //$NON-NLS-1$
- } else {
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,"/"); //$NON-NLS-1$
- }
- } else if("PathDelimiter".equals(macroName)){ //$NON-NLS-1$
- if(isWin32()){
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,";"); //$NON-NLS-1$
- } else {
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,":"); //$NON-NLS-1$
- }
- }
- return macro;
- }
-
- private boolean isWin32(){
- String os = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
- if (os.startsWith("windows ")) //$NON-NLS-1$
- return true;
- return false;
- }
-
- public ICdtVariable getMacro(String macroName){
- ICdtVariable macro = null;
- if("EclipseVersion".equals(macroName)){ //$NON-NLS-1$
- Bundle bundle = Platform.getBundle("org.eclipse.platform"); //$NON-NLS-1$
- String version = bundle != null ?
- (String)bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION) :
- null;
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,version);
- }
- else if("CDTVersion".equals(macroName)){ //$NON-NLS-1$
- String version = (String)CCorePlugin.getDefault().getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,version);
- }
-/* else if("MBSVersion".equals(macroName)){ //$NON-NLS-1$
- String version = ManagedBuildManager.getBuildInfoVersion().toString();
- macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,version);
- }*/
- else if("HostOsName".equals(macroName)){ //$NON-NLS-1$
- String os = System.getProperty("os.name"); //$NON-NLS-1$
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,os);
- }
- else if("HostArchName".equals(macroName)){ //$NON-NLS-1$
- String arch = System.getProperty("os.arch"); //$NON-NLS-1$
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,arch);
- }
- else if("OsType".equals(macroName)){ //$NON-NLS-1$
- String os = Platform.getOS();
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,os);
- }
- else if("ArchType".equals(macroName)){ //$NON-NLS-1$
- String arch = Platform.getOSArch();
- macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,arch);
- }
-
- return macro;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacros(int, java.lang.Object)
- */
- public ICdtVariable[] getMacros(int contextType, Object contextData) {
- String names[] = getMacroNames(contextType,false);
-
- if(names != null){
- ICdtVariable macros[] = new ICdtVariable[names.length];
- int num = 0;
- for(int i = 0; i < names.length; i++){
- ICdtVariable macro = getMacro(names[i],contextType,contextData);
- if(macro != null)
- macros[num++] = macro;
- }
- if(macros.length != num){
- ICdtVariable tmp[] = new ICdtVariable[num];
- if(num > 0)
- System.arraycopy(macros,0,tmp,0,num);
- macros = tmp;
- }
- return macros;
- }
- return null;
- }
-
-/* private IPath getBuilderCWD(IConfiguration cfg){
- IPath workingDirectory = null;
- IResource owner = cfg.getOwner();
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(owner);
-
- if(info != null){
- if(info.getDefaultConfiguration().equals(cfg)){
- IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getBuildfileGenerator(info.getDefaultConfiguration());
- generator.initialize((IProject)owner,info,null);
-
- IPath topBuildDir = generator.getBuildWorkingDir();
- if(topBuildDir == null)
- topBuildDir = new Path(info.getConfigurationName());
-
- IPath projectLocation = owner.getLocation();
- workingDirectory = projectLocation.append(topBuildDir);
- }
- }
- return workingDirectory;
- }
-*/
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtVariableManager.java
deleted file mode 100644
index fef7ea7dac7..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtVariableManager.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.internal.core.cdtvariables.EclipseVariablesVariableSupplier.EclipseVarMacro;
-import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCache;
-import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
-import org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-import org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor;
-import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableManager;
-import org.eclipse.core.variables.IStringVariable;
-
-/**
- * The default IBuildMacroProvider implementation
- * @since 3.0
- */
-public class CdtVariableManager implements ICdtVariableManager {
- static private CdtVariableManager fDefault;
-
- public static UserDefinedVariableSupplier fUserDefinedMacroSupplier = UserDefinedVariableSupplier.getInstance();
- public static EnvironmentVariableSupplier fEnvironmentMacroSupplier = EnvironmentVariableSupplier.getInstance();
- public static CdtMacroSupplier fCdtMacroSupplier = CdtMacroSupplier.getInstance();
- public static EclipseVariablesVariableSupplier fEclipseVariablesMacroSupplier = EclipseVariablesVariableSupplier.getInstance();
-
- protected CdtVariableManager(){
-
- }
-
- public static CdtVariableManager getDefault(){
- if(fDefault == null)
- fDefault = new CdtVariableManager();
- return fDefault;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#getMacro(java.lang.String, int, java.lang.Object, boolean)
- */
- public ICdtVariable getVariable(String macroName, ICConfigurationDescription cfg) {
- if(cfg instanceof CConfigurationDescriptionCache){
- StorableCdtVariables macros = ((CConfigurationDescriptionCache)cfg).getCachedVariables();
- if(macros != null)
- return macros.getMacro(macroName);
- }
- int type = getContextType(cfg);
- return SupplierBasedCdtVariableManager.getVariable(macroName,
- getMacroContextInfo(type,cfg),true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#getMacros(int, java.lang.Object, boolean)
- */
- public ICdtVariable[] getVariables(ICConfigurationDescription cfg) {
- if(cfg instanceof CConfigurationDescriptionCache){
- StorableCdtVariables macros = ((CConfigurationDescriptionCache)cfg).getCachedVariables();
- if(macros != null)
- return macros.getMacros();
- }
- int type = getContextType(cfg);
- return SupplierBasedCdtVariableManager.getVariables(getMacroContextInfo(type,cfg),
- true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#getSuppliers(int, java.lang.Object)
- */
- public ICdtVariableSupplier[] getSuppliers(int contextType,
- Object contextData) {
- IVariableContextInfo info = getMacroContextInfo(contextType,contextData);
- if(info != null)
- return info.getSuppliers();
- return null;
- }
-
- /**
- * @param contextType
- * @param contextData
- * @return
- */
- public IVariableContextInfo getMacroContextInfo(
- int contextType,
- Object contextData){
- DefaultVariableContextInfo info = new DefaultVariableContextInfo(contextType,contextData);
- if(info.getSuppliers() != null)
- return info;
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#convertStringListToString(java.lang.String[], java.lang.String)
- */
- public String convertStringListToString(String[] value, String listDelimiter) {
- return CdtVariableResolver.convertStringListToString(value,listDelimiter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#resolveValue(java.lang.String, java.lang.String, java.lang.String, int, java.lang.Object)
- */
- public String resolveValue(String value, String nonexistentMacrosValue,
- String listDelimiter, ICConfigurationDescription cfg)
- throws CdtVariableException {
-
- IVariableContextInfo info = getMacroContextInfo(getContextType(cfg),cfg);
- if(info != null)
- return CdtVariableResolver.resolveToString(value,
- getMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter));
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#resolveStringListValue(java.lang.String, java.lang.String, int, java.lang.Object)
- */
- public String[] resolveStringListValue(String value,
- String nonexistentMacrosValue, String listDelimiter,
- ICConfigurationDescription cfg) throws CdtVariableException {
-
- IVariableContextInfo info = getMacroContextInfo(getContextType(cfg),cfg);
- if(info != null)
- return CdtVariableResolver.resolveToStringList(value,getMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter));
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#isStringListValue(java.lang.String)
- */
- public boolean isStringListValue(String value, ICConfigurationDescription cfg) throws CdtVariableException {
- try {
- CdtVariableResolver.resolveToStringList(value,getMacroSubstitutor(getMacroContextInfo(getContextType(cfg), cfg)," ",null)); //$NON-NLS-1$
- }catch(CdtVariableException e){
- return false;
- }
- return true;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#checkIntegrity(int, java.lang.Object)
- */
- public void checkVariableIntegrity(ICConfigurationDescription cfg)
- throws CdtVariableException {
-
- int type = getContextType(cfg);
- IVariableContextInfo info = getMacroContextInfo(type,cfg);
- IVariableSubstitutor subst = new CoreVariableSubstitutor(info,null,""){ //$NON-NLS-1$
- protected ResolvedMacro resolveMacro(ICdtVariable macro) throws CdtVariableException {
- if(macro instanceof EclipseVariablesVariableSupplier.EclipseVarMacro)
- return new ResolvedMacro(macro.getName(),""); //$NON-NLS-1$
- return super.resolveMacro(macro);
- }
- };
- if(info != null)
- CdtVariableResolver.checkIntegrity(info,subst);
- }
-
- private int getContextType(ICConfigurationDescription des){
- if(des != null)
- return DefaultVariableContextInfo.CONTEXT_CONFIGURATION;
- return DefaultVariableContextInfo.CONTEXT_WORKSPACE;
- }
-
- public IVariableSubstitutor getMacroSubstitutor(IVariableContextInfo info, String inexistentMacroValue, String listDelimiter){
- return new CoreVariableSubstitutor(info, inexistentMacroValue, listDelimiter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#resolveStringListValues(java.lang.String[], java.lang.String, java.lang.String, int, java.lang.Object)
- */
- public String[] resolveStringListValues(String[] value, String nonexistentMacrosValue, String listDelimiter, ICConfigurationDescription cfg) throws CdtVariableException {
- IVariableContextInfo info = getMacroContextInfo(getContextType(cfg),cfg);
- if(info != null)
- return CdtVariableResolver.resolveStringListValues(value,
- getMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter), true);
- return null;
- }
-
- public boolean isEnvironmentVariable(ICdtVariable variable,
- ICConfigurationDescription cfg) {
- return variable instanceof EnvironmentVariableSupplier.EnvVarMacro;
- }
-
- public IStringVariable toEclipseVariable(ICdtVariable variable,
- ICConfigurationDescription cfg) {
- if(variable instanceof EclipseVariablesVariableSupplier.EclipseVarMacro){
- return ((EclipseVarMacro)variable).getVariable();
- }
- return null;
- }
-
- public boolean isUserVariable(ICdtVariable variable,
- ICConfigurationDescription cfg) {
- return variable instanceof StorableCdtVariable;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreMacroSupplierBase.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreMacroSupplierBase.java
deleted file mode 100644
index 78c5e7b32d8..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreMacroSupplierBase.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-
-public abstract class CoreMacroSupplierBase implements ICdtVariableSupplier {
-
- public ICdtVariable getVariable(String macroName, IVariableContextInfo context) {
- if(context instanceof ICoreVariableContextInfo){
- ICoreVariableContextInfo info = (ICoreVariableContextInfo)context;
- return getMacro(macroName, info.getContextType(), info.getContextData());
- }
- return null;
- }
-
- protected abstract ICdtVariable getMacro(String name, int type, Object data);
-
- public ICdtVariable[] getVariables(IVariableContextInfo context) {
- if(context instanceof ICoreVariableContextInfo){
- ICoreVariableContextInfo info = (ICoreVariableContextInfo)context;
- return getMacros(info.getContextType(), info.getContextData());
- }
- return null;
- }
-
- protected abstract ICdtVariable[] getMacros(int type, Object data);
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java
deleted file mode 100644
index 8b8f2af48ef..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import java.util.Map;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor;
-
-/**
- * This substitutor resolves all macro references
- *
- * @see org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor
- * @since 3.0
- */
-public class CoreVariableSubstitutor extends SupplierBasedCdtVariableSubstitutor {
-
-
- public CoreVariableSubstitutor(IVariableContextInfo contextInfo,
- String inexistentMacroValue, String listDelimiter,
- Map delimiterMap, String incorrectlyReferencedMacroValue) {
- super(contextInfo, inexistentMacroValue, listDelimiter, delimiterMap,
- incorrectlyReferencedMacroValue);
- // TODO Auto-generated constructor stub
- }
-
- public CoreVariableSubstitutor(IVariableContextInfo contextInfo,
- String inexistentMacroValue, String listDelimiter) {
- super(contextInfo, inexistentMacroValue, listDelimiter);
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.macros.IMacroSubstitutor#setMacroContextInfo(int, java.lang.Object)
- */
- public void setMacroContextInfo(int contextType, Object contextData) throws CdtVariableException{
- setMacroContextInfo(getMacroContextInfo(contextType,contextData));
- }
-
- protected IVariableContextInfo getMacroContextInfo(int contextType, Object contextData){
- return new DefaultVariableContextInfo(contextType, contextData);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/DefaultVariableContextInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/DefaultVariableContextInfo.java
deleted file mode 100644
index 4309ee4068e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/DefaultVariableContextInfo.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-/**
- * This is the default implementation of the IMacroContextInfo
- *
- * @since 3.0
- */
-public class DefaultVariableContextInfo implements ICoreVariableContextInfo {
-
- private ICdtVariableSupplier fSuppliers[];
- private int fType;
- private Object fData;
-
- public DefaultVariableContextInfo(int type, Object data){
- fType = type;
- fData = data;
- }
-
- protected DefaultVariableContextInfo(int type, Object data, ICdtVariableSupplier suppliers[]){
- fType = type;
- fData = data;
- fSuppliers = suppliers;
- }
-
- protected ICdtVariableSupplier[] getSuppliers(int type, Object data){
- switch(type){
- case CONTEXT_CONFIGURATION:
- if(data instanceof ICConfigurationDescription){
- return new ICdtVariableSupplier[]{
- CdtVariableManager.fUserDefinedMacroSupplier,
- CdtVariableManager.fEnvironmentMacroSupplier,
- CdtVariableManager.fCdtMacroSupplier
- };
- }
- break;
- case CONTEXT_WORKSPACE:
- if(data == null || data instanceof IWorkspace){
- return new ICdtVariableSupplier[]{
- CdtVariableManager.fUserDefinedMacroSupplier,
- CdtVariableManager.fEnvironmentMacroSupplier,
- CdtVariableManager.fCdtMacroSupplier,
- CdtVariableManager.fEclipseVariablesMacroSupplier
- };
- }
- break;
- case CONTEXT_INSTALLATIONS:
- if(data == null){
- return new ICdtVariableSupplier[]{
- CdtVariableManager.fCdtMacroSupplier
- };
- }
- break;
- case CONTEXT_ECLIPSEENV:
- if(data == null){
- return new ICdtVariableSupplier[]{
- CdtVariableManager.fEnvironmentMacroSupplier
- };
- }
- break;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo#getContextType()
- */
- public int getContextType() {
- return fType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo#getContextData()
- */
- public Object getContextData() {
- return fData;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo#getSuppliers()
- */
- public ICdtVariableSupplier[] getSuppliers() {
- if(fSuppliers == null)
- fSuppliers = getSuppliers(fType, fData);
- return fSuppliers;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo#getNext()
- */
- public IVariableContextInfo getNext() {
- switch(fType){
- case CONTEXT_CONFIGURATION:
- if(fData instanceof ICConfigurationDescription){
- IWorkspace wsp = ResourcesPlugin.getWorkspace();
- if(wsp != null)
- return new DefaultVariableContextInfo(
- CONTEXT_WORKSPACE,
- wsp);
- }
- break;
- case CONTEXT_WORKSPACE:
- if(fData instanceof IWorkspace){
- return new DefaultVariableContextInfo(
- CONTEXT_INSTALLATIONS,
- null);
- }
- break;
- case CONTEXT_INSTALLATIONS:
- if(fData == null){
- return new DefaultVariableContextInfo(
- CONTEXT_ECLIPSEENV,
- null);
- }
- break;
- case CONTEXT_ECLIPSEENV:
- if(fData == null){
- return null;
- }
- break;
- }
- return null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EclipseVariablesVariableSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EclipseVariablesVariableSupplier.java
deleted file mode 100644
index b1e6beaa0d2..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EclipseVariablesVariableSupplier.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariable;
-import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.variables.IDynamicVariable;
-import org.eclipse.core.variables.IStringVariable;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.IValueVariable;
-import org.eclipse.core.variables.VariablesPlugin;
-
-/**
- * This supplier suplies the macros that represent the Eclipse variables
- *
- * @since 3.0
- */
-public class EclipseVariablesVariableSupplier implements ICdtVariableSupplier {
- private static final String VAR_PREFIX = "${"; //$NON-NLS-1$
- private static final char VAR_SUFFIX = '}'; //$NON-NLS-1$
- private static final char COLON = ':'; //$NON-NLS-1$
-
- private static EclipseVariablesVariableSupplier fInstance;
-
- private EclipseVariablesVariableSupplier(){
-
- }
-
- public static EclipseVariablesVariableSupplier getInstance(){
- if(fInstance == null)
- fInstance = new EclipseVariablesVariableSupplier();
- return fInstance;
- }
-
- public class EclipseVarMacro extends CdtVariable {
- private IStringVariable fVariable;
- private String fArgument;
- private boolean fInitialized;
-
- private EclipseVarMacro(IStringVariable var){
- this(var,null);
- }
-
- private EclipseVarMacro(IStringVariable var, String argument){
- fVariable = var;
- fType = VALUE_TEXT;
- fName = var.getName();
- if(argument != null)
- fName += COLON + argument;
- fArgument = argument;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacro#getStringValue()
- */
- public String getStringValue() throws CdtVariableException {
- if(!fInitialized){
- loadValue(fVariable);
- fInitialized = true;
- }
- return fStringValue;
- }
-
- private void loadValue(IStringVariable var){
- if(var instanceof IDynamicVariable){
- IDynamicVariable dynamicVar = (IDynamicVariable)var;
- if(fArgument == null || dynamicVar.supportsArgument()){
- try{
- fStringValue = dynamicVar.getValue(fArgument);
- }catch(CoreException e){
- fStringValue = null;
- }
- }else
- fStringValue = null;
-
- }else if(var instanceof IValueVariable){
- if(fArgument == null)
- fStringValue = ((IValueVariable)var).getValue();
- else
- fStringValue = null;
- }
-
- }
-
- public IStringVariable getVariable(){
- return fVariable;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacro(java.lang.String, int, java.lang.Object)
- */
- public ICdtVariable getVariable(String macroName, IVariableContextInfo info) {
- return getVariable(macroName);
- }
-
- public ICdtVariable getVariable(String macroName) {
-
-// if(contextType != DefaultMacroContextInfo.CONTEXT_WORKSPACE)
-// return null;
- if(macroName == null || "".equals(macroName)) //$NON-NLS-1$
- return null;
-
- String varName = null;
- String param = null;
- IStringVariable var = null;
- int index = macroName.indexOf(COLON);
- if(index == -1)
- varName = macroName;
- else if(index > 0){
- varName = macroName.substring(0,index);
- param = macroName.substring(index+1);
- }
-
- if(varName != null){
- IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
- var = mngr.getValueVariable(varName);
- if(var == null)
- var = mngr.getDynamicVariable(varName);
- }
-
- if(var != null)
- return new EclipseVarMacro(var,param);
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacros(int, java.lang.Object)
- */
- public ICdtVariable[] getVariables(IVariableContextInfo info) {
- return getVariables();
- }
-
- public ICdtVariable[] getVariables() {
-// if(contextType != DefaultMacroContextInfo.CONTEXT_WORKSPACE)
-// return null;
-
- IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
- IDynamicVariable vars[] = mngr.getDynamicVariables();
- Map map = new HashMap();
- for(int i = 0; i < vars.length; i++)
- map.put(vars[i].getName(),vars[i]);
-
- IValueVariable valVars[] = mngr.getValueVariables();
- for(int i = 0; i < valVars.length; i++)
- map.put(valVars[i].getName(),valVars[i]);
-
- Collection collection = map.values();
- EclipseVarMacro macros[] = new EclipseVarMacro[collection.size()];
- Iterator iter = collection.iterator();
- for(int i = 0; i < macros.length ; i++)
- macros[i] = new EclipseVarMacro((IStringVariable)iter.next());
-
- return macros;
- }
-
- private String getMacroValue(String name){
- IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
- try{
- return mngr.performStringSubstitution(VAR_PREFIX + name + VAR_SUFFIX);
- }catch (CoreException e){
- }
-
- return null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java
deleted file mode 100644
index 6019b1924f7..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariable;
-import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
-import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
-import org.eclipse.core.resources.IWorkspace;
-
-/**
- * This supplier suplies the macros that represent the Managed Build environment variables
- *
- * @since 3.0
- */
-public class EnvironmentVariableSupplier extends CoreMacroSupplierBase {
- private static EnvironmentVariableSupplier fInstance;
- private EnvironmentVariableManager fEnvironmentProvider;
-
- public class EnvVarMacro extends CdtVariable{
- private IEnvironmentVariable fVariable;
- private EnvVarMacro(IEnvironmentVariable var){
- fName = var.getName();
- fVariable = var;
- }
-
- private void loadValue(IEnvironmentVariable var){
- String delimiter = var.getDelimiter();
- String value = var.getOperation() != IEnvironmentVariable.ENVVAR_REMOVE ?
- var.getValue() : null;
-
- if(delimiter != null && !"".equals(delimiter)){ //$NON-NLS-1$
- fType = VALUE_TEXT_LIST;
- if(value != null){
- List list = EnvVarOperationProcessor.convertToList(value,delimiter);
- fStringListValue = (String[])list.toArray(new String[list.size()]);
- } else {
- fStringListValue = null;
- }
- } else {
- fType = VALUE_TEXT;
- fStringValue = value;
- }
- }
-
-
- public int getValueType() {
- if(fVariable != null){
- loadValue(fVariable);
-
- //we do not need it any more, release clean the reference
- fVariable = null;
- }
- return super.getValueType();
- }
-
- public String getStringValue() throws CdtVariableException {
- if(fVariable != null){
- loadValue(fVariable);
-
- //we do not need it any more, release clean the reference
- fVariable = null;
- }
- return super.getStringValue();
- }
-
- public String[] getStringListValue() throws CdtVariableException {
- if(fVariable != null){
- loadValue(fVariable);
-
- //we do not need it any more, release clean the reference
- fVariable = null;
- }
- return super.getStringListValue();
- }
- }
-
- protected EnvironmentVariableSupplier(){
- this(EnvironmentVariableManager.getDefault());
- }
-
- public EnvironmentVariableSupplier(EnvironmentVariableManager varProvider){
- fEnvironmentProvider = varProvider;
- }
-
- public ICdtVariable createBuildMacro(IEnvironmentVariable var){
- if(var != null)
- return new EnvVarMacro(var);
- return null;
- }
-
- public static EnvironmentVariableSupplier getInstance(){
- if(fInstance == null)
- fInstance = new EnvironmentVariableSupplier();
- return fInstance;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacro(java.lang.String, int, java.lang.Object)
- */
- public ICdtVariable getMacro(String macroName, int contextType,
- Object contextData) {
- if(macroName == null || "".equals(macroName)) //$NON-NLS-1$
- return null;
-
- IEnvironmentVariable var = null;
- switch(contextType){
- case ICoreVariableContextInfo.CONTEXT_CONFIGURATION:
- if(contextData instanceof ICConfigurationDescription){
- var = fEnvironmentProvider.getVariable(macroName, (ICConfigurationDescription)contextData, false);
- }
- break;
- case ICoreVariableContextInfo.CONTEXT_WORKSPACE:
- if(contextData == null || contextData instanceof IWorkspace){
- var = fEnvironmentProvider.getVariable(macroName, (ICConfigurationDescription)null, false);
- }
- break;
-// case IBuildMacroProvider.CONTEXT_ECLIPSEENV:
-// if(contextData == null){
-// var = fEnvironmentProvider.getVariable(macroName,fEnvironmentProvider.getContextInfo(contextData),false);
-// }
-// break;
- }
- if(var != null && var.getOperation() != IEnvironmentVariable.ENVVAR_REMOVE)
- return new EnvVarMacro(var);
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacros(int, java.lang.Object)
- */
- public ICdtVariable[] getMacros(int contextType, Object contextData) {
- IEnvironmentVariable vars[] = null;
-
- switch(contextType){
- case ICoreVariableContextInfo.CONTEXT_CONFIGURATION:
- if(contextData instanceof ICConfigurationDescription){
- vars = fEnvironmentProvider.getVariables((ICConfigurationDescription)contextData, false);
- }
- break;
- case ICoreVariableContextInfo.CONTEXT_WORKSPACE:
- if(contextData == null || contextData instanceof IWorkspace){
- vars = fEnvironmentProvider.getVariables((ICConfigurationDescription)null, false);
- }
- break;
-// case IBuildMacroProvider.CONTEXT_ECLIPSEENV:
-// if(contextData == null){
-// vars = fEnvironmentProvider.getVariables(fEnvironmentProvider.getContextInfo(contextData),false).toArray(false);
-// }
-// break;
- }
-
- if(vars != null){
- EnvVarMacro macros[] = new EnvVarMacro[vars.length];
- for(int i = 0; i < macros.length; i++)
- macros[i] = new EnvVarMacro(vars[i]);
-
- return macros;
- }
-
- return null;
- }
-/*
- public EnvironmentVariableProvider getEnvironmentVariableProvider(){
- return fEnvironmentProvider;
- }
-*/
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/ICoreVariableContextInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/ICoreVariableContextInfo.java
deleted file mode 100644
index b0e7e4e333a..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/ICoreVariableContextInfo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-
-public interface ICoreVariableContextInfo extends IVariableContextInfo {
-// public final static int CONTEXT_FILE = 1;
-// public final static int CONTEXT_OPTION = 2;
- public final static int CONTEXT_CONFIGURATION = 3;
-// public final static int CONTEXT_PROJECT = 4;
- public final static int CONTEXT_WORKSPACE = 5;
- public final static int CONTEXT_INSTALLATIONS = 6;
- public final static int CONTEXT_ECLIPSEENV = 7;
-
- /**
- * returns the context type
- *
- * @return int
- */
- public int getContextType();
-
- /**
- * returns the context data
- *
- * @return Object
- */
- public Object getContextData();
-
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java
deleted file mode 100644
index 75bd0f30694..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariable;
-import org.eclipse.cdt.core.settings.model.ICStorageElement;
-import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
-
-/**
- * This class represents the Build Macro that could be loaded
- * and stored in XML
- *
- * @since 3.0
- *
- */
-public class StorableCdtVariable extends CdtVariable {
- public static final String STRING_MACRO_ELEMENT_NAME = "stringMacro"; //$NON-NLS-1$
- public static final String STRINGLIST_MACRO_ELEMENT_NAME = "stringListMacro"; //$NON-NLS-1$
- public static final String NAME = "name"; //$NON-NLS-1$
- public static final String VALUE = "value"; //$NON-NLS-1$
- public static final String TYPE = "type"; //$NON-NLS-1$
-
- public static final String VALUE_ELEMENT_NAME = "value"; //$NON-NLS-1$
- public static final String VALUE_ELEMENT_VALUE = "name"; //$NON-NLS-1$
-
- public static final String TYPE_TEXT = "VALUE_TEXT"; //$NON-NLS-1$
- public static final String TYPE_TEXT_LIST = "VALUE_TEXT_LIST"; //$NON-NLS-1$
- public static final String TYPE_PATH_FILE = "VALUE_PATH_FILE"; //$NON-NLS-1$
- public static final String TYPE_PATH_FILE_LIST = "VALUE_PATH_FILE_LIST"; //$NON-NLS-1$
- public static final String TYPE_PATH_DIR = "VALUE_PATH_DIR"; //$NON-NLS-1$
- public static final String TYPE_PATH_DIR_LIST = "VALUE_PATH_DIR_LIST"; //$NON-NLS-1$
- public static final String TYPE_PATH_ANY = "VALUE_PATH_ANY"; //$NON-NLS-1$
- public static final String TYPE_PATH_ANY_LIST = "VALUE_PATH_ANY_LIST"; //$NON-NLS-1$
-
- public StorableCdtVariable(String name, int type, String value){
- super(name,type,value);
- }
-
- public StorableCdtVariable(String name, int type, String value[]){
- super(name,type,value);
- }
-
- public StorableCdtVariable(ICStorageElement element){
- load(element);
- }
-
- private void load(ICStorageElement element){
- fName = element.getAttribute(NAME);
-
- fType = typeStringToInt(element.getAttribute(TYPE));
-
- if(!CdtVariableResolver.isStringListVariable(fType))
- fStringValue = element.getAttribute(VALUE);
- else {
- ICStorageElement nodeList[] = element.getChildren();
- List values = new ArrayList();
- for (int i = 0; i < nodeList.length; ++i) {
- ICStorageElement node = nodeList[i];
- if (node.getName().equals(VALUE_ELEMENT_NAME)) {
- values.add(node.getAttribute(VALUE_ELEMENT_VALUE));
- }
- }
- fStringListValue = (String[])values.toArray(new String[values.size()]);
- }
- }
-
- private int typeStringToInt(String typeString){
- int type;
-
- if(TYPE_TEXT_LIST.equals(typeString))
- type = VALUE_TEXT_LIST;
- else if(TYPE_PATH_FILE.equals(typeString))
- type = VALUE_PATH_FILE;
- else if(TYPE_PATH_FILE_LIST.equals(typeString))
- type = VALUE_PATH_FILE_LIST;
- else if(TYPE_PATH_DIR.equals(typeString))
- type = VALUE_PATH_DIR;
- else if(TYPE_PATH_DIR_LIST.equals(typeString))
- type = VALUE_PATH_DIR_LIST;
- else if(TYPE_PATH_ANY.equals(typeString))
- type = VALUE_PATH_ANY;
- else if(TYPE_PATH_ANY_LIST.equals(typeString))
- type = VALUE_PATH_ANY_LIST;
- else
- type = VALUE_TEXT;
-
- return type;
- }
-
- private String typeIntToString(int type){
- String stringType;
-
- switch(type){
- case VALUE_TEXT_LIST:
- stringType = TYPE_TEXT_LIST;
- break;
- case VALUE_PATH_FILE:
- stringType = TYPE_PATH_FILE;
- break;
- case VALUE_PATH_FILE_LIST:
- stringType = TYPE_PATH_FILE_LIST;
- break;
- case VALUE_PATH_DIR:
- stringType = TYPE_PATH_DIR;
- break;
- case VALUE_PATH_DIR_LIST:
- stringType = TYPE_PATH_DIR_LIST;
- break;
- case VALUE_PATH_ANY:
- stringType = TYPE_PATH_ANY;
- break;
- case VALUE_PATH_ANY_LIST:
- stringType = TYPE_PATH_ANY_LIST;
- break;
- case VALUE_TEXT:
- default:
- stringType = TYPE_TEXT;
- break;
- }
-
- return stringType;
- }
-
- public void serialize(ICStorageElement element){
- if(fName != null)
- element.setAttribute(NAME,fName);
-
- element.setAttribute(TYPE,typeIntToString(fType));
-
- if(!CdtVariableResolver.isStringListVariable(fType)){
- if(fStringValue != null)
- element.setAttribute(VALUE,fStringValue);
- }
- else {
- if(fStringListValue != null && fStringListValue.length > 0){
- for(int i = 0; i < fStringListValue.length; i++){
- ICStorageElement valEl = element.createChild(VALUE_ELEMENT_NAME);
- if(fStringListValue[i] != null)
- valEl.setAttribute(VALUE_ELEMENT_VALUE, fStringListValue[i]);
- }
- }
- }
-
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariables.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariables.java
deleted file mode 100644
index bdf269243d4..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariables.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.core.settings.model.ICStorageElement;
-import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
-import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
-
-/**
- * This class represents the set of Build Macros that could be loaded
- * and stored in XML
- *
- * @since 3.0
- *
- */
-public class StorableCdtVariables {
- public static final String MACROS_ELEMENT_NAME = "macros"; //$NON-NLS-1$
-// public static final String EXPAND_ENVIRONMENT_MACROS = "expandEnvironmentMacros"; //$NON-NLS-1$
-// public static final String TRUE = "true"; //$NON-NLS-1$
- private HashMap fMacros;
-// private boolean fExpandInMakefile = false;
- private boolean fIsDirty = false;
- private boolean fIsChanged = false;
- private boolean fIsReadOnly;
-
- private HashMap getMap(){
- if(fMacros == null)
- fMacros = new HashMap();
- return fMacros;
- }
-
- public StorableCdtVariables(boolean readOnly) {
- fIsReadOnly = readOnly;
- }
-
- public StorableCdtVariables(StorableCdtVariables base, boolean readOnly) {
- fMacros = (HashMap)base.getMap().clone();
- fIsReadOnly = readOnly;
- }
-
- public StorableCdtVariables(ICdtVariable vars[], boolean readOnly) {
- fMacros = new HashMap(vars.length);
- for(int i = 0; i < vars.length; i++){
- addMacro(vars[i]);
- }
- fIsReadOnly = readOnly;
- }
-
- public StorableCdtVariables(ICStorageElement element, boolean readOnly) {
- load(element);
- fIsReadOnly = readOnly;
- }
-
- private void load(ICStorageElement element){
-// fExpandInMakefile = TRUE.equals(element.getAttribute(EXPAND_ENVIRONMENT_MACROS));
-
- ICStorageElement nodeList[] = element.getChildren();
- for (int i = 0; i < nodeList.length; ++i) {
- ICStorageElement node = nodeList[i];
- String name = node.getName();
- if (StorableCdtVariable.STRING_MACRO_ELEMENT_NAME.equals(name)) {
- addMacro(new StorableCdtVariable(node));
- }
- else if (StorableCdtVariable.STRINGLIST_MACRO_ELEMENT_NAME.equals(name)) {
- addMacro(new StorableCdtVariable(node));
- }
- }
- fIsDirty = false;
- fIsChanged = false;
- }
-
- public void serialize(ICStorageElement element){
-// if(fExpandInMakefile)
-// element.setAttribute(EXPAND_ENVIRONMENT_MACROS,TRUE);
-
- if(fMacros != null){
- Iterator iter = fMacros.values().iterator();
- while(iter.hasNext()){
- StorableCdtVariable macro = (StorableCdtVariable)iter.next();
- ICStorageElement macroEl;
- if(CdtVariableResolver.isStringListVariable(macro.getValueType()))
- macroEl = element.createChild(StorableCdtVariable.STRINGLIST_MACRO_ELEMENT_NAME);
- else
- macroEl = element.createChild(StorableCdtVariable.STRING_MACRO_ELEMENT_NAME);
- macro.serialize(macroEl);
- }
- }
- fIsDirty = false;
- }
-
- private void addMacro(ICdtVariable macro){
- String name = macro.getName();
- if(name == null)
- return;
-
- getMap().put(name,macro);
- }
-
- public ICdtVariable createMacro(String name, int type, String value){
- if(name == null || "".equals(name = name.trim()) || CdtVariableResolver.isStringListVariable(type)) //$NON-NLS-1$
- return null;
-
- ICdtVariable macro = checkMacro(name, type, value);
- if(macro == null){
- macro = new StorableCdtVariable(name, type, value);
- addMacro(macro);
- fIsDirty = true;
- fIsChanged = true;
- }
- return macro;
- }
-
- public ICdtVariable checkMacro(String name, int type, String value){
- if(fIsReadOnly)
- throw ExceptionFactory.createIsReadOnlyException();
- ICdtVariable macro = getMacro(name);
- if(macro != null){
- if(macro.getName().equals(name)
- && macro.getValueType() == type){
- try {
- String val = macro.getStringValue();
- if((val != null
- && val.equals(value))
- || val == value){
- return macro;
- }
- } catch (CdtVariableException e) {
- }
- }
- }
- return null;
- }
-
- public ICdtVariable checkMacro(String name, int type, String value[]){
- if(fIsReadOnly)
- throw ExceptionFactory.createIsReadOnlyException();
- ICdtVariable macro = getMacro(name);
- if(macro != null){
- if(macro.getName().equals(name)
- && macro.getValueType() == type){
- try {
- String val[] = macro.getStringListValue();
- if(val != null){
- if(value != null && value.length == val.length){
- int i;
- for(i = 0; i < val.length; i++){
- if(!value[i].equals(val[i]))
- break;
- }
- if(i == value.length)
- return macro;
- }
- } else if (value == val){
- return macro;
- }
- } catch (CdtVariableException e) {
- }
- }
- }
- return null;
- }
-
- /*
- * sets the storable macros to hold the geven number of macros
- * all macros that are present in the store but not included in the given array
- * will be removed
- */
- public void setMacros(ICdtVariable macros[]){
- if(fIsReadOnly)
- throw ExceptionFactory.createIsReadOnlyException();
- if(macros == null || macros.length == 0)
- deleteAll();
- else{
- if (getMap().size() != 0) {
- Iterator iter = getMap().values().iterator();
- while(iter.hasNext()){
- ICdtVariable m = (ICdtVariable)iter.next();
- int i;
- for(i = 0 ; i < macros.length; i++){
- if(m.getName().equals(macros[i].getName()))
- break;
- }
- if(i == macros.length)
- deleteMacro(m.getName());
- }
- }
- createMacros(macros);
- }
- }
-
- public void createMacros(ICdtVariable macros[]){
- if(fIsReadOnly)
- throw ExceptionFactory.createIsReadOnlyException();
- for(int i = 0; i < macros.length; i++){
- createMacro(macros[i]);
- }
- }
-
- public boolean isEmpty(){
- return fMacros == null || fMacros.isEmpty();
- }
-
- public ICdtVariable createMacro(ICdtVariable copy){
- if(fIsReadOnly)
- throw ExceptionFactory.createIsReadOnlyException();
- String name = copy.getName();
- if(name == null || "".equals(name = name.trim())) //$NON-NLS-1$
- return null;
-
- int type = copy.getValueType();
-
- ICdtVariable macro = null;
- try{
- if(CdtVariableResolver.isStringListVariable(type)){
- String value[] = copy.getStringListValue();
- macro = checkMacro(name, type, value);
- if(macro == null){
- macro = new StorableCdtVariable(name, type, value);
- addMacro(macro);
- fIsDirty = true;
- fIsChanged = true;
- }
- }
- else {
- String value = copy.getStringValue();
- macro = checkMacro(name, type, value);
- if(macro == null){
- macro = new StorableCdtVariable(name, type, value);
- addMacro(macro);
- fIsDirty = true;
- fIsChanged = true;
- }
- }
-
- }catch(CdtVariableException e){
- }
- return macro;
- }
-
- public ICdtVariable createMacro(String name, int type, String value[]){
- if(name == null || "".equals(name = name.trim()) || !CdtVariableResolver.isStringListVariable(type)) //$NON-NLS-1$
- return null;
-
- ICdtVariable macro = checkMacro(name, type, value);
- if(macro == null){
- macro = new StorableCdtVariable(name, type, value);
- addMacro(macro);
- fIsDirty = true;
- fIsChanged = true;
- }
- return macro;
- }
-
- /**
- * Returns the "dirty" state for this set of macros.
- * If the dirty state is <code>true</code>, that means that the macros
- * is out of synch with the repository and the macros need to be serialized.
- * <br><br>
- * The dirty state is automatically set to <code>false</code> when the macros are serialized
- * by calling the serialize() method
- * @return boolean
- */
- public boolean isDirty(){
- return fIsDirty;
- }
-
- /**
- * sets the "dirty" state for this set of macros.
- * @see org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables#isDirty()
- * @param dirty represents the new state
- */
- public void setDirty(boolean dirty){
- fIsDirty = dirty;
- }
-
- /**
- * Returns the "change" state for this set of macros.
- * The "change" state represents whether the macros were changed or not.
- * This state is not reset when the serialize() method is called
- * Users can use this state to monitor whether the macros were changed or not.
- * The "change" state can be reset only by calling the setChanged(false) method
- * @return boolean
- */
- public boolean isChanged(){
- return fIsChanged;
- }
-
-/* public boolean isExpanded(){
- return fExpandInMakefile;
- }
-*/
-/* public void setExpanded(boolean expand){
- if(fExpandInMakefile != expand){
- fExpandInMakefile = expand;
- fIsDirty = true;
- //should we set the change state here?
- fIsChanged = true;
- }
- }
-*/
- /**
- * sets the "change" state for this set of macros.
- * @see org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables#isChanged()
- * @param changed represents the new "change" state
- */
- public void setChanged(boolean changed){
- fIsChanged = changed;
- }
-
- public ICdtVariable getMacro(String name){
- if(name == null || "".equals(name = name.trim())) //$NON-NLS-1$
- return null;
-
- ICdtVariable var = (ICdtVariable)getMap().get(name);
- if(var == null){
- int indx = name.indexOf(':');
- if(indx != -1){
- String baseName = name.substring(0, indx);
- ICdtVariable tmp = (ICdtVariable)getMap().get(baseName);
- if(tmp != null
- && CdtVariableManager.getDefault().toEclipseVariable(tmp, null) != null){
- var = EclipseVariablesVariableSupplier.getInstance().getVariable(name);
- }
- }
- }
- return var;
- }
-
- public ICdtVariable[] getMacros(){
- Collection macros = getMap().values();
-
- return (ICdtVariable[])macros.toArray(new ICdtVariable[macros.size()]);
- }
-
- public ICdtVariable deleteMacro(String name){
- if(fIsReadOnly)
- throw ExceptionFactory.createIsReadOnlyException();
-
- if(name == null || "".equals(name = name.trim())) //$NON-NLS-1$
- return null;
-
- ICdtVariable macro = (ICdtVariable)getMap().remove(name);
- if(macro != null){
- fIsDirty = true;
- fIsChanged = true;
- }
-
- return macro;
- }
-
- public boolean deleteAll(){
- if(fIsReadOnly)
- throw ExceptionFactory.createIsReadOnlyException();
- Map map = getMap();
- if(map.size() > 0){
- fIsDirty = true;
- fIsChanged = true;
- map.clear();
- return true;
- }
- return false;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/UserDefinedVariableSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/UserDefinedVariableSupplier.java
deleted file mode 100644
index 94bd5902e6c..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/UserDefinedVariableSupplier.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.cdtvariables;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICStorageElement;
-import org.eclipse.cdt.core.settings.model.util.XmlStorageElement;
-import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
-import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
-import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * This supplier is used to obtain the user-defined macros
- *
- * @since 3.0
- */
-public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
-// public static final String MACROS_ELEMENT_NAME = "macros"; //$NON-NLS-1$
- public static final String NODENAME = "macros"; //$NON-NLS-1$
- public static final String PREFNAME_WORKSPACE = "workspace"; //$NON-NLS-1$
-
- private static UserDefinedVariableSupplier fInstance;
-
- private StorableCdtVariables fWorkspaceMacros;
-
- private StorableCdtVariables getStorableMacros(int contextType, Object contextData){
- StorableCdtVariables macros = null;
- switch(contextType){
- case ICoreVariableContextInfo.CONTEXT_CONFIGURATION:
- if(contextData instanceof IInternalCCfgInfo){
- try {
- CConfigurationSpecSettings settings = ((IInternalCCfgInfo)contextData).getSpecSettings();
- macros = settings.getMacros();
- } catch (CoreException e) {
- }
- }
- break;
- case ICoreVariableContextInfo.CONTEXT_WORKSPACE:
- if(contextData == null || contextData instanceof IWorkspace){
- if(fWorkspaceMacros == null)
- fWorkspaceMacros = loadWorkspaceMacros();
- macros = fWorkspaceMacros;
- }
- }
-
- return macros;
- }
-
- private UserDefinedVariableSupplier(){
-
- }
-
- public static UserDefinedVariableSupplier getInstance(){
- if(fInstance == null)
- fInstance = new UserDefinedVariableSupplier();
- return fInstance;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacro(java.lang.String, int, java.lang.Object)
- */
- public ICdtVariable getMacro(String macroName, int contextType, Object contextData) {
- if(macroName == null || "".equals(macroName)) //$NON-NLS-1$
- return null;
-
- StorableCdtVariables macros = getStorableMacros(contextType,contextData);
- if(macros != null)
- return macros.getMacro(macroName);
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacros(int, java.lang.Object)
- */
- public ICdtVariable[] getMacros(int contextType, Object contextData) {
- StorableCdtVariables macros = getStorableMacros(contextType,contextData);
- if(macros != null)
- return macros.getMacros();
- return null;
- }
-
- public ICdtVariable createMacro(String macroName,
- int type,
- String value,
- int contextType,
- Object contextData){
- if(macroName == null || "".equals(macroName)) //$NON-NLS-1$
- return null;
- StorableCdtVariables macros = getStorableMacros(contextType, contextData);
- if(macros == null)
- return null;
-
- ICdtVariable macro = macros.createMacro(macroName,type,value);
- if(macros.isChanged()){
- setRebuildStateForContext(contextType, contextData);
- macros.setChanged(false);
- }
-
- return macro;
-
- }
-
- public ICdtVariable createMacro(String macroName,
- int type,
- String value[],
- int contextType,
- Object contextData){
- if(macroName == null || "".equals(macroName)) //$NON-NLS-1$
- return null;
- StorableCdtVariables macros = getStorableMacros(contextType, contextData);
- if(macros == null)
- return null;
-
- ICdtVariable macro = macros.createMacro(macroName,type,value);
- if(macros.isChanged()){
- setRebuildStateForContext(contextType, contextData);
- macros.setChanged(false);
- }
-
- return macro;
-
- }
-
- public ICdtVariable createMacro(ICdtVariable copy, int contextType, Object contextData){
- if(copy == null)
- return null;
- String macroName = copy.getName();
- if(macroName == null || "".equals(macroName)) //$NON-NLS-1$
- return null;
- StorableCdtVariables macros = getStorableMacros(contextType, contextData);
- if(macros == null)
- return null;
-
- ICdtVariable macro = macros.createMacro(copy);
- if(macros.isChanged()){
- setRebuildStateForContext(contextType, contextData);
- macros.setChanged(false);
- }
-
- return macro;
- }
-
- public ICdtVariable deleteMacro(String name, int contextType, Object contextData){
- StorableCdtVariables macros = getStorableMacros(contextType,contextData);
- if(macros == null)
- return null;
- ICdtVariable macro = macros.deleteMacro(name);
- if(macro != null)
- setRebuildStateForContext(contextType, contextData);
-
- return macro;
- }
-
- public void deleteAll(int contextType, Object contextData){
- StorableCdtVariables macros = getStorableMacros(contextType, contextData);
- if(macros == null)
- return;
-
- if(macros.deleteAll())
- setRebuildStateForContext(contextType, contextData);
- }
-
- public void setMacros(ICdtVariable m[], int contextType, Object contextData){
- StorableCdtVariables macros = getStorableMacros(contextType, contextData);
- if(macros == null)
- return;
-
- macros.setMacros(m);
- if(macros.isChanged()){
- setRebuildStateForContext(contextType, contextData);
- macros.setChanged(false);
- }
- }
-
- /*
- *
- * methods used for loadding/storing workspace macros from properties
- *
- */
- public void storeWorkspaceVariables(boolean force){
- try{
- if(fWorkspaceMacros != null)
- storeWorkspaceMacros(fWorkspaceMacros,force);
- }catch(CoreException e){
- }
- }
-
- public StorableCdtVariables getWorkspaceVariablesCopy(){
- StorableCdtVariables vars = getStorableMacros(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
- return new StorableCdtVariables(vars, false);
- }
-
- public void setWorkspaceVariables(StorableCdtVariables vars) throws CoreException{
- fWorkspaceMacros = new StorableCdtVariables(vars, false);
-
- storeWorkspaceVariables(true);
- }
-
- private Preferences getWorkspaceNode(){
- Preferences prefNode = new InstanceScope().getNode(CCorePlugin.PLUGIN_ID);
- if(prefNode == null)
- return null;
-
- return prefNode.node(NODENAME);
- }
-
-
- /*
- * loads the stored workspace macros
- */
- protected StorableCdtVariables loadWorkspaceMacros(){
- InputStream stream = loadInputStream(getWorkspaceNode(),PREFNAME_WORKSPACE);
- if(stream == null)
- return new StorableCdtVariables(false);
- return loadMacrosFromStream(stream);
- }
-
- /*
- * stores the given macros
- */
- protected void storeWorkspaceMacros(StorableCdtVariables macros, boolean force) throws CoreException{
- if(!macros.isDirty() && !force)
- return;
-
- ByteArrayOutputStream stream = storeMacrosToStream(macros);
- if(stream == null)
- return;
- storeOutputStream(stream,getWorkspaceNode(),PREFNAME_WORKSPACE);
- }
-
- private StorableCdtVariables loadMacrosFromStream(InputStream stream){
- try{
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- InputSource inputSource = new InputSource(stream);
- Document document = parser.parse(inputSource);
- Element rootElement = document.getDocumentElement();
-
- if(!StorableCdtVariables.MACROS_ELEMENT_NAME.equals(rootElement.getNodeName()))
- return null;
-
- return new StorableCdtVariables(new XmlStorageElement(rootElement), true);
- }
- catch(ParserConfigurationException e){
-
- }
- catch(SAXException e){
-
- }
- catch(IOException e){
-
- }
-
- return null;
- }
-
- private ByteArrayOutputStream storeMacrosToStream(StorableCdtVariables macros) throws CoreException{
- try{
- DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
- DocumentBuilder builder= factory.newDocumentBuilder();
- Document document= builder.newDocument();
-
- Element rootElement = document.createElement(StorableCdtVariables.MACROS_ELEMENT_NAME);
- document.appendChild(rootElement);
- ICStorageElement storageElement = new XmlStorageElement(rootElement);
- macros.serialize(storageElement);
-
- Transformer transformer=TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- DOMSource source = new DOMSource(document);
-
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- StreamResult result = new StreamResult(stream);
-
- transformer.transform(source, result);
- return stream;
- }
- catch(ParserConfigurationException e){
- throw ExceptionFactory.createCoreException(e.getMessage(),
- e);
- }
- catch(TransformerConfigurationException e){
- throw ExceptionFactory.createCoreException(e.getMessage(),
- e);
- }
- catch(TransformerException e){
- throw ExceptionFactory.createCoreException(e.getMessage(),
- e);
- }
- }
-
- private InputStream loadInputStream(Preferences node, String key){
- if(node == null || key == null)
- return null;
-
- String value = node.get(key,null);
- if(value == null || value.length() == 0)
- return null;
-
- byte[] bytes;
- try {
- bytes = value.getBytes("UTF-8"); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- bytes = value.getBytes();
- }
-
- return new ByteArrayInputStream(bytes);
- }
-
- private void storeOutputStream(ByteArrayOutputStream stream, Preferences node, String key) throws CoreException{
- if(stream == null || node == null || key == null)
- throw ExceptionFactory.createCoreException(new IllegalArgumentException());
- byte[] bytes= stream.toByteArray();
-
- String val = null;
- try {
- val= new String(bytes, "UTF-8"); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- val= new String(bytes);
- }
-
- node.put(key,val);
-
- try{
- node.flush();
- }
- catch(BackingStoreException e){
- throw ExceptionFactory.createCoreException(e.getMessage(),
- e);
- }
- }
-
- protected void setRebuildStateForContext(int contextType, Object contextData){
-/*
- switch(contextType){
- case DefaultMacroContextInfo.CONTEXT_CONFIGURATION:
- if(contextData instanceof IConfiguration){
- ((IConfiguration)contextData).setRebuildState(true);
- }
- break;
- case DefaultMacroContextInfo.CONTEXT_WORKSPACE:
- if(contextData instanceof IWorkspace){
- IProject projects[] = ((IWorkspace)contextData).getRoot().getProjects();
- for(int i = 0; i < projects.length; i++){
- if(ManagedBuildManager.manages(projects[i])){
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projects[i]);
- if(info != null){
- IConfiguration cfgs[] = info.getManagedProject().getConfigurations();
- for(int j = 0; j < cfgs.length; j++){
- cfgs[j].setRebuildState(true);
- }
- }
- }
- }
- }
- }
-
-*/
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/InternalASTServiceProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/InternalASTServiceProvider.java
deleted file mode 100644
index d4fd71e3510..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/InternalASTServiceProvider.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.dom;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.IASTServiceProvider;
-import org.eclipse.cdt.core.dom.ICodeReaderFactory;
-import org.eclipse.cdt.core.dom.IParserConfiguration;
-import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
-import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.IScannerInfoProvider;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ParserUtil;
-import org.eclipse.cdt.core.parser.ScannerInfo;
-import org.eclipse.cdt.internal.core.dom.parser.ISourceCodeParser;
-import org.eclipse.cdt.internal.core.dom.parser.c.ANSICParserExtensionConfiguration;
-import org.eclipse.cdt.internal.core.dom.parser.c.GCCParserExtensionConfiguration;
-import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
-import org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ANSICPPParserExtensionConfiguration;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfiguration;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
-import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
-import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
-import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
-import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.content.IContentType;
-
-/**
- * @author jcamelon
- */
-public class InternalASTServiceProvider implements IASTServiceProvider {
-
- protected static final GCCScannerExtensionConfiguration C_GNU_SCANNER_EXTENSION = new GCCScannerExtensionConfiguration();
- protected static final GPPScannerExtensionConfiguration CPP_GNU_SCANNER_EXTENSION = new GPPScannerExtensionConfiguration();
- private static final String[] dialects = {
- "C99", //$NON-NLS-1$
- "C++98", //$NON-NLS-1$
- "GNUC", //$NON-NLS-1$
- "GNUC++" //$NON-NLS-1$
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getName()
- */
- public String getName() {
- // TODO is this a name or an id?
- return "CDT AST Service"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getTranslationUnit()
- */
- public IASTTranslationUnit getTranslationUnit(IFile fileToParse) throws UnsupportedDialectException {
- return getTranslationUnit( fileToParse.getLocation().toOSString(), fileToParse, SavedCodeReaderFactory.getInstance(), null );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getTranslationUnit(org.eclipse.cdt.core.dom.ICodeReaderFactory)
- */
- public IASTTranslationUnit getTranslationUnit(IFile fileToParse, ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- return getTranslationUnit( fileToParse.getLocation().toOSString(), fileToParse, fileCreator, null );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getTranslationUnit(org.eclipse.cdt.core.dom.ICodeReaderFactory, org.eclipse.cdt.core.dom.IParserConfiguration)
- */
- public IASTTranslationUnit getTranslationUnit(
- IFile fileToParse, ICodeReaderFactory fileCreator, IParserConfiguration configuration) throws UnsupportedDialectException {
- return getTranslationUnit( fileToParse.getLocation().toOSString(), fileToParse, fileCreator, configuration );
- }
-
- public IASTTranslationUnit getTranslationUnit(
- String filename, IResource infoProvider, ICodeReaderFactory fileCreator, IParserConfiguration configuration ) throws UnsupportedDialectException
- {
- IProject project = infoProvider.getProject();
- IScannerInfo scanInfo = null;
-
- if( configuration == null )
- {
- IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
- if (provider != null){
- IScannerInfo buildScanInfo = provider.getScannerInformation(infoProvider);
-
- if (buildScanInfo != null)
- scanInfo = buildScanInfo;
- else
- scanInfo = new ScannerInfo();
- }
- }
- else
- scanInfo = configuration.getScannerInfo();
-
- CodeReader reader = fileCreator.createCodeReaderForTranslationUnit(filename);
- if( reader == null )
- return null;
- IScanner scanner = null;
- ISourceCodeParser parser = null;
-
- if( configuration == null || configuration.getParserDialect() == null)
- {
- ParserLanguage l = getLanguage(filename, project);
- IScannerExtensionConfiguration scannerExtensionConfiguration;
- if( l == ParserLanguage.CPP )
- scannerExtensionConfiguration = CPP_GNU_SCANNER_EXTENSION;
- else
- scannerExtensionConfiguration = C_GNU_SCANNER_EXTENSION;
-
- scanner = new DOMScanner(reader, scanInfo, ParserMode.COMPLETE_PARSE,
- l, ParserFactory.createDefaultLogService(), scannerExtensionConfiguration, fileCreator );
- //assume GCC
- if( l == ParserLanguage.C )
- parser = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), new GCCParserExtensionConfiguration() );
- else
- parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), new GPPParserExtensionConfiguration() );
- }
- else
- {
- String dialect = configuration.getParserDialect();
- if( dialect.equals( dialects[0]) || dialect.equals( dialects[2]))
- scanner = new DOMScanner(reader, scanInfo, ParserMode.COMPLETE_PARSE,
- ParserLanguage.C,
- ParserUtil.getScannerLogService(), C_GNU_SCANNER_EXTENSION, fileCreator );
- else if( dialect.equals( dialects[1] ) || dialect.equals( dialects[3] ))
- scanner = new DOMScanner(reader, scanInfo, ParserMode.COMPLETE_PARSE,
- ParserLanguage.CPP,
- ParserUtil.getScannerLogService(), CPP_GNU_SCANNER_EXTENSION, fileCreator );
- else
- throw new UnsupportedDialectException();
-
- if( dialect.equals( dialects[0]))
- {
- ICParserExtensionConfiguration config = new ANSICParserExtensionConfiguration();
- parser = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), config );
- }
- else if( dialect.equals( dialects[1] ))
- {
- ICPPParserExtensionConfiguration config = new ANSICPPParserExtensionConfiguration();
- parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), config );
- }
- else if( dialect.equals( dialects[2]))
- {
- ICParserExtensionConfiguration config = new GCCParserExtensionConfiguration();
- parser = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), config );
- }
- else if( dialect.equals( dialects[3]))
- {
- ICPPParserExtensionConfiguration config = new GPPParserExtensionConfiguration();
- parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), config );
- }
- }
- // Parse
- return parser.parse();
- }
-
- public ASTCompletionNode getCompletionNode(IStorage fileToParse, IProject project, int offset,
- ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- return getCompletionNode(fileToParse.getFullPath().toOSString(), project, offset, fileCreator);
- }
-
- public ASTCompletionNode getCompletionNode(IFile fileToParse, int offset,
- ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- return getCompletionNode(fileToParse.getLocation().toOSString(), fileToParse, offset, fileCreator);
- }
-
- public ASTCompletionNode getCompletionNode(String filename, IResource infoProvider, int offset,
- ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
- // Get the scanner info
- IScannerInfo scanInfo = null;
- IProject project = infoProvider.getProject();
-
- IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
- if (provider != null) {
- IScannerInfo buildScanInfo = provider.getScannerInformation(infoProvider);
- if (buildScanInfo != null)
- scanInfo = buildScanInfo;
- else
- scanInfo = new ScannerInfo();
- }
-
- CodeReader reader = fileCreator.createCodeReaderForTranslationUnit(filename);
-
- ParserLanguage l = getLanguage(filename, project);
- IScannerExtensionConfiguration scannerExtensionConfiguration = null;
- if (l == ParserLanguage.CPP)
- scannerExtensionConfiguration = CPP_GNU_SCANNER_EXTENSION;
- else
- scannerExtensionConfiguration = C_GNU_SCANNER_EXTENSION;
-
- IScanner scanner = new DOMScanner(reader, scanInfo, ParserMode.COMPLETION_PARSE,
- l, ParserFactory.createDefaultLogService(),
- scannerExtensionConfiguration, fileCreator);
- scanner.setContentAssistMode(offset);
-
- // assume GCC
- ISourceCodeParser parser = null;
- if (l == ParserLanguage.C)
- parser = new GNUCSourceParser(scanner, ParserMode.COMPLETION_PARSE,
- ParserUtil.getParserLogService(),
- new GCCParserExtensionConfiguration());
- else
- parser = new GNUCPPSourceParser(scanner, ParserMode.COMPLETION_PARSE,
- ParserUtil.getParserLogService(),
- new GPPParserExtensionConfiguration());
-
- // Run the parse and return the completion node
- parser.parse();
- ASTCompletionNode node = parser.getCompletionNode();
- if (node != null) {
- node.count = scanner.getCount();
- }
- return node;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.core.dom.IASTServiceProvider#getSupportedDialects()
- */
- public String[] getSupportedDialects() {
- return dialects;
- }
-
- private ParserLanguage getLanguage( String filename, IProject project )
- {
- //FIXME: ALAIN, for headers should we assume CPP ??
- // The problem is that it really depends on how the header was included.
- String id = null;
- IContentType contentType = CCorePlugin.getContentType(project, filename);
- if (contentType != null) {
- id = contentType.getId();
- }
- if (id != null) {
- if (CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(id)) {
- return ParserLanguage.CPP;
- } else if (CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(id)) {
- return ParserLanguage.CPP;
- } else if (CCorePlugin.CONTENT_TYPE_CHEADER.equals(id)) {
- return ParserLanguage.C;
- } else if (CCorePlugin.CONTENT_TYPE_CSOURCE.equals(id)) {
- return ParserLanguage.C;
- } else if (CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(id)) {
- // ???
- // What do we do here ?
- }
- }
- return ParserLanguage.CPP;
- }
-
- public IASTTranslationUnit getTranslationUnit(IStorage fileToParse, IProject project, ICodeReaderFactory fileCreator) throws UnsupportedDialectException{
- return getTranslationUnit( fileToParse.getFullPath().toOSString(), project, fileCreator, null );
- }
-
- public IASTTranslationUnit getTranslationUnit(IStorage fileToParse, IProject project) throws UnsupportedDialectException {
- return getTranslationUnit( fileToParse.getFullPath().toOSString(), project, SavedCodeReaderFactory.getInstance(), null );
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/NullCodeReaderFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/NullCodeReaderFactory.java
deleted file mode 100644
index a36ddbb44d3..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/NullCodeReaderFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Anton Leherbauer (Wind River Systems) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.dom;
-
-import org.eclipse.cdt.core.dom.ICodeReaderFactory;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.ICodeReaderCache;
-import org.eclipse.cdt.core.parser.IScanner;
-
-/**
- * A <code>ICodeReaderFactory</code> which creates dummy <code>CodeReader</code>s without content.
- *
- * @since 4.0
- */
-public class NullCodeReaderFactory implements ICodeReaderFactory {
-
- private static final char[] EMPTY_CHARS = new char[0];
- private static final ICodeReaderFactory INSTANCE= new NullCodeReaderFactory();
-
- public static ICodeReaderFactory getInstance() {
- return INSTANCE;
- }
-
- private NullCodeReaderFactory() {
- // singleton
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForInclusion(org.eclipse.cdt.core.parser.IScanner, java.lang.String)
- */
- public CodeReader createCodeReaderForInclusion(IScanner scanner, String path) {
- return new CodeReader(path, EMPTY_CHARS);
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForTranslationUnit(java.lang.String)
- */
- public CodeReader createCodeReaderForTranslationUnit(String path) {
- return new CodeReader(path, EMPTY_CHARS);
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#getCodeReaderCache()
- */
- public ICodeReaderCache getCodeReaderCache() {
- return null;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#getUniqueIdentifier()
- */
- public int getUniqueIdentifier() {
- // is this used somewhere?
- return 7;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java
deleted file mode 100644
index 1040bfbb355..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.dom;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.dom.CDOM;
-import org.eclipse.cdt.core.dom.ICodeReaderFactory;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.ICodeReaderCache;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.ParserUtil;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
-
-/**
- * @author jcamelon
- */
-public class PartialWorkingCopyCodeReaderFactory
- implements ICodeReaderFactory {
-
- private final IWorkingCopyProvider provider;
- private ICodeReaderCache cache = null;
-
- /**
- * @param provider
- */
- public PartialWorkingCopyCodeReaderFactory(IWorkingCopyProvider provider) {
- this.provider = provider;
- cache = SavedCodeReaderFactory.getInstance().getCodeReaderCache();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#getUniqueIdentifier()
- */
- public int getUniqueIdentifier() {
- return CDOM.PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForTranslationUnit(java.lang.String)
- */
- public CodeReader createCodeReaderForTranslationUnit(String path) {
- return checkWorkingCopyThenCache(path);
- }
-
- public CodeReader createCodeReaderForTranslationUnit(ITranslationUnit tu) {
- return new CodeReader(tu.getPath().toOSString(), tu.getContents());
- }
-
- /**
- * @param path
- * @return
- */
- protected CodeReader checkWorkingCopyThenCache(String path) {
- char [] buffer = ParserUtil.findWorkingCopyBuffer( path, createWorkingCopyIterator() );
- if( buffer != null )
- return new CodeReader(path, buffer);
- return cache.get( path );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForInclusion(java.lang.String)
- */
- public CodeReader createCodeReaderForInclusion(IScanner scanner, String path) {
- return cache.get( path );
- }
-
- /**
- * @return
- */
- protected Iterator createWorkingCopyIterator() {
- if( provider == null ) return EmptyIterator.EMPTY_ITERATOR;
- return Arrays.asList( provider.getWorkingCopies() ).iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#getCodeReaderCache()
- */
- public ICodeReaderCache getCodeReaderCache() {
- return cache;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/SavedCodeReaderFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/SavedCodeReaderFactory.java
deleted file mode 100644
index 62432c65348..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/SavedCodeReaderFactory.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.dom;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.CDOM;
-import org.eclipse.cdt.core.dom.ICodeReaderFactory;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.CodeReaderCache;
-import org.eclipse.cdt.core.parser.ICodeReaderCache;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.core.runtime.Preferences;
-
-/**
- * @author jcamelon
- */
-public class SavedCodeReaderFactory implements ICodeReaderFactory {
-
- private ICodeReaderCache cache = null;
-
- public static SavedCodeReaderFactory getInstance()
- {
- return instance;
- }
-
- private static SavedCodeReaderFactory instance = new SavedCodeReaderFactory();
-
- private SavedCodeReaderFactory()
- {
- int size=0;
- Preferences pluginPreferences = CCorePlugin.getDefault().getPluginPreferences();
- if (CCorePlugin.getDefault() == null || pluginPreferences == null)
- size = CodeReaderCache.DEFAULT_CACHE_SIZE_IN_MB;
- else
- size = pluginPreferences.getInt(CodeReaderCache.CODE_READER_BUFFER);
-
- if (size > 0)
- cache = new CodeReaderCache(size);
- else if( size == 0 )
- {
- //necessary for cache to work headless
- String [] properties = pluginPreferences.propertyNames();
- boolean found = false;
- for( int j = 0; j < properties.length; ++j )
- if( properties[j].equals( CodeReaderCache.CODE_READER_BUFFER ) )
- {
- found = true;
- break;
- }
-
- if( !found && size == 0 )
- cache = new CodeReaderCache(CodeReaderCache.DEFAULT_CACHE_SIZE_IN_MB);
- else
- cache = new CodeReaderCache(0);
- }
- else
- cache = new CodeReaderCache(CodeReaderCache.DEFAULT_CACHE_SIZE_IN_MB);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#getUniqueIdentifier()
- */
- public int getUniqueIdentifier() {
- return CDOM.PARSE_SAVED_RESOURCES;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForTranslationUnit(java.lang.String)
- */
- public CodeReader createCodeReaderForTranslationUnit(String path) {
- return cache.get(path);
- }
-
- public CodeReader createCodeReaderForTranslationUnit(ITranslationUnit tu) {
- return new CodeReader(tu.getResource().getLocation().toOSString(), tu.getContents());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForInclusion(java.lang.String)
- */
- public CodeReader createCodeReaderForInclusion(IScanner scanner, String path) {
- return cache.get(path);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForInclusion(java.lang.String)
- */
- public ICodeReaderCache getCodeReaderCache() {
- return cache;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/WorkingCopyCodeReaderFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/WorkingCopyCodeReaderFactory.java
deleted file mode 100644
index a488b817dd2..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/WorkingCopyCodeReaderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.dom;
-
-import org.eclipse.cdt.core.dom.CDOM;
-import org.eclipse.cdt.core.dom.ICodeReaderFactory;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.IScanner;
-
-/**
- * @author jcamelon
- */
-public class WorkingCopyCodeReaderFactory extends
- PartialWorkingCopyCodeReaderFactory implements ICodeReaderFactory {
-
- /**
- * @param provider
- */
- public WorkingCopyCodeReaderFactory(IWorkingCopyProvider provider) {
- super(provider);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#getUniqueIdentifier()
- */
- public int getUniqueIdentifier() {
- return CDOM.PARSE_WORKING_COPY_WHENEVER_POSSIBLE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ICodeReaderFactory#createCodeReaderForInclusion(java.lang.String)
- */
- public CodeReader createCodeReaderForInclusion(IScanner scanner, String path) {
- return checkWorkingCopyThenCache(path);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/BuildSustemEnvironmentSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/BuildSustemEnvironmentSupplier.java
deleted file mode 100644
index 413aa7a5a7c..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/BuildSustemEnvironmentSupplier.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.core.envvar.IEnvironmentContributor;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
-import org.eclipse.cdt.internal.core.cdtvariables.DefaultVariableContextInfo;
-import org.eclipse.cdt.internal.core.cdtvariables.EnvironmentVariableSupplier;
-import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
-import org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-import org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor;
-import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableManager;
-import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
-
-/**
- * This is the Environment Variable Supplier used to supply variables
- * defined by the tool-integrator
- *
- * @since 3.0
- */
-public class BuildSustemEnvironmentSupplier implements
- ICoreEnvironmentVariableSupplier {
-
- /**
- * EnvironmentVariableProvider passed to the tool-integrator provided
- * suppliers.
- * Accepts only contexts lower than the one passed to a suppler
- *
- * @since 3.0
- */
- private class ExtensionEnvVarProvider extends EnvironmentVariableManager{
- private IEnvironmentContextInfo fStartInfo;
- private Object fStartLevel;
- private boolean fStartInitialized;
- private int fStartType;
- private Object fStartData;
- private IVariableContextInfo fStartMacroContextInfo;
- private boolean fStartMacroInfoInitialized;
-
- public ExtensionEnvVarProvider(Object level){
- fStartLevel = level;
- fStartType = getMacroContextTypeFromContext(level);
- fStartData = level;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable(java.lang.String, java.lang.Object, boolean)
- */
- public IEnvironmentVariable getVariable(String variableName,
- ICConfigurationDescription cfg, boolean resolveMacros) {
- if((variableName = getValidName(variableName)) == null)
- return null;
- return super.getVariable(variableName,cfg,resolveMacros);
- }
-
- public IEnvironmentVariable[] getVariables(ICConfigurationDescription cfg, boolean resolveMacros) {
- return filterVariables(super.getVariables(cfg,resolveMacros));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.envvar.EnvironmentVariableProvider#getContextInfo(java.lang.Object)
- */
- public IEnvironmentContextInfo getContextInfo(Object level){
- IEnvironmentContextInfo startInfo = getStartInfo();
- if(level == fStartLevel)
- return startInfo;
-
- IEnvironmentContextInfo info = super.getContextInfo(level);
- if(info == null)
- return null;
-
- if(checkParentContextRelation(startInfo,info))
- return info;
- return null;
- }
-
- protected IEnvironmentContextInfo getStartInfo(){
- if(fStartInfo == null && !fStartInitialized){
- IEnvironmentContextInfo info = super.getContextInfo(fStartLevel);
- if(info != null){
- ICoreEnvironmentVariableSupplier suppliers[] = info.getSuppliers();
- suppliers = filterValidSuppliers(suppliers);
- if(suppliers != null)
- fStartInfo = new DefaultEnvironmentContextInfo(fStartLevel,suppliers);
- else
- fStartInfo = info.getNext();
- fStartInitialized = true;
- }
- fStartInitialized = true;
- }
- return fStartInfo;
- }
-
- public IVariableSubstitutor getVariableSubstitutor(IVariableContextInfo info, String inexistentMacroValue, String listDelimiter){
- return super.getVariableSubstitutor(getSubstitutorMacroContextInfo(info),inexistentMacroValue,listDelimiter);
- }
-
- protected IVariableContextInfo getSubstitutorMacroContextInfo(IVariableContextInfo info){
- IVariableContextInfo startInfo = getStartMacroContextInfo();
- if(info == null)
- return null;
-
- if(info instanceof ICoreVariableContextInfo){
- ICoreVariableContextInfo coreInfo = (ICoreVariableContextInfo)info;
- if(coreInfo.getContextType() == fStartType &&
- coreInfo.getContextData() == fStartData)
- return startInfo;
- }
-
- if(SupplierBasedCdtVariableManager.checkParentContextRelation(startInfo,info))
- return info;
- return null;
- }
-
- protected IVariableContextInfo getStartMacroContextInfo(){
- if(fStartMacroContextInfo == null && !fStartMacroInfoInitialized){
- final IVariableContextInfo info = getMacroContextInfoForContext(fStartLevel);
- if(info != null){
- fStartMacroContextInfo = new DefaultVariableContextInfo(fStartType,fStartData){
- protected ICdtVariableSupplier[] getSuppliers(int type, Object data){
- ICdtVariableSupplier suppliers[] = info.getSuppliers();
- return filterValidMacroSuppliers(suppliers);
- }
-
- public IVariableContextInfo getNext() {
- return info.getNext();
- }
- };
- fStartInitialized = true;
- }
- fStartInitialized = true;
- }
- return fStartMacroContextInfo;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariable()
- */
- public IEnvironmentVariable getVariable(String name, Object context) {
- if(context == null)
- return null;
- if((name = getValidName(name)) == null)
- return null;
-
- if(context instanceof ICConfigurationDescription){
- ICConfigurationDescription cfg = (ICConfigurationDescription)context;
- IEnvironmentContributor supplier = cfg.getBuildSetting().getBuildEnvironmentContributor();
- if(supplier == null)
- return null;
- return supplier.getVariable(name, new ExtensionEnvVarProvider(context));
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariables()
- */
- public IEnvironmentVariable[] getVariables(Object context) {
- if(context == null)
- return null;
- IEnvironmentVariable variables[] = null;
- if(context instanceof ICConfigurationDescription){
- ICConfigurationDescription cfg = (ICConfigurationDescription)context;
- IEnvironmentContributor supplier = cfg.getBuildSetting().getBuildEnvironmentContributor();
- if(supplier == null)
- return null;
- variables = supplier.getVariables(new ExtensionEnvVarProvider(context));
- }
-
- return filterVariables(variables);
- }
-
- protected ICoreEnvironmentVariableSupplier[] filterValidSuppliers(ICoreEnvironmentVariableSupplier suppliers[]){
- if(suppliers == null)
- return null;
-
- int i = 0, j = 0;
- for(i = 0; i < suppliers.length; i++){
- if(suppliers[i] == this)
- break;
- }
-
-
- if(i >= suppliers.length)
- return null;
-
- int startNum = i + 1;
-
-
- ICoreEnvironmentVariableSupplier validSuppliers[] =
- new ICoreEnvironmentVariableSupplier[suppliers.length - startNum];
-
- for(i = startNum, j = 0; i < suppliers.length; i++, j++)
- validSuppliers[j] = suppliers[i];
-
- return validSuppliers;
- }
-
- protected String getValidName(String name){
- name = EnvVarOperationProcessor.normalizeName(name);
- if(name == null)
- return null;
- return name;
- }
-
- protected IEnvironmentVariable[] filterVariables(IEnvironmentVariable variables[]){
- return EnvVarOperationProcessor.filterVariables(variables,null);
- }
-
- protected ICdtVariableSupplier[] filterValidMacroSuppliers(ICdtVariableSupplier suppliers[]){
- if(suppliers == null)
- return null;
-
- int i = 0, j = 0;
- for(i = 0; i < suppliers.length; i++){
- if(suppliers[i] instanceof EnvironmentVariableSupplier)
- break;
- }
-
-
- if(i >= suppliers.length)
- return suppliers;
-
- int startNum = i + 1;
-
- ICdtVariableSupplier validSuppliers[] =
- new ICdtVariableSupplier[suppliers.length - startNum];
-
- for(i = startNum, j = 0; i < suppliers.length; i++, j++)
- validSuppliers[j] = suppliers[i];
-
- return validSuppliers;
- }
-
- public boolean appendEnvironment(Object context) {
- // TODO
- return true;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ContributedEnvironment.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ContributedEnvironment.java
deleted file mode 100644
index 82b3560ec38..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ContributedEnvironment.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.core.envvar.IContributedEnvironment;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-
-public class ContributedEnvironment implements IContributedEnvironment{
- private EnvironmentVariableManager fMngr;
- public ContributedEnvironment(EnvironmentVariableManager mngr){
- fMngr = mngr;
- }
- private class ContributedEnvContextInfo extends DefaultEnvironmentContextInfo {
- private IEnvironmentContextInfo fBaseInfo;
- private ICoreEnvironmentVariableSupplier fSuppliers[];
-
-/* public ContributedEnvContextInfo(Object context,
- ICoreEnvironmentVariableSupplier[] suppliers) {
- super(context, suppliers);
- }
-*/
- public ContributedEnvContextInfo(IEnvironmentContextInfo info) {
- super(info.getContext());
- fBaseInfo = info;
- }
-
- public ICoreEnvironmentVariableSupplier[] getSuppliers() {
- if(fSuppliers == null){
- ICoreEnvironmentVariableSupplier[] suppliers = fBaseInfo.getSuppliers();
- int i = 0;
- for(; i < suppliers.length; i++){
- if(suppliers[i] == EnvironmentVariableManager.fEclipseSupplier){
- break;
- }
- }
-
- if(i != suppliers.length){
- ICoreEnvironmentVariableSupplier tmp[] = new ICoreEnvironmentVariableSupplier[suppliers.length - 1];
- if(i != 0)
- System.arraycopy(suppliers, 0, tmp, 0, i);
- if(i != tmp.length)
- System.arraycopy(suppliers, i+1, tmp, i, tmp.length - i);
- suppliers = tmp;
- }
-
- fSuppliers = suppliers;
- }
- return fSuppliers;
- }
-
- public IEnvironmentContextInfo getNext() {
- IEnvironmentContextInfo baseNext = fBaseInfo.getNext();
- if(baseNext != null)
- return new ContributedEnvContextInfo(baseNext);
- return null;
- }
- }
-
- public IEnvironmentContextInfo getContextInfo(Object context){
- return new ContributedEnvContextInfo(fMngr.getDefaultContextInfo(context));
- }
-
- public IEnvironmentVariable[] getVariables(ICConfigurationDescription des){
- EnvVarCollector cr = EnvironmentVariableManager.getVariables(getContextInfo(des), true);
- if(cr != null){
- EnvVarDescriptor collected[] = cr.toArray(true);
- List vars = new ArrayList(collected.length);
- IEnvironmentVariable var;
- IEnvironmentContextInfo info = new DefaultEnvironmentContextInfo(des);//getContextInfo(des);
- for(int i = 0; i < collected.length; i++){
- var = collected[i];
- var = EnvironmentVariableManager.getVariable(var.getName(), info, true);
- if(var != null)
- vars.add(var);
- }
- return (EnvVarDescriptor[])vars.toArray(new EnvVarDescriptor[vars.size()]);
- }
- return new EnvVarDescriptor[0];
- }
-
- public IEnvironmentVariable getVariable(String name, ICConfigurationDescription des){
- EnvVarDescriptor varDes = EnvironmentVariableManager.getVariable(name, getContextInfo(des), true);
- if(varDes != null)
- return EnvironmentVariableManager.getVariable(name, new DefaultEnvironmentContextInfo(des), true);
- return null;
- }
-
- public boolean appendEnvironment(ICConfigurationDescription des){
- return EnvironmentVariableManager.fUserSupplier.appendContributedEnvironment(des);
- }
-
- public void setAppendEnvironment(boolean append, ICConfigurationDescription des){
- EnvironmentVariableManager.fUserSupplier.setAppendContributedEnvironment(append, des);
- }
-
- public IEnvironmentVariable addVariable(String name,
- String value,
- int op,
- String delimiter,
- ICConfigurationDescription des){
- return new EnvVarDescriptor(
- EnvironmentVariableManager.fUserSupplier.createVariable(name, value, op, delimiter, des),
- null,
- -1,
- EnvironmentVariableManager.fUserSupplier);
- }
-
- public IEnvironmentVariable removeVariable(String name, ICConfigurationDescription des){
- return EnvironmentVariableManager.fUserSupplier.deleteVariable(name, des);
- }
-
- public void restoreDefaults(ICConfigurationDescription des){
- EnvironmentVariableManager.fUserSupplier.restoreDefaults(des);
- }
-
- public boolean isUserVariable(ICConfigurationDescription des, IEnvironmentVariable var){
- if(var instanceof EnvVarDescriptor)
- return ((EnvVarDescriptor)var).getSupplier() == EnvironmentVariableManager.fUserSupplier;
- return false;
- }
-
- public void serialize(ICProjectDescription des){
- EnvironmentVariableManager.fUserSupplier.storeProjectEnvironment(des, false);
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/DefaultEnvironmentContextInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/DefaultEnvironmentContextInfo.java
deleted file mode 100644
index 2bf466a6ce4..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/DefaultEnvironmentContextInfo.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-
-/**
- * The default implementation of the IContextInfo used by the Environment Variable Provider
- * Used to represent the Configuration, Project, Workspace and Eclipse environment contexts
- *
- * @since 3.0
- */
-public class DefaultEnvironmentContextInfo implements IEnvironmentContextInfo{
- private Object fContextObject;
- private ICoreEnvironmentVariableSupplier fContextSuppliers[];
-
- /**
- * This constructor is used to create the default context info given a context object
- *
- * @param context
- */
- public DefaultEnvironmentContextInfo(Object context){
- fContextObject = context;
- }
-
- protected DefaultEnvironmentContextInfo(Object context, ICoreEnvironmentVariableSupplier suppliers[]){
- fContextSuppliers = suppliers;
- fContextObject = context;
- }
-
- /*
- * answers the list of suppliers that should be used for the given context
- */
- protected ICoreEnvironmentVariableSupplier[] getSuppliers(Object context){
- ICoreEnvironmentVariableSupplier suppliers[];
- if(context instanceof ICConfigurationDescription)
- suppliers = new ICoreEnvironmentVariableSupplier[]{EnvironmentVariableManager.fUserSupplier,EnvironmentVariableManager.fExternalSupplier};
- else
- suppliers = new ICoreEnvironmentVariableSupplier[]{EnvironmentVariableManager.fUserSupplier, EnvironmentVariableManager.fEclipseSupplier};
- return suppliers;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo#getNext()
- */
- public IEnvironmentContextInfo getNext(){
- DefaultEnvironmentContextInfo next = null;
- if(fContextObject == null)
- next = null;
- else if(fContextObject instanceof ICConfigurationDescription)
- next = new DefaultEnvironmentContextInfo(null);
-
- if(next != null && next.getSuppliers() == null)
- next = null;
- return next;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo#getSuppliers()
- */
- public ICoreEnvironmentVariableSupplier[] getSuppliers(){
- if(fContextSuppliers == null)
- fContextSuppliers = getSuppliers(fContextObject);
- return fContextSuppliers;
- }
-
- protected void setSuppliers(ICoreEnvironmentVariableSupplier suppliers[]){
- fContextSuppliers = suppliers;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo#getContext()
- */
- public Object getContext(){
- return fContextObject;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java
deleted file mode 100644
index df2a794c582..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import java.util.Enumeration;
-import java.util.Properties;
-
-import org.eclipse.cdt.core.envvar.EnvirinmentVariable;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.utils.spawner.EnvironmentReader;
-
-/**
- * This is the Environment Variable Supplier used to supply variables
- * defined in eclipse environment
- *
- * @since 3.0
- */
-public class EclipseEnvironmentSupplier implements ICoreEnvironmentVariableSupplier {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariable()
- */
- public IEnvironmentVariable getVariable(String name, Object context) {
- if(context == null){
- String value = EnvironmentReader.getEnvVar(name);
- if(value == null)
- return null;
- return new EnvirinmentVariable(name,value,IEnvironmentVariable.ENVVAR_REPLACE,null);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariables()
- */
- public IEnvironmentVariable[] getVariables(Object context) {
- if(context == null){
- Properties values = EnvironmentReader.getEnvVars();
- if(values == null)
- return null;
-
- IEnvironmentVariable variables[] = new IEnvironmentVariable[values.size()];
- Enumeration en = values.propertyNames();
- for( int i = 0; i < variables.length ; i++){
- String name = (String)en.nextElement();
- String value = values.getProperty(name);
- variables[i] = new EnvirinmentVariable(name,value,IEnvironmentVariable.ENVVAR_REPLACE,null);
- }
- return variables;
- }
- return null;
- }
-
- public boolean appendEnvironment(Object context) {
- return true;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java
deleted file mode 100644
index c265e3f8877..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
-
-/**
- * This class implements the "merging" functionality of environment variables
- * Used by the EnvironmentVariableProvider to "merge" the sets of macros returned
- * by different suppliers into one set returned to the user
- *
- * @since 3.0
- *
- */
-public class EnvVarCollector {
- private Map fMap = null;
- public EnvVarCollector(){
-
- }
-
- /**
- * adds an array of environment variables to the set of variables held by this collector
- * performing environment variable operations
- * @param vars
- */
- public void add(IEnvironmentVariable vars[]){
- add(vars,null,-1, null);
- }
-
- public void add(IEnvironmentVariable vars[], IEnvironmentContextInfo info, int num, ICoreEnvironmentVariableSupplier supplier){
- if(vars == null)
- return;
- boolean isCaseInsensitive = !EnvironmentVariableManager.getDefault().isVariableCaseSensitive();
- for(int i = 0; i < vars.length; i ++) {
- IEnvironmentVariable var = vars[i];
- String name = var.getName();
- if(isCaseInsensitive)
- name = name.toUpperCase();
-
- boolean noCheck = false;
-
- if(fMap == null){
- noCheck = true;
- fMap = new HashMap();
- }
-
- EnvVarDescriptor des = null;
- if(noCheck || (des = (EnvVarDescriptor)fMap.get(name)) == null){
- des = new EnvVarDescriptor(var,info,num, supplier);
- fMap.put(name,des);
- }
- else {
- des.setContextInfo(info);
- des.setSupplierNum(num);
- des.setVariable(EnvVarOperationProcessor.performOperation(des.getOriginalVariable(),var));
- }
- }
- }
-
- /**
- * Returns an array of variables held by this collector
- *
- * @param includeRemoved true if removed variables should be included in the resulting array
- * @return IBuildEnvironmentVariable[]
- */
- public EnvVarDescriptor[] toArray(boolean includeRemoved){
- if(fMap == null)
- return new EnvVarDescriptor[0];
- Collection values = fMap.values();
- List list = new ArrayList();
- Iterator iter = values.iterator();
- while(iter.hasNext()){
- EnvVarDescriptor des = (EnvVarDescriptor)iter.next();
- if(des != null &&
- (includeRemoved || des.getOperation() != IEnvironmentVariable.ENVVAR_REMOVE))
- list.add(des);
- }
- return (EnvVarDescriptor[])list.toArray(new EnvVarDescriptor[list.size()]);
- }
-
- /**
- * Returns a variable of a given name held by this collector
- *
- * @param name a variable name
- * @return IBuildEnvironmentVariable
- */
- public EnvVarDescriptor getVariable(String name){
- if(fMap == null)
- return null;
-
- if(!EnvironmentVariableManager.getDefault().isVariableCaseSensitive())
- name = name.toUpperCase();
-
- return (EnvVarDescriptor)fMap.get(name);
- }
-
- /**
- * Returns an array of variables held by this collector
- * The call to this method is equivalent of calling toArray(true)
- *
- * @return IBuildEnvironmentVariable[]
- */
- public EnvVarDescriptor[] getVariables(){
- return toArray(true);
- }
-
- public void clear(){
- if(fMap != null)
- fMap.clear();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarDescriptor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarDescriptor.java
deleted file mode 100644
index ec620f2b3b5..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarDescriptor.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-
-
-/*
- * this class represents the environment variable-relaed information.
- * That is the context for which the variable is defined and the supplier
- * that supplies the variable
- *
- */
-public class EnvVarDescriptor implements IEnvironmentVariable{
- private IEnvironmentVariable fVariable;
- private IEnvironmentContextInfo fContextInfo;
- private int fSupplierNum;
- private ICoreEnvironmentVariableSupplier fSupplier;
-
- public EnvVarDescriptor(IEnvironmentVariable variable, IEnvironmentContextInfo contextInfo, int supplierNum, ICoreEnvironmentVariableSupplier supplier){
- fVariable = variable;
- fContextInfo = contextInfo;
- fSupplierNum = supplierNum;
- fSupplier = supplier;
- }
-
- public IEnvironmentContextInfo getContextInfo() {
- return fContextInfo;
- }
-
- public int getSupplierNum() {
- return fSupplierNum;
- }
-
- public IEnvironmentVariable getOriginalVariable() {
- return fVariable;
- }
-
- public String getName() {
- return fVariable.getName();
- }
-
- public String getValue() {
- return fVariable.getValue();
- }
-
- public int getOperation() {
- return fVariable.getOperation();
- }
-
- public String getDelimiter() {
- return fVariable.getDelimiter();
- }
-
- public void setContextInfo(IEnvironmentContextInfo contextInfo) {
- fContextInfo = contextInfo;
- }
-
- public void setSupplierNum(int supplierNum) {
- fSupplierNum = supplierNum;
- }
-
- public void setVariable(IEnvironmentVariable variable) {
- fVariable = variable;
- }
-
- public ICoreEnvironmentVariableSupplier getSupplier(){
- return fSupplier;
- }
-
-/* public String getResolvedValue(int contextType, Object contextData){
- String value = null;
- if(getOperation() != IBuildEnvironmentVariable.ENVVAR_REMOVE){
- String name = getName();
- value = getValue();
- if(value != null && value.length() > 0){
- int supplierNum = -1;
- IMacroContextInfo macroInfo = getMacroContextInfo(fContextInfo);
- IBuildMacroSupplier macroSuppliers[] = macroInfo.getSuppliers();
- for(int i = 0; i < macroSuppliers.length; i++){
- if(macroSuppliers[i] instanceof EnvironmentMacroSupplier){
- supplierNum = i;
- break;
- }
- }
-
- DefaultMacroSubstitutor sub = new DefaultMacroSubstitutor(new DefaultMacroContextInfo(contextType,contextData),""," ");//,delimiters,""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try{
- value = sub.resolveToString(new BuildMacro(name,IBuildMacro.VALUE_TEXT,value),macroInfo,supplierNum);
- } catch (BuildMacroException e){
- }
- }
- }
- return value;
- }
-
- protected IMacroContextInfo getMacroContextInfo(IContextInfo info){
- Object context = info.getContext();
- if(context instanceof IConfiguration)
- return new DefaultMacroContextInfo(IBuildMacroProvider.CONTEXT_CONFIGURATION,context);
- else if(context instanceof IManagedProject)
- return new DefaultMacroContextInfo(IBuildMacroProvider.CONTEXT_PROJECT,context);
- else if(context instanceof IWorkspace)
- return new DefaultMacroContextInfo(IBuildMacroProvider.CONTEXT_WORKSPACE,context);
- else if(context == null)
- return new DefaultMacroContextInfo(IBuildMacroProvider.CONTEXT_ECLIPSEENV,context);
- return null;
- }
-*/
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
deleted file mode 100644
index 59492261564..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
-import org.eclipse.cdt.core.envvar.EnvirinmentVariable;
-import org.eclipse.cdt.core.envvar.IContributedEnvironment;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.internal.core.cdtvariables.DefaultVariableContextInfo;
-import org.eclipse.cdt.internal.core.cdtvariables.EnvironmentVariableSupplier;
-import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
-import org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier;
-import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
-import org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor;
-import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor;
-import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
-
-
-/**
- * This class implements the IEnvironmentVariableProvider interface and provides all
- * build environment funvtionality to the MBS
- *
- * @since 3.0
- *
- */
-public class EnvironmentVariableManager implements
- IEnvironmentVariableManager {
-
- private static final String DELIMITER_WIN32 = ";"; //$NON-NLS-1$
- private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
-
- private static EnvironmentVariableManager fInstance = null;
-
- private EnvVarVariableSubstitutor fVariableSubstitutor;
-
- public static final UserDefinedEnvironmentSupplier fUserSupplier = new UserDefinedEnvironmentSupplier();
- public static final BuildSustemEnvironmentSupplier fExternalSupplier = new BuildSustemEnvironmentSupplier();
- public static final EclipseEnvironmentSupplier fEclipseSupplier = new EclipseEnvironmentSupplier();
-
- private ContributedEnvironment fContributedEnvironment;
-
- public class EnvVarVariableSubstitutor extends SupplierBasedCdtVariableSubstitutor {
- private String fDefaultDelimiter;
-/* public EnvVarMacroSubstitutor(int contextType, Object contextData, String inexistentMacroValue, String listDelimiter){
- super(contextType,contextData,inexistentMacroValue,listDelimiter);
- fDefaultDelimiter = listDelimiter;
- }
-*/
- public EnvVarVariableSubstitutor(IVariableContextInfo contextInfo, String inexistentMacroValue, String listDelimiter){
- super(contextInfo, inexistentMacroValue, listDelimiter, null ,inexistentMacroValue);
- fDefaultDelimiter = listDelimiter;
- }
-
- public IEnvironmentVariable resolveVariable(EnvVarDescriptor var) throws CdtVariableException {
- String value;
- if(var == null || (value = var.getValue()) == null || value.length() == 0 || var.getOperation() == IEnvironmentVariable.ENVVAR_REMOVE)
- return var;
-
- String listDelimiter = var.getDelimiter();
- if(listDelimiter == null)
- listDelimiter = fDefaultDelimiter;
- setListDelimiter(listDelimiter);
- ICdtVariable macro = EnvironmentVariableSupplier.getInstance().createBuildMacro(var);
- IVariableContextInfo varMacroInfo = getVarMacroContextInfo(var);
- int varSupplierNum = getVarMacroSupplierNum(var,varMacroInfo);
- value = resolveToString(new MacroDescriptor(macro,varMacroInfo,varSupplierNum));
- removeResolvedMacro(var.getName());
- return new EnvirinmentVariable(var.getName(),value,var.getOperation(),var.getDelimiter());
- }
-
- protected IVariableContextInfo getVarMacroContextInfo(EnvVarDescriptor var){
- IEnvironmentContextInfo info = var.getContextInfo();
- if(info != null)
- return getMacroContextInfoForContext(info.getContext());
- return null;
- }
-
- protected int getVarMacroSupplierNum(EnvVarDescriptor var, IVariableContextInfo varMacroInfo){
- int varSupplierNum = -1;
- ICdtVariableSupplier macroSuppliers[] = varMacroInfo.getSuppliers();
- for(int i = 0; i < macroSuppliers.length; i++){
- if(macroSuppliers[i] instanceof EnvironmentVariableSupplier){
- varSupplierNum = i;
- break;
- }
- }
- return varSupplierNum;
- }
- }
-
- protected EnvironmentVariableManager(){
- fContributedEnvironment = new ContributedEnvironment(this);
- }
-
- public static EnvironmentVariableManager getDefault(){
- if(fInstance == null)
- fInstance = new EnvironmentVariableManager();
- return fInstance;
- }
-
- /*
- * returns a variable of a given name or null
- * the context information is taken from the contextInfo passed
- * @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo
- */
- public static EnvVarDescriptor getVariable(String variableName,
- IEnvironmentContextInfo contextInfo, boolean includeParentLevels){
-
- if(contextInfo == null)
- return null;
- if((variableName = EnvVarOperationProcessor.normalizeName(variableName)) == null) //$NON-NLS-1$
- return null;
-
-
- IEnvironmentContextInfo infos[] = getAllContextInfos(contextInfo);
-
- if(!includeParentLevels){
- ICoreEnvironmentVariableSupplier suppliers[] = infos[0].getSuppliers();
- boolean bVarFound = false;
- for(int i = 0; i < suppliers.length; i++){
- if(suppliers[i].getVariable(variableName,infos[0].getContext()) != null){
- bVarFound = true;
- break;
- }
- }
- if(!bVarFound)
- return null;
- }
-
- IEnvironmentVariable variable = null;
- IEnvironmentContextInfo varContextInfo = null;
- int varSupplierNum = -1;
- ICoreEnvironmentVariableSupplier varSupplier = null;
-
- for(int i = infos.length-1 ; i >=0 ; i-- ) {
- IEnvironmentContextInfo info = infos[i];
- ICoreEnvironmentVariableSupplier suppliers[] = info.getSuppliers();
-
- for(int j = suppliers.length-1 ; j >= 0 ; j-- ) {
- ICoreEnvironmentVariableSupplier supplier = suppliers[j];
- IEnvironmentVariable var = supplier.getVariable(variableName,info.getContext());
-
- if(var == null)
- continue;
-
- varContextInfo = info;
- varSupplierNum = j;
- varSupplier = supplier;
-
- if(variable == null)
- variable = var;
- else
- variable = EnvVarOperationProcessor.performOperation(variable,var);
- }
- }
-
- if(variable != null){
-// if(variable.getOperation() == IEnvironmentVariable.ENVVAR_REMOVE)
-// return null;
- return new EnvVarDescriptor(variable,varContextInfo,varSupplierNum,varSupplier);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable()
- */
- public IEnvironmentVariable getVariable(String variableName,
- ICConfigurationDescription cfg, boolean resolveMacros) {
- if(variableName == null || "".equals(variableName)) //$NON-NLS-1$
- return null;
-
- IEnvironmentContextInfo info = getContextInfo(cfg);
- EnvVarDescriptor var = getVariable(variableName,info,true);
-
- if(var != null && var.getOperation() != IEnvironmentVariable.ENVVAR_REMOVE){
- return resolveMacros ? calculateResolvedVariable(var,info) : var;
- }
- return null;
- }
-
- IEnvironmentContextInfo getDefaultContextInfo(Object level){
- DefaultEnvironmentContextInfo info = new DefaultEnvironmentContextInfo(level);
- if(info.getSuppliers() == null)
- return null;
- return info;
- }
-
- /*
- * returns the context info that should be used for the given level
- * or null if the the given level is not supported
- */
- public IEnvironmentContextInfo getContextInfo(Object level){
- if(level instanceof ICConfigurationDescription)
- return fContributedEnvironment.appendEnvironment((ICConfigurationDescription)level) ?
- getDefaultContextInfo(level) : fContributedEnvironment.getContextInfo(level);
- return getDefaultContextInfo(level);
- }
-
- /*
- * returns a list of defined variables.
- * the context information is taken from the contextInfo passed
- * @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo
- */
- public static EnvVarCollector getVariables(IEnvironmentContextInfo contextInfo,
- boolean includeParentLevels) {
- if(contextInfo == null)
- return null;
-
- IEnvironmentContextInfo infos[] = getAllContextInfos(contextInfo);
- HashSet set = null;
-
- if(!includeParentLevels){
- ICoreEnvironmentVariableSupplier suppliers[] = infos[0].getSuppliers();
- set = new HashSet();
- for(int i = 0; i < suppliers.length; i++){
- IEnvironmentVariable vars[] = suppliers[i].getVariables(infos[0].getContext());
- if(vars != null){
- for(int j = 0; j < vars.length; j++){
- String name = EnvVarOperationProcessor.normalizeName(vars[j].
- getName());
- if(name != null)
- set.add(name);
- }
- }
- if(!suppliers[i].appendEnvironment(infos[0].getContext()))
- break;
- }
- if(set.size() == 0)
- return new EnvVarCollector();
- }
-
- EnvVarCollector envVarSet = new EnvVarCollector();
-
- for(int i = infos.length-1 ; i >=0 ; i-- ) {
- IEnvironmentContextInfo info = infos[i];
- ICoreEnvironmentVariableSupplier suppliers[] = info.getSuppliers();
-
- for(int j = suppliers.length-1 ; j >= 0 ; j-- ) {
- ICoreEnvironmentVariableSupplier supplier = suppliers[j];
- if(!supplier.appendEnvironment(info.getContext())){
- envVarSet.clear();
- }
-
- IEnvironmentVariable vars[] = null;
- if(set != null){
- List varList = new ArrayList();
- Iterator iter = set.iterator();
-
- while(iter.hasNext()){
- IEnvironmentVariable var = supplier.getVariable((String)iter.next(),info.getContext());
- if(var != null)
- varList.add(var);
- }
- vars = (IEnvironmentVariable[])varList.toArray(new IEnvironmentVariable[varList.size()]);
- }
- else{
- vars = supplier.getVariables(info.getContext());
- }
- envVarSet.add(vars,info,j, supplier);
- }
- }
-
- return envVarSet;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariables()
- */
- public IEnvironmentVariable[] getVariables(ICConfigurationDescription cfg, boolean resolveMacros) {
-
-
- IEnvironmentContextInfo info = getContextInfo(cfg);
- EnvVarCollector varSet = getVariables(info,true);
-
- EnvVarDescriptor vars[] = varSet != null ? varSet.toArray(false) : null;
-
- if(vars != null){
- if(!resolveMacros)
- return vars;
-
- IEnvironmentVariable resolved[] = new IEnvironmentVariable[vars.length];
- for(int i = 0; i < vars.length; i++)
- resolved[i] = calculateResolvedVariable(vars[i], info);
- return resolved;
- }
- return new EnvVarDescriptor[0];
- }
-
- /*
- * returns an array of the IContextInfo that holds the context informations
- * starting from the one passed to this method and including all subsequent parents
- */
- public static IEnvironmentContextInfo[] getAllContextInfos(IEnvironmentContextInfo contextInfo){
- if(contextInfo == null)
- return null;
-
- List list = new ArrayList();
-
- list.add(contextInfo);
-
- while((contextInfo = contextInfo.getNext()) != null)
- list.add(contextInfo);
-
- return (IEnvironmentContextInfo[])list.toArray(new IEnvironmentContextInfo[list.size()]);
- }
-
- private boolean isWin32(){
- String os = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
- if (os.startsWith("windows ")) //$NON-NLS-1$
- return true;
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getDefaultDelimiter()
- */
- public String getDefaultDelimiter() {
- return isWin32() ? DELIMITER_WIN32 : DELIMITER_UNIX;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#isVariableCaseSensitive()
- */
- public boolean isVariableCaseSensitive() {
- return !isWin32();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getSuppliers()
- */
- public ICoreEnvironmentVariableSupplier[] getSuppliers(Object level) {
- IEnvironmentContextInfo info = getContextInfo(level);
- if(info != null)
- return info.getSuppliers();
- return null;
- }
-
- /*
- * returns true if the first passed contextInfo is the child of the second one
- */
- public boolean checkParentContextRelation(IEnvironmentContextInfo child, IEnvironmentContextInfo parent){
- if(child == null || parent == null)
- return false;
-
- IEnvironmentContextInfo enumInfo = child;
- do{
- if(parent.getContext() == enumInfo.getContext())
- return true;
- }while((enumInfo = enumInfo.getNext()) != null);
- return false;
- }
-
- public IEnvironmentVariable calculateResolvedVariable(EnvVarDescriptor des, IEnvironmentContextInfo info){
- if(des == null || info == null)
- return null;
-
- return calculateResolvedVariable(des,getVariableSubstitutor(getMacroContextInfoForContext(info.getContext()),""," ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public IEnvironmentVariable calculateResolvedVariable(EnvVarDescriptor des, IVariableSubstitutor sub){
- if(des == null)
- return null;
- IEnvironmentVariable var = des;
-
- try{
- if(sub instanceof EnvVarVariableSubstitutor)
- var = ((EnvVarVariableSubstitutor)sub).resolveVariable(des);
- else if(des.getOperation() != IEnvironmentVariable.ENVVAR_REMOVE){
- String name = des.getName();
- var = new EnvirinmentVariable(name,sub.resolveToString(name),des.getOperation(),des.getDelimiter());
- }
- } catch (CdtVariableException e){
- }
- return var;
-
- }
-
- protected int getMacroContextTypeFromContext(Object context){
- if(context instanceof ICConfigurationDescription)
- return ICoreVariableContextInfo.CONTEXT_CONFIGURATION;
- else
- return ICoreVariableContextInfo.CONTEXT_WORKSPACE;
- }
-
- public ICoreVariableContextInfo getMacroContextInfoForContext(Object context){
- return new DefaultVariableContextInfo(getMacroContextTypeFromContext(context),context);
- }
-
- public IVariableSubstitutor getVariableSubstitutor(IVariableContextInfo info, String inexistentMacroValue, String listDelimiter){
- if(fVariableSubstitutor == null)
- fVariableSubstitutor = new EnvVarVariableSubstitutor(info,inexistentMacroValue,listDelimiter);
- else {
- try {
- fVariableSubstitutor.setMacroContextInfo(info);
- fVariableSubstitutor.setInexistentMacroValue(inexistentMacroValue);
- fVariableSubstitutor.setListDelimiter(listDelimiter);
- } catch (CdtVariableException e){
- fVariableSubstitutor = new EnvVarVariableSubstitutor(info,inexistentMacroValue,listDelimiter);
- }
- }
- return fVariableSubstitutor;
- }
-
- public IContributedEnvironment getContributedEnvironment() {
- return fContributedEnvironment;
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ICoreEnvironmentVariableSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ICoreEnvironmentVariableSupplier.java
deleted file mode 100644
index f6a642236d8..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ICoreEnvironmentVariableSupplier.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-
-
-/**
- *
- * @since 3.0
- */
-public interface ICoreEnvironmentVariableSupplier {
-
- /**
- *
- * @param name the variable name
- * @param context the context
- * @return the reference to the IBuildEnvironmentVariable interface representing
- * the variable of a given name
- */
- IEnvironmentVariable getVariable(String name, Object context);
-
- /**
- *
- * @param context the context
- * @return the array of IBuildEnvironmentVariable that represents the environment variables
- */
- IEnvironmentVariable[] getVariables(Object context);
-
- boolean appendEnvironment(Object context);
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/IEnvironmentContextInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/IEnvironmentContextInfo.java
deleted file mode 100644
index 9a4ee57f6da..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/IEnvironmentContextInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-
-
-
-/**
- * This interface is used by the Environment Variable Provider to
- * represent the given context(level) information
- *
- * @since 3.0
- */
-public interface IEnvironmentContextInfo {
- /**
- * Returns the next lower-precedence context
- *
- * @return IContextInfo
- */
- public IEnvironmentContextInfo getNext();
-
- /**
- * Returns the array of suppliers to be used for this context
- *
- * @return IEnvironmentVariableSupplier[]
- */
- public ICoreEnvironmentVariableSupplier[] getSuppliers();
-
- /**
- * Returns the current context
- *
- * @return Object
- */
- public Object getContext();
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/UserDefinedEnvironmentSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/UserDefinedEnvironmentSupplier.java
deleted file mode 100644
index 493500a3d84..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/UserDefinedEnvironmentSupplier.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.envvar;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
-import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
-import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
-import org.eclipse.cdt.utils.envvar.StorableEnvironment;
-import org.eclipse.cdt.utils.envvar.StorableEnvironmentLoader;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * This is the Environment Variable Supplier used to supply variables
- * defined by a user
- *
- * @since 3.0
- */
-public class UserDefinedEnvironmentSupplier extends
- StorableEnvironmentLoader
- implements ICoreEnvironmentVariableSupplier{
-
- public static final String NODENAME = "environment"; //$NON-NLS-1$
- public static final String PREFNAME_WORKSPACE = "workspace"; //$NON-NLS-1$
- public static final String PREFNAME_PROJECT = "project"; //$NON-NLS-1$
- public static final String NODENAME_CFG = "project"; //$NON-NLS-1$
-
-/* private static final String fNonOverloadableVariables[] = new String[]{
- //users not allowed currently to override the "CWD" and "PWD" variables
- EnvVarOperationProcessor.normalizeName("CWD"), //$NON-NLS-1$
- EnvVarOperationProcessor.normalizeName("PWD") //$NON-NLS-1$
- };
-*/
- private StorableEnvironment fWorkspaceVariables;
-
- protected StorableEnvironment getEnvironment(Object context){
- return getEnvironment(context,true);
- }
-
- protected StorableEnvironment getEnvironment(Object context, boolean forceLoad){
-// if(context == null)
-// return null;
-
- StorableEnvironment env = null;
- if(context instanceof IInternalCCfgInfo){
- try {
- CConfigurationSpecSettings settings = ((IInternalCCfgInfo)context).getSpecSettings();
- env = settings.getEnvironment();
- if(env == null && forceLoad){
- env = loadEnvironment(context, settings.isReadOnly());
- settings.setEnvironment(env);
- }
- } catch (CoreException e) {
- }
- }
- else if(context instanceof IWorkspace || context == null){
- if(fWorkspaceVariables == null && forceLoad)
- fWorkspaceVariables = loadEnvironment(context, false);
- env = fWorkspaceVariables;
- }
-
- return env;
- }
-
- protected ISerializeInfo getSerializeInfo(Object context){
- ISerializeInfo serializeInfo = null;
-
- if(context instanceof ICConfigurationDescription){
- ICConfigurationDescription cfg = (ICConfigurationDescription)context;
-
- final Preferences prefs = getConfigurationNode(cfg.getProjectDescription());
- final String name = cfg.getId();
- if(prefs != null && name != null)
- serializeInfo = new ISerializeInfo(){
- public Preferences getNode(){
- return prefs;
- }
-
- public String getPrefName(){
- return name;
- }
- };
- }
- else if(context == null || context instanceof IWorkspace){
- final Preferences prefs = getWorkspaceNode();
- final String name = PREFNAME_WORKSPACE;
- if(prefs != null && name != null)
- serializeInfo = new ISerializeInfo(){
- public Preferences getNode(){
- return prefs;
- }
-
- public String getPrefName(){
- return name;
- }
- };
- }
- return serializeInfo;
- }
-
- private Preferences getConfigurationNode(ICProjectDescription projDes){
- Preferences prefNode = getProjectNode(projDes);
- if(prefNode == null)
- return null;
-
- return prefNode.node(NODENAME_CFG);
- }
-
- private Preferences getProjectNode(ICProjectDescription projDes){
- if(projDes == null)
- return null;
- IProject project = projDes.getProject();
- if(!project.exists())
- return null;
-
- Preferences prefNode = new ProjectScope(project).getNode(CCorePlugin.PLUGIN_ID);
- if(prefNode == null)
- return null;
-
- return prefNode.node(NODENAME);
- }
-
- private Preferences getWorkspaceNode(){
- Preferences prefNode = new InstanceScope().getNode(CCorePlugin.PLUGIN_ID);
- if(prefNode == null)
- return null;
-
- return prefNode.node(NODENAME);
- }
-
- public void checkInexistentConfigurations(ICProjectDescription projDes){
- Preferences prefNode = getConfigurationNode(projDes);
- if(prefNode == null)
- return;
-
- try{
- String ids[] = prefNode.keys();
- boolean found = false;
- for( int i = 0; i < ids.length; i++){
- if(projDes.getConfigurationById(ids[i]) == null){
- prefNode.remove(ids[i]);
- found = true;
- }
- }
-
- if(found)
- prefNode.flush();
- }
- catch(BackingStoreException e){
- }
- }
-
- public void storeWorkspaceEnvironment(boolean force){
- if(fWorkspaceVariables != null){
- try{
- storeEnvironment(fWorkspaceVariables,ResourcesPlugin.getWorkspace(),force, true);
- } catch(CoreException e){
-
- }
- }
- }
-
- public StorableEnvironment getWorkspaceEnvironmentCopy(){
- StorableEnvironment envVar = getEnvironment(null);
- return new StorableEnvironment(envVar, false);
- }
-
- public void setWorkspaceEnvironment(StorableEnvironment env){
- fWorkspaceVariables = new StorableEnvironment(env, false);
-
- storeWorkspaceEnvironment(true);
- }
-
- public void storeProjectEnvironment(ICProjectDescription des, boolean force){
- ICConfigurationDescription cfgs[] = des.getConfigurations();
- for(int i = 0; i < cfgs.length; i++){
- storeEnvironment(cfgs[i], force, false);
- }
-
- Preferences node = getProjectNode(des);
- try {
- node.flush();
- } catch (BackingStoreException e) {
- }
- }
-
- private void storeEnvironment(Object context, boolean force, boolean flush){
- StorableEnvironment env = getEnvironment(context, false);
- if(env != null){
- try {
- storeEnvironment(env, context, force, flush);
- } catch (CoreException e) {
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariable()
- */
- public IEnvironmentVariable getVariable(String name, Object context) {
- if(getValidName(name) == null)
- return null;
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return null;
- return env.getVariable(name);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariables()
- */
- public IEnvironmentVariable[] getVariables(Object context) {
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return null;
- return filterVariables(env.getVariables());
- }
-
- public IEnvironmentVariable createVariable(String name, String value, int op, String delimiter, Object context){
- if(getValidName(name) == null)
- return null;
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return null;
- IEnvironmentVariable var = env.createVariable(name,value,op,delimiter);
- if(env.isChanged()){
- setRebuildStateForContext(context);
- env.setChanged(false);
- }
- return var;
- }
-
- public IEnvironmentVariable deleteVariable(String name, Object context){
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return null;
- IEnvironmentVariable var = env.deleteVariable(name);
- if(var != null)
- setRebuildStateForContext(context);
- return var;
- }
-
- public void deleteAll(Object context){
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return;
-
- if(env.deleteAll())
- setRebuildStateForContext(context);
- }
-
- public void setVariables(IEnvironmentVariable vars[], Object context){
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return;
-
- env.setVariales(vars);
- if(env.isChanged()){
- setRebuildStateForContext(context);
- env.setChanged(false);
- }
- }
-
- protected void setRebuildStateForContext(Object context){
-/* if(context == null)
- return;
- if(context instanceof ICConfigurationDescription){
- cfgVarsModified((ICConfigurationDescription)context);
- } else if(context == null || context instanceof IWorkspace){
- CoreModel model = CoreModel.getDefault();
- IProject projects[] = ((IWorkspace)context).getRoot().getProjects();
- for(int i = 0; i < projects.length; i++){
- ICProjectDescription des = model.getProjectDescription(projects[i]);
-
-// if(ManagedBuildManager.manages(projects[i])){
-// IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projects[i]);
- if(des != null){
- ICConfigurationDescription cfgs[] = des.getConfigurations();
- for(int j = 0; j < cfgs.length; j++){
- cfgVarsModified(cfgs[j]);
- }
- }
-// }
- }
- }
-*/
- }
-
-// protected void cfgVarsModified(ICConfigurationDescription cfg){
-// cfg.setRebuildState(true);
-// EnvironmentVariableProvider.getDefault().checkBuildPathVariables(cfg);
-// }
-
- protected String getValidName(String name){
- if(name == null || (name = name.trim()).length() == 0)
- return null;
-// if(fNonOverloadableVariables != null){
-// for(int i = 0; i < fNonOverloadableVariables.length; i++){
-// if(fNonOverloadableVariables[i].equals(EnvVarOperationProcessor.normalizeName(name)))
-// return null;
-// }
-// }
- return name;
- }
-
- protected IEnvironmentVariable[] filterVariables(IEnvironmentVariable variables[]){
- return EnvVarOperationProcessor.filterVariables(variables,null);
- }
-
- public boolean appendEnvironment(Object context) {
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return true;
- return env.appendEnvironment();
- }
-
- public boolean appendContributedEnvironment(Object context){
- StorableEnvironment env = getEnvironment(context);
- if(env == null)
- return true;
- return env.appendContributedEnvironment();
- }
-
-
- public void setAppendEnvironment(boolean append, Object context) {
- StorableEnvironment env = getEnvironment(context);
- if(env != null){
- env.setAppendEnvironment(append);
- }
- }
-
- public void setAppendContributedEnvironment(boolean append, Object context){
- StorableEnvironment env = getEnvironment(context);
- if(env != null){
- env.setAppendContributedEnvironment(append);
- }
- }
-
- public void restoreDefaults(Object context){
- StorableEnvironment env = getEnvironment(context);
- if(env != null){
- env.restoreDefaults();
- }
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/parser/ParserLogService.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/parser/ParserLogService.java
deleted file mode 100644
index 626f828efd4..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/parser/ParserLogService.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * Markus Schorn (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.parser;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICLogConstants;
-import org.eclipse.cdt.core.parser.AbstractParserLogService;
-import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.internal.core.model.IDebugLogConstants.DebugLogConstant;
-
-/**
- * @author jcamelon
- *
- */
-public class ParserLogService extends AbstractParserLogService
-{
-
- final DebugLogConstant topic;
- final boolean fIsTracing;
- final boolean fIsTracingExceptions;
-
- /**
- * @param constant
- */
- public ParserLogService(DebugLogConstant constant) {
- topic = constant;
- if (CCorePlugin.getDefault() == null) {
- fIsTracing= fIsTracingExceptions= false;
- }
- else {
- fIsTracingExceptions= Util.PARSER_EXCEPTIONS;
- fIsTracing= Util.isActive(topic);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParserLogService#traceLog(java.lang.String)
- */
- public void traceLog(String message)
- {
- Util.debugLog( message, topic );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParserLogService#errorLog(java.lang.String)
- */
- public void errorLog(String message)
- {
- Util.log( message, ICLogConstants.CDT );
- }
-
- public boolean isTracing(){
- if( CCorePlugin.getDefault() == null )
- return false;
-
- return ( CCorePlugin.getDefault().isDebugging() && Util.isActive( topic ) );
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java
deleted file mode 100644
index a67ba446566..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.errorparsers;
-
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.core.IErrorParser;
-
-/**
- * @author Doug Schaefer
- *
- */
-public class AbstractErrorParser implements IErrorParser {
-
- private ErrorPattern[] patterns;
-
- protected AbstractErrorParser(ErrorPattern[] patterns) {
- this.patterns = patterns;
- }
-
- public boolean processLine(String line, ErrorParserManager eoParser) {
- for (int i = 0; i < patterns.length; ++i)
- if (patterns[i].processLine(line, eoParser))
- break;
- // Should this return true if we processed a line?
- return false;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java
deleted file mode 100644
index c37c8b80278..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.errorparsers;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.utils.CygPath;
-import org.eclipse.cdt.utils.DefaultCygwinToolFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author Doug Schaefer
- *
- */
-public class ErrorPattern {
- private final Pattern pattern;
- private final int groupFileName;
- private final int groupLineNum;
- private final int groupDesc;
- private final int groupVarName;
- private final int severity;
-
- /**
- * Full Pattern Constructor.
- *
- * @param pattern
- * @param groupFileName
- * @param groupLineNum
- * @param groupDesc
- * @param groupVarName
- * @param severity
- */
- public ErrorPattern(String pattern,
- int groupFileName,
- int groupLineNum,
- int groupDesc,
- int groupVarName,
- int severity) {
- this.pattern = Pattern.compile(pattern);
- this.groupFileName = groupFileName;
- this.groupLineNum = groupLineNum;
- this.groupDesc = groupDesc;
- this.groupVarName = groupVarName;
- this.severity = severity;
- }
-
- /**
- * Pattern for errors not associated file a file
- * (e.g. make and linker errors).
- *
- * @param pattern
- * @param groupDesc
- * @param severity
- */
- public ErrorPattern(String pattern, int groupDesc, int severity) {
- this(pattern, 0, 0, groupDesc, 0, severity);
- }
-
- /**
- * Pattern for errors that should be skipped.
- *
- * @param pattern
- */
- public ErrorPattern(String pattern) {
- this(pattern, 0, 0, 0, 0, -1);
- }
- public Matcher getMatcher(CharSequence input) {
- return pattern.matcher(input);
- }
-
- public String getFileName(Matcher matcher) {
- return groupFileName != 0 ? matcher.group(groupFileName) : null;
- }
-
- public int getLineNum(Matcher matcher) {
- try {
- return groupLineNum != 0
- ? Integer.valueOf(matcher.group(groupLineNum)).intValue()
- : 0;
- } catch (NumberFormatException e) {
- return 0;
- }
- }
-
- public String getDesc(Matcher matcher) {
- return groupDesc != 0 ? matcher.group(groupDesc) : null;
- }
-
- public String getVarName(Matcher matcher) {
- return groupVarName != 0 ? matcher.group(groupVarName) : null;
- }
-
- public int getSeverity(Matcher matcher) {
- return severity;
- }
-
- public boolean processLine(String line, ErrorParserManager eoParser) {
- Matcher matcher = getMatcher(line);
- if (!matcher.find())
- return false;
-
- return recordError(matcher, eoParser);
- }
-
- protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
- int severity = getSeverity(matcher);
- if (severity == -1)
- // Skip
- return true;
-
- String fileName = getFileName(matcher);
- int lineNum = getLineNum(matcher);
- String desc = getDesc(matcher);
- String varName = getVarName(matcher);
- IPath externalPath = null ;
-
- IResource file = null;
- if (fileName != null) {
- file = eoParser.findFileName(fileName);
- if (file == null || eoParser.isConflictingName(fileName)) {
- file = eoParser.findFilePath(fileName);
- }
-
- if (file == null) {
- // If the file is not found in the workspace we attach the problem to the project
- // and add the external path to the file.
- desc = fileName + " " + desc; //$NON-NLS-1$
- file = eoParser.getProject();
- externalPath = getLocation(fileName);
- }
- }
-
- eoParser.generateExternalMarker(file, lineNum, desc, severity, varName, externalPath);
- return true;
- }
-
- /**
- * If the file designated by filename exists, return the IPath representation of the filename
- * If it does not exist, try cygpath translation
- */
- protected IPath getLocation(String filename) {
- IPath path = new Path(filename);
- File file = path.toFile() ;
- if (!file.exists()) {
- CygPath cygpath = null ;
- try {
- cygpath = new CygPath("cygpath");
- String cygfilename = cygpath.getFileName(filename);
- path = new Path(cygfilename);
- } catch (IOException e) {
- }
- finally {
- if (null!=cygpath) {
- cygpath.dispose();
- }
- }
- }
- return path ;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java
deleted file mode 100644
index c2ac13d5939..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.errorparsers;
-
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.core.IErrorParser;
-import org.eclipse.cdt.core.IMarkerGenerator;
-import org.eclipse.core.resources.IFile;
-
-public class GASErrorParser implements IErrorParser {
-
- public boolean processLine(String line, ErrorParserManager eoParser) {
- // cc -c x.c
- // Only when the previous line sasys Assembler
- // /tmp/cc8EXnKk.s: Assembler messages:
- // /tmp/cc8EXnKk.s:46: Error: no such 386 instruction: `b'
- try {
- String previous = eoParser.getPreviousLine();
- 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")) { //$NON-NLS-1$
- if (! line.startsWith("FATAL")) { //$NON-NLS-1$
- int firstColon= line.indexOf(':');
- if (firstColon != -1) {
- fileName = line.substring(0, firstColon);
- desc = line.substring(firstColon + 1);
- int secondColon= line.indexOf(':', firstColon + 1);
- if (secondColon != -1) {
- String lineNumber = line.substring(firstColon + 1, secondColon);
- try {
- num = Integer.parseInt(lineNumber);
- } catch (NumberFormatException e) {
- }
- if (num != 0) {
- desc = line.substring(secondColon + 2);
- }
- }
- file = eoParser.findFileName(fileName);
- }
- }
- boolean isConflicting = false;
- if (file != null) {
- isConflicting = eoParser.isConflictingName(fileName);
- file = null;
- } else {
- file = eoParser.findFileName(fileName);
- }
- if (file == null) {
- desc = fileName + ":" + desc; //$NON-NLS-1$
- }
- eoParser.generateMarker(file, num, desc, severity, null);
- }
- } catch (IndexOutOfBoundsException e) {
- }
- return false;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
deleted file mode 100644
index 8127e4d6f94..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * James Blackburn - Patch for PR 85264
- * Norbert Ploett (Siemens AG) - externalized strings
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.errorparsers;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.cdt.core.IMarkerGenerator;
-
-public class GCCErrorParser extends AbstractErrorParser {
-
- private static final Pattern[] varPatterns = {
- Pattern.compile(Messages.GCCErrorParser_varPattern_undeclared),
- Pattern.compile(Messages.GCCErrorParser_varPattern_defdNotUsed),
- Pattern.compile(Messages.GCCErrorParser_varPattern_conflictTypes),
- Pattern.compile(Messages.GCCErrorParser_varPattern_parseError)
- };
-
- private static final ErrorPattern[] patterns = {
- // The following are skipped
- new ErrorPattern(Messages.GCCErrorParser_skip_UndeclaredOnlyOnce),
- new ErrorPattern(Messages.GCCErrorParser_skip_forEachFunction),
- new ErrorPattern(Messages.GCCErrorParser_skip_note),
- new ErrorPattern(Messages.GCCErrorParser_sikp_instantiatedFromHere),
- // The following are not...
- new ErrorPattern(Messages.GCCErrorParser_Warnings, 1, 2, 4, 0, 0) {
- public String getVarName(Matcher matcher) {
- String desc = getDesc(matcher);
- Matcher varMatcher = null;
- for (int i = 0; i < varPatterns.length; ++i) {
- varMatcher = varPatterns[i].matcher(desc);
- if (varMatcher.find())
- break;
- else
- varMatcher = null;
- }
-
- return varMatcher != null ? varMatcher.group(1) : null;
- }
- public int getSeverity(Matcher matcher) {
- String warningGroup = matcher.group(5);
- if (warningGroup != null)
- return IMarkerGenerator.SEVERITY_WARNING;
- else
- return IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
- }
- }
- };
-
- public GCCErrorParser() {
- super(patterns);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java
deleted file mode 100644
index e9df1cb75ae..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Norbert Ploett (Siemens AG) - externalized strings
-*******************************************************************************/
-
-package org.eclipse.cdt.internal.errorparsers;
-
-import java.util.regex.Matcher;
-
-import org.eclipse.cdt.core.IMarkerGenerator;
-
-public class GLDErrorParser extends AbstractErrorParser {
-
- private static final ErrorPattern[] patterns = {
- new ErrorPattern(Messages.GLDErrorParser_error_text, 1, 0, 2, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1
- new ErrorPattern(Messages.GLDErrorParser_warning_general, 2, IMarkerGenerator.SEVERITY_WARNING), //$NON-NLS-1
- new ErrorPattern(Messages.GLDErrorParser_error_general, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
- public String getDesc(Matcher matcher) {
- // add in the name of the link command to give it some context
- StringBuffer buff = new StringBuffer();
- buff.append("ld: "); //$NON-NLS-1$
- buff.append(matcher.group(2));
- return buff.toString();
- }
- }
- };
-
- public GLDErrorParser() {
- super(patterns);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java
deleted file mode 100644
index 9909d9ecbab..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Norbert Ploett (Siemens AG) - externalized strings
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.errorparsers;
-
-import java.util.regex.Matcher;
-
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.core.IMarkerGenerator;
-import org.eclipse.core.runtime.Path;
-
-public class MakeErrorParser extends AbstractErrorParser {
-
- private static final ErrorPattern[] patterns = {
- new ErrorPattern(Messages.MakeErrorParser_error_entering, 0, 0) { //$NON-NLS-1
- protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
- int level;
- try {
- level = Integer.valueOf(matcher.group(1)).intValue();
- } catch (NumberFormatException e) {
- level = 0;
- }
- String dir = matcher.group(2);
- /* Sometimes make screws up the output, so
- * "leave" events can't be seen. Double-check level
- * here.
- */
- int parseLevel = eoParser.getDirectoryLevel();
- for (; level < parseLevel; level++) {
- eoParser.popDirectory();
- }
- eoParser.pushDirectory(new Path(dir));
- return true;
- }
- },
- new ErrorPattern(Messages.MakeErrorParser_error_leaving, 0, 0) { //$NON-NLS-1
- protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
- eoParser.popDirectory();
- return true;
- }
- },
- new ErrorPattern(Messages.MakeErrorParser_error_general, 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
- protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
- if (!eoParser.hasErrors())
- super.recordError(matcher, eoParser);
- return true;
- }
- }
- };
-
- public MakeErrorParser() {
- super(patterns);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java
deleted file mode 100644
index b90071d5644..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Siemens AG.
- * All rights reserved. This content and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Norbert Ploett - Initial implementation
- *******************************************************************************/
-
-
-package org.eclipse.cdt.internal.errorparsers;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.errorparsers.messages"; //$NON-NLS-1$
- public static String GCCErrorParser_sikp_instantiatedFromHere;
- public static String GCCErrorParser_skip_forEachFunction;
- public static String GCCErrorParser_skip_note;
- public static String GCCErrorParser_skip_UndeclaredOnlyOnce;
- public static String GCCErrorParser_varPattern_conflictTypes;
- public static String GCCErrorParser_varPattern_defdNotUsed;
- public static String GCCErrorParser_varPattern_parseError;
- public static String GCCErrorParser_varPattern_undeclared;
- public static String GCCErrorParser_Warnings;
- public static String GLDErrorParser_error_general;
- public static String GLDErrorParser_error_text;
- public static String GLDErrorParser_warning_general;
- public static String MakeErrorParser_error_entering;
- public static String MakeErrorParser_error_general;
- public static String MakeErrorParser_error_leaving;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
deleted file mode 100644
index 2e6db842c45..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.errorparsers;
-
-import java.util.regex.Matcher;
-
-import org.eclipse.cdt.core.IMarkerGenerator;
-
-public class VCErrorParser extends AbstractErrorParser {
-
- private static final ErrorPattern[] patterns = {
- new ErrorPattern("(.+?)(\\(([0-9]+)\\))? : (fatal error|error|warning) (.*)", 1, 3, 5, 0, 0) {
- public int getSeverity(Matcher matcher) {
- return "warning".equals(matcher.group(4))
- ? IMarkerGenerator.SEVERITY_WARNING
- : IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
- }
- }
- };
-
- public VCErrorParser() {
- super(patterns);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties
deleted file mode 100644
index a3bb6a1888e..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 Siemens AG.
-# All rights reserved. This content and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Norbert Ploett - Initial implementation
-###############################################################################
-GCCErrorParser_varPattern_undeclared='(.*)' undeclared
-GCCErrorParser_varPattern_defdNotUsed='(.*)' defined but not used
-GCCErrorParser_varPattern_conflictTypes=conflicting types for '(.*)'
-GCCErrorParser_varPattern_parseError=parse error before '(.*)'
-GCCErrorParser_skip_UndeclaredOnlyOnce=\\(Each undeclared identifier is reported only once
-GCCErrorParser_skip_forEachFunction=for each function it appears in.\\)
-GCCErrorParser_skip_note=: note:
-GCCErrorParser_sikp_instantiatedFromHere=instantiated from here
-GCCErrorParser_Warnings=(.*?):([0-9]+):([0-9]+:)? ((.*?[Ww]arning)?.*)
-GLDErrorParser_error_text=(.*)\\(\\.text\\+.*\\): (.*)
-GLDErrorParser_warning_general=ld(\\.exe)?: ([Ww]arning .*)
-GLDErrorParser_error_general=ld(\\.exe)?: (.*)
-MakeErrorParser_error_entering=make\\[(.*)\\]: Entering directory `(.*)'
-MakeErrorParser_error_leaving=make\\[.*\\]: Leaving directory
-MakeErrorParser_error_general=(make: \\*\\*\\* \\[.*\\] Error .*)
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/AbortFormatting.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/AbortFormatting.java
deleted file mode 100644
index e29dd565aaa..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/AbortFormatting.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter;
-
-/**
- * Unchecked exception wrapping invalid input checked exception which may occur
- * when scanning original formatted source.
- *
- * @since 4.0
- */
-public class AbortFormatting extends RuntimeException {
-
- private static final long serialVersionUID= -5796507276311428526L;
- Throwable nestedException;
-
- public AbortFormatting(String message) {
- super(message);
- }
- public AbortFormatting(Throwable nestedException) {
- super(nestedException.getMessage());
- this.nestedException = nestedException;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java
deleted file mode 100644
index 97685a29eac..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Sergey Prigogin, Google
- * Anton Leherbauer (Wind River Systems)
- * IBM Corporation
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter;
-
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ICodeReaderFactory;
-import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
-import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
-import org.eclipse.cdt.core.formatter.CodeFormatter;
-import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
-import org.eclipse.cdt.core.index.IIndex;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ILanguage;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.ParserUtil;
-import org.eclipse.cdt.core.parser.ScannerInfo;
-import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.text.edits.TextEdit;
-
-public class CCodeFormatter extends CodeFormatter {
-
- private DefaultCodeFormatterOptions preferences;
- private Map options;
-
- public CCodeFormatter() {
- this(DefaultCodeFormatterOptions.getDefaultSettings());
- }
-
- public CCodeFormatter(DefaultCodeFormatterOptions preferences) {
- this(preferences, null);
- }
-
- public CCodeFormatter(DefaultCodeFormatterOptions defaultCodeFormatterOptions, Map options) {
- setOptions(options);
- if (defaultCodeFormatterOptions != null) {
- preferences.set(defaultCodeFormatterOptions.getMap());
- }
- }
-
- public CCodeFormatter(Map options) {
- this(null, options);
- }
-
- public String createIndentationString(final int indentationLevel) {
- if (indentationLevel < 0) {
- throw new IllegalArgumentException();
- }
-
- int tabs= 0;
- int spaces= 0;
- switch (preferences.tab_char) {
- case DefaultCodeFormatterOptions.SPACE:
- spaces= indentationLevel * preferences.tab_size;
- break;
-
- case DefaultCodeFormatterOptions.TAB:
- tabs= indentationLevel;
- break;
-
- case DefaultCodeFormatterOptions.MIXED:
- int tabSize= preferences.tab_size;
- int spaceEquivalents= indentationLevel
- * preferences.indentation_size;
- tabs= spaceEquivalents / tabSize;
- spaces= spaceEquivalents % tabSize;
- break;
-
- default:
- return EMPTY_STRING;
- }
-
- if (tabs == 0 && spaces == 0) {
- return EMPTY_STRING;
- }
- StringBuffer buffer= new StringBuffer(tabs + spaces);
- for (int i= 0; i < tabs; i++) {
- buffer.append('\t');
- }
- for (int i= 0; i < spaces; i++) {
- buffer.append(' ');
- }
- return buffer.toString();
- }
-
- public void setOptions(Map options) {
- if (options != null) {
- this.options= options;
- preferences= new DefaultCodeFormatterOptions(options);
- } else {
- this.options= CCorePlugin.getOptions();
- preferences= DefaultCodeFormatterOptions.getDefaultSettings();
- }
- }
-
- /*
- * @see org.eclipse.cdt.core.formatter.CodeFormatter#format(int, java.lang.String, int, int, int, java.lang.String)
- */
- public TextEdit format(int kind, String source, int offset, int length, int indentationLevel, String lineSeparator) {
- TextEdit edit= null;
- ITranslationUnit tu= (ITranslationUnit)options.get(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT);
- if (tu == null) {
- IFile file= (IFile)options.get(DefaultCodeFormatterConstants.FORMATTER_CURRENT_FILE);
- if (file != null) {
- tu= (ITranslationUnit)CoreModel.getDefault().create(file);
- }
- }
- if (lineSeparator != null) {
- this.preferences.line_separator = lineSeparator;
- } else {
- this.preferences.line_separator = System.getProperty("line.separator"); //$NON-NLS-1$
- }
- this.preferences.initial_indentation_level = indentationLevel;
-
- if (tu != null) {
- IIndex index;
- try {
- index = CCorePlugin.getIndexManager().getIndex(tu.getCProject());
- index.acquireReadLock();
- } catch (CoreException e) {
- throw new AbortFormatting(e);
- } catch (InterruptedException e) {
- return null;
- }
- IASTTranslationUnit ast;
- try {
- try {
- ast= tu.getAST(index, ITranslationUnit.AST_SKIP_ALL_HEADERS);
- } catch (CoreException exc) {
- throw new AbortFormatting(exc);
- }
- CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(this.preferences, this.options, offset, length);
- edit= codeFormatter.format(source, ast);
- } finally {
- index.releaseReadLock();
- }
- } else {
- ICodeReaderFactory codeReaderFactory;
- codeReaderFactory = SavedCodeReaderFactory.getInstance();
-
- IScannerInfo scanInfo = new ScannerInfo();
-
- CodeReader reader;
- reader= new CodeReader(source.toCharArray());
-
- ILanguage language= (ILanguage)options.get(DefaultCodeFormatterConstants.FORMATTER_LANGUAGE);
- if (language == null) {
- language= GPPLanguage.getDefault();
- }
- IASTTranslationUnit ast;
- try {
- ast= language.getASTTranslationUnit(reader, scanInfo, codeReaderFactory, null, ParserUtil.getParserLogService());
- CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(this.preferences, this.options, offset, length);
- edit= codeFormatter.format(source, ast);
- } catch (CoreException exc) {
- throw new AbortFormatting(exc);
- }
- }
- return edit;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
deleted file mode 100644
index 39518872e57..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
+++ /dev/null
@@ -1,2121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Anton Leherbauer (Wind River Systems) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EmptyStackException;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
-import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
-import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
-import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
-import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
-import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
-import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
-import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
-import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
-import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
-import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
-import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
-import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
-import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
-import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
-import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.dom.ast.IASTExpression;
-import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
-import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
-import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
-import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
-import org.eclipse.cdt.core.dom.ast.IASTForStatement;
-import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
-import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
-import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
-import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
-import org.eclipse.cdt.core.dom.ast.IASTInitializer;
-import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
-import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
-import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
-import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
-import org.eclipse.cdt.core.dom.ast.IASTMacroExpansion;
-import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
-import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
-import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
-import org.eclipse.cdt.core.dom.ast.IASTPreprocessorElifStatement;
-import org.eclipse.cdt.core.dom.ast.IASTPreprocessorElseStatement;
-import org.eclipse.cdt.core.dom.ast.IASTPreprocessorEndifStatement;
-import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfStatement;
-import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfdefStatement;
-import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfndefStatement;
-import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
-import org.eclipse.cdt.core.dom.ast.IASTProblem;
-import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
-import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
-import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
-import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
-import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
-import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
-import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
-import org.eclipse.cdt.core.dom.ast.IASTStatement;
-import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
-import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
-import org.eclipse.cdt.core.dom.ast.IASTTypeId;
-import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
-import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
-import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
-import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
-import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
-import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
-import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceAlias;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTWhileStatement;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
-import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
-import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
-import org.eclipse.cdt.internal.formatter.align.Alignment;
-import org.eclipse.cdt.internal.formatter.align.AlignmentException;
-import org.eclipse.cdt.internal.formatter.scanner.Scanner;
-import org.eclipse.cdt.internal.formatter.scanner.Token;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.Position;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * This class is responsible for formatting C/C++ source code.
- * Some heuristic is applied in case of syntax errors or other problems
- * to skip those areas, but because of incomplete location information
- * the formatting may fail. The reason of the failure is logged.
- *
- * @since 4.0
- */
-public class CodeFormatterVisitor extends CPPASTVisitor {
-
- private static boolean DEBUG = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.cdt.core/debug/formatter"));
-
- private static class ASTProblemException extends RuntimeException {
- private static final long serialVersionUID= 1L;
- ASTProblemException(IASTProblem problem) {
- super(problem.getMessage());
- if (DEBUG) System.err.println("PROBLEM: "+getMessage());
- }
- }
-
- private static class ListAlignment {
- public int fMode;
- public boolean fSpaceBeforeComma;
- public boolean fSpaceAfterComma= true;
- public boolean fSpaceAfterOpeningParen;
- public boolean fSpaceBeforeClosingParen;
- public boolean fSpaceBeforeOpeningParen;
- public ListAlignment(int mode) {
- fMode= mode;
- }
- }
-
- {
- shouldVisitNames = true;
- shouldVisitDeclarations = true;
- shouldVisitInitializers = true;
- shouldVisitParameterDeclarations = true;
- shouldVisitDeclarators = true;
- shouldVisitDeclSpecifiers = true;
- shouldVisitExpressions = true;
- shouldVisitStatements = true;
- shouldVisitTypeIds = true;
- shouldVisitEnumerators = true;
- shouldVisitTranslationUnit = true;
- shouldVisitProblems = true;
-
- shouldVisitBaseSpecifiers = true;
- shouldVisitNamespaces = true;
- shouldVisitTemplateParameters = true;
- }
-
- private Scanner localScanner;
-
- public DefaultCodeFormatterOptions preferences;
-
- public Scribe scribe;
- private String fTranslationUnitFile;
-
- private boolean fInsideFor;
-
- public CodeFormatterVisitor(DefaultCodeFormatterOptions preferences, Map settings, int offset, int length) {
- localScanner = new Scanner() {
- public Token nextToken() {
- Token t= super.nextToken();
- while (t != null && (t.isWhiteSpace() || t.isPreprocessor())) {
- t= super.nextToken();
- }
- return t;
- }
-
- };
- this.preferences = preferences;
- scribe = new Scribe(this, offset, length);
- }
-
- /**
- * @see org.eclipse.cdt.core.formatter.CodeFormatter#format(int, String, int, int, int, String)
- */
- public TextEdit format(String string, IASTTranslationUnit unit) {
- // reset the scribe
- scribe.reset();
-
- long startTime = System.currentTimeMillis();
-
- final char[] compilationUnitSource = string.toCharArray();
-
- localScanner.setSource(compilationUnitSource);
- scribe.initializeScanner(compilationUnitSource);
- scribe.setSkipPositions(collectInactiveCodePositions(unit));
-
- fTranslationUnitFile= unit.getFilePath();
- try {
- unit.accept(this);
- } catch (AbortFormatting e){
- return failedToFormat(e);
- } catch (RuntimeException e) {
- return failedToFormat(new AbortFormatting(e));
- }
- if (DEBUG){
- System.out.println("Formatting time: " + (System.currentTimeMillis() - startTime)); //$NON-NLS-1$
- }
- return scribe.getRootEdit();
- }
-
- private final TextEdit failedToFormat(AbortFormatting e) {
- String errorMessage= e.getMessage();
- if (errorMessage == null) {
- if (e.nestedException != null) {
- errorMessage= e.nestedException.getClass().getName();
- } else {
- errorMessage= "Unknown error";
- }
- }
- CCorePlugin.log(CCorePlugin.createStatus("Could not format: " + errorMessage, e.nestedException));
- if (DEBUG) {
- System.out.println("COULD NOT FORMAT: " + e.getMessage());
- System.out.println(scribe.scanner); //$NON-NLS-1$
- System.out.println(scribe);
- System.out.flush();
- System.err.flush();
- e.printStackTrace();
- System.err.flush();
- }
- return null;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit)
- */
- public int visit(IASTTranslationUnit tu) {
- // fake new line
- scribe.lastNumberOfNewLines = 1;
- scribe.startNewLine();
- int indentLevel= scribe.indentationLevel;
- IASTDeclaration[] decls= tu.getDeclarations();
- for (int i = 0; i < decls.length; i++) {
- IASTDeclaration declaration = decls[i];
- if (!fTranslationUnitFile.equals(declaration.getContainingFilename())) {
- continue;
- }
- try {
- declaration.accept(this);
- scribe.startNewLine();
- } catch (ASTProblemException e) {
- if (i < decls.length - 1) {
- exitAlignments();
- skipToNode(decls[i+1]);
- while (scribe.indentationLevel < indentLevel) {
- scribe.indent();
- }
- while (scribe.indentationLevel > indentLevel) {
- scribe.unIndent();
- }
- }
- }
- }
- scribe.printEndOfTranslationUnit();
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
- */
- public int visit(IASTDeclaration node) {
- int indentLevel= scribe.indentationLevel;
- try {
- if (node.getNodeLocations()[0] instanceof IASTMacroExpansion) {
- skipNode(node);
- } else
- if (node instanceof IASTFunctionDefinition) {
- return visit((IASTFunctionDefinition)node);
- } else if (node instanceof IASTSimpleDeclaration) {
- return visit((IASTSimpleDeclaration)node);
- } else if (node instanceof IASTASMDeclaration) {
- return visit((IASTASMDeclaration)node);
- } else if (node instanceof ICPPASTVisiblityLabel) {
- return visit((ICPPASTVisiblityLabel)node);
- } else if (node instanceof ICPPASTNamespaceDefinition) {
- return visit((ICPPASTNamespaceDefinition)node);
- } else if (node instanceof ICPPASTNamespaceAlias) {
- formatNode(node);
- // return visit((ICPPASTNamespaceAlias)declaration);
- } else if (node instanceof ICPPASTUsingDeclaration) {
- formatNode(node);
- // return visit((ICPPASTUsingDeclaration)declaration);
- } else if (node instanceof ICPPASTUsingDirective) {
- formatNode(node);
- // return visit((ICPPASTUsingDirective)declaration);
- } else if (node instanceof ICPPASTLinkageSpecification) {
- return visit((ICPPASTLinkageSpecification)node);
- } else if (node instanceof ICPPASTTemplateDeclaration) {
- return visit((ICPPASTTemplateDeclaration)node);
- } else if (node instanceof ICPPASTTemplateSpecialization) {
- return visit((ICPPASTTemplateSpecialization)node);
- } else if (node instanceof ICPPASTExplicitTemplateInstantiation) {
- return visit((ICPPASTExplicitTemplateInstantiation)node);
- } else if (node instanceof IASTProblemDeclaration) {
- return visit((IASTProblemDeclaration)node);
- } else {
- formatNode(node);
- }
- } catch (ASTProblemException e) {
- if (node instanceof IASTProblemDeclaration) {
- throw e;
- } else {
- skipNode(node);
- while (scribe.indentationLevel > indentLevel) {
- scribe.unIndent();
- }
- }
- }
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTName)
- */
- public int visit(IASTName node) {
- IASTNodeLocation[] locations= node.getNodeLocations();
- if (locations.length == 0) {
- return PROCESS_SKIP;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- formatNode(node);
- } else
- if (node instanceof ICPPASTQualifiedName) {
- visit((ICPPASTQualifiedName)node);
- } else if (node instanceof ICPPASTTemplateId) {
- visit((ICPPASTTemplateId)node);
- } else {
- formatNode(node);
- }
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTInitializer)
- */
- public int visit(IASTInitializer node) {
- IASTNodeLocation[] locations= node.getNodeLocations();
- if (locations.length == 0) {
- return PROCESS_SKIP;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- formatNode(node);
- return PROCESS_SKIP;
- }
- if (node instanceof ICPPASTConstructorInitializer) {
- visit((ICPPASTConstructorInitializer)node);
- return PROCESS_SKIP;
- }
-
- if (peekNextToken() == Token.tASSIGN) {
- scribe.printNextToken(Token.tASSIGN, scribe.printComment());
- if (scribe.printComment()) {
- scribe.space();
- }
- }
- if (node instanceof IASTInitializerExpression) {
- visit((IASTInitializerExpression)node);
- } else if (node instanceof IASTInitializerList) {
- visit((IASTInitializerList)node);
- } else if (node instanceof ICASTDesignatedInitializer) {
- formatNode(node);
- } else {
- formatNode(node);
- }
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
- */
- public int visit(IASTParameterDeclaration parameterDeclaration) {
- formatNode(parameterDeclaration);
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
- */
- public int visit(IASTDeclarator node) {
- IASTNodeLocation[] locations= node.getNodeLocations();
- if (locations.length == 0) {
- return PROCESS_SKIP;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- formatNode(node);
- return PROCESS_SKIP;
- }
-
- // common to all declarators
- scribe.printComment();
- formatPointers(node.getPointerOperators());
- IASTName name= node.getName();
- if (name != null) {
- name.accept(this);
- }
- IASTDeclarator nestedDecl= node.getNestedDeclarator();
- if (nestedDecl != null) {
- scribe.printNextToken(Token.tLPAREN, false);
- nestedDecl.accept(this);
- scribe.printNextToken(Token.tRPAREN, false);
- }
-
- if (node instanceof ICPPASTFunctionTryBlockDeclarator) {
- visit((IASTStandardFunctionDeclarator)node);
- skipNode(node);
- return PROCESS_SKIP;
- } else if (node instanceof ICPPASTFunctionDeclarator) {
- return visit((ICPPASTFunctionDeclarator)node);
- } else if (node instanceof IASTStandardFunctionDeclarator) {
- visit((IASTStandardFunctionDeclarator)node);
- } else if (node instanceof ICASTKnRFunctionDeclarator) {
- visit((ICASTKnRFunctionDeclarator)node);
- } else if (node instanceof IASTFieldDeclarator) {
- visit((IASTFieldDeclarator)node);
- } else if (node instanceof IASTArrayDeclarator) {
- visit((IASTArrayDeclarator)node);
- }
-
- IASTInitializer initializer= node.getInitializer();
- if (initializer != null) {
- initializer.accept(this);
- }
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
- */
- public int visit(IASTDeclSpecifier node) {
- IASTNodeLocation[] locations= node.getNodeLocations();
- if (locations.length == 0) {
- return PROCESS_SKIP;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- formatNode(node);
- } else
- if (node instanceof ICPPASTCompositeTypeSpecifier) {
- visit((ICPPASTCompositeTypeSpecifier)node);
- } else if (node instanceof ICASTCompositeTypeSpecifier) {
- visit((ICASTCompositeTypeSpecifier)node);
- } else if (node instanceof ICPPASTElaboratedTypeSpecifier) {
- visit((ICPPASTElaboratedTypeSpecifier)node);
- } else if (node instanceof ICASTElaboratedTypeSpecifier) {
- visit((ICASTElaboratedTypeSpecifier)node);
- } else if (node instanceof IASTEnumerationSpecifier) {
- visit((IASTEnumerationSpecifier)node);
- } else if (node instanceof IASTSimpleDeclSpecifier) {
- visit((IASTSimpleDeclSpecifier)node);
- } else if (node instanceof IASTNamedTypeSpecifier) {
- visit((IASTNamedTypeSpecifier)node);
- } else {
- formatNode(node);
- scribe.space();
- }
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTExpression)
- */
- public int visit(IASTExpression node) {
- IASTNodeLocation[] locations= node.getNodeLocations();
- if (locations.length == 0) {
- return PROCESS_SKIP;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- skipNode(node);
- } else if (locations[0].getNodeOffset()+locations[0].getNodeLength() < scribe.scanner.getCurrentPosition()) {
- return PROCESS_SKIP;
- } else
- if (node instanceof IASTConditionalExpression) {
- visit((IASTConditionalExpression)node);
- } else if (node instanceof IASTFunctionCallExpression) {
- visit((IASTFunctionCallExpression)node);
- } else if (node instanceof IASTExpressionList) {
- visit((IASTExpressionList)node);
- } else if (node instanceof IASTTypeIdExpression) {
- visit((IASTTypeIdExpression)node);
- } else if (node instanceof IASTBinaryExpression) {
- visit((IASTBinaryExpression)node);
- } else if (node instanceof IASTLiteralExpression) {
- visit((IASTLiteralExpression)node);
- } else if (node instanceof IASTProblemExpression) {
- visit((IASTProblemExpression)node);
- } else {
- formatNode(node);
- }
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTStatement)
- */
- public int visit(IASTStatement node) {
- scribe.printComment();
- int indentLevel= scribe.indentationLevel;
- IASTNodeLocation[] locations= node.getNodeLocations();
- try {
- if (locations.length == 0) {
- return PROCESS_SKIP;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- skipNode(node);
- } else if (locations[0].getNodeOffset()+locations[0].getNodeLength() < scribe.scanner.getCurrentPosition()) {
- return PROCESS_SKIP;
- } else
- if (node instanceof IASTCompoundStatement) {
- visit((IASTCompoundStatement)node);
- } else if (node instanceof IASTNullStatement) {
- visit((IASTNullStatement)node);
- } else if (node instanceof IASTDeclarationStatement) {
- visit((IASTDeclarationStatement)node);
- } else if (node instanceof ICPPASTForStatement) {
- // TLETODO [formatter] handle C++ specifics
- visit((IASTForStatement)node);
- } else if (node instanceof IASTForStatement) {
- visit((IASTForStatement)node);
- } else if (node instanceof IASTIfStatement) {
- visit((IASTIfStatement)node);
- } else if (node instanceof ICPPASTWhileStatement) {
- // TLETODO [formatter] handle C++ specifics
- visit((IASTWhileStatement)node);
- } else if (node instanceof IASTWhileStatement) {
- visit((IASTWhileStatement)node);
- } else if (node instanceof IASTDoStatement) {
- visit((IASTDoStatement)node);
- } else if (node instanceof IASTSwitchStatement) {
- visit((IASTSwitchStatement)node);
- } else if (node instanceof IASTExpressionStatement) {
- visit((IASTExpressionStatement)node);
- } else if (node instanceof IASTContinueStatement) {
- visit((IASTContinueStatement)node);
- } else if (node instanceof IASTReturnStatement) {
- visit((IASTReturnStatement)node);
- } else if (node instanceof IASTBreakStatement) {
- visit((IASTBreakStatement)node);
- } else if (node instanceof IASTCaseStatement) {
- visit((IASTCaseStatement)node);
- } else if (node instanceof IASTDefaultStatement) {
- visit((IASTDefaultStatement)node);
- } else if (node instanceof IASTLabelStatement) {
- visit((IASTLabelStatement)node);
- } else if (node instanceof IASTProblemStatement) {
- visit((IASTProblemStatement)node);
- } else {
- formatNode(node);
- }
- } catch (ASTProblemException e) {
- if (node instanceof IASTProblemStatement) {
- throw e;
- } else {
- skipNode(node);
- while (scribe.indentationLevel > indentLevel) {
- scribe.unIndent();
- }
- }
- }
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTTypeId)
- */
- public int visit(IASTTypeId typeId) {
- formatNode(typeId);
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
- */
- public int visit(IASTEnumerator enumerator) {
- formatNode(enumerator);
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTProblem)
- */
- public int visit(IASTProblem problem) {
- formatNode(problem);
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor#visit(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier)
- */
- public int visit(ICPPASTBaseSpecifier specifier) {
- formatNode(specifier);
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor#visit(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition)
- */
- public int visit(ICPPASTNamespaceDefinition node) {
- scribe.printComment();
- final int line= scribe.line;
- // namespace <name>
- scribe.printNextToken(Token.t_namespace, false);
- scribe.space();
- node.getName().accept(this);
-
- // member declarations
- IASTDeclaration[] memberDecls= node.getDeclarations();
- formatLeftCurlyBrace(line, preferences.brace_position_for_namespace_declaration);
- formatOpeningBrace(preferences.brace_position_for_namespace_declaration, preferences.insert_space_before_opening_brace_in_namespace_declaration);
- if (preferences.indent_body_declarations_compare_to_namespace_header) {
- scribe.indent();
- }
- scribe.startNewLine();
- for (int i = 0; i < memberDecls.length; i++) {
- IASTDeclaration declaration = memberDecls[i];
- if (declaration instanceof ICPPASTVisiblityLabel) {
- visit((ICPPASTVisiblityLabel)declaration);
- } else {
- declaration.accept(this);
- }
- scribe.startNewLine();
- }
- if (preferences.indent_body_declarations_compare_to_namespace_header) {
- scribe.unIndent();
- }
- formatClosingBrace(preferences.brace_position_for_namespace_declaration);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTLinkageSpecification node) {
- scribe.printComment();
- final int line= scribe.line;
- // extern "<linkage>"
- scribe.printNextToken(Token.t_extern, false);
- scribe.space();
- scribe.printNextToken(Token.tSTRING);
-
- // member declarations
- IASTDeclaration[] memberDecls= node.getDeclarations();
- // TLETODO [formatter] need options for linkage specification
- formatLeftCurlyBrace(line, preferences.brace_position_for_namespace_declaration);
- formatOpeningBrace(preferences.brace_position_for_namespace_declaration, preferences.insert_space_before_opening_brace_in_namespace_declaration);
- if (preferences.indent_body_declarations_compare_to_namespace_header) {
- scribe.indent();
- }
- scribe.startNewLine();
- for (int i = 0; i < memberDecls.length; i++) {
- IASTDeclaration declaration = memberDecls[i];
- if (declaration instanceof ICPPASTVisiblityLabel) {
- visit((ICPPASTVisiblityLabel)declaration);
- } else {
- declaration.accept(this);
- }
- scribe.startNewLine();
- }
- if (preferences.indent_body_declarations_compare_to_namespace_header) {
- scribe.unIndent();
- }
- formatClosingBrace(preferences.brace_position_for_namespace_declaration);
- return PROCESS_SKIP;
- }
-
- /*
- * @see org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor#visit(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter)
- */
- public int visit(ICPPASTTemplateParameter parameter) {
- formatNode(parameter);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTConstructorInitializer node) {
- scribe.printNextToken(Token.tLPAREN, false);
- final IASTExpression value= node.getExpression();
- if (value != null) {
- value.accept(this);
- }
- scribe.printNextToken(Token.tRPAREN, false);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTConstructorChainInitializer node) {
- final IASTName member= node.getMemberInitializerId();
- if (member!= null) {
- member.accept(this);
- scribe.printNextToken(Token.tLPAREN, false);
- final IASTExpression value= node.getInitializerValue();
- if (value != null) {
- value.accept(this);
- }
- scribe.printNextToken(Token.tRPAREN, false);
- } else {
- formatNode(node);
- }
- return PROCESS_SKIP;
- }
-
- private int visit(IASTFunctionDefinition node) {
- scribe.printComment();
- final int line= scribe.line;
- IASTDeclSpecifier declSpec= node.getDeclSpecifier();
- declSpec.accept(this);
- IASTFunctionDeclarator decl= node.getDeclarator();
- boolean needSpace= scribe.printComment() || (decl.getPointerOperators().length == 0 && decl.getNestedDeclarator() == null);
- if (needSpace) {
- scribe.space();
- }
- decl.accept(this);
- IASTStatement bodyStmt= node.getBody();
- if (bodyStmt instanceof IASTCompoundStatement) {
- formatLeftCurlyBrace(line, preferences.brace_position_for_method_declaration);
- formatBlock((IASTCompoundStatement) bodyStmt,
- preferences.brace_position_for_method_declaration,
- preferences.insert_space_before_opening_brace_in_method_declaration,
- preferences.indent_statements_compare_to_body);
- } else {
- bodyStmt.accept(this);
- }
- scribe.printTrailingComment();
- scribe.startNewLine();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTASMDeclaration node) {
- formatNode(node);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTFunctionDeclarator node) {
- visit((IASTStandardFunctionDeclarator)node);
- skipConstVolatile();
- final IASTTypeId[] exceptionSpecification= node.getExceptionSpecification();
- if (exceptionSpecification != null) {
- if (peekNextToken() == Token.t_throw) {
- // TLETODO [formatter] need special alignment for exception specification
- scribe.printNextToken(Token.t_throw, true);
- final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
- formatList(Arrays.asList(exceptionSpecification), align, true, false);
- }
- }
- final ICPPASTConstructorChainInitializer[] constructorChain= node.getConstructorChain();
- if (constructorChain != null && constructorChain.length > 0) {
- // TLETODO [formatter] need special constructor chain alignment
- scribe.printNextToken(Token.tCOLON, true);
- scribe.printTrailingComment();
- scribe.startNewLine();
- scribe.indent();
- final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
- formatList(Arrays.asList(constructorChain), align, false, false);
- scribe.unIndent();
- } else {
- // skip the rest (=0)
- skipNode(node);
- }
- return PROCESS_SKIP;
- }
-
- private void skipConstVolatile() {
- int token= peekNextToken();
- while (token == Token.t_const || token == Token.t_volatile) {
- scribe.printNextToken(token, true);
- token= peekNextToken();
- }
- }
-
- private int visit(IASTStandardFunctionDeclarator node) {
- final List parameters = Arrays.asList(node.getParameters());
- final ListAlignment align= new ListAlignment(preferences.alignment_for_parameters_in_method_declaration);
- align.fSpaceAfterOpeningParen= preferences.insert_space_after_opening_paren_in_method_declaration;
- align.fSpaceBeforeClosingParen= preferences.insert_space_before_closing_paren_in_method_declaration;
- align.fSpaceBeforeComma= preferences.insert_space_before_comma_in_method_declaration_parameters;
- align.fSpaceAfterComma= preferences.insert_space_after_comma_in_method_declaration_parameters;
- formatList(parameters, align, true, node.takesVarArgs());
-
- return PROCESS_SKIP;
- }
-
- private void formatPointers(IASTPointerOperator[] pointers) {
- for (int i = 0; i < pointers.length; i++) {
- IASTPointerOperator pointer= pointers[i];
- scribe.printModifiers();
- if (pointer instanceof ICPPASTReferenceOperator) {
- scribe.printNextToken(Token.tAMPER, false);
- } else if (pointer instanceof ICASTPointer) {
- scribe.printNextToken(Token.tSTAR, false);
- } else if (pointer instanceof ICPPASTPointerToMember) {
- final ICPPASTPointerToMember ptrToMember= (ICPPASTPointerToMember)pointer;
- final IASTName name= ptrToMember.getName();
- if (name != null) {
- name.accept(this);
- }
- scribe.printNextToken(Token.tSTAR, false);
- } else {
- skipNode(pointer);
- }
- }
- }
-
- private int visit(ICASTKnRFunctionDeclarator node) {
- final List parameters= Arrays.asList(node.getParameterNames());
- ListAlignment align= new ListAlignment(preferences.alignment_for_parameters_in_method_declaration);
- align.fSpaceAfterOpeningParen= preferences.insert_space_after_opening_paren_in_method_declaration;
- align.fSpaceBeforeClosingParen= preferences.insert_space_before_closing_paren_in_method_declaration;
- align.fSpaceBeforeComma= preferences.insert_space_before_comma_in_method_declaration_parameters;
- align.fSpaceAfterComma= preferences.insert_space_after_comma_in_method_declaration_parameters;
- formatList(parameters, align, true, false);
-
- IASTDeclaration[] parameterDecls= node.getParameterDeclarations();
- scribe.startNewLine();
- scribe.indent();
- try {
- for (int i = 0; i < parameterDecls.length; i++) {
- IASTDeclaration declaration = parameterDecls[i];
- declaration.accept(this);
- }
- } finally {
- scribe.unIndent();
- }
- return PROCESS_SKIP;
- }
-
- private int visit(IASTFieldDeclarator node) {
- IASTExpression bitFieldSizeExpr= node.getBitFieldSize();
- if (bitFieldSizeExpr != null) {
- scribe.printNextToken(Token.tCOLON, true);
- bitFieldSizeExpr.accept(this);
- }
- return PROCESS_SKIP;
- }
-
- private int visit(IASTArrayDeclarator node) {
- IASTArrayModifier[] arrayModifiers= node.getArrayModifiers();
- if (arrayModifiers != null) {
- for (int i = 0; i < arrayModifiers.length; i++) {
- IASTArrayModifier arrayModifier = arrayModifiers[i];
- scribe.printNextToken(Token.tLBRACKET, scribe.printComment());
- try {
- arrayModifier.accept(this);
- } catch (ASTProblemException e) {
- scribe.skipToToken(Token.tRBRACKET);
- }
- scribe.printNextToken(Token.tRBRACKET, scribe.printComment());
- }
- }
- return PROCESS_SKIP;
- }
-
- private int visit(IASTSimpleDeclaration node) {
- IASTDeclSpecifier declSpec= node.getDeclSpecifier();
- declSpec.accept(this);
- final List declarators= Arrays.asList(node.getDeclarators());
- if (declarators.size() > 0) {
- if (scribe.printComment()) {
- scribe.space();
- }
- final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
- formatList(declarators, align, false, false);
- }
- if (peekNextToken() == Token.tIDENTIFIER) {
- // there may be a macro
- scribe.skipToToken(Token.tSEMI);
- }
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTTemplateDeclaration node) {
- scribe.printNextToken(Token.t_template, false);
- scribe.printNextToken(Token.tLT, false);
- final ICPPASTTemplateParameter[] templateParameters= node.getTemplateParameters();
- if (templateParameters.length > 0) {
- final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
- formatList(Arrays.asList(templateParameters), align, false, false);
- }
- scribe.printNextToken(Token.tGT, false);
- scribe.space();
- node.getDeclaration().accept(this);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTTemplateSpecialization node) {
- node.getDeclaration().accept(this);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTExplicitTemplateInstantiation node) {
- node.getDeclaration().accept(this);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTSimpleDeclSpecifier node) {
- formatNode(node);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTNamedTypeSpecifier node) {
- formatNode(node);
- return PROCESS_SKIP;
- }
-
- private int visit(ICASTCompositeTypeSpecifier node) {
- scribe.printComment();
- final int line= scribe.line;
-
- // storage class and other modifiers
- scribe.printModifiers();
-
- switch (node.getKey()) {
- case IASTCompositeTypeSpecifier.k_struct:
- scribe.printNextToken(Token.t_struct, true);
- break;
- case IASTCompositeTypeSpecifier.k_union:
- scribe.printNextToken(Token.t_union, true);
- break;
- default:
- assert false : "Unexpected composite type specifier"; //$NON-NLS-1$
- }
- scribe.space();
- node.getName().accept(this);
-
- // member declarations
- IASTDeclaration[] memberDecls= node.getMembers();
- formatLeftCurlyBrace(line, preferences.brace_position_for_type_declaration);
- formatOpeningBrace(preferences.brace_position_for_type_declaration, preferences.insert_space_before_opening_brace_in_type_declaration);
- if (preferences.indent_body_declarations_compare_to_access_specifier) {
- scribe.indent();
- }
- scribe.startNewLine();
- for (int i = 0; i < memberDecls.length; i++) {
- IASTDeclaration declaration = memberDecls[i];
- declaration.accept(this);
- scribe.startNewLine();
- }
- if (preferences.indent_body_declarations_compare_to_access_specifier) {
- scribe.unIndent();
- }
- formatClosingBrace(preferences.brace_position_for_type_declaration);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTCompositeTypeSpecifier node) {
- scribe.printComment();
- final int line= scribe.line;
-
- // storage class and other modifiers
- scribe.printModifiers();
-
- switch (node.getKey()) {
- case IASTCompositeTypeSpecifier.k_struct:
- scribe.printNextToken(Token.t_struct, true);
- break;
- case IASTCompositeTypeSpecifier.k_union:
- scribe.printNextToken(Token.t_union, true);
- break;
- case ICPPASTCompositeTypeSpecifier.k_class:
- scribe.printNextToken(Token.t_class, true);
- break;
- default:
- assert false : "Unexpected composite type specifier"; //$NON-NLS-1$
- }
- scribe.space();
- node.getName().accept(this);
-
- // base specifiers
- final List baseSpecifiers= Arrays.asList(node.getBaseSpecifiers());
- if (baseSpecifiers.size() > 0) {
- scribe.printNextToken(Token.tCOLON, true /*preferences.insert_space_before_colon_in_composite_type_specifier*/);
- scribe.space();
- final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
- formatList(baseSpecifiers, align, false, false);
- }
-
- // member declarations
- formatLeftCurlyBrace(line, preferences.brace_position_for_type_declaration);
- formatOpeningBrace(preferences.brace_position_for_type_declaration, preferences.insert_space_before_opening_brace_in_type_declaration);
- if (preferences.indent_access_specifier_compare_to_type_header) {
- scribe.indent();
- }
- IASTDeclaration[] memberDecls= node.getMembers();
- scribe.startNewLine();
- for (int i = 0; i < memberDecls.length; i++) {
- IASTDeclaration declaration = memberDecls[i];
- if (declaration instanceof ICPPASTVisiblityLabel) {
- if (preferences.indent_body_declarations_compare_to_access_specifier) {
- scribe.indent();
- }
- scribe.printComment();
- if (preferences.indent_body_declarations_compare_to_access_specifier) {
- scribe.unIndent();
- }
- visit((ICPPASTVisiblityLabel)declaration);
- } else {
- if (preferences.indent_body_declarations_compare_to_access_specifier) {
- scribe.indent();
- }
- declaration.accept(this);
- scribe.printComment();
- if (preferences.indent_body_declarations_compare_to_access_specifier) {
- scribe.unIndent();
- }
- }
- scribe.startNewLine();
- }
- if (preferences.indent_access_specifier_compare_to_type_header) {
- scribe.unIndent();
- }
- formatClosingBrace(preferences.brace_position_for_type_declaration);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTVisiblityLabel node) {
- if (!preferences.indent_access_specifier_compare_to_type_header) {
- scribe.unIndent();
- }
- switch (node.getVisibility()) {
- case ICPPASTVisiblityLabel.v_private:
- scribe.printNextToken(Token.t_private, false);
- break;
- case ICPPASTVisiblityLabel.v_protected:
- scribe.printNextToken(Token.t_protected, false);
- break;
- case ICPPASTVisiblityLabel.v_public:
- scribe.printNextToken(Token.t_public, false);
- break;
- }
- scribe.printNextToken(Token.tCOLON, false/*preferences.insert_space_before_colon_in_visibility_label */);
- if (!preferences.indent_access_specifier_compare_to_type_header) {
- scribe.indent();
- }
- return PROCESS_SKIP;
- }
-
- private int visit(ICASTElaboratedTypeSpecifier node) {
- formatNode(node);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTElaboratedTypeSpecifier node) {
- formatNode(node);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTEnumerationSpecifier node) {
- formatNode(node);
- return PROCESS_SKIP;
- }
-
- /**
- * Format a given list of elements according alignment options.
- *
- * @param elements
- * @param align
- * @param encloseInParen
- * @param addEllipsis
- */
- private void formatList(List elements, ListAlignment align, boolean encloseInParen, boolean addEllipsis) {
- if (encloseInParen)
- scribe.printNextToken(Token.tLPAREN, align.fSpaceBeforeOpeningParen);
-
- final int elementsLength = elements.size();
- if (elementsLength != 0 || addEllipsis) {
- if (align.fSpaceAfterOpeningParen) {
- scribe.space();
- }
- Alignment listAlignment = scribe.createAlignment(
- "listElements_"+align,//$NON-NLS-1$
- align.fMode,
- elementsLength + (addEllipsis ? 1 : 0),
- scribe.scanner.getCurrentPosition());
- scribe.enterAlignment(listAlignment);
- boolean ok = false;
- do {
- try {
- int i;
- for (i = 0; i < elementsLength; i++) {
- if (i > 0) {
- // handle missing parameter
- int token= peekNextToken();
- if (token == Token.tIDENTIFIER) {
- if (!scribe.skipToToken(Token.tCOMMA)) {
- break;
- }
- } else if (token == Token.tRPAREN) {
- if (encloseInParen) {
- break;
- }
- if (!scribe.skipToToken(Token.tCOMMA)) {
- break;
- }
- }
- scribe.printNextToken(Token.tCOMMA, align.fSpaceBeforeComma);
- scribe.printTrailingComment();
- }
- scribe.alignFragment(listAlignment, i);
- if (i > 0 && align.fSpaceAfterComma) {
- scribe.space();
- }
- final IASTNode node= (IASTNode) elements.get(i);
- if (node instanceof ICPPASTConstructorChainInitializer) {
- // this is a special case
- visit((ICPPASTConstructorChainInitializer)node);
- } else {
- node.accept(this);
- }
- }
- if (addEllipsis) {
- if (i > 0) {
- scribe.printNextToken(Token.tCOMMA, align.fSpaceBeforeComma);
- scribe.printTrailingComment();
- }
- scribe.alignFragment(listAlignment, i);
- if (i > 0 && align.fSpaceAfterComma) {
- scribe.space();
- }
- scribe.printNextToken(Token.tELIPSE);
- }
- ok = true;
- } catch (AlignmentException e) {
- scribe.redoAlignment(e);
- }
- } while (!ok);
- scribe.exitAlignment(listAlignment, true);
- }
- if (encloseInParen) {
- // handle missing parameter
- if (peekNextToken() == Token.tIDENTIFIER) {
- scribe.skipToToken(Token.tRPAREN);
- }
- scribe.printNextToken(Token.tRPAREN, align.fSpaceBeforeClosingParen);
- }
- }
-
- private int visit(IASTCompoundStatement node) {
- formatBlock(node, preferences.brace_position_for_block, preferences.insert_space_before_opening_brace_in_block, preferences.indent_statements_compare_to_block);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTBreakStatement node) {
- scribe.printNextToken(Token.t_break);
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTConditionalExpression node) {
- node.getLogicalConditionExpression().accept(this);
-
- Alignment conditionalExpressionAlignment =scribe.createAlignment(
- "conditionalExpression", //$NON-NLS-1$
- preferences.alignment_for_conditional_expression,
- 2,
- scribe.scanner.getCurrentPosition());
-
- scribe.enterAlignment(conditionalExpressionAlignment);
- boolean ok = false;
- do {
- try {
- scribe.alignFragment(conditionalExpressionAlignment, 0);
- scribe.printNextToken(Token.tQUESTION, preferences.insert_space_before_question_in_conditional);
-
- if (preferences.insert_space_after_question_in_conditional) {
- scribe.space();
- }
- node.getPositiveResultExpression().accept(this);
- scribe.printTrailingComment();
- scribe.alignFragment(conditionalExpressionAlignment, 1);
- scribe.printNextToken(Token.tCOLON, preferences.insert_space_before_colon_in_conditional);
-
- if (preferences.insert_space_after_colon_in_conditional) {
- scribe.space();
- }
- node.getNegativeResultExpression().accept(this);
-
- ok = true;
- } catch (AlignmentException e) {
- scribe.redoAlignment(e);
- }
- } while (!ok);
- scribe.exitAlignment(conditionalExpressionAlignment, true);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTFunctionCallExpression node) {
- node.getFunctionNameExpression().accept(this);
- IASTExpression paramExpr= node.getParameterExpression();
- scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_method_invocation);
- if (preferences.insert_space_after_opening_paren_in_method_invocation) {
- scribe.space();
- }
- if (paramExpr != null) {
- paramExpr.accept(this);
- }
- scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_method_invocation);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTExpressionList node) {
- final List expressions = Arrays.asList(node.getExpressions());
- final ListAlignment align= new ListAlignment(preferences.alignment_for_arguments_in_method_invocation);
- align.fSpaceAfterOpeningParen= preferences.insert_space_after_opening_paren_in_method_invocation;
- align.fSpaceBeforeClosingParen= preferences.insert_space_before_closing_paren_in_method_invocation;
- align.fSpaceBeforeComma= preferences.insert_space_before_comma_in_method_invocation_arguments;
- align.fSpaceAfterComma= preferences.insert_space_after_comma_in_method_invocation_arguments;
- formatList(expressions, align, false, false);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTTypeIdExpression node) {
- scribe.printNextToken(peekNextToken());
- scribe.printNextToken(Token.tLPAREN);
- node.getTypeId().accept(this);
- scribe.printNextToken(Token.tRPAREN);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTInitializerExpression node) {
- node.getExpression().accept(this);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTInitializerList node) {
- scribe.printComment();
-
- final List initializers = Arrays.asList(node.getInitializers());
- if (initializers.isEmpty() && preferences.keep_empty_array_initializer_on_one_line) {
- scribe.printNextToken(Token.tLBRACE, preferences.insert_space_before_opening_brace_in_array_initializer);
- scribe.printNextToken(Token.tLBRACE, preferences.insert_space_between_empty_braces_in_array_initializer);
- } else {
- final int line= scribe.line;
- final String brace_position= preferences.brace_position_for_array_initializer;
- formatLeftCurlyBrace(line, brace_position);
- formatOpeningBrace(brace_position, preferences.insert_space_before_opening_brace_in_array_initializer);
- if (preferences.insert_new_line_after_opening_brace_in_array_initializer) {
- scribe.printNewLine();
- }
- if (preferences.insert_space_after_opening_brace_in_array_initializer) {
- scribe.space();
- }
- int indents= preferences.continuation_indentation_for_array_initializer;
- while (indents-- > 0) {
- scribe.indent();
- }
-
- final ListAlignment align= new ListAlignment(preferences.alignment_for_expressions_in_array_initializer);
- align.fSpaceBeforeComma= preferences.insert_space_before_comma_in_array_initializer;
- align.fSpaceAfterComma= preferences.insert_space_after_comma_in_array_initializer;
- formatList(initializers, align, false, false);
-
- indents= preferences.continuation_indentation_for_array_initializer;
- while (indents-- > 0) {
- scribe.unIndent();
- }
- if (preferences.insert_new_line_before_closing_brace_in_array_initializer) {
- scribe.startNewLine();
- }
- if (preferences.insert_space_before_closing_brace_in_array_initializer) {
- scribe.space();
- }
- formatClosingBrace(brace_position);
- }
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTBinaryExpression node) {
- // TODO binary expression alignment!
- final IASTExpression op1= node.getOperand1();
- // operand 1
- op1.accept(this);
- // operator
- scribe.printNextToken(peekNextToken(), scribe.printComment());
- if (scribe.printComment()) {
- scribe.space();
- }
- // operand 2
- final IASTExpression op2= node.getOperand2();
- op2.accept(this);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTLiteralExpression node) {
- scribe.printNextToken(peekNextToken(), scribe.printComment());
- return PROCESS_SKIP;
- }
-
- private int visit(IASTContinueStatement node) {
- scribe.printNextToken(Token.t_continue);
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTDoStatement node) {
- scribe.printNextToken(Token.t_do);
- final int line = scribe.line;
-
- final IASTStatement action = node.getBody();
- if (action != null) {
- if (action instanceof IASTCompoundStatement) {
- formatLeftCurlyBrace(line, preferences.brace_position_for_block);
- visit((IASTCompoundStatement)action);
- } else if (action instanceof IASTNullStatement) {
- scribe.indent();
- visit((IASTNullStatement)this);
- scribe.unIndent();
- } else {
- scribe.startNewLine();
- scribe.indent();
- action.accept(this);
- scribe.unIndent();
- scribe.startNewLine();
- }
- }
-
- if (preferences.insert_new_line_before_while_in_do_statement) {
- scribe.startNewLine();
- }
- scribe.printNextToken(Token.t_while, preferences.insert_space_after_closing_brace_in_block);
- scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_while);
-
- if (preferences.insert_space_after_opening_paren_in_while) {
- scribe.space();
- }
-
- node.getCondition().accept(this);
-
- scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_while);
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTNullStatement node) {
- if (peekNextToken() == Token.tIDENTIFIER) {
- // probably a macro with empty expansion
- skipToNode(node);
- }
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTDeclarationStatement node) {
- node.getDeclaration().accept(this);
- if (!fInsideFor) {
- scribe.startNewLine();
- }
- return PROCESS_SKIP;
- }
-
- private int visit(IASTExpressionStatement node) {
- node.getExpression().accept(this);
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTForStatement node) {
- scribe.printNextToken(Token.t_for);
- final int line = scribe.line;
- scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_for);
-
- if (preferences.insert_space_after_opening_paren_in_for) {
- scribe.space();
- }
- IASTStatement initializerStmt= node.getInitializerStatement();
- fInsideFor= true;
- initializerStmt.accept(this);
- fInsideFor= false;
- final IASTExpression condition = node.getConditionExpression();
- if (condition != null) {
- if (preferences.insert_space_after_semicolon_in_for) {
- scribe.space();
- }
- condition.accept(this);
- }
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon_in_for);
- IASTExpression iterationExpr= node.getIterationExpression();
- if (iterationExpr != null) {
- iterationExpr.accept(this);
- }
- scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_for);
-
- formatAction(line, node.getBody(), preferences.brace_position_for_block, preferences.insert_space_before_opening_brace_in_block);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTIfStatement node) {
- scribe.printNextToken(Token.t_if);
- final int line = scribe.line;
- scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_if);
- if (preferences.insert_space_after_opening_paren_in_if) {
- scribe.space();
- }
- IASTExpression condExpr= node.getConditionExpression();
- if (condExpr instanceof IASTProblemExpression) {
- scribe.skipToToken(Token.tRPAREN);
- } else {
- condExpr.accept(this);
- }
- scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_if);
-
- final IASTStatement thenStatement = node.getThenClause();
- final IASTStatement elseStatement = node.getElseClause();
-
- boolean thenStatementIsBlock = false;
- if (thenStatement != null) {
- if (thenStatement instanceof IASTCompoundStatement) {
- final IASTCompoundStatement block = (IASTCompoundStatement) thenStatement;
- thenStatementIsBlock = true;
- final List statements = Arrays.asList(block.getStatements());
- if (isGuardClause(block, statements) && elseStatement == null && preferences.keep_guardian_clause_on_one_line) {
- /*
- * Need a specific formatting for guard clauses
- * guard clauses are block with a single return or throw
- * statement
- */
- scribe.printNextToken(Token.tLBRACE, preferences.insert_space_before_opening_brace_in_block);
- scribe.space();
- ((IASTStatement) statements.get(0)).accept(this);
- scribe.printNextToken(Token.tRBRACE, true);
- scribe.printTrailingComment();
- } else {
- formatLeftCurlyBrace(line, preferences.brace_position_for_block);
- thenStatement.accept(this);
- if (elseStatement != null && (preferences.insert_new_line_before_else_in_if_statement)) {
- scribe.startNewLine();
- }
- }
- } else if (elseStatement == null && preferences.keep_simple_if_on_one_line) {
- Alignment compactIfAlignment = scribe.createAlignment(
- "compactIf", //$NON-NLS-1$
- preferences.alignment_for_compact_if,
- Alignment.R_OUTERMOST,
- 1,
- scribe.scanner.getCurrentPosition(),
- 1,
- false);
- scribe.enterAlignment(compactIfAlignment);
- boolean ok = false;
- do {
- try {
- scribe.alignFragment(compactIfAlignment, 0);
- scribe.space();
- thenStatement.accept(this);
- ok = true;
- } catch (AlignmentException e) {
- scribe.redoAlignment(e);
- }
- } while (!ok);
- scribe.exitAlignment(compactIfAlignment, true);
- } else if (preferences.keep_then_statement_on_same_line) {
- scribe.space();
- thenStatement.accept(this);
- if (elseStatement != null) {
- scribe.startNewLine();
- }
- } else {
- scribe.printTrailingComment();
- scribe.startNewLine();
- scribe.indent();
- thenStatement.accept(this);
- if (elseStatement != null) {
- scribe.startNewLine();
- }
- scribe.unIndent();
- }
- }
-
- if (elseStatement != null) {
- if (thenStatementIsBlock) {
- scribe.printNextToken(Token.t_else, preferences.insert_space_after_closing_brace_in_block);
- } else {
- scribe.printNextToken(Token.t_else, true);
- }
- if (elseStatement instanceof IASTCompoundStatement) {
- elseStatement.accept(this);
- } else if (elseStatement instanceof IASTIfStatement) {
- if (!preferences.compact_else_if) {
- scribe.startNewLine();
- scribe.indent();
- }
- scribe.space();
- elseStatement.accept(this);
- if (!preferences.compact_else_if) {
- scribe.unIndent();
- }
- } else if (preferences.keep_else_statement_on_same_line) {
- scribe.space();
- elseStatement.accept(this);
- } else {
- scribe.startNewLine();
- scribe.indent();
- elseStatement.accept(this);
- scribe.unIndent();
- }
- }
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTQualifiedName node) {
- IASTName[] names= node.getNames();
- for (int i = 0; i < names.length-1; i++) {
- names[i].accept(this);
- scribe.printNextToken(Token.tCOLONCOLON);
- }
- if (peekNextToken() == Token.tCOMPL) {
- // destructor
- scribe.printNextToken(Token.tCOMPL, false);
- }
- scribe.printNextToken(Token.tIDENTIFIER, false);
- return PROCESS_SKIP;
- }
-
- private int visit(ICPPASTTemplateId node) {
- IASTName name= node.getTemplateName();
- name.accept(this);
- scribe.printNextToken(Token.tLT, false);
- final IASTNode[] templateArguments= node.getTemplateArguments();
- if (templateArguments.length > 0) {
- final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
- formatList(Arrays.asList(templateArguments), align, false, false);
- }
- scribe.printNextToken(Token.tGT, false);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTReturnStatement node) {
- scribe.printNextToken(Token.t_return);
- final IASTExpression expression = node.getReturnValue();
- if (expression != null) {
- scribe.space();
- expression.accept(this);
- }
- // sometimes the return expression is null, when it should not
- if (expression == null && Token.tSEMI != peekNextToken()) {
- scribe.skipToToken(Token.tSEMI);
- }
- scribe.printNextToken(Token.tSEMI, preferences.insert_space_before_semicolon);
- scribe.printTrailingComment();
- return PROCESS_SKIP;
- }
-
- private int visit(IASTLabelStatement node) {
- // TLETODO [formatter] label indentation
- node.getName().accept(this);
- scribe.printNextToken(Token.tCOLON, false);
- scribe.space();
- node.getNestedStatement().accept(this);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTCaseStatement node) {
- IASTExpression constant = node.getExpression();
- if (constant == null) {
- scribe.printNextToken(Token.t_default);
- scribe.printNextToken(Token.tCOLON, preferences.insert_space_before_colon_in_default);
- } else {
- scribe.printNextToken(Token.t_case);
- scribe.space();
- constant.accept(this);
- scribe.printNextToken(Token.tCOLON, preferences.insert_space_before_colon_in_case);
- }
- return PROCESS_SKIP;
- }
-
- private int visit(IASTDefaultStatement node) {
- scribe.printNextToken(Token.t_default);
- scribe.printNextToken(Token.tCOLON, preferences.insert_space_before_colon_in_default);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTSwitchStatement node) {
- scribe.printNextToken(Token.t_switch);
- scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_switch);
-
- if (preferences.insert_space_after_opening_paren_in_switch) {
- scribe.space();
- }
-
- node.getControllerExpression().accept(this);
- scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_switch);
- /*
- * switch body
- */
- String switch_brace = preferences.brace_position_for_switch;
- formatOpeningBrace(switch_brace, preferences.insert_space_before_opening_brace_in_switch);
- scribe.startNewLine();
-
- if (preferences.indent_switchstatements_compare_to_switch) {
- scribe.indent();
- }
- IASTStatement bodyStmt= node.getBody();
- final List statements;
- if (bodyStmt instanceof IASTCompoundStatement) {
- statements= Arrays.asList(((IASTCompoundStatement)bodyStmt).getStatements());
- } else {
- statements= Collections.singletonList(bodyStmt);
- }
- final int statementsLength = statements.size();
- boolean wasACase = false;
- boolean wasAStatement = false;
- if (statementsLength != 0) {
- for (int i = 0; i < statementsLength; i++) {
- final IASTStatement statement = (IASTStatement) statements.get(i);
- if (statement instanceof IASTCaseStatement || statement instanceof IASTDefaultStatement) {
- if (wasACase) {
- scribe.startNewLine();
- }
- if ((wasACase || wasAStatement) && preferences.indent_switchstatements_compare_to_cases) {
- scribe.unIndent();
- }
- statement.accept(this);
- scribe.printTrailingComment();
- wasACase = true;
- wasAStatement = false;
- if (preferences.indent_switchstatements_compare_to_cases) {
- scribe.indent();
- }
- } else if (statement instanceof IASTBreakStatement) {
- if (preferences.indent_breaks_compare_to_cases) {
- if (!preferences.indent_switchstatements_compare_to_cases) {
- scribe.indent();
- }
- } else {
- if ((wasACase || wasAStatement) && preferences.indent_switchstatements_compare_to_cases) {
- scribe.unIndent();
- }
- }
- if (wasACase) {
- scribe.startNewLine();
- }
- statement.accept(this);
- if (preferences.indent_breaks_compare_to_cases) {
- if(!preferences.indent_switchstatements_compare_to_cases) {
- scribe.unIndent();
- }
- } else if (preferences.indent_switchstatements_compare_to_cases) {
- scribe.indent();
- }
- wasACase = false;
- wasAStatement = true;
- } else if (statement instanceof IASTCompoundStatement) {
- String bracePosition;
- if (wasACase) {
- if (preferences.indent_switchstatements_compare_to_cases) {
- scribe.unIndent();
- }
- bracePosition = preferences.brace_position_for_block_in_case;
- formatBlock((IASTCompoundStatement) statement, bracePosition,
- preferences.insert_space_after_colon_in_case,
- preferences.indent_statements_compare_to_block);
- if (preferences.indent_switchstatements_compare_to_cases) {
- scribe.indent();
- }
- } else {
- bracePosition = preferences.brace_position_for_block;
- formatBlock((IASTCompoundStatement) statement, bracePosition,
- preferences.insert_space_before_opening_brace_in_block,
- preferences.indent_statements_compare_to_block);
- }
- wasAStatement = true;
- wasACase = false;
- } else {
- scribe.startNewLine();
- statement.accept(this);
- wasAStatement = true;
- wasACase = false;
- }
- if (!wasACase) {
- scribe.startNewLine();
- }
- scribe.printComment();
- }
- }
-
- if ((wasACase || wasAStatement) && preferences.indent_switchstatements_compare_to_cases) {
- scribe.unIndent();
- }
- if (preferences.indent_switchstatements_compare_to_switch) {
- scribe.unIndent();
- }
- scribe.startNewLine();
-
- formatClosingBrace(switch_brace);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTWhileStatement node) {
- scribe.printNextToken(Token.t_while);
- final int line = scribe.line;
- scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_while);
-
- if (preferences.insert_space_after_opening_paren_in_while) {
- scribe.space();
- }
- node.getCondition().accept(this);
-
- scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_while);
-
- formatAction(line, node.getBody(), preferences.brace_position_for_method_declaration, preferences.insert_space_before_opening_brace_in_method_declaration);
- return PROCESS_SKIP;
- }
-
- private int visit(IASTProblemStatement node) {
- throw new ASTProblemException(node.getProblem());
- }
-
- private int visit(IASTProblemExpression node) {
- throw new ASTProblemException(node.getProblem());
- }
-
- private int visit(IASTProblemDeclaration node) {
- throw new ASTProblemException(node.getProblem());
- }
-
- private void formatNode(IASTNode node) {
- if (scribe.printComment()) {
- scribe.space();
- }
- final IASTNodeLocation[] locations= node.getNodeLocations();
- final IASTNodeLocation minLocation= getMinFileLocation(locations);
- if (minLocation != null) {
- final IASTNodeLocation maxLocation= getMaxFileLocation(locations);
- if (maxLocation != null) {
- final int startOffset= minLocation.getNodeOffset();
- final int endOffset= maxLocation.getNodeOffset() + maxLocation.getNodeLength();
- scribe.printRaw(startOffset, endOffset - startOffset);
- }
- }
- }
-
- private static IASTFileLocation getMaxFileLocation(IASTNodeLocation[] locations) {
- if (locations == null || locations.length == 0) {
- return null;
- }
- final IASTNodeLocation nodeLocation= locations[locations.length-1];
- if (nodeLocation instanceof IASTFileLocation) {
- return (IASTFileLocation)nodeLocation;
- } else if (nodeLocation instanceof IASTMacroExpansion) {
- IASTNodeLocation[] macroLocations= ((IASTMacroExpansion)nodeLocation).getExpansionLocations();
- return getMaxFileLocation(macroLocations);
- }
- return null;
- }
-
- private static IASTFileLocation getMinFileLocation(IASTNodeLocation[] locations) {
- if (locations == null || locations.length == 0) {
- return null;
- }
- final IASTNodeLocation nodeLocation= locations[0];
- if (nodeLocation instanceof IASTFileLocation) {
- return (IASTFileLocation)nodeLocation;
- } else if (nodeLocation instanceof IASTMacroExpansion) {
- IASTNodeLocation[] macroLocations= ((IASTMacroExpansion)nodeLocation).getExpansionLocations();
- return getMinFileLocation(macroLocations);
- }
- return null;
- }
-
- private void exitAlignments() {
- while (scribe.currentAlignment != null) {
- scribe.exitAlignment(scribe.currentAlignment, true);
- }
- }
-
- private void skipNode(IASTNode node) {
- final IASTNodeLocation[] locations= node.getNodeLocations();
- final IASTNodeLocation maxLocation= getMaxFileLocation(locations);
- if (maxLocation != null) {
- final int endOffset= maxLocation.getNodeOffset() + maxLocation.getNodeLength();
- final int currentOffset= scribe.scanner.getCurrentTokenEndPosition() + 1;
- final int restLength= endOffset - currentOffset;
- if (restLength > 0) {
- scribe.printRaw(currentOffset, restLength);
- }
- }
- }
-
- private void skipToNode(IASTNode node) {
- final IASTNodeLocation[] locations= node.getNodeLocations();
- final IASTNodeLocation minLocation= getMinFileLocation(locations);
- if (minLocation != null) {
- final int startOffset= minLocation.getNodeOffset();
- final int currentOffset= scribe.scanner.getCurrentTokenEndPosition() + 1;
- final int restLength= startOffset - currentOffset;
- if (restLength > 0) {
- scribe.printRaw(currentOffset, restLength);
- }
- }
- }
-
- private void formatAction(final int line, final IASTStatement stmt, String brace_position, boolean insertLineForSingleStatement) {
- if (stmt != null) {
- if (stmt instanceof IASTCompoundStatement) {
- formatLeftCurlyBrace(line, brace_position);
- formatBlock((IASTCompoundStatement)stmt, brace_position, preferences.insert_space_before_opening_brace_in_block, preferences.indent_statements_compare_to_block);
- } else if (stmt instanceof IASTNullStatement) {
- scribe.indent();
- if (preferences.put_empty_statement_on_new_line) {
- scribe.startNewLine();
- }
- visit((IASTNullStatement)stmt);
- scribe.unIndent();
- } else {
- scribe.startNewLine();
- scribe.indent();
- stmt.accept(this);
- scribe.unIndent();
- if (insertLineForSingleStatement) {
- scribe.startNewLine();
- }
- }
- }
- }
-
- private void formatBlock(IASTCompoundStatement block, String block_brace_position, boolean insertSpaceBeforeOpeningBrace, boolean indentStatements) {
- IASTNodeLocation[] locations= block.getNodeLocations();
- if (locations.length == 0) {
- return;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- formatNode(block);
- return;
- }
- formatOpeningBrace(block_brace_position, insertSpaceBeforeOpeningBrace);
- IASTStatement[] statements = block.getStatements();
- final int statementsLength = statements.length;
- if (statementsLength != 0) {
- scribe.startNewLine();
- if (indentStatements) {
- scribe.indent();
- }
- formatStatements(Arrays.asList(statements), true);
- scribe.printComment();
-
- if (indentStatements) {
- scribe.unIndent();
- }
- } else {
- if (preferences.insert_new_line_in_empty_block) {
- scribe.startNewLine();
- }
- if (indentStatements) {
- scribe.indent();
- }
- scribe.printComment();
-
- if (indentStatements) {
- scribe.unIndent();
- }
- }
- formatClosingBrace(block_brace_position);
- }
-
- private void formatLeftCurlyBrace(final int line, final String bracePosition) {
- // deal with (quite unexpected) comments right before lcurly
- scribe.printComment();
- if (DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP.equals(bracePosition)
- && (scribe.line > line || scribe.column >= preferences.page_width))
- {
- scribe.startNewLine();
- }
- }
-
- private void formatOpeningBrace(String bracePosition, boolean insertSpaceBeforeBrace) {
- if (DefaultCodeFormatterConstants.NEXT_LINE.equals(bracePosition)) {
- scribe.startNewLine();
- } else if (DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(bracePosition)) {
- scribe.startNewLine();
- scribe.indent();
- }
- scribe.printNextToken(Token.tLBRACE, insertSpaceBeforeBrace);
-
- scribe.printTrailingComment();
- }
-
- private void formatClosingBrace(String brace_position) {
- scribe.printNextToken(Token.tRBRACE);
- scribe.printTrailingComment();
- if (DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(brace_position)) {
- scribe.unIndent();
- }
- }
-
- private void formatStatements(final List statements, boolean insertNewLineAfterLastStatement) {
- final int statementsLength = statements.size();
- if (statementsLength > 1) {
- IASTStatement previousStatement = (IASTStatement) statements.get(0);
- previousStatement.accept(this);
- final boolean previousStatementIsNullStmt = previousStatement instanceof IASTNullStatement;
- for (int i = 1; i < statementsLength - 1; i++) {
- final IASTStatement statement = (IASTStatement) statements.get(i);
- final boolean statementIsNullStmt = statement instanceof IASTNullStatement;
- if ((previousStatementIsNullStmt && !statementIsNullStmt)
- || (!previousStatementIsNullStmt && !statementIsNullStmt)) {
- scribe.startNewLine();
- }
- statement.accept(this);
- previousStatement = statement;
- }
- final IASTStatement statement = ((IASTStatement) statements.get(statementsLength - 1));
- final boolean statementIsNullStmt = statement instanceof IASTNullStatement;
- if ((previousStatementIsNullStmt && !statementIsNullStmt)
- || (!previousStatementIsNullStmt && !statementIsNullStmt)) {
- scribe.startNewLine();
- }
- statement.accept(this);
- } else {
- ((IASTStatement) statements.get(0)).accept(this);
- }
- if (insertNewLineAfterLastStatement) {
- scribe.startNewLine();
- }
- }
-
- private boolean commentStartsBlock(int start, int end) {
- localScanner.resetTo(start, end);
- if (localScanner.getNextToken() == Token.tLBRACE) {
- switch(localScanner.getNextToken()) {
- case Token.tBLOCKCOMMENT :
- case Token.tLINECOMMENT :
- return true;
- }
- }
- return false;
- }
-
- protected boolean hasComments() {
- localScanner.resetTo(scribe.scanner.startPosition, scribe.scannerEndPosition - 1);
- int token = localScanner.getNextToken();
- loop: while(true) {
- switch(token) {
- case Token.tBLOCKCOMMENT :
- case Token.tLINECOMMENT :
- return true;
- default:
- break loop;
- }
- }
- return false;
- }
-
- protected int peekNextToken() {
- localScanner.resetTo(scribe.scanner.getCurrentPosition(), scribe.scannerEndPosition - 1);
- int token = localScanner.getNextToken();
- loop: while(true) {
- switch(token) {
- case Token.tBLOCKCOMMENT :
- case Token.tLINECOMMENT :
- token = localScanner.getNextToken();
- continue loop;
- default:
- break loop;
- }
- }
- return token;
- }
-
- protected boolean isClosingTemplateToken() {
- localScanner.resetTo(scribe.scanner.getCurrentPosition(), scribe.scannerEndPosition - 1);
- int token = localScanner.getNextToken();
- loop: while(true) {
- switch(token) {
- case Token.tBLOCKCOMMENT :
- case Token.tLINECOMMENT :
- token = localScanner.getNextToken();
- continue loop;
- default:
- break loop;
- }
- }
- switch(token) {
- case Token.tGT :
- case Token.tSHIFTR :
- return true;
- }
- return false;
- }
-
- private boolean isGuardClause(IASTCompoundStatement block, List statements) {
- IASTNodeLocation[] locations= block.getNodeLocations();
- if (locations.length == 0) {
- return false;
- } else if (locations[0] instanceof IASTMacroExpansion) {
- return false;
- }
- IASTNodeLocation fileLocation= block.getFileLocation();
- if (fileLocation == null) {
- return false;
- }
- int blockStartPosition= block.getFileLocation().getNodeOffset();
- int blockLength= block.getFileLocation().getNodeLength();
- if (commentStartsBlock(blockStartPosition, blockLength)) return false;
- final int statementsLength = statements.size();
- if (statementsLength != 1) return false;
- if(statements.get(0) instanceof IASTReturnStatement) {
- return true;
- }
- return false;
- }
-
- /**
- * Collect source positions of preprocessor-hidden branches
- * in the given translation unit.
- *
- * @param translationUnit the {@link IASTTranslationUnit}, may be <code>null</code>
- * @return a {@link List} of {@link Position}s
- */
- private static List collectInactiveCodePositions(IASTTranslationUnit translationUnit) {
- if (translationUnit == null) {
- return Collections.EMPTY_LIST;
- }
- String fileName = translationUnit.getFilePath();
- if (fileName == null) {
- return Collections.EMPTY_LIST;
- }
- List positions = new ArrayList();
- int inactiveCodeStart = -1;
- boolean inInactiveCode = false;
- Stack inactiveCodeStack = new Stack();
-
- IASTPreprocessorStatement[] preprocStmts = translationUnit.getAllPreprocessorStatements();
-
- for (int i = 0; i < preprocStmts.length; i++) {
- IASTPreprocessorStatement statement = preprocStmts[i];
- if (!fileName.equals(statement.getContainingFilename())) {
- // preprocessor directive is from a different file
- continue;
- }
- if (statement instanceof IASTPreprocessorIfStatement) {
- IASTPreprocessorIfStatement ifStmt = (IASTPreprocessorIfStatement)statement;
- inactiveCodeStack.push(Boolean.valueOf(inInactiveCode));
- if (!ifStmt.taken()) {
- if (!inInactiveCode) {
- IASTNodeLocation nodeLocation = ifStmt.getFileLocation();
- inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength();
- inInactiveCode = true;
- }
- }
- } else if (statement instanceof IASTPreprocessorIfdefStatement) {
- IASTPreprocessorIfdefStatement ifdefStmt = (IASTPreprocessorIfdefStatement)statement;
- inactiveCodeStack.push(Boolean.valueOf(inInactiveCode));
- if (!ifdefStmt.taken()) {
- if (!inInactiveCode) {
- IASTNodeLocation nodeLocation = ifdefStmt.getFileLocation();
- inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength();
- inInactiveCode = true;
- }
- }
- } else if (statement instanceof IASTPreprocessorIfndefStatement) {
- IASTPreprocessorIfndefStatement ifndefStmt = (IASTPreprocessorIfndefStatement)statement;
- inactiveCodeStack.push(Boolean.valueOf(inInactiveCode));
- if (!ifndefStmt.taken()) {
- if (!inInactiveCode) {
- IASTNodeLocation nodeLocation = ifndefStmt.getFileLocation();
- inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength();
- inInactiveCode = true;
- }
- }
- } else if (statement instanceof IASTPreprocessorElseStatement) {
- IASTPreprocessorElseStatement elseStmt = (IASTPreprocessorElseStatement)statement;
- if (!elseStmt.taken() && !inInactiveCode) {
- IASTNodeLocation nodeLocation = elseStmt.getFileLocation();
- inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength();
- inInactiveCode = true;
- } else if (elseStmt.taken() && inInactiveCode) {
- IASTNodeLocation nodeLocation = elseStmt.getFileLocation();
- int inactiveCodeEnd = nodeLocation.getNodeOffset();
- positions.add(new Position(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart));
- inInactiveCode = false;
- }
- } else if (statement instanceof IASTPreprocessorElifStatement) {
- IASTPreprocessorElifStatement elifStmt = (IASTPreprocessorElifStatement)statement;
- if (!elifStmt.taken() && !inInactiveCode) {
- IASTNodeLocation nodeLocation = elifStmt.getFileLocation();
- inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength();
- inInactiveCode = true;
- } else if (elifStmt.taken() && inInactiveCode) {
- IASTNodeLocation nodeLocation = elifStmt.getFileLocation();
- int inactiveCodeEnd = nodeLocation.getNodeOffset();
- positions.add(new Position(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart));
- inInactiveCode = false;
- }
- } else if (statement instanceof IASTPreprocessorEndifStatement) {
- IASTPreprocessorEndifStatement endifStmt = (IASTPreprocessorEndifStatement)statement;
- try {
- boolean wasInInactiveCode = ((Boolean)inactiveCodeStack.pop()).booleanValue();
- if (inInactiveCode && !wasInInactiveCode) {
- IASTNodeLocation nodeLocation = endifStmt.getFileLocation();
- int inactiveCodeEnd = nodeLocation.getNodeOffset();
- positions.add(new Position(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart));
- }
- inInactiveCode = wasInInactiveCode;
- }
- catch( EmptyStackException e) {}
- }
- }
- if (inInactiveCode) {
- // handle dangling #if?
- }
- return positions;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java
deleted file mode 100644
index 4a0a2447647..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java
+++ /dev/null
@@ -1,2114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sergey Prigogin, Google
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.internal.formatter.align.Alignment;
-
-
-public class DefaultCodeFormatterOptions {
- public static final int TAB = 1;
- public static final int SPACE = 2;
- public static final int MIXED = 4;
-
- public static DefaultCodeFormatterOptions getDefaultSettings() {
- DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions();
- options.setDefaultSettings();
- return options;
- }
-
- public static DefaultCodeFormatterOptions getKandRSettings() {
- DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions();
- options.setKandRSettings();
- return options;
- }
-
- public static DefaultCodeFormatterOptions getAllmanSettings() {
- DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions();
- options.setAllmanSettings();
- return options;
- }
-
- public static DefaultCodeFormatterOptions getGNUSettings() {
- DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions();
- options.setGNUSettings();
- return options;
- }
-
- public static DefaultCodeFormatterOptions getWhitesmithsSettings() {
- DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions();
- options.setWhitesmitsSettings();
- return options;
- }
-
-// public int alignment_for_arguments_in_allocation_expression;
-// public int alignment_for_arguments_in_enum_constant;
-// public int alignment_for_arguments_in_explicit_constructor_call;
- public int alignment_for_arguments_in_method_invocation;
-// public int alignment_for_arguments_in_qualified_allocation_expression;
-// public int alignment_for_assignment;
-// public int alignment_for_binary_expression;
- public int alignment_for_compact_if;
- public int alignment_for_conditional_expression;
-// public int alignment_for_enum_constants;
- public int alignment_for_expressions_in_array_initializer;
-// public int alignment_for_multiple_fields;
-// public int alignment_for_parameters_in_constructor_declaration;
- public int alignment_for_parameters_in_method_declaration;
-// public int alignment_for_selector_in_method_invocation;
-// public int alignment_for_superclass_in_type_declaration;
-// public int alignment_for_throws_clause_in_constructor_declaration;
-// public int alignment_for_throws_clause_in_method_declaration;
-
-// public boolean align_type_members_on_columns;
-
- public String brace_position_for_array_initializer;
- public String brace_position_for_block;
- public String brace_position_for_block_in_case;
-// public String brace_position_for_constructor_declaration;
-// public String brace_position_for_enum_constant;
-// public String brace_position_for_enum_declaration;
- public String brace_position_for_method_declaration;
- public String brace_position_for_type_declaration;
- public String brace_position_for_namespace_declaration;
- public String brace_position_for_switch;
-
- public int continuation_indentation;
- public int continuation_indentation_for_array_initializer;
-
-// public int blank_lines_after_includes;
-// public int blank_lines_before_field;
-// public int blank_lines_before_first_class_body_declaration;
-// public int blank_lines_before_includes;
-// public int blank_lines_before_member_type;
-// public int blank_lines_before_method;
-// public int blank_lines_before_new_chunk;
-// public int blank_lines_between_type_declarations;
-// public int blank_lines_at_beginning_of_method_body;
-
-// public boolean comment_clear_blank_lines;
-// public boolean comment_format;
-// public boolean comment_format_header;
-// public boolean comment_format_html;
-// public boolean comment_format_source;
-// public int comment_line_length;
-
- public boolean indent_statements_compare_to_block;
- public boolean indent_statements_compare_to_body;
-// public boolean indent_body_declarations_compare_to_enum_constant_header;
-// public boolean indent_body_declarations_compare_to_enum_declaration_header;
- public boolean indent_body_declarations_compare_to_access_specifier;
- public boolean indent_access_specifier_compare_to_type_header;
- public boolean indent_body_declarations_compare_to_namespace_header;
- public boolean indent_breaks_compare_to_cases;
- public boolean indent_empty_lines;
- public boolean indent_switchstatements_compare_to_cases;
- public boolean indent_switchstatements_compare_to_switch;
- public int indentation_size;
-
- public boolean insert_new_line_after_opening_brace_in_array_initializer;
- public boolean insert_new_line_at_end_of_file_if_missing;
-// public boolean insert_new_line_before_catch_in_try_statement;
- public boolean insert_new_line_before_closing_brace_in_array_initializer;
- public boolean insert_new_line_before_else_in_if_statement;
-// public boolean insert_new_line_before_finally_in_try_statement;
- public boolean insert_new_line_before_while_in_do_statement;
- public boolean insert_new_line_in_empty_block;
-// public boolean insert_new_line_in_empty_enum_constant;
-// public boolean insert_new_line_in_empty_enum_declaration;
-// public boolean insert_new_line_in_empty_method_body;
-// public boolean insert_new_line_in_empty_type_declaration;
-// public boolean insert_space_after_and_in_type_parameter;
-// public boolean insert_space_after_assignment_operator;
-// public boolean insert_space_after_binary_operator;
-// public boolean insert_space_after_closing_angle_bracket_in_type_arguments;
-// public boolean insert_space_after_closing_angle_bracket_in_type_parameters;
-// public boolean insert_space_after_closing_paren_in_cast;
- public boolean insert_space_after_closing_brace_in_block;
- public boolean insert_space_after_colon_in_case;
- public boolean insert_space_after_colon_in_conditional;
-// public boolean insert_space_after_colon_in_for;
-// public boolean insert_space_after_colon_in_labeled_statement;
-// public boolean insert_space_after_comma_in_allocation_expression;
- public boolean insert_space_after_comma_in_array_initializer;
-// public boolean insert_space_after_comma_in_constructor_declaration_parameters;
-// public boolean insert_space_after_comma_in_constructor_declaration_throws;
-// public boolean insert_space_after_comma_in_enum_constant_arguments;
-// public boolean insert_space_after_comma_in_enum_declarations;
-// public boolean insert_space_after_comma_in_explicit_constructor_call_arguments;
-// public boolean insert_space_after_comma_in_for_increments;
-// public boolean insert_space_after_comma_in_for_inits;
- public boolean insert_space_after_comma_in_method_invocation_arguments;
- public boolean insert_space_after_comma_in_method_declaration_parameters;
-// public boolean insert_space_after_comma_in_method_declaration_throws;
-// public boolean insert_space_after_comma_in_multiple_field_declarations;
-// public boolean insert_space_after_comma_in_multiple_local_declarations;
-// public boolean insert_space_after_comma_in_parameterized_type_reference;
-// public boolean insert_space_after_comma_in_superinterfaces;
-// public boolean insert_space_after_comma_in_type_arguments;
-// public boolean insert_space_after_comma_in_type_parameters;
-// public boolean insert_space_after_ellipsis;
-// public boolean insert_space_after_opening_angle_bracket_in_parameterized_type_reference;
-// public boolean insert_space_after_opening_angle_bracket_in_type_arguments;
-// public boolean insert_space_after_opening_angle_bracket_in_type_parameters;
-// public boolean insert_space_after_opening_bracket_in_array_allocation_expression;
-// public boolean insert_space_after_opening_bracket_in_array_reference;
- public boolean insert_space_after_opening_brace_in_array_initializer;
-// public boolean insert_space_after_opening_paren_in_cast;
-// public boolean insert_space_after_opening_paren_in_catch;
-// public boolean insert_space_after_opening_paren_in_constructor_declaration;
-// public boolean insert_space_after_opening_paren_in_enum_constant;
- public boolean insert_space_after_opening_paren_in_for;
- public boolean insert_space_after_opening_paren_in_if;
- public boolean insert_space_after_opening_paren_in_method_declaration;
- public boolean insert_space_after_opening_paren_in_method_invocation;
-// public boolean insert_space_after_opening_paren_in_parenthesized_expression;
- public boolean insert_space_after_opening_paren_in_switch;
- public boolean insert_space_after_opening_paren_in_while;
-// public boolean insert_space_after_postfix_operator;
-// public boolean insert_space_after_prefix_operator;
- public boolean insert_space_after_question_in_conditional;
- public boolean insert_space_after_semicolon_in_for;
-// public boolean insert_space_after_unary_operator;
-// public boolean insert_space_before_and_in_type_parameter;
-// public boolean insert_space_before_assignment_operator;
-// public boolean insert_space_before_binary_operator;
-// public boolean insert_space_before_closing_angle_bracket_in_parameterized_type_reference;
-// public boolean insert_space_before_closing_angle_bracket_in_type_arguments;
-// public boolean insert_space_before_closing_angle_bracket_in_type_parameters;
- public boolean insert_space_before_closing_brace_in_array_initializer;
-// public boolean insert_space_before_closing_bracket_in_array_allocation_expression;
-// public boolean insert_space_before_closing_bracket_in_array_reference;
-// public boolean insert_space_before_closing_paren_in_cast;
-// public boolean insert_space_before_closing_paren_in_catch;
-// public boolean insert_space_before_closing_paren_in_constructor_declaration;
-// public boolean insert_space_before_closing_paren_in_enum_constant;
- public boolean insert_space_before_closing_paren_in_for;
- public boolean insert_space_before_closing_paren_in_if;
- public boolean insert_space_before_closing_paren_in_method_declaration;
- public boolean insert_space_before_closing_paren_in_method_invocation;
-// public boolean insert_space_before_closing_paren_in_parenthesized_expression;
- public boolean insert_space_before_closing_paren_in_switch;
- public boolean insert_space_before_closing_paren_in_while;
- public boolean insert_space_before_colon_in_case;
- public boolean insert_space_before_colon_in_conditional;
- public boolean insert_space_before_colon_in_default;
-// public boolean insert_space_before_colon_in_for;
-// public boolean insert_space_before_colon_in_labeled_statement;
-// public boolean insert_space_before_comma_in_allocation_expression;
- public boolean insert_space_before_comma_in_array_initializer;
-// public boolean insert_space_before_comma_in_constructor_declaration_parameters;
-// public boolean insert_space_before_comma_in_constructor_declaration_throws;
-// public boolean insert_space_before_comma_in_enum_constant_arguments;
-// public boolean insert_space_before_comma_in_enum_declarations;
-// public boolean insert_space_before_comma_in_explicit_constructor_call_arguments;
-// public boolean insert_space_before_comma_in_for_increments;
-// public boolean insert_space_before_comma_in_for_inits;
- public boolean insert_space_before_comma_in_method_invocation_arguments;
- public boolean insert_space_before_comma_in_method_declaration_parameters;
-// public boolean insert_space_before_comma_in_method_declaration_throws;
-// public boolean insert_space_before_comma_in_multiple_field_declarations;
-// public boolean insert_space_before_comma_in_multiple_local_declarations;
-// public boolean insert_space_before_comma_in_parameterized_type_reference;
-// public boolean insert_space_before_comma_in_superinterfaces;
-// public boolean insert_space_before_comma_in_type_arguments;
-// public boolean insert_space_before_comma_in_type_parameters;
-// public boolean insert_space_before_ellipsis;
-// public boolean insert_space_before_parenthesized_expression_in_return;
-// public boolean insert_space_before_opening_angle_bracket_in_parameterized_type_reference;
-// public boolean insert_space_before_opening_angle_bracket_in_type_arguments;
-// public boolean insert_space_before_opening_angle_bracket_in_type_parameters;
- public boolean insert_space_before_opening_brace_in_array_initializer;
- public boolean insert_space_before_opening_brace_in_block;
-// public boolean insert_space_before_opening_brace_in_constructor_declaration;
-// public boolean insert_space_before_opening_brace_in_enum_constant;
-// public boolean insert_space_before_opening_brace_in_enum_declaration;
- public boolean insert_space_before_opening_brace_in_method_declaration;
- public boolean insert_space_before_opening_brace_in_type_declaration;
- public boolean insert_space_before_opening_brace_in_namespace_declaration;
-// public boolean insert_space_before_opening_bracket_in_array_allocation_expression;
-// public boolean insert_space_before_opening_bracket_in_array_reference;
-// public boolean insert_space_before_opening_bracket_in_array_type_reference;
-// public boolean insert_space_before_opening_paren_in_catch;
-// public boolean insert_space_before_opening_paren_in_constructor_declaration;
-// public boolean insert_space_before_opening_paren_in_enum_constant;
- public boolean insert_space_before_opening_paren_in_for;
- public boolean insert_space_before_opening_paren_in_if;
- public boolean insert_space_before_opening_paren_in_method_invocation;
- public boolean insert_space_before_opening_paren_in_method_declaration;
- public boolean insert_space_before_opening_paren_in_switch;
- public boolean insert_space_before_opening_brace_in_switch;
-// public boolean insert_space_before_opening_paren_in_parenthesized_expression;
- public boolean insert_space_before_opening_paren_in_while;
-// public boolean insert_space_before_postfix_operator;
-// public boolean insert_space_before_prefix_operator;
- public boolean insert_space_before_question_in_conditional;
- public boolean insert_space_before_semicolon;
- public boolean insert_space_before_semicolon_in_for;
-// public boolean insert_space_before_unary_operator;
-// public boolean insert_space_between_brackets_in_array_type_reference;
- public boolean insert_space_between_empty_braces_in_array_initializer;
-// public boolean insert_space_between_empty_brackets_in_array_allocation_expression;
-// public boolean insert_space_between_empty_parens_in_constructor_declaration;
-// public boolean insert_space_between_empty_parens_in_enum_constant;
- public boolean insert_space_between_empty_parens_in_method_declaration;
-// public boolean insert_space_between_empty_parens_in_method_invocation;
- public boolean compact_else_if;
- public boolean keep_guardian_clause_on_one_line;
- public boolean keep_else_statement_on_same_line;
- public boolean keep_empty_array_initializer_on_one_line;
- public boolean keep_simple_if_on_one_line;
- public boolean keep_then_statement_on_same_line;
- public int number_of_empty_lines_to_preserve;
- public boolean put_empty_statement_on_new_line;
- public int tab_size;
- public int page_width;
- public int tab_char = TAB;
- public boolean use_tabs_only_for_leading_indentations;
- public int initial_indentation_level;
- public String line_separator;
-
- private DefaultCodeFormatterOptions() {
- // cannot be instantiated
- }
-
- public DefaultCodeFormatterOptions(Map settings) {
- setDefaultSettings();
- if (settings == null) return;
- set(settings);
- }
-
- private String getAlignment(int alignment) {
- return Integer.toString(alignment);
- }
-
- public Map getMap() {
- Map options = new HashMap();
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_allocation_expression));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT, getAlignment(this.alignment_for_arguments_in_enum_constant));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL, getAlignment(this.alignment_for_arguments_in_explicit_constructor_call));
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_arguments_in_method_invocation));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_qualified_allocation_expression));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT, getAlignment(this.alignment_for_assignment));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION, getAlignment(this.alignment_for_binary_expression));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF, getAlignment(this.alignment_for_compact_if));
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION, getAlignment(this.alignment_for_conditional_expression));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS, getAlignment(this.alignment_for_enum_constants));
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER, getAlignment(this.alignment_for_expressions_in_array_initializer));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS, getAlignment(this.alignment_for_multiple_fields));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_parameters_in_constructor_declaration));
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_parameters_in_method_declaration));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_selector_in_method_invocation));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superclass_in_type_declaration));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_constructor_declaration));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_method_declaration));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS, this.align_type_members_on_columns ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, this.brace_position_for_array_initializer);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, this.brace_position_for_block);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE, this.brace_position_for_block_in_case);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, this.brace_position_for_constructor_declaration);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT, this.brace_position_for_enum_constant);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION, this.brace_position_for_enum_declaration);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, this.brace_position_for_method_declaration);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, this.brace_position_for_type_declaration);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, this.brace_position_for_switch);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_NAMESPACE_DECLARATION, this.brace_position_for_namespace_declaration);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, this.comment_clear_blank_lines ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT, this.comment_format ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, this.comment_format_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML, this.comment_format_html ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, this.comment_format_source ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, Integer.toString(this.comment_line_length));
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION, Integer.toString(this.continuation_indentation));
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, Integer.toString(this.continuation_indentation_for_array_initializer));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS, Integer.toString(this.blank_lines_after_includes));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIELD, Integer.toString(this.blank_lines_before_field));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION, Integer.toString(this.blank_lines_before_first_class_body_declaration));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_IMPORTS, Integer.toString(this.blank_lines_before_includes));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE, Integer.toString(this.blank_lines_before_member_type));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, Integer.toString(this.blank_lines_before_method));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK, Integer.toString(this.blank_lines_before_new_chunk));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS, Integer.toString(this.blank_lines_between_type_declarations));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY, Integer.toString(this.blank_lines_at_beginning_of_method_body));
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK, this.indent_statements_compare_to_block ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, this.indent_statements_compare_to_body ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER, this.indent_body_declarations_compare_to_enum_constant_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER, this.indent_body_declarations_compare_to_enum_declaration_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER, this.indent_body_declarations_compare_to_access_specifier ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER, this.indent_access_specifier_compare_to_type_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_NAMESPACE_HEADER, this.indent_body_declarations_compare_to_namespace_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES, this.indent_breaks_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, this.indent_empty_lines ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, this.indent_switchstatements_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, this.indent_switchstatements_compare_to_switch ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE, Integer.toString(this.indentation_size));
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_after_opening_brace_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, this.insert_new_line_at_end_of_file_if_missing ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, this.insert_new_line_before_catch_in_try_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_before_closing_brace_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, this.insert_new_line_before_else_in_if_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, this.insert_new_line_before_finally_in_try_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, this.insert_new_line_before_while_in_do_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK, this.insert_new_line_in_empty_block? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT, this.insert_new_line_in_empty_enum_constant? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION, this.insert_new_line_in_empty_enum_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY, this.insert_new_line_in_empty_method_body? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION, this.insert_new_line_in_empty_type_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER, this.insert_space_after_and_in_type_parameter? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, this.insert_space_after_assignment_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR, this.insert_space_after_binary_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, this.insert_space_after_closing_angle_bracket_in_type_arguments ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS, this.insert_space_after_closing_angle_bracket_in_type_parameters ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST, this.insert_space_after_closing_paren_in_cast? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK, this.insert_space_after_closing_brace_in_block? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE, this.insert_space_after_colon_in_case ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL, this.insert_space_after_colon_in_conditional ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR, this.insert_space_after_colon_in_for ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT, this.insert_space_after_colon_in_labeled_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION, this.insert_space_after_comma_in_allocation_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, this.insert_space_after_comma_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, this.insert_space_after_comma_in_constructor_declaration_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, this.insert_space_after_comma_in_constructor_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS, this.insert_space_after_comma_in_enum_constant_arguments ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS, this.insert_space_after_comma_in_enum_declarations ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS, this.insert_space_after_comma_in_explicit_constructor_call_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS, this.insert_space_after_comma_in_for_increments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS, this.insert_space_after_comma_in_for_inits? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, this.insert_space_after_comma_in_method_invocation_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, this.insert_space_after_comma_in_method_declaration_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_after_comma_in_method_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, this.insert_space_after_comma_in_multiple_field_declarations? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, this.insert_space_after_comma_in_multiple_local_declarations? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE, this.insert_space_after_comma_in_parameterized_type_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES, this.insert_space_after_comma_in_superinterfaces? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS, this.insert_space_after_comma_in_type_arguments ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS, this.insert_space_after_comma_in_type_parameters ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_after_opening_bracket_in_array_allocation_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS, this.insert_space_after_ellipsis ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE, this.insert_space_after_opening_angle_bracket_in_parameterized_type_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, this.insert_space_after_opening_angle_bracket_in_type_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS, this.insert_space_after_opening_angle_bracket_in_type_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE, this.insert_space_after_opening_bracket_in_array_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_space_after_opening_brace_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST, this.insert_space_after_opening_paren_in_cast? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH, this.insert_space_after_opening_paren_in_catch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, this.insert_space_after_opening_paren_in_constructor_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT, this.insert_space_after_opening_paren_in_enum_constant? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR, this.insert_space_after_opening_paren_in_for? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF, this.insert_space_after_opening_paren_in_if? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_after_opening_paren_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_after_opening_paren_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_after_opening_paren_in_parenthesized_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH, this.insert_space_after_opening_paren_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE, this.insert_space_after_opening_paren_in_while? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR, this.insert_space_after_postfix_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR, this.insert_space_after_prefix_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL, this.insert_space_after_question_in_conditional? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR, this.insert_space_after_semicolon_in_for? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR, this.insert_space_after_unary_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER, this.insert_space_before_and_in_type_parameter ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, this.insert_space_before_assignment_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR, this.insert_space_before_binary_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE, this.insert_space_before_closing_angle_bracket_in_parameterized_type_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, this.insert_space_before_closing_angle_bracket_in_type_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS, this.insert_space_before_closing_angle_bracket_in_type_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, this.insert_space_before_closing_brace_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_before_closing_bracket_in_array_allocation_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE, this.insert_space_before_closing_bracket_in_array_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST, this.insert_space_before_closing_paren_in_cast? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH, this.insert_space_before_closing_paren_in_catch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION, this.insert_space_before_closing_paren_in_constructor_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT, this.insert_space_before_closing_paren_in_enum_constant? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, this.insert_space_before_closing_paren_in_for? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF, this.insert_space_before_closing_paren_in_if? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_closing_paren_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_closing_paren_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_before_closing_paren_in_parenthesized_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH, this.insert_space_before_closing_paren_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE, this.insert_space_before_closing_paren_in_while? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE, this.insert_space_before_colon_in_case? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL, this.insert_space_before_colon_in_conditional? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT, this.insert_space_before_colon_in_default? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR, this.insert_space_before_colon_in_for ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT, this.insert_space_before_colon_in_labeled_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION, this.insert_space_before_comma_in_allocation_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER, this.insert_space_before_comma_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, this.insert_space_before_comma_in_constructor_declaration_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, this.insert_space_before_comma_in_constructor_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS, this.insert_space_before_comma_in_enum_constant_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS, this.insert_space_before_comma_in_enum_declarations? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS, this.insert_space_before_comma_in_explicit_constructor_call_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS, this.insert_space_before_comma_in_for_increments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS, this.insert_space_before_comma_in_for_inits? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, this.insert_space_before_comma_in_method_invocation_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, this.insert_space_before_comma_in_method_declaration_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_before_comma_in_method_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, this.insert_space_before_comma_in_multiple_field_declarations? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, this.insert_space_before_comma_in_multiple_local_declarations? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES, this.insert_space_before_comma_in_superinterfaces? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS, this.insert_space_before_comma_in_type_arguments ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS, this.insert_space_before_comma_in_type_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE, this.insert_space_before_comma_in_parameterized_type_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS, this.insert_space_before_ellipsis ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE, this.insert_space_before_opening_angle_bracket_in_parameterized_type_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, this.insert_space_before_opening_angle_bracket_in_type_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS, this.insert_space_before_opening_angle_bracket_in_type_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_space_before_opening_brace_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK, this.insert_space_before_opening_brace_in_block? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION, this.insert_space_before_opening_brace_in_constructor_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT, this.insert_space_before_opening_brace_in_enum_constant? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION, this.insert_space_before_opening_brace_in_enum_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, this.insert_space_before_opening_brace_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, this.insert_space_before_opening_brace_in_type_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_NAMESPACE_DECLARATION, this.insert_space_before_opening_brace_in_namespace_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_before_opening_bracket_in_array_allocation_expression ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE, this.insert_space_before_opening_bracket_in_array_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE, this.insert_space_before_opening_bracket_in_array_type_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH, this.insert_space_before_opening_paren_in_catch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, this.insert_space_before_opening_paren_in_constructor_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT, this.insert_space_before_opening_paren_in_enum_constant? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR, this.insert_space_before_opening_paren_in_for? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF, this.insert_space_before_opening_paren_in_if? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_opening_paren_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_opening_paren_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH, this.insert_space_before_opening_paren_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH, this.insert_space_before_opening_brace_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_before_opening_paren_in_parenthesized_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE, this.insert_space_before_opening_paren_in_while? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN, this.insert_space_before_parenthesized_expression_in_return ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR, this.insert_space_before_postfix_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR, this.insert_space_before_prefix_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL, this.insert_space_before_question_in_conditional? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, this.insert_space_before_semicolon? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR, this.insert_space_before_semicolon_in_for? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR, this.insert_space_before_unary_operator? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE, this.insert_space_between_brackets_in_array_type_reference? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, this.insert_space_between_empty_braces_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_between_empty_brackets_in_array_allocation_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION, this.insert_space_between_empty_parens_in_constructor_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT, this.insert_space_between_empty_parens_in_enum_constant? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, this.insert_space_between_empty_parens_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
-// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, this.insert_space_between_empty_parens_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF, this.compact_else_if ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE, this.keep_guardian_clause_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE, this.keep_else_statement_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, this.keep_empty_array_initializer_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE, this.keep_simple_if_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE, this.keep_then_statement_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, Integer.toString(this.number_of_empty_lines_to_preserve));
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, this.put_empty_statement_on_new_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, Integer.toString(this.page_width));
- switch(this.tab_char) {
- case SPACE :
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
- break;
- case TAB :
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.TAB);
- break;
- case MIXED :
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, DefaultCodeFormatterConstants.MIXED);
- break;
- }
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, Integer.toString(this.tab_size));
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, this.use_tabs_only_for_leading_indentations ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
- return options;
- }
-
- public void set(Map settings) {
-// final Object alignmentForArgumentsInAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION);
-// if (alignmentForArgumentsInAllocationExpressionOption != null) {
-// try {
-// this.alignment_for_arguments_in_allocation_expression = Integer.parseInt((String) alignmentForArgumentsInAllocationExpressionOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignmentForArgumentsInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT);
-// if (alignmentForArgumentsInEnumConstantOption != null) {
-// try {
-// this.alignment_for_arguments_in_enum_constant = Integer.parseInt((String) alignmentForArgumentsInEnumConstantOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_arguments_in_enum_constant = Alignment.M_COMPACT_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_arguments_in_enum_constant = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignmentForArgumentsInExplicitConstructorCallOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL);
-// if (alignmentForArgumentsInExplicitConstructorCallOption != null) {
-// try {
-// this.alignment_for_arguments_in_explicit_constructor_call = Integer.parseInt((String) alignmentForArgumentsInExplicitConstructorCallOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
-// }
-// }
- final Object alignmentForArgumentsInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
- if (alignmentForArgumentsInMethodInvocationOption != null) {
- try {
- this.alignment_for_arguments_in_method_invocation = Integer.parseInt((String) alignmentForArgumentsInMethodInvocationOption);
- } catch (NumberFormatException e) {
- this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
- } catch (ClassCastException e) {
- this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
- }
- }
-// final Object alignmentForArgumentsInQualifiedAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION);
-// if (alignmentForArgumentsInQualifiedAllocationExpressionOption != null) {
-// try {
-// this.alignment_for_arguments_in_qualified_allocation_expression = Integer.parseInt((String) alignmentForArgumentsInQualifiedAllocationExpressionOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_arguments_in_qualified_allocation_expression = Alignment.M_COMPACT_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_arguments_in_qualified_allocation_expression = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignmentForAssignmentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT);
-// if (alignmentForAssignmentOption != null) {
-// try {
-// this.alignment_for_assignment = Integer.parseInt((String) alignmentForAssignmentOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_assignment = Alignment.M_ONE_PER_LINE_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_assignment = Alignment.M_ONE_PER_LINE_SPLIT;
-// }
-// }
-// final Object alignmentForBinaryExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION);
-// if (alignmentForBinaryExpressionOption != null) {
-// try {
-// this.alignment_for_binary_expression = Integer.parseInt((String) alignmentForBinaryExpressionOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_binary_expression = Alignment.M_COMPACT_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_binary_expression = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignmentForCompactIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF);
-// if (alignmentForCompactIfOption != null) {
-// try {
-// this.alignment_for_compact_if = Integer.parseInt((String) alignmentForCompactIfOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
-// } catch (ClassCastException e) {
-// this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
-// }
-// }
- final Object alignmentForConditionalExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
- if (alignmentForConditionalExpressionOption != null) {
- try {
- this.alignment_for_conditional_expression = Integer.parseInt((String) alignmentForConditionalExpressionOption);
- } catch (NumberFormatException e) {
- this.alignment_for_conditional_expression = Alignment.M_ONE_PER_LINE_SPLIT;
- } catch (ClassCastException e) {
- this.alignment_for_conditional_expression = Alignment.M_ONE_PER_LINE_SPLIT;
- }
- }
-// final Object alignmentForEnumConstantsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS);
-// if (alignmentForEnumConstantsOption != null) {
-// try {
-// this.alignment_for_enum_constants = Integer.parseInt((String) alignmentForEnumConstantsOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_enum_constants = Alignment.NONE;
-// } catch (ClassCastException e) {
-// this.alignment_for_enum_constants = Alignment.NONE;
-// }
-// }
- final Object alignmentForExpressionsInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
- if (alignmentForExpressionsInArrayInitializerOption != null) {
- try {
- this.alignment_for_expressions_in_array_initializer = Integer.parseInt((String) alignmentForExpressionsInArrayInitializerOption);
- } catch (NumberFormatException e) {
- this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
- } catch (ClassCastException e) {
- this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
- }
- }
-// final Object alignmentForMultipleFieldsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS);
-// if (alignmentForMultipleFieldsOption != null) {
-// try {
-// this.alignment_for_multiple_fields = Integer.parseInt((String) alignmentForMultipleFieldsOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_multiple_fields = Alignment.M_COMPACT_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_multiple_fields = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignmentForParametersInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION);
-// if (alignmentForParametersInConstructorDeclarationOption != null) {
-// try {
-// this.alignment_for_parameters_in_constructor_declaration = Integer.parseInt((String) alignmentForParametersInConstructorDeclarationOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
-// } catch (ClassCastException e) {
-// this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
-// }
-// }
- final Object alignmentForParametersInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
- if (alignmentForParametersInMethodDeclarationOption != null) {
- try {
- this.alignment_for_parameters_in_method_declaration = Integer.parseInt((String) alignmentForParametersInMethodDeclarationOption);
- } catch (NumberFormatException e) {
- this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
- } catch(ClassCastException e) {
- this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
- }
- }
-// final Object alignmentForSelectorInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION);
-// if (alignmentForSelectorInMethodInvocationOption != null) {
-// try {
-// this.alignment_for_selector_in_method_invocation = Integer.parseInt((String) alignmentForSelectorInMethodInvocationOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
-// } catch(ClassCastException e) {
-// this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignmentForSuperclassInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION);
-// if (alignmentForSuperclassInTypeDeclarationOption != null) {
-// try {
-// this.alignment_for_superclass_in_type_declaration = Integer.parseInt((String) alignmentForSuperclassInTypeDeclarationOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
-// } catch(ClassCastException e) {
-// this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
-// }
-// }
-// final Object alignmentForThrowsClauseInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION);
-// if (alignmentForThrowsClauseInConstructorDeclarationOption != null) {
-// try {
-// this.alignment_for_throws_clause_in_constructor_declaration = Integer.parseInt((String) alignmentForThrowsClauseInConstructorDeclarationOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
-// } catch(ClassCastException e) {
-// this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignmentForThrowsClauseInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION);
-// if (alignmentForThrowsClauseInMethodDeclarationOption != null) {
-// try {
-// this.alignment_for_throws_clause_in_method_declaration = Integer.parseInt((String) alignmentForThrowsClauseInMethodDeclarationOption);
-// } catch (NumberFormatException e) {
-// this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
-// } catch(ClassCastException e) {
-// this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
-// }
-// }
-// final Object alignTypeMembersOnColumnsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS);
-// if (alignTypeMembersOnColumnsOption != null) {
-// this.align_type_members_on_columns = DefaultCodeFormatterConstants.TRUE.equals(alignTypeMembersOnColumnsOption);
-// }
- final Object bracePositionForArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER);
- if (bracePositionForArrayInitializerOption != null) {
- try {
- this.brace_position_for_array_initializer = (String) bracePositionForArrayInitializerOption;
- } catch(ClassCastException e) {
- this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.END_OF_LINE;
- }
- }
- final Object bracePositionForBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK);
- if (bracePositionForBlockOption != null) {
- try {
- this.brace_position_for_block = (String) bracePositionForBlockOption;
- } catch(ClassCastException e) {
- this.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
- }
- }
- final Object bracePositionForBlockInCaseOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE);
- if (bracePositionForBlockInCaseOption != null) {
- try {
- this.brace_position_for_block_in_case = (String) bracePositionForBlockInCaseOption;
- } catch(ClassCastException e) {
- this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.END_OF_LINE;
- }
- }
-// final Object bracePositionForConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION);
-// if (bracePositionForConstructorDeclarationOption != null) {
-// try {
-// this.brace_position_for_constructor_declaration = (String) bracePositionForConstructorDeclarationOption;
-// } catch(ClassCastException e) {
-// this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
-// }
-// }
-// final Object bracePositionForEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT);
-// if (bracePositionForEnumConstantOption != null) {
-// try {
-// this.brace_position_for_enum_constant = (String) bracePositionForEnumConstantOption;
-// } catch(ClassCastException e) {
-// this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.END_OF_LINE;
-// }
-// }
-// final Object bracePositionForEnumDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION);
-// if (bracePositionForEnumDeclarationOption != null) {
-// try {
-// this.brace_position_for_enum_declaration = (String) bracePositionForEnumDeclarationOption;
-// } catch(ClassCastException e) {
-// this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
-// }
-// }
- final Object bracePositionForMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION);
- if (bracePositionForMethodDeclarationOption != null) {
- try {
- this.brace_position_for_method_declaration = (String) bracePositionForMethodDeclarationOption;
- } catch(ClassCastException e) {
- this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- }
- }
- final Object bracePositionForSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH);
- if (bracePositionForSwitchOption != null) {
- try {
- this.brace_position_for_switch = (String) bracePositionForSwitchOption;
- } catch(ClassCastException e) {
- this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
- }
- }
- final Object bracePositionForTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION);
- if (bracePositionForTypeDeclarationOption != null) {
- try {
- this.brace_position_for_type_declaration = (String) bracePositionForTypeDeclarationOption;
- } catch(ClassCastException e) {
- this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- }
- }
- final Object bracePositionForNamespaceDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_NAMESPACE_DECLARATION);
- if (bracePositionForNamespaceDeclarationOption != null) {
- try {
- this.brace_position_for_namespace_declaration = (String) bracePositionForNamespaceDeclarationOption;
- } catch(ClassCastException e) {
- this.brace_position_for_namespace_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- }
- }
- final Object continuationIndentationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION);
- if (continuationIndentationOption != null) {
- try {
- this.continuation_indentation = Integer.parseInt((String) continuationIndentationOption);
- } catch (NumberFormatException e) {
- this.continuation_indentation = 2;
- } catch(ClassCastException e) {
- this.continuation_indentation = 2;
- }
- }
- final Object continuationIndentationForArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER);
- if (continuationIndentationForArrayInitializerOption != null) {
- try {
- this.continuation_indentation_for_array_initializer = Integer.parseInt((String) continuationIndentationForArrayInitializerOption);
- } catch (NumberFormatException e) {
- this.continuation_indentation_for_array_initializer = 2;
- } catch(ClassCastException e) {
- this.continuation_indentation_for_array_initializer = 2;
- }
- }
-// final Object blankLinesAfterIncludesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS);
-// if (blankLinesAfterIncludesOption != null) {
-// try {
-// this.blank_lines_after_includes = Integer.parseInt((String) blankLinesAfterIncludesOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_after_includes = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_after_includes = 0;
-// }
-// }
-// final Object blankLinesBeforeFieldOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIELD);
-// if (blankLinesBeforeFieldOption != null) {
-// try {
-// this.blank_lines_before_field = Integer.parseInt((String) blankLinesBeforeFieldOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_before_field = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_before_field = 0;
-// }
-// }
-// final Object blankLinesBeforeFirstClassBodyDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION);
-// if (blankLinesBeforeFirstClassBodyDeclarationOption != null) {
-// try {
-// this.blank_lines_before_first_class_body_declaration = Integer.parseInt((String) blankLinesBeforeFirstClassBodyDeclarationOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_before_first_class_body_declaration = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_before_first_class_body_declaration = 0;
-// }
-// }
-// final Object blankLinesBeforeIncludesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_IMPORTS);
-// if (blankLinesBeforeIncludesOption != null) {
-// try {
-// this.blank_lines_before_includes = Integer.parseInt((String) blankLinesBeforeIncludesOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_before_includes = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_before_includes = 0;
-// }
-// }
-// final Object blankLinesBeforeMemberTypeOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE);
-// if (blankLinesBeforeMemberTypeOption != null) {
-// try {
-// this.blank_lines_before_member_type = Integer.parseInt((String) blankLinesBeforeMemberTypeOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_before_member_type = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_before_member_type = 0;
-// }
-// }
-// final Object blankLinesBeforeMethodOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD);
-// if (blankLinesBeforeMethodOption != null) {
-// try {
-// this.blank_lines_before_method = Integer.parseInt((String) blankLinesBeforeMethodOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_before_method = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_before_method = 0;
-// }
-// }
-// final Object blankLinesBeforeNewChunkOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK);
-// if (blankLinesBeforeNewChunkOption != null) {
-// try {
-// this.blank_lines_before_new_chunk = Integer.parseInt((String) blankLinesBeforeNewChunkOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_before_new_chunk = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_before_new_chunk = 0;
-// }
-// }
-// final Object blankLinesBetweenTypeDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS);
-// if (blankLinesBetweenTypeDeclarationsOption != null) {
-// try {
-// this.blank_lines_between_type_declarations = Integer.parseInt((String) blankLinesBetweenTypeDeclarationsOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_between_type_declarations = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_between_type_declarations = 0;
-// }
-// }
-// final Object blankLinesAtBeginningOfMethodBodyOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY);
-// if (blankLinesAtBeginningOfMethodBodyOption != null) {
-// try {
-// this.blank_lines_at_beginning_of_method_body = Integer.parseInt((String) blankLinesAtBeginningOfMethodBodyOption);
-// } catch (NumberFormatException e) {
-// this.blank_lines_at_beginning_of_method_body = 0;
-// } catch(ClassCastException e) {
-// this.blank_lines_at_beginning_of_method_body = 0;
-// }
-// }
-// final Object commentClearBlankLinesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES);
-// if (commentClearBlankLinesOption != null) {
-// this.comment_clear_blank_lines = DefaultCodeFormatterConstants.TRUE.equals(commentClearBlankLinesOption);
-// }
-// final Object commentFormatOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT);
-// if (commentFormatOption != null) {
-// this.comment_format = DefaultCodeFormatterConstants.TRUE.equals(commentFormatOption);
-// }
-// final Object commentFormatHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER);
-// if (commentFormatHeaderOption != null) {
-// this.comment_format_header = DefaultCodeFormatterConstants.TRUE.equals(commentFormatHeaderOption);
-// }
-// final Object commentFormatHtmlOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML);
-// if (commentFormatHtmlOption != null) {
-// this.comment_format_html = DefaultCodeFormatterConstants.TRUE.equals(commentFormatHtmlOption);
-// }
-// final Object commentFormatSourceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE);
-// if (commentFormatSourceOption != null) {
-// this.comment_format_source = DefaultCodeFormatterConstants.TRUE.equals(commentFormatSourceOption);
-// }
-// final Object commentLineLengthOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
-// if (commentLineLengthOption != null) {
-// try {
-// this.comment_line_length = Integer.parseInt((String) commentLineLengthOption);
-// } catch (NumberFormatException e) {
-// this.comment_line_length = 80;
-// } catch(ClassCastException e) {
-// this.comment_line_length = 80;
-// }
-// }
- final Object indentStatementsCompareToBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK);
- if (indentStatementsCompareToBlockOption != null) {
- this.indent_statements_compare_to_block = DefaultCodeFormatterConstants.TRUE.equals(indentStatementsCompareToBlockOption);
- }
- final Object indentStatementsCompareToBodyOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY);
- if (indentStatementsCompareToBodyOption != null) {
- this.indent_statements_compare_to_body = DefaultCodeFormatterConstants.TRUE.equals(indentStatementsCompareToBodyOption);
- }
-// final Object indentBodyDeclarationsCompareToEnumConstantHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER);
-// if (indentBodyDeclarationsCompareToEnumConstantHeaderOption != null) {
-// this.indent_body_declarations_compare_to_enum_constant_header = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToEnumConstantHeaderOption);
-// }
-// final Object indentBodyDeclarationsCompareToEnumDeclarationHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER);
-// if (indentBodyDeclarationsCompareToEnumDeclarationHeaderOption != null) {
-// this.indent_body_declarations_compare_to_enum_declaration_header = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToEnumDeclarationHeaderOption);
-// }
- final Object indentAccessSpecifierCompareToTypeHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER);
- if (indentAccessSpecifierCompareToTypeHeaderOption != null) {
- this.indent_access_specifier_compare_to_type_header = DefaultCodeFormatterConstants.TRUE.equals(indentAccessSpecifierCompareToTypeHeaderOption);
- }
- final Object indentBodyDeclarationsCompareToAccessSpecifierOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER);
- if (indentBodyDeclarationsCompareToAccessSpecifierOption != null) {
- this.indent_body_declarations_compare_to_access_specifier = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToAccessSpecifierOption);
- }
- final Object indentBodyDeclarationsCompareToNamespaceHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_NAMESPACE_HEADER);
- if (indentBodyDeclarationsCompareToNamespaceHeaderOption != null) {
- this.indent_body_declarations_compare_to_namespace_header = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToNamespaceHeaderOption);
- }
- final Object indentBreaksCompareToCasesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES);
- if (indentBreaksCompareToCasesOption != null) {
- this.indent_breaks_compare_to_cases = DefaultCodeFormatterConstants.TRUE.equals(indentBreaksCompareToCasesOption);
- }
- final Object indentEmptyLinesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES);
- if (indentEmptyLinesOption != null) {
- this.indent_empty_lines = DefaultCodeFormatterConstants.TRUE.equals(indentEmptyLinesOption);
- }
- final Object indentSwitchstatementsCompareToCasesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES);
- if (indentSwitchstatementsCompareToCasesOption != null) {
- this.indent_switchstatements_compare_to_cases = DefaultCodeFormatterConstants.TRUE.equals(indentSwitchstatementsCompareToCasesOption);
- }
- final Object indentSwitchstatementsCompareToSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH);
- if (indentSwitchstatementsCompareToSwitchOption != null) {
- this.indent_switchstatements_compare_to_switch = DefaultCodeFormatterConstants.TRUE.equals(indentSwitchstatementsCompareToSwitchOption);
- }
- final Object indentationSizeOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE);
- if (indentationSizeOption != null) {
- try {
- this.indentation_size = Integer.parseInt((String) indentationSizeOption);
- } catch (NumberFormatException e) {
- this.indentation_size = 4;
- } catch(ClassCastException e) {
- this.indentation_size = 4;
- }
- }
- final Object insertNewLineAfterOpeningBraceInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER);
- if (insertNewLineAfterOpeningBraceInArrayInitializerOption != null) {
- this.insert_new_line_after_opening_brace_in_array_initializer = CCorePlugin.INSERT.equals(insertNewLineAfterOpeningBraceInArrayInitializerOption);
- }
- final Object insertNewLineAtEndOfFileIfMissingOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING);
- if (insertNewLineAtEndOfFileIfMissingOption != null) {
- this.insert_new_line_at_end_of_file_if_missing = CCorePlugin.INSERT.equals(insertNewLineAtEndOfFileIfMissingOption);
- }
-// final Object insertNewLineBeforeCatchInTryStatementOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT);
-// if (insertNewLineBeforeCatchInTryStatementOption != null) {
-// this.insert_new_line_before_catch_in_try_statement = CCorePlugin.INSERT.equals(insertNewLineBeforeCatchInTryStatementOption);
-// }
- final Object insertNewLineBeforeClosingBraceInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER);
- if (insertNewLineBeforeClosingBraceInArrayInitializerOption != null) {
- this.insert_new_line_before_closing_brace_in_array_initializer = CCorePlugin.INSERT.equals(insertNewLineBeforeClosingBraceInArrayInitializerOption);
- }
- final Object insertNewLineBeforeElseInIfStatementOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT);
- if (insertNewLineBeforeElseInIfStatementOption != null) {
- this.insert_new_line_before_else_in_if_statement = CCorePlugin.INSERT.equals(insertNewLineBeforeElseInIfStatementOption);
- }
-// final Object insertNewLineBeforeFinallyInTryStatementOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT);
-// if (insertNewLineBeforeFinallyInTryStatementOption != null) {
-// this.insert_new_line_before_finally_in_try_statement = CCorePlugin.INSERT.equals(insertNewLineBeforeFinallyInTryStatementOption);
-// }
- final Object insertNewLineBeforeWhileInDoStatementOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT);
- if (insertNewLineBeforeWhileInDoStatementOption != null) {
- this.insert_new_line_before_while_in_do_statement = CCorePlugin.INSERT.equals(insertNewLineBeforeWhileInDoStatementOption);
- }
- final Object insertNewLineInEmptyBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK);
- if (insertNewLineInEmptyBlockOption != null) {
- this.insert_new_line_in_empty_block = CCorePlugin.INSERT.equals(insertNewLineInEmptyBlockOption);
- }
-// final Object insertNewLineInEmptyEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT);
-// if (insertNewLineInEmptyEnumConstantOption != null) {
-// this.insert_new_line_in_empty_enum_constant = CCorePlugin.INSERT.equals(insertNewLineInEmptyEnumConstantOption);
-// }
-// final Object insertNewLineInEmptyEnumDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION);
-// if (insertNewLineInEmptyEnumDeclarationOption != null) {
-// this.insert_new_line_in_empty_enum_declaration = CCorePlugin.INSERT.equals(insertNewLineInEmptyEnumDeclarationOption);
-// }
-// final Object insertNewLineInEmptyMethodBodyOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY);
-// if (insertNewLineInEmptyMethodBodyOption != null) {
-// this.insert_new_line_in_empty_method_body = CCorePlugin.INSERT.equals(insertNewLineInEmptyMethodBodyOption);
-// }
-// final Object insertNewLineInEmptyTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION);
-// if (insertNewLineInEmptyTypeDeclarationOption != null) {
-// this.insert_new_line_in_empty_type_declaration = CCorePlugin.INSERT.equals(insertNewLineInEmptyTypeDeclarationOption);
-// }
-// final Object insertSpaceAfterAndInWildcardOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER);
-// if (insertSpaceAfterAndInWildcardOption != null) {
-// this.insert_space_after_and_in_type_parameter = CCorePlugin.INSERT.equals(insertSpaceAfterAndInWildcardOption);
-// }
-// final Object insertSpaceAfterAssignmentOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR);
-// if (insertSpaceAfterAssignmentOperatorOption != null) {
-// this.insert_space_after_assignment_operator = CCorePlugin.INSERT.equals(insertSpaceAfterAssignmentOperatorOption);
-// }
-// final Object insertSpaceAfterBinaryOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR);
-// if (insertSpaceAfterBinaryOperatorOption != null) {
-// this.insert_space_after_binary_operator = CCorePlugin.INSERT.equals(insertSpaceAfterBinaryOperatorOption);
-// }
-// final Object insertSpaceAfterClosingAngleBracketInTypeArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS);
-// if (insertSpaceAfterClosingAngleBracketInTypeArgumentsOption != null) {
-// this.insert_space_after_closing_angle_bracket_in_type_arguments = CCorePlugin.INSERT.equals(insertSpaceAfterClosingAngleBracketInTypeArgumentsOption);
-// }
-// final Object insertSpaceAfterClosingAngleBracketInTypeParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS);
-// if (insertSpaceAfterClosingAngleBracketInTypeParametersOption != null) {
-// this.insert_space_after_closing_angle_bracket_in_type_parameters = CCorePlugin.INSERT.equals(insertSpaceAfterClosingAngleBracketInTypeParametersOption);
-// }
-// final Object insertSpaceAfterClosingParenInCastOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST);
-// if (insertSpaceAfterClosingParenInCastOption != null) {
-// this.insert_space_after_closing_paren_in_cast = CCorePlugin.INSERT.equals(insertSpaceAfterClosingParenInCastOption);
-// }
- final Object insertSpaceAfterClosingBraceInBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK);
- if (insertSpaceAfterClosingBraceInBlockOption != null) {
- this.insert_space_after_closing_brace_in_block = CCorePlugin.INSERT.equals(insertSpaceAfterClosingBraceInBlockOption);
- }
- final Object insertSpaceAfterColonInCaseOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE);
- if (insertSpaceAfterColonInCaseOption != null) {
- this.insert_space_after_colon_in_case = CCorePlugin.INSERT.equals(insertSpaceAfterColonInCaseOption);
- }
- final Object insertSpaceAfterColonInConditionalOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL);
- if (insertSpaceAfterColonInConditionalOption != null) {
- this.insert_space_after_colon_in_conditional = CCorePlugin.INSERT.equals(insertSpaceAfterColonInConditionalOption);
- }
-// final Object insertSpaceAfterColonInForOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR);
-// if (insertSpaceAfterColonInForOption != null) {
-// this.insert_space_after_colon_in_for = CCorePlugin.INSERT.equals(insertSpaceAfterColonInForOption);
-// }
-// final Object insertSpaceAfterColonInLabeledStatementOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT);
-// if (insertSpaceAfterColonInLabeledStatementOption != null) {
-// this.insert_space_after_colon_in_labeled_statement = CCorePlugin.INSERT.equals(insertSpaceAfterColonInLabeledStatementOption);
-// }
-// final Object insertSpaceAfterCommaInAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION);
-// if (insertSpaceAfterCommaInAllocationExpressionOption != null) {
-// this.insert_space_after_comma_in_allocation_expression = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInAllocationExpressionOption);
-// }
- final Object insertSpaceAfterCommaInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER);
- if (insertSpaceAfterCommaInArrayInitializerOption != null) {
- this.insert_space_after_comma_in_array_initializer = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInArrayInitializerOption);
- }
-// final Object insertSpaceAfterCommaInConstructorDeclarationParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS);
-// if (insertSpaceAfterCommaInConstructorDeclarationParametersOption != null) {
-// this.insert_space_after_comma_in_constructor_declaration_parameters = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInConstructorDeclarationParametersOption);
-// }
-// final Object insertSpaceAfterCommaInConstructorDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS);
-// if (insertSpaceAfterCommaInConstructorDeclarationThrowsOption != null) {
-// this.insert_space_after_comma_in_constructor_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInConstructorDeclarationThrowsOption);
-// }
-// final Object insertSpaceAfterCommaInEnumConstantArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS);
-// if (insertSpaceAfterCommaInEnumConstantArgumentsOption != null) {
-// this.insert_space_after_comma_in_enum_constant_arguments = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInEnumConstantArgumentsOption);
-// }
-// final Object insertSpaceAfterCommaInEnumDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS);
-// if (insertSpaceAfterCommaInEnumDeclarationsOption != null) {
-// this.insert_space_after_comma_in_enum_declarations = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInEnumDeclarationsOption);
-// }
-// final Object insertSpaceAfterCommaInExplicitConstructorCallArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS);
-// if (insertSpaceAfterCommaInExplicitConstructorCallArgumentsOption != null) {
-// this.insert_space_after_comma_in_explicit_constructor_call_arguments = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInExplicitConstructorCallArgumentsOption);
-// }
-// final Object insertSpaceAfterCommaInForIncrementsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS);
-// if (insertSpaceAfterCommaInForIncrementsOption != null) {
-// this.insert_space_after_comma_in_for_increments = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInForIncrementsOption);
-// }
-// final Object insertSpaceAfterCommaInForInitsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS);
-// if (insertSpaceAfterCommaInForInitsOption != null) {
-// this.insert_space_after_comma_in_for_inits = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInForInitsOption);
-// }
- final Object insertSpaceAfterCommaInMethodInvocationArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS);
- if (insertSpaceAfterCommaInMethodInvocationArgumentsOption != null) {
- this.insert_space_after_comma_in_method_invocation_arguments = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMethodInvocationArgumentsOption);
- }
- final Object insertSpaceAfterCommaInMethodDeclarationParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS);
- if (insertSpaceAfterCommaInMethodDeclarationParametersOption != null) {
- this.insert_space_after_comma_in_method_declaration_parameters = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMethodDeclarationParametersOption);
- }
-// final Object insertSpaceAfterCommaInMethodDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS);
-// if (insertSpaceAfterCommaInMethodDeclarationThrowsOption != null) {
-// this.insert_space_after_comma_in_method_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMethodDeclarationThrowsOption);
-// }
-// final Object insertSpaceAfterCommaInMultipleFieldDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS);
-// if (insertSpaceAfterCommaInMultipleFieldDeclarationsOption != null) {
-// this.insert_space_after_comma_in_multiple_field_declarations = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMultipleFieldDeclarationsOption);
-// }
-// final Object insertSpaceAfterCommaInMultipleLocalDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS);
-// if (insertSpaceAfterCommaInMultipleLocalDeclarationsOption != null) {
-// this.insert_space_after_comma_in_multiple_local_declarations = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMultipleLocalDeclarationsOption);
-// }
-// final Object insertSpaceAfterCommaInParameterizedTypeReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE);
-// if (insertSpaceAfterCommaInParameterizedTypeReferenceOption != null) {
-// this.insert_space_after_comma_in_parameterized_type_reference = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInParameterizedTypeReferenceOption);
-// }
-// final Object insertSpaceAfterCommaInSuperinterfacesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES);
-// if (insertSpaceAfterCommaInSuperinterfacesOption != null) {
-// this.insert_space_after_comma_in_superinterfaces = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInSuperinterfacesOption);
-// }
-// final Object insertSpaceAfterCommaInTypeArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS);
-// if (insertSpaceAfterCommaInTypeArgumentsOption != null) {
-// this.insert_space_after_comma_in_type_arguments = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInTypeArgumentsOption);
-// }
-// final Object insertSpaceAfterCommaInTypeParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS);
-// if (insertSpaceAfterCommaInTypeParametersOption != null) {
-// this.insert_space_after_comma_in_type_parameters = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInTypeParametersOption);
-// }
-// final Object insertSpaceAfterEllipsisOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS);
-// if (insertSpaceAfterEllipsisOption != null) {
-// this.insert_space_after_ellipsis = CCorePlugin.INSERT.equals(insertSpaceAfterEllipsisOption);
-// }
-// final Object insertSpaceAfterOpeningAngleBracketInParameterizedTypeReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE);
-// if (insertSpaceAfterOpeningAngleBracketInParameterizedTypeReferenceOption != null) {
-// this.insert_space_after_opening_angle_bracket_in_parameterized_type_reference = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningAngleBracketInParameterizedTypeReferenceOption);
-// }
-// final Object insertSpaceAfterOpeningAngleBracketInTypeArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS);
-// if (insertSpaceAfterOpeningAngleBracketInTypeArgumentsOption != null) {
-// this.insert_space_after_opening_angle_bracket_in_type_arguments = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningAngleBracketInTypeArgumentsOption);
-// }
-// final Object insertSpaceAfterOpeningAngleBracketInTypeParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS);
-// if (insertSpaceAfterOpeningAngleBracketInTypeParametersOption != null) {
-// this.insert_space_after_opening_angle_bracket_in_type_parameters = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningAngleBracketInTypeParametersOption);
-// }
-// final Object insertSpaceAfterOpeningBracketInArrayAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION);
-// if (insertSpaceAfterOpeningBracketInArrayAllocationExpressionOption != null) {
-// this.insert_space_after_opening_bracket_in_array_allocation_expression = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningBracketInArrayAllocationExpressionOption);
-// }
-// final Object insertSpaceAfterOpeningBracketInArrayReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE);
-// if (insertSpaceAfterOpeningBracketInArrayReferenceOption != null) {
-// this.insert_space_after_opening_bracket_in_array_reference = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningBracketInArrayReferenceOption);
-// }
- final Object insertSpaceAfterOpeningBraceInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER);
- if (insertSpaceAfterOpeningBraceInArrayInitializerOption != null) {
- this.insert_space_after_opening_brace_in_array_initializer = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningBraceInArrayInitializerOption);
- }
-// final Object insertSpaceAfterOpeningParenInCastOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST);
-// if (insertSpaceAfterOpeningParenInCastOption != null) {
-// this.insert_space_after_opening_paren_in_cast = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInCastOption);
-// }
-// final Object insertSpaceAfterOpeningParenInCatchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH);
-// if (insertSpaceAfterOpeningParenInCatchOption != null) {
-// this.insert_space_after_opening_paren_in_catch = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInCatchOption);
-// }
-// final Object insertSpaceAfterOpeningParenInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION);
-// if (insertSpaceAfterOpeningParenInConstructorDeclarationOption != null) {
-// this.insert_space_after_opening_paren_in_constructor_declaration = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInConstructorDeclarationOption);
-// }
-// final Object insertSpaceAfterOpeningParenInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT);
-// if (insertSpaceAfterOpeningParenInEnumConstantOption != null) {
-// this.insert_space_after_opening_paren_in_enum_constant = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInEnumConstantOption);
-// }
- final Object insertSpaceAfterOpeningParenInForOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR);
- if (insertSpaceAfterOpeningParenInForOption != null) {
- this.insert_space_after_opening_paren_in_for = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInForOption);
- }
- final Object insertSpaceAfterOpeningParenInIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF);
- if (insertSpaceAfterOpeningParenInIfOption != null) {
- this.insert_space_after_opening_paren_in_if = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInIfOption);
- }
- final Object insertSpaceAfterOpeningParenInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION);
- if (insertSpaceAfterOpeningParenInMethodDeclarationOption != null) {
- this.insert_space_after_opening_paren_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInMethodDeclarationOption);
- }
- final Object insertSpaceAfterOpeningParenInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION);
- if (insertSpaceAfterOpeningParenInMethodInvocationOption != null) {
- this.insert_space_after_opening_paren_in_method_invocation = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInMethodInvocationOption);
- }
-// final Object insertSpaceAfterOpeningParenInParenthesizedExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION);
-// if (insertSpaceAfterOpeningParenInParenthesizedExpressionOption != null) {
-// this.insert_space_after_opening_paren_in_parenthesized_expression = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInParenthesizedExpressionOption);
-// }
- final Object insertSpaceAfterOpeningParenInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH);
- if (insertSpaceAfterOpeningParenInSwitchOption != null) {
- this.insert_space_after_opening_paren_in_switch = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInSwitchOption);
- }
- final Object insertSpaceAfterOpeningParenInWhileOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE);
- if (insertSpaceAfterOpeningParenInWhileOption != null) {
- this.insert_space_after_opening_paren_in_while = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInWhileOption);
- }
-// final Object insertSpaceAfterPostfixOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR);
-// if (insertSpaceAfterPostfixOperatorOption != null) {
-// this.insert_space_after_postfix_operator = CCorePlugin.INSERT.equals(insertSpaceAfterPostfixOperatorOption);
-// }
-// final Object insertSpaceAfterPrefixOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR);
-// if (insertSpaceAfterPrefixOperatorOption != null) {
-// this.insert_space_after_prefix_operator = CCorePlugin.INSERT.equals(insertSpaceAfterPrefixOperatorOption);
-// }
- final Object insertSpaceAfterQuestionInConditionalOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL);
- if (insertSpaceAfterQuestionInConditionalOption != null) {
- this.insert_space_after_question_in_conditional = CCorePlugin.INSERT.equals(insertSpaceAfterQuestionInConditionalOption);
- }
- final Object insertSpaceAfterSemicolonInForOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR);
- if (insertSpaceAfterSemicolonInForOption != null) {
- this.insert_space_after_semicolon_in_for = CCorePlugin.INSERT.equals(insertSpaceAfterSemicolonInForOption);
- }
-// final Object insertSpaceAfterUnaryOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR);
-// if (insertSpaceAfterUnaryOperatorOption != null) {
-// this.insert_space_after_unary_operator = CCorePlugin.INSERT.equals(insertSpaceAfterUnaryOperatorOption);
-// }
-// final Object insertSpaceBeforeAndInWildcardOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER);
-// if (insertSpaceBeforeAndInWildcardOption != null) {
-// this.insert_space_before_and_in_type_parameter = CCorePlugin.INSERT.equals(insertSpaceBeforeAndInWildcardOption);
-// }
-// final Object insertSpaceBeforeAssignmentOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR);
-// if (insertSpaceBeforeAssignmentOperatorOption != null) {
-// this.insert_space_before_assignment_operator = CCorePlugin.INSERT.equals(insertSpaceBeforeAssignmentOperatorOption);
-// }
-// final Object insertSpaceBeforeBinaryOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR);
-// if (insertSpaceBeforeBinaryOperatorOption != null) {
-// this.insert_space_before_binary_operator = CCorePlugin.INSERT.equals(insertSpaceBeforeBinaryOperatorOption);
-// }
-// final Object insertSpaceBeforeClosingAngleBracketInParameterizedTypeReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE);
-// if (insertSpaceBeforeClosingAngleBracketInParameterizedTypeReferenceOption != null) {
-// this.insert_space_before_closing_angle_bracket_in_parameterized_type_reference = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingAngleBracketInParameterizedTypeReferenceOption);
-// }
-// final Object insertSpaceBeforeClosingAngleBracketInTypeArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS);
-// if (insertSpaceBeforeClosingAngleBracketInTypeArgumentsOption != null) {
-// this.insert_space_before_closing_angle_bracket_in_type_arguments = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingAngleBracketInTypeArgumentsOption);
-// }
-// final Object insertSpaceBeforeClosingAngleBracketInTypeParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS);
-// if (insertSpaceBeforeClosingAngleBracketInTypeParametersOption != null) {
-// this.insert_space_before_closing_angle_bracket_in_type_parameters = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingAngleBracketInTypeParametersOption);
-// }
-// final Object insertSpaceBeforeClosingBraceInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER);
-// if (insertSpaceBeforeClosingBraceInArrayInitializerOption != null) {
-// this.insert_space_before_closing_brace_in_array_initializer = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingBraceInArrayInitializerOption);
-// }
-// final Object insertSpaceBeforeClosingBracketInArrayAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION);
-// if (insertSpaceBeforeClosingBracketInArrayAllocationExpressionOption != null) {
-// this.insert_space_before_closing_bracket_in_array_allocation_expression = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingBracketInArrayAllocationExpressionOption);
-// }
-// final Object insertSpaceBeforeClosingBracketInArrayReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE);
-// if (insertSpaceBeforeClosingBracketInArrayReferenceOption != null) {
-// this.insert_space_before_closing_bracket_in_array_reference = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingBracketInArrayReferenceOption);
-// }
-// final Object insertSpaceBeforeClosingParenInCastOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST);
-// if (insertSpaceBeforeClosingParenInCastOption != null) {
-// this.insert_space_before_closing_paren_in_cast = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInCastOption);
-// }
-// final Object insertSpaceBeforeClosingParenInCatchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH);
-// if (insertSpaceBeforeClosingParenInCatchOption != null) {
-// this.insert_space_before_closing_paren_in_catch = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInCatchOption);
-// }
-// final Object insertSpaceBeforeClosingParenInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION);
-// if (insertSpaceBeforeClosingParenInConstructorDeclarationOption != null) {
-// this.insert_space_before_closing_paren_in_constructor_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInConstructorDeclarationOption);
-// }
-// final Object insertSpaceBeforeClosingParenInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT);
-// if (insertSpaceBeforeClosingParenInEnumConstantOption != null) {
-// this.insert_space_before_closing_paren_in_enum_constant = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInEnumConstantOption);
-// }
- final Object insertSpaceBeforeClosingParenInForOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR);
- if (insertSpaceBeforeClosingParenInForOption != null) {
- this.insert_space_before_closing_paren_in_for = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInForOption);
- }
- final Object insertSpaceBeforeClosingParenInIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF);
- if (insertSpaceBeforeClosingParenInIfOption != null) {
- this.insert_space_before_closing_paren_in_if = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInIfOption);
- }
- final Object insertSpaceBeforeClosingParenInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION);
- if (insertSpaceBeforeClosingParenInMethodDeclarationOption != null) {
- this.insert_space_before_closing_paren_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInMethodDeclarationOption);
- }
- final Object insertSpaceBeforeClosingParenInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION);
- if (insertSpaceBeforeClosingParenInMethodInvocationOption != null) {
- this.insert_space_before_closing_paren_in_method_invocation = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInMethodInvocationOption);
- }
-// final Object insertSpaceBeforeClosingParenInParenthesizedExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION);
-// if (insertSpaceBeforeClosingParenInParenthesizedExpressionOption != null) {
-// this.insert_space_before_closing_paren_in_parenthesized_expression = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInParenthesizedExpressionOption);
-// }
- final Object insertSpaceBeforeClosingParenInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH);
- if (insertSpaceBeforeClosingParenInSwitchOption != null) {
- this.insert_space_before_closing_paren_in_switch = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInSwitchOption);
- }
- final Object insertSpaceBeforeClosingParenInWhileOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE);
- if (insertSpaceBeforeClosingParenInWhileOption != null) {
- this.insert_space_before_closing_paren_in_while = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInWhileOption);
- }
- final Object insertSpaceBeforeColonInCaseOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE);
- if (insertSpaceBeforeColonInCaseOption != null) {
- this.insert_space_before_colon_in_case = CCorePlugin.INSERT.equals(insertSpaceBeforeColonInCaseOption);
- }
- final Object insertSpaceBeforeColonInConditionalOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL);
- if (insertSpaceBeforeColonInConditionalOption != null) {
- this.insert_space_before_colon_in_conditional = CCorePlugin.INSERT.equals(insertSpaceBeforeColonInConditionalOption);
- }
- final Object insertSpaceBeforeColonInDefaultOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT);
- if (insertSpaceBeforeColonInDefaultOption != null) {
- this.insert_space_before_colon_in_default = CCorePlugin.INSERT.equals(insertSpaceBeforeColonInDefaultOption);
- }
-// final Object insertSpaceBeforeColonInForOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR);
-// if (insertSpaceBeforeColonInForOption != null) {
-// this.insert_space_before_colon_in_for = CCorePlugin.INSERT.equals(insertSpaceBeforeColonInForOption);
-// }
-// final Object insertSpaceBeforeColonInLabeledStatementOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT);
-// if (insertSpaceBeforeColonInLabeledStatementOption != null) {
-// this.insert_space_before_colon_in_labeled_statement = CCorePlugin.INSERT.equals(insertSpaceBeforeColonInLabeledStatementOption);
-// }
-// final Object insertSpaceBeforeCommaInAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION);
-// if (insertSpaceBeforeCommaInAllocationExpressionOption != null) {
-// this.insert_space_before_comma_in_allocation_expression = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInAllocationExpressionOption);
-// }
-// final Object insertSpaceBeforeCommaInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER);
-// if (insertSpaceBeforeCommaInArrayInitializerOption != null) {
-// this.insert_space_before_comma_in_array_initializer = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInArrayInitializerOption);
-// }
-// final Object insertSpaceBeforeCommaInConstructorDeclarationParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS);
-// if (insertSpaceBeforeCommaInConstructorDeclarationParametersOption != null) {
-// this.insert_space_before_comma_in_constructor_declaration_parameters = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInConstructorDeclarationParametersOption);
-// }
-// final Object insertSpaceBeforeCommaInConstructorDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS);
-// if (insertSpaceBeforeCommaInConstructorDeclarationThrowsOption != null) {
-// this.insert_space_before_comma_in_constructor_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInConstructorDeclarationThrowsOption);
-// }
-// final Object insertSpaceBeforeCommaInEnumConstantArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS);
-// if (insertSpaceBeforeCommaInEnumConstantArgumentsOption != null) {
-// this.insert_space_before_comma_in_enum_constant_arguments = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInEnumConstantArgumentsOption);
-// }
-// final Object insertSpaceBeforeCommaInEnumDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS);
-// if (insertSpaceBeforeCommaInEnumDeclarationsOption != null) {
-// this.insert_space_before_comma_in_enum_declarations = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInEnumDeclarationsOption);
-// }
-// final Object insertSpaceBeforeCommaInExplicitConstructorCallArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS);
-// if (insertSpaceBeforeCommaInExplicitConstructorCallArgumentsOption != null) {
-// this.insert_space_before_comma_in_explicit_constructor_call_arguments = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInExplicitConstructorCallArgumentsOption);
-// }
-// final Object insertSpaceBeforeCommaInForIncrementsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS);
-// if (insertSpaceBeforeCommaInForIncrementsOption != null) {
-// this.insert_space_before_comma_in_for_increments = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInForIncrementsOption);
-// }
-// final Object insertSpaceBeforeCommaInForInitsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS);
-// if (insertSpaceBeforeCommaInForInitsOption != null) {
-// this.insert_space_before_comma_in_for_inits = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInForInitsOption);
-// }
- final Object insertSpaceBeforeCommaInMethodInvocationArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS);
- if (insertSpaceBeforeCommaInMethodInvocationArgumentsOption != null) {
- this.insert_space_before_comma_in_method_invocation_arguments = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMethodInvocationArgumentsOption);
- }
- final Object insertSpaceBeforeCommaInMethodDeclarationParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS);
- if (insertSpaceBeforeCommaInMethodDeclarationParametersOption != null) {
- this.insert_space_before_comma_in_method_declaration_parameters = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMethodDeclarationParametersOption);
- }
-// final Object insertSpaceBeforeCommaInMethodDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS);
-// if (insertSpaceBeforeCommaInMethodDeclarationThrowsOption != null) {
-// this.insert_space_before_comma_in_method_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMethodDeclarationThrowsOption);
-// }
-// final Object insertSpaceBeforeCommaInMultipleFieldDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS);
-// if (insertSpaceBeforeCommaInMultipleFieldDeclarationsOption != null) {
-// this.insert_space_before_comma_in_multiple_field_declarations = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMultipleFieldDeclarationsOption);
-// }
-// final Object insertSpaceBeforeCommaInMultipleLocalDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS);
-// if (insertSpaceBeforeCommaInMultipleLocalDeclarationsOption != null) {
-// this.insert_space_before_comma_in_multiple_local_declarations = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMultipleLocalDeclarationsOption);
-// }
-// final Object insertSpaceBeforeCommaInParameterizedTypeReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE);
-// if (insertSpaceBeforeCommaInParameterizedTypeReferenceOption != null) {
-// this.insert_space_before_comma_in_parameterized_type_reference = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInParameterizedTypeReferenceOption);
-// }
-// final Object insertSpaceBeforeCommaInSuperinterfacesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES);
-// if (insertSpaceBeforeCommaInSuperinterfacesOption != null) {
-// this.insert_space_before_comma_in_superinterfaces = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInSuperinterfacesOption);
-// }
-// final Object insertSpaceBeforeCommaInTypeArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS);
-// if (insertSpaceBeforeCommaInTypeArgumentsOption != null) {
-// this.insert_space_before_comma_in_type_arguments = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInTypeArgumentsOption);
-// }
-// final Object insertSpaceBeforeCommaInTypeParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS);
-// if (insertSpaceBeforeCommaInTypeParametersOption != null) {
-// this.insert_space_before_comma_in_type_parameters = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInTypeParametersOption);
-// }
-// final Object insertSpaceBeforeEllipsisOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS);
-// if (insertSpaceBeforeEllipsisOption != null) {
-// this.insert_space_before_ellipsis = CCorePlugin.INSERT.equals(insertSpaceBeforeEllipsisOption);
-// }
-// final Object insertSpaceBeforeOpeningAngleBrackerInParameterizedTypeReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE);
-// if (insertSpaceBeforeOpeningAngleBrackerInParameterizedTypeReferenceOption != null) {
-// this.insert_space_before_opening_angle_bracket_in_parameterized_type_reference = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningAngleBrackerInParameterizedTypeReferenceOption);
-// }
-// final Object insertSpaceBeforeOpeningAngleBrackerInTypeArgumentsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS);
-// if (insertSpaceBeforeOpeningAngleBrackerInTypeArgumentsOption != null) {
-// this.insert_space_before_opening_angle_bracket_in_type_arguments = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningAngleBrackerInTypeArgumentsOption);
-// }
-// final Object insertSpaceBeforeOpeningAngleBrackerInTypeParametersOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS);
-// if (insertSpaceBeforeOpeningAngleBrackerInTypeParametersOption != null) {
-// this.insert_space_before_opening_angle_bracket_in_type_parameters = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningAngleBrackerInTypeParametersOption);
-// }
-// final Object insertSpaceBeforeOpeningBraceInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER);
-// if (insertSpaceBeforeOpeningBraceInArrayInitializerOption != null) {
-// this.insert_space_before_opening_brace_in_array_initializer = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInArrayInitializerOption);
-// }
- final Object insertSpaceBeforeOpeningBraceInBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK);
- if (insertSpaceBeforeOpeningBraceInBlockOption != null) {
- this.insert_space_before_opening_brace_in_block = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInBlockOption);
- }
-// final Object insertSpaceBeforeOpeningBraceInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION);
-// if (insertSpaceBeforeOpeningBraceInConstructorDeclarationOption != null) {
-// this.insert_space_before_opening_brace_in_constructor_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInConstructorDeclarationOption);
-// }
-// final Object insertSpaceBeforeOpeningBraceInEnumDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION);
-// if (insertSpaceBeforeOpeningBraceInEnumDeclarationOption != null) {
-// this.insert_space_before_opening_brace_in_enum_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInEnumDeclarationOption);
-// }
-// final Object insertSpaceBeforeOpeningBraceInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT);
-// if (insertSpaceBeforeOpeningBraceInEnumConstantOption != null) {
-// this.insert_space_before_opening_brace_in_enum_constant = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInEnumConstantOption);
-// }
- final Object insertSpaceBeforeOpeningBraceInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION);
- if (insertSpaceBeforeOpeningBraceInMethodDeclarationOption != null) {
- this.insert_space_before_opening_brace_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInMethodDeclarationOption);
- }
- final Object insertSpaceBeforeOpeningBraceInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION);
- if (insertSpaceBeforeOpeningBraceInTypeDeclarationOption != null) {
- this.insert_space_before_opening_brace_in_type_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInTypeDeclarationOption);
- }
- final Object insertSpaceBeforeOpeningBraceInNamespaceDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_NAMESPACE_DECLARATION);
- if (insertSpaceBeforeOpeningBraceInNamespaceDeclarationOption != null) {
- this.insert_space_before_opening_brace_in_namespace_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInNamespaceDeclarationOption);
- }
-// final Object insertSpaceBeforeOpeningBracketInArrayAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION);
-// if (insertSpaceBeforeOpeningBracketInArrayAllocationExpressionOption != null) {
-// this.insert_space_before_opening_bracket_in_array_allocation_expression = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBracketInArrayAllocationExpressionOption);
-// }
-// final Object insertSpaceBeforeOpeningBracketInArrayReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE);
-// if (insertSpaceBeforeOpeningBracketInArrayReferenceOption != null) {
-// this.insert_space_before_opening_bracket_in_array_reference = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBracketInArrayReferenceOption);
-// }
-// final Object insertSpaceBeforeOpeningBracketInArrayTypeReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE);
-// if (insertSpaceBeforeOpeningBracketInArrayTypeReferenceOption != null) {
-// this.insert_space_before_opening_bracket_in_array_type_reference = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBracketInArrayTypeReferenceOption);
-// }
-// final Object insertSpaceBeforeOpeningParenInCatchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH);
-// if (insertSpaceBeforeOpeningParenInCatchOption != null) {
-// this.insert_space_before_opening_paren_in_catch = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInCatchOption);
-// }
-// final Object insertSpaceBeforeOpeningParenInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION);
-// if (insertSpaceBeforeOpeningParenInConstructorDeclarationOption != null) {
-// this.insert_space_before_opening_paren_in_constructor_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInConstructorDeclarationOption);
-// }
-// final Object insertSpaceBeforeOpeningParenInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT);
-// if (insertSpaceBeforeOpeningParenInEnumConstantOption != null) {
-// this.insert_space_before_opening_paren_in_enum_constant = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInEnumConstantOption);
-// }
- final Object insertSpaceBeforeOpeningParenInForOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR);
- if (insertSpaceBeforeOpeningParenInForOption != null) {
- this.insert_space_before_opening_paren_in_for = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInForOption);
- }
- final Object insertSpaceBeforeOpeningParenInIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF);
- if (insertSpaceBeforeOpeningParenInIfOption != null) {
- this.insert_space_before_opening_paren_in_if = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInIfOption);
- }
- final Object insertSpaceBeforeOpeningParenInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION);
- if (insertSpaceBeforeOpeningParenInMethodInvocationOption != null) {
- this.insert_space_before_opening_paren_in_method_invocation = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInMethodInvocationOption);
- }
- final Object insertSpaceBeforeOpeningParenInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION);
- if (insertSpaceBeforeOpeningParenInMethodDeclarationOption != null) {
- this.insert_space_before_opening_paren_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInMethodDeclarationOption);
- }
- final Object insertSpaceBeforeOpeningParenInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH);
- if (insertSpaceBeforeOpeningParenInSwitchOption != null) {
- this.insert_space_before_opening_paren_in_switch = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInSwitchOption);
- }
- final Object insertSpaceBeforeOpeningBraceInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH);
- if (insertSpaceBeforeOpeningBraceInSwitchOption != null) {
- this.insert_space_before_opening_brace_in_switch = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningBraceInSwitchOption);
- }
-// final Object insertSpaceBeforeOpeningParenInParenthesizedExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION);
-// if (insertSpaceBeforeOpeningParenInParenthesizedExpressionOption != null) {
-// this.insert_space_before_opening_paren_in_parenthesized_expression = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInParenthesizedExpressionOption);
-// }
- final Object insertSpaceBeforeOpeningParenInWhileOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE);
- if (insertSpaceBeforeOpeningParenInWhileOption != null) {
- this.insert_space_before_opening_paren_in_while = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInWhileOption);
- }
-// final Object insertSpaceBeforeParenthesizedExpressionInReturnOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN);
-// if (insertSpaceBeforeParenthesizedExpressionInReturnOption != null) {
-// this.insert_space_before_parenthesized_expression_in_return = CCorePlugin.INSERT.equals(insertSpaceBeforeParenthesizedExpressionInReturnOption);
-// }
-// final Object insertSpaceBeforePostfixOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR);
-// if (insertSpaceBeforePostfixOperatorOption != null) {
-// this.insert_space_before_postfix_operator = CCorePlugin.INSERT.equals(insertSpaceBeforePostfixOperatorOption);
-// }
-// final Object insertSpaceBeforePrefixOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR);
-// if (insertSpaceBeforePrefixOperatorOption != null) {
-// this.insert_space_before_prefix_operator = CCorePlugin.INSERT.equals(insertSpaceBeforePrefixOperatorOption);
-// }
- final Object insertSpaceBeforeQuestionInConditionalOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL);
- if (insertSpaceBeforeQuestionInConditionalOption != null) {
- this.insert_space_before_question_in_conditional = CCorePlugin.INSERT.equals(insertSpaceBeforeQuestionInConditionalOption);
- }
- final Object insertSpaceBeforeSemicolonOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON);
- if (insertSpaceBeforeSemicolonOption != null) {
- this.insert_space_before_semicolon = CCorePlugin.INSERT.equals(insertSpaceBeforeSemicolonOption);
- }
- final Object insertSpaceBeforeSemicolonInForOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR);
- if (insertSpaceBeforeSemicolonInForOption != null) {
- this.insert_space_before_semicolon_in_for = CCorePlugin.INSERT.equals(insertSpaceBeforeSemicolonInForOption);
- }
-// final Object insertSpaceBeforeUnaryOperatorOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR);
-// if (insertSpaceBeforeUnaryOperatorOption != null) {
-// this.insert_space_before_unary_operator = CCorePlugin.INSERT.equals(insertSpaceBeforeUnaryOperatorOption);
-// }
-// final Object insertSpaceBetweenBracketsInArrayTypeReferenceOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE);
-// if (insertSpaceBetweenBracketsInArrayTypeReferenceOption != null) {
-// this.insert_space_between_brackets_in_array_type_reference = CCorePlugin.INSERT.equals(insertSpaceBetweenBracketsInArrayTypeReferenceOption);
-// }
-// final Object insertSpaceBetweenEmptyBracesInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER);
-// if (insertSpaceBetweenEmptyBracesInArrayInitializerOption != null) {
-// this.insert_space_between_empty_braces_in_array_initializer = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyBracesInArrayInitializerOption);
-// }
-// final Object insertSpaceBetweenEmptyBracketsInArrayAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION);
-// if (insertSpaceBetweenEmptyBracketsInArrayAllocationExpressionOption != null) {
-// this.insert_space_between_empty_brackets_in_array_allocation_expression = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyBracketsInArrayAllocationExpressionOption);
-// }
-// final Object insertSpaceBetweenEmptyParensInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION);
-// if (insertSpaceBetweenEmptyParensInConstructorDeclarationOption != null) {
-// this.insert_space_between_empty_parens_in_constructor_declaration = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyParensInConstructorDeclarationOption);
-// }
-// final Object insertSpaceBetweenEmptyParensInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT);
-// if (insertSpaceBetweenEmptyParensInEnumConstantOption != null) {
-// this.insert_space_between_empty_parens_in_enum_constant = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyParensInEnumConstantOption);
-// }
- final Object insertSpaceBetweenEmptyParensInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION);
- if (insertSpaceBetweenEmptyParensInMethodDeclarationOption != null) {
- this.insert_space_between_empty_parens_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyParensInMethodDeclarationOption);
- }
-// final Object insertSpaceBetweenEmptyParensInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION);
-// if (insertSpaceBetweenEmptyParensInMethodInvocationOption != null) {
-// this.insert_space_between_empty_parens_in_method_invocation = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyParensInMethodInvocationOption);
-// }
- final Object compactElseIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF);
- if (compactElseIfOption != null) {
- this.compact_else_if = DefaultCodeFormatterConstants.TRUE.equals(compactElseIfOption);
- }
- final Object keepGuardianClauseOnOneLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE);
- if (keepGuardianClauseOnOneLineOption != null) {
- this.keep_guardian_clause_on_one_line = DefaultCodeFormatterConstants.TRUE.equals(keepGuardianClauseOnOneLineOption);
- }
- final Object keepElseStatementOnSameLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE);
- if (keepElseStatementOnSameLineOption != null) {
- this.keep_else_statement_on_same_line = DefaultCodeFormatterConstants.TRUE.equals(keepElseStatementOnSameLineOption);
- }
-// final Object keepEmptyArrayInitializerOnOneLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE);
-// if (keepEmptyArrayInitializerOnOneLineOption != null) {
-// this.keep_empty_array_initializer_on_one_line = DefaultCodeFormatterConstants.TRUE.equals(keepEmptyArrayInitializerOnOneLineOption);
-// }
- final Object keepSimpleIfOnOneLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE);
- if (keepSimpleIfOnOneLineOption != null) {
- this.keep_simple_if_on_one_line = DefaultCodeFormatterConstants.TRUE.equals(keepSimpleIfOnOneLineOption);
- }
- final Object keepThenStatementOnSameLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE);
- if (keepThenStatementOnSameLineOption != null) {
- this.keep_then_statement_on_same_line = DefaultCodeFormatterConstants.TRUE.equals(keepThenStatementOnSameLineOption);
- }
- final Object numberOfEmptyLinesToPreserveOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE);
- if (numberOfEmptyLinesToPreserveOption != null) {
- try {
- this.number_of_empty_lines_to_preserve = Integer.parseInt((String) numberOfEmptyLinesToPreserveOption);
- } catch (NumberFormatException e) {
- this.number_of_empty_lines_to_preserve = 0;
- } catch(ClassCastException e) {
- this.number_of_empty_lines_to_preserve = 0;
- }
- }
- final Object putEmptyStatementOnNewLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE);
- if (putEmptyStatementOnNewLineOption != null) {
- this.put_empty_statement_on_new_line = DefaultCodeFormatterConstants.TRUE.equals(putEmptyStatementOnNewLineOption);
- }
- final Object tabSizeOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
- if (tabSizeOption != null) {
- try {
- this.tab_size = Integer.parseInt((String) tabSizeOption);
- } catch (NumberFormatException e) {
- this.tab_size = 4;
- } catch(ClassCastException e) {
- this.tab_size = 4;
- }
- }
- final Object useTabsOnlyForLeadingIndentationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS);
- if (useTabsOnlyForLeadingIndentationsOption != null) {
- this.use_tabs_only_for_leading_indentations = DefaultCodeFormatterConstants.TRUE.equals(useTabsOnlyForLeadingIndentationsOption);
- }
- final Object pageWidthOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT);
- if (pageWidthOption != null) {
- try {
- this.page_width = Integer.parseInt((String) pageWidthOption);
- } catch (NumberFormatException e) {
- this.page_width = 80;
- } catch(ClassCastException e) {
- this.page_width = 80;
- }
- }
- final Object useTabOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
- if (useTabOption != null) {
- if (CCorePlugin.TAB.equals(useTabOption)) {
- this.tab_char = TAB;
- } else if (CCorePlugin.SPACE.equals(useTabOption)) {
- this.tab_char = SPACE;
- } else {
- this.tab_char = MIXED;
- }
- }
- }
-
- public void setDefaultSettings() {
-// this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_arguments_in_enum_constant = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
- this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_arguments_in_qualified_allocation_expression = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_assignment = Alignment.M_NO_ALIGNMENT;
-// this.alignment_for_binary_expression = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_compact_if = Alignment.M_COMPACT_SPLIT;
- this.alignment_for_conditional_expression = Alignment.M_NEXT_PER_LINE_SPLIT;
-// this.alignment_for_enum_constants = Alignment.NONE;
- this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_multiple_fields = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
- this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_superclass_in_type_declaration = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
-// this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
-// this.align_type_members_on_columns = false;
- this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.END_OF_LINE;
- this.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
- this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.END_OF_LINE;
-// this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
-// this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.END_OF_LINE;
-// this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- this.brace_position_for_namespace_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
-// this.comment_clear_blank_lines = false;
-// this.comment_format = true;
-// this.comment_format_header = false;
-// this.comment_format_html = true;
-// this.comment_format_source = true;
-// this.comment_indent_parameter_description = true;
-// this.comment_indent_root_tags = true;
-// this.comment_insert_empty_line_before_root_tags = true;
-// this.comment_insert_new_line_for_parameter = true;
-// this.comment_line_length = 80;
- this.continuation_indentation = 2;
- this.continuation_indentation_for_array_initializer = 2;
-// this.blank_lines_after_includes = 1;
-// this.blank_lines_before_field = 1;
-// this.blank_lines_before_first_class_body_declaration = 0;
-// this.blank_lines_before_includes = 1;
-// this.blank_lines_before_member_type = 1;
-// this.blank_lines_before_method = 1;
-// this.blank_lines_before_new_chunk = 1;
-// this.blank_lines_between_type_declarations = 1;
-// this.blank_lines_at_beginning_of_method_body = 0;
- this.indent_statements_compare_to_block = true;
- this.indent_statements_compare_to_body = true;
- this.indent_body_declarations_compare_to_namespace_header = false;
-// this.indent_body_declarations_compare_to_enum_constant_header = true;
-// this.indent_body_declarations_compare_to_enum_declaration_header = true;
- this.indent_body_declarations_compare_to_access_specifier = true;
- this.indent_breaks_compare_to_cases = true;
- this.indent_empty_lines = false;
- this.indent_switchstatements_compare_to_cases = true;
- this.indent_switchstatements_compare_to_switch = false;
- this.indentation_size = 4;
- this.insert_new_line_after_opening_brace_in_array_initializer = false;
- this.insert_new_line_at_end_of_file_if_missing = false;
-// this.insert_new_line_before_catch_in_try_statement = false;
- this.insert_new_line_before_closing_brace_in_array_initializer = false;
- this.insert_new_line_before_else_in_if_statement = false;
-// this.insert_new_line_before_finally_in_try_statement = false;
- this.insert_new_line_before_while_in_do_statement = false;
- this.insert_new_line_in_empty_block = true;
-// this.insert_new_line_in_empty_enum_constant = true;
-// this.insert_new_line_in_empty_enum_declaration = true;
-// this.insert_new_line_in_empty_method_body = true;
-// this.insert_new_line_in_empty_type_declaration = true;
-// this.insert_space_after_and_in_type_parameter = true;
-// this.insert_space_after_assignment_operator = true;
-// this.insert_space_after_binary_operator = true;
-// this.insert_space_after_closing_angle_bracket_in_type_arguments = true;
-// this.insert_space_after_closing_angle_bracket_in_type_parameters = true;
-// this.insert_space_after_closing_paren_in_cast = true;
- this.insert_space_after_closing_brace_in_block = true;
- this.insert_space_after_colon_in_case = true;
- this.insert_space_after_colon_in_conditional = true;
-// this.insert_space_after_colon_in_for = true;
-// this.insert_space_after_colon_in_labeled_statement = true;
-// this.insert_space_after_comma_in_allocation_expression = true;
- this.insert_space_after_comma_in_array_initializer = true;
-// this.insert_space_after_comma_in_constructor_declaration_parameters = true;
-// this.insert_space_after_comma_in_constructor_declaration_throws = true;
-// this.insert_space_after_comma_in_enum_constant_arguments = true;
-// this.insert_space_after_comma_in_enum_declarations = true;
-// this.insert_space_after_comma_in_explicit_constructor_call_arguments = true;
-// this.insert_space_after_comma_in_for_increments = true;
-// this.insert_space_after_comma_in_for_inits = true;
- this.insert_space_after_comma_in_method_invocation_arguments = true;
- this.insert_space_after_comma_in_method_declaration_parameters = true;
-// this.insert_space_after_comma_in_method_declaration_throws = true;
-// this.insert_space_after_comma_in_multiple_field_declarations = true;
-// this.insert_space_after_comma_in_multiple_local_declarations = true;
-// this.insert_space_after_comma_in_parameterized_type_reference = true;
-// this.insert_space_after_comma_in_superinterfaces = true;
-// this.insert_space_after_comma_in_type_arguments = true;
-// this.insert_space_after_comma_in_type_parameters = true;
-// this.insert_space_after_ellipsis = true;
-// this.insert_space_after_opening_angle_bracket_in_parameterized_type_reference = false;
-// this.insert_space_after_opening_angle_bracket_in_type_arguments = false;
-// this.insert_space_after_opening_angle_bracket_in_type_parameters = false;
-// this.insert_space_after_opening_bracket_in_array_allocation_expression = false;
-// this.insert_space_after_opening_bracket_in_array_reference = false;
- this.insert_space_after_opening_brace_in_array_initializer = true;
-// this.insert_space_after_opening_paren_in_cast = false;
-// this.insert_space_after_opening_paren_in_catch = false;
-// this.insert_space_after_opening_paren_in_constructor_declaration = false;
-// this.insert_space_after_opening_paren_in_enum_constant = false;
- this.insert_space_after_opening_paren_in_for = false;
- this.insert_space_after_opening_paren_in_if = false;
- this.insert_space_after_opening_paren_in_method_declaration = false;
- this.insert_space_after_opening_paren_in_method_invocation = false;
-// this.insert_space_after_opening_paren_in_parenthesized_expression = false;
- this.insert_space_after_opening_paren_in_switch = false;
- this.insert_space_after_opening_paren_in_while = false;
-// this.insert_space_after_postfix_operator = false;
-// this.insert_space_after_prefix_operator = false;
- this.insert_space_after_question_in_conditional = true;
- this.insert_space_after_semicolon_in_for = true;
-// this.insert_space_after_unary_operator = false;
-// this.insert_space_before_and_in_type_parameter = true;
-// this.insert_space_before_assignment_operator = true;
-// this.insert_space_before_binary_operator = true;
-// this.insert_space_before_closing_angle_bracket_in_parameterized_type_reference = false;
-// this.insert_space_before_closing_angle_bracket_in_type_arguments = false;
-// this.insert_space_before_closing_angle_bracket_in_type_parameters = false;
- this.insert_space_before_closing_brace_in_array_initializer = true;
-// this.insert_space_before_closing_bracket_in_array_allocation_expression = false;
-// this.insert_space_before_closing_bracket_in_array_reference = false;
-// this.insert_space_before_closing_paren_in_cast = false;
-// this.insert_space_before_closing_paren_in_catch = false;
-// this.insert_space_before_closing_paren_in_constructor_declaration = false;
-// this.insert_space_before_closing_paren_in_enum_constant = false;
- this.insert_space_before_closing_paren_in_for = false;
- this.insert_space_before_closing_paren_in_if = false;
- this.insert_space_before_closing_paren_in_method_declaration = false;
- this.insert_space_before_closing_paren_in_method_invocation = false;
-// this.insert_space_before_closing_paren_in_parenthesized_expression = false;
- this.insert_space_before_closing_paren_in_switch = false;
- this.insert_space_before_closing_paren_in_while = false;
- this.insert_space_before_colon_in_case = false;
- this.insert_space_before_colon_in_conditional = true;
- this.insert_space_before_colon_in_default = false;
-// this.insert_space_before_colon_in_for = true;
-// this.insert_space_before_colon_in_labeled_statement = false;
-// this.insert_space_before_comma_in_allocation_expression = false;
- this.insert_space_before_comma_in_array_initializer = false;
-// this.insert_space_before_comma_in_constructor_declaration_parameters = false;
-// this.insert_space_before_comma_in_constructor_declaration_throws = false;
-// this.insert_space_before_comma_in_enum_constant_arguments = false;
-// this.insert_space_before_comma_in_enum_declarations = false;
-// this.insert_space_before_comma_in_explicit_constructor_call_arguments = false;
-// this.insert_space_before_comma_in_for_increments = false;
-// this.insert_space_before_comma_in_for_inits = false;
- this.insert_space_before_comma_in_method_invocation_arguments = false;
- this.insert_space_before_comma_in_method_declaration_parameters = false;
-// this.insert_space_before_comma_in_method_declaration_throws = false;
-// this.insert_space_before_comma_in_multiple_field_declarations = false;
-// this.insert_space_before_comma_in_multiple_local_declarations = false;
-// this.insert_space_before_comma_in_parameterized_type_reference = false;
-// this.insert_space_before_comma_in_superinterfaces = false;
-// this.insert_space_before_comma_in_type_arguments = false;
-// this.insert_space_before_comma_in_type_parameters = false;
-// this.insert_space_before_ellipsis = false;
-// this.insert_space_before_parenthesized_expression_in_return = true;
-// this.insert_space_before_opening_angle_bracket_in_parameterized_type_reference = false;
-// this.insert_space_before_opening_angle_bracket_in_type_arguments = false;
-// this.insert_space_before_opening_angle_bracket_in_type_parameters = false;
- this.insert_space_before_opening_brace_in_array_initializer = true;
- this.insert_space_before_opening_brace_in_block = true;
-// this.insert_space_before_opening_brace_in_constructor_declaration = true;
-// this.insert_space_before_opening_brace_in_enum_constant = true;
-// this.insert_space_before_opening_brace_in_enum_declaration = true;
- this.insert_space_before_opening_brace_in_method_declaration = true;
- this.insert_space_before_opening_brace_in_switch = true;
- this.insert_space_before_opening_brace_in_type_declaration = true;
- this.insert_space_before_opening_brace_in_namespace_declaration = true;
-// this.insert_space_before_opening_bracket_in_array_allocation_expression = false;
-// this.insert_space_before_opening_bracket_in_array_reference = false;
-// this.insert_space_before_opening_bracket_in_array_type_reference = false;
-// this.insert_space_before_opening_paren_in_catch = true;
-// this.insert_space_before_opening_paren_in_constructor_declaration = false;
-// this.insert_space_before_opening_paren_in_enum_constant = false;
- this.insert_space_before_opening_paren_in_for = true;
- this.insert_space_before_opening_paren_in_if = true;
- this.insert_space_before_opening_paren_in_method_invocation = false;
- this.insert_space_before_opening_paren_in_method_declaration = false;
- this.insert_space_before_opening_paren_in_switch = true;
-// this.insert_space_before_opening_paren_in_parenthesized_expression = false;
- this.insert_space_before_opening_paren_in_while = true;
-// this.insert_space_before_postfix_operator = false;
-// this.insert_space_before_prefix_operator = false;
- this.insert_space_before_question_in_conditional = true;
- this.insert_space_before_semicolon = false;
- this.insert_space_before_semicolon_in_for = false;
-// this.insert_space_before_unary_operator = false;
-// this.insert_space_between_brackets_in_array_type_reference = false;
- this.insert_space_between_empty_braces_in_array_initializer = false;
-// this.insert_space_between_empty_brackets_in_array_allocation_expression = false;
-// this.insert_space_between_empty_parens_in_constructor_declaration = false;
-// this.insert_space_between_empty_parens_in_enum_constant = false;
- this.insert_space_between_empty_parens_in_method_declaration = false;
-// this.insert_space_between_empty_parens_in_method_invocation = false;
- this.compact_else_if = true;
- this.keep_guardian_clause_on_one_line = false;
- this.keep_else_statement_on_same_line = false;
- this.keep_empty_array_initializer_on_one_line = false;
- this.keep_simple_if_on_one_line = false;
- this.keep_then_statement_on_same_line = false;
- this.number_of_empty_lines_to_preserve = 1;
- this.put_empty_statement_on_new_line = true;
- this.tab_size = 4;
- this.page_width = 80;
- this.tab_char = TAB;
- this.use_tabs_only_for_leading_indentations = false;
- }
-
- /**
- * Configure K&R style.
- * <p>Example:</p>
- * <pre>
- * namespace foospace {
- * int Foo() {
- * if (isBar) {
- * bar();
- * return 1;
- * } else
- * return 0;
- * }
- * }
- * </pre>
- * @see http://en.wikipedia.org/wiki/Indent_style
- */
- public void setKandRSettings() {
- setDefaultSettings();
- }
-
- /**
- * Configure BSD/Allman style.
- * <p>Example:</p>
- * <pre>
- * namespace foospace
- * {
- * int Foo()
- * {
- * if (isBar)
- * {
- * bar();
- * return 1;
- * }
- * else
- * return 0;
- * }
- * }
- * </pre>
- * @see http://en.wikipedia.org/wiki/Indent_style
- */
- public void setAllmanSettings() {
- setDefaultSettings();
- this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE;
- this.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.NEXT_LINE;
-// this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
-// this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.NEXT_LINE;
-// this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- this.brace_position_for_namespace_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- this.brace_position_for_switch = DefaultCodeFormatterConstants.NEXT_LINE;
-
- this.indent_statements_compare_to_block = true;
- this.indent_statements_compare_to_body = true;
- this.indent_body_declarations_compare_to_namespace_header = false;
-// this.indent_body_declarations_compare_to_enum_constant_header = true;
-// this.indent_body_declarations_compare_to_enum_declaration_header = true;
- this.indent_body_declarations_compare_to_access_specifier = true;
- this.indent_breaks_compare_to_cases = true;
- this.indent_empty_lines = false;
- this.indent_switchstatements_compare_to_cases = true;
- this.indent_switchstatements_compare_to_switch = false;
- this.indentation_size = 4;
-
- this.insert_new_line_after_opening_brace_in_array_initializer = false;
- this.insert_new_line_at_end_of_file_if_missing = false;
-// this.insert_new_line_before_catch_in_try_statement = false;
- this.insert_new_line_before_closing_brace_in_array_initializer = false;
- this.insert_new_line_before_else_in_if_statement = true;
-// this.insert_new_line_before_finally_in_try_statement = false;
- this.insert_new_line_before_while_in_do_statement = false;
- this.insert_new_line_in_empty_block = true;
-// this.insert_new_line_in_empty_enum_constant = true;
-// this.insert_new_line_in_empty_enum_declaration = true;
-// this.insert_new_line_in_empty_method_body = true;
-// this.insert_new_line_in_empty_type_declaration = true;
-
- this.compact_else_if = true;
- this.keep_guardian_clause_on_one_line = false;
- this.keep_else_statement_on_same_line = false;
- this.keep_empty_array_initializer_on_one_line = false;
- this.keep_simple_if_on_one_line = false;
- this.keep_then_statement_on_same_line = false;
- this.number_of_empty_lines_to_preserve = 1;
- this.put_empty_statement_on_new_line = true;
- this.tab_size = 4;
- this.page_width = 80;
- this.tab_char = TAB;
- this.use_tabs_only_for_leading_indentations = false;
- }
-
-
-
- /**
- * Configure GNU style.
- * <p>Example:</p>
- * <pre>
- * namespace foospace
- * {
- * int Foo()
- * {
- * if (isBar)
- * {
- * bar();
- * return 1;
- * }
- * else
- * return 0;
- * }
- * }
- * </pre>
- * @see http://en.wikipedia.org/wiki/Indent_style
- */
- public void setGNUSettings() {
- setDefaultSettings();
- this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-// this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-// this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-// this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_namespace_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_switch = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-
- this.indent_statements_compare_to_block = true;
- this.indent_statements_compare_to_body = true;
- this.indent_body_declarations_compare_to_namespace_header = true;
-// this.indent_body_declarations_compare_to_enum_constant_header = true;
-// this.indent_body_declarations_compare_to_enum_declaration_header = true;
- this.indent_body_declarations_compare_to_access_specifier = true;
- this.indent_breaks_compare_to_cases = true;
- this.indent_empty_lines = false;
- this.indent_switchstatements_compare_to_cases = true;
- this.indent_switchstatements_compare_to_switch = false;
- this.indentation_size = 8;
-
- this.insert_new_line_after_opening_brace_in_array_initializer = false;
- this.insert_new_line_at_end_of_file_if_missing = false;
-// this.insert_new_line_before_catch_in_try_statement = false;
- this.insert_new_line_before_closing_brace_in_array_initializer = false;
- this.insert_new_line_before_else_in_if_statement = true;
-// this.insert_new_line_before_finally_in_try_statement = false;
- this.insert_new_line_before_while_in_do_statement = false;
- this.insert_new_line_in_empty_block = true;
-// this.insert_new_line_in_empty_enum_constant = true;
-// this.insert_new_line_in_empty_enum_declaration = true;
-// this.insert_new_line_in_empty_method_body = true;
-// this.insert_new_line_in_empty_type_declaration = true;
-
- this.compact_else_if = true;
- this.keep_guardian_clause_on_one_line = false;
- this.keep_else_statement_on_same_line = false;
- this.keep_empty_array_initializer_on_one_line = false;
- this.keep_simple_if_on_one_line = false;
- this.keep_then_statement_on_same_line = false;
- this.number_of_empty_lines_to_preserve = 1;
- this.put_empty_statement_on_new_line = true;
- this.tab_size = 2;
- this.page_width = 80;
- this.tab_char = SPACE;
- this.use_tabs_only_for_leading_indentations = false;
- }
-
- /**
- * Configure Whitesmiths style.
- * <p>Example:</p>
- * <pre>
- * namespace foospace
- * {
- * int Foo()
- * {
- * if (isBar)
- * {
- * bar();
- * return 1;
- * }
- * else
- * return 0;
- * }
- * }
- * </pre>
- * @see http://en.wikipedia.org/wiki/Indent_style
- */
- public void setWhitesmitsSettings() {
- setDefaultSettings();
- this.alignment_for_expressions_in_array_initializer = Alignment.M_ONE_PER_LINE_SPLIT;
-
- this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-// this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-// this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-// this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_namespace_declaration = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- this.brace_position_for_switch = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
-
- this.indent_statements_compare_to_block = false;
- this.indent_statements_compare_to_body = false;
- this.indent_body_declarations_compare_to_namespace_header = false;
-// this.indent_body_declarations_compare_to_enum_constant_header = true;
-// this.indent_body_declarations_compare_to_enum_declaration_header = true;
- this.indent_body_declarations_compare_to_access_specifier = false;
- this.indent_breaks_compare_to_cases = true;
- this.indent_empty_lines = false;
- this.indent_switchstatements_compare_to_cases = true;
- this.indent_switchstatements_compare_to_switch = false;
- this.indentation_size = 4;
-
- this.insert_new_line_after_opening_brace_in_array_initializer = true;
- this.insert_new_line_at_end_of_file_if_missing = false;
-// this.insert_new_line_before_catch_in_try_statement = true;
- this.insert_new_line_before_closing_brace_in_array_initializer = true;
- this.insert_new_line_before_else_in_if_statement = true;
-// this.insert_new_line_before_finally_in_try_statement = true;
- this.insert_new_line_before_while_in_do_statement = true;
- this.insert_new_line_in_empty_block = true;
-// this.insert_new_line_in_empty_enum_constant = true;
-// this.insert_new_line_in_empty_enum_declaration = true;
-// this.insert_new_line_in_empty_method_body = true;
-// this.insert_new_line_in_empty_type_declaration = true;
-
- this.compact_else_if = false;
- this.keep_guardian_clause_on_one_line = false;
- this.keep_else_statement_on_same_line = false;
- this.keep_empty_array_initializer_on_one_line = false;
- this.keep_simple_if_on_one_line = false;
- this.keep_then_statement_on_same_line = false;
- this.number_of_empty_lines_to_preserve = 1;
- this.put_empty_statement_on_new_line = true;
- this.tab_size = 8;
- this.page_width = 80;
- this.tab_char = MIXED;
- this.use_tabs_only_for_leading_indentations = false;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Location.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Location.java
deleted file mode 100644
index 9d933e2e961..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Location.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter;
-
-/**
- * A location maintains positional information both in original source
- * and in the output source.
- * It remembers source offsets, line/column and indentation level.
- *
- * @since 4.0
- */
-public class Location {
-
- public int inputOffset;
- public int outputLine;
- public int outputColumn;
- public int outputIndentationLevel;
- public boolean needSpace;
- public boolean pendingSpace;
- public int numberOfIndentations;
-
- // chunk management
- public int lastNumberOfNewLines;
-
- // edits management
- int editsIndex;
- OptimizedReplaceEdit textEdit;
-
- public Location(Scribe scribe, int sourceRestart){
- update(scribe, sourceRestart);
- }
-
- public void update(Scribe scribe, int sourceRestart){
- this.outputColumn = scribe.column;
- this.outputLine = scribe.line;
- this.inputOffset = sourceRestart;
- this.outputIndentationLevel = scribe.indentationLevel;
- this.lastNumberOfNewLines = scribe.lastNumberOfNewLines;
- this.needSpace = scribe.needSpace;
- this.pendingSpace = scribe.pendingSpace;
- this.editsIndex = scribe.editsIndex;
- this.numberOfIndentations = scribe.numberOfIndentations;
- textEdit = scribe.getLastEdit();
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/OptimizedReplaceEdit.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/OptimizedReplaceEdit.java
deleted file mode 100644
index d901415e9eb..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/OptimizedReplaceEdit.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter;
-
-public class OptimizedReplaceEdit {
-
- int offset;
- int length;
- String replacement;
-
- public OptimizedReplaceEdit(int offset, int length, String replacement) {
- this.offset = offset;
- this.length = length;
- this.replacement = replacement;
- }
-
- public String toString() {
- return "(" + this.offset + ", length " + this.length + " :>" + this.replacement + "<"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java
deleted file mode 100644
index 466541f1f4f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java
+++ /dev/null
@@ -1,1579 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
-import org.eclipse.cdt.internal.formatter.align.Alignment;
-import org.eclipse.cdt.internal.formatter.align.AlignmentException;
-import org.eclipse.cdt.internal.formatter.scanner.Scanner;
-import org.eclipse.cdt.internal.formatter.scanner.Token;
-import org.eclipse.jface.text.Position;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * This class is responsible for dumping formatted source.
- *
- * @since 4.0
- */
-public class Scribe {
- public static final String EMPTY_STRING= ""; //$NON-NLS-1$
-
- private static final int INITIAL_SIZE= 100;
-
- private boolean checkLineWrapping;
-
- /** one-based column */
- public int column= 1;
-
- // Most specific alignment.
- public Alignment currentAlignment;
-
- public Token currentToken;
-
- // edits management
- private OptimizedReplaceEdit[] edits;
-
- public int editsIndex;
-
- public CodeFormatterVisitor formatter;
-
- public int indentationLevel;
-
- public int lastNumberOfNewLines;
-
- public int line;
-
- private String lineSeparator;
-
- public Alignment memberAlignment;
-
- public boolean needSpace= false;
-
- public int pageWidth;
-
- public boolean pendingSpace= false;
-
- public Scanner scanner;
-
- public int scannerEndPosition;
-
- public int tabLength;
-
- public int indentationSize;
-
- private int textRegionEnd;
-
- private int textRegionStart;
-
- public int tabChar;
-
- public int numberOfIndentations;
-
- private boolean useTabsOnlyForLeadingIndents;
-
- /** indent empty lines */
- private final boolean indentEmptyLines;
-
- private boolean preserveWhitespace;
-
- private boolean preserveNewlines;
-
- private List fSkipPositions= Collections.EMPTY_LIST;
-
- private boolean skipOverInactive;
-
- Scribe(CodeFormatterVisitor formatter, int offset, int length) {
- scanner= new Scanner();
- this.formatter= formatter;
- pageWidth= formatter.preferences.page_width;
- tabLength= formatter.preferences.tab_size;
- indentationLevel= 0; // initialize properly
- numberOfIndentations= 0;
- useTabsOnlyForLeadingIndents= formatter.preferences.use_tabs_only_for_leading_indentations;
- indentEmptyLines= formatter.preferences.indent_empty_lines;
- tabChar= formatter.preferences.tab_char;
- if (tabChar == DefaultCodeFormatterOptions.MIXED) {
- indentationSize= formatter.preferences.indentation_size;
- } else {
- indentationSize= tabLength;
- }
- lineSeparator= formatter.preferences.line_separator;
- indentationLevel= formatter.preferences.initial_indentation_level * indentationSize;
- textRegionStart= offset;
- textRegionEnd= offset + length - 1;
- reset();
- }
-
- private final void addDeleteEdit(int start, int end) {
- if (edits.length == editsIndex) {
- // resize
- resize();
- }
- addOptimizedReplaceEdit(start, end - start + 1, EMPTY_STRING);
- }
-
- public final void addInsertEdit(int insertPosition, String insertedString) {
- if (edits.length == editsIndex) {
- // resize
- resize();
- }
- addOptimizedReplaceEdit(insertPosition, 0, insertedString);
- }
-
- private final void addOptimizedReplaceEdit(int offset, int length, String replacement) {
- if (editsIndex > 0) {
- // try to merge last two edits
- final OptimizedReplaceEdit previous= edits[editsIndex - 1];
- final int previousOffset= previous.offset;
- final int previousLength= previous.length;
- final int endOffsetOfPreviousEdit= previousOffset + previousLength;
- final int replacementLength= replacement.length();
- final String previousReplacement= previous.replacement;
- final int previousReplacementLength= previousReplacement.length();
- if (previousOffset == offset && previousLength == length
- && (replacementLength == 0 || previousReplacementLength == 0)) {
- if (currentAlignment != null) {
- final Location location= currentAlignment.location;
- if (location.editsIndex == editsIndex) {
- location.editsIndex--;
- location.textEdit= previous;
- }
- }
- editsIndex--;
- return;
- }
- if (endOffsetOfPreviousEdit == offset) {
- if (length != 0) {
- if (replacementLength != 0) {
- edits[editsIndex - 1]= new OptimizedReplaceEdit(previousOffset, previousLength + length,
- previousReplacement + replacement);
- } else if (previousLength + length == previousReplacementLength) {
- // check the characters. If they are identical, we can
- // get rid of the previous edit
- boolean canBeRemoved= true;
- loop: for (int i= previousOffset; i < previousOffset + previousReplacementLength; i++) {
- if (scanner.source[i] != previousReplacement.charAt(i - previousOffset)) {
- edits[editsIndex - 1]= new OptimizedReplaceEdit(previousOffset,
- previousReplacementLength, previousReplacement);
- canBeRemoved= false;
- break loop;
- }
- }
- if (canBeRemoved) {
- if (currentAlignment != null) {
- final Location location= currentAlignment.location;
- if (location.editsIndex == editsIndex) {
- location.editsIndex--;
- location.textEdit= previous;
- }
- }
- editsIndex--;
- }
- } else {
- edits[editsIndex - 1]= new OptimizedReplaceEdit(previousOffset, previousLength + length,
- previousReplacement);
- }
- } else {
- if (replacementLength != 0) {
- edits[editsIndex - 1]= new OptimizedReplaceEdit(previousOffset, previousLength,
- previousReplacement + replacement);
- }
- }
- } else {
- assert endOffsetOfPreviousEdit < offset;
- edits[editsIndex++]= new OptimizedReplaceEdit(offset, length, replacement);
- }
- } else {
- edits[editsIndex++]= new OptimizedReplaceEdit(offset, length, replacement);
- }
- }
-
- /**
- * Add a replace edit.
- * @param start start offset (inclusive)
- * @param end end offset (inclusive)
- * @param replacement the replacement string
- */
- public final void addReplaceEdit(int start, int end, String replacement) {
- if (edits.length == editsIndex) {
- // resize
- resize();
- }
- addOptimizedReplaceEdit(start, end - start + 1, replacement);
- }
-
- public void alignFragment(Alignment alignment, int fragmentIndex) {
- alignment.fragmentIndex= fragmentIndex;
- alignment.checkColumn();
- alignment.performFragmentEffect();
- }
-
- public void consumeNextToken() {
- printComment();
- currentToken= scanner.nextToken();
- addDeleteEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition());
- }
-
- public Alignment createAlignment(String name, int mode, int count, int sourceRestart) {
- return createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart);
- }
-
- public Alignment createAlignment(String name, int mode, int count, int sourceRestart, boolean adjust) {
- return createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart, adjust);
- }
-
- public Alignment createAlignment(String name, int mode, int tieBreakRule, int count, int sourceRestart) {
- return createAlignment(name, mode, tieBreakRule, count, sourceRestart,
- formatter.preferences.continuation_indentation, false);
- }
-
- public Alignment createAlignment(String name, int mode, int count, int sourceRestart, int continuationIndent,
- boolean adjust) {
- return createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart, continuationIndent, adjust);
- }
-
- public Alignment createAlignment(String name, int mode, int tieBreakRule, int count, int sourceRestart,
- int continuationIndent, boolean adjust) {
- Alignment alignment= new Alignment(name, mode, tieBreakRule, this, count, sourceRestart, continuationIndent);
- // adjust break indentation
- if (adjust && memberAlignment != null) {
- Alignment current= memberAlignment;
- while (current.enclosing != null) {
- current= current.enclosing;
- }
- if ((current.mode & Alignment.M_MULTICOLUMN) != 0) {
- final int indentSize= indentationSize;
- switch (current.chunkKind) {
- case Alignment.CHUNK_METHOD:
- case Alignment.CHUNK_TYPE:
- if ((mode & Alignment.M_INDENT_BY_ONE) != 0) {
- alignment.breakIndentationLevel= indentationLevel + indentSize;
- } else {
- alignment.breakIndentationLevel= indentationLevel + continuationIndent * indentSize;
- }
- alignment.update();
- break;
- case Alignment.CHUNK_FIELD:
- if ((mode & Alignment.M_INDENT_BY_ONE) != 0) {
- alignment.breakIndentationLevel= current.originalIndentationLevel + indentSize;
- } else {
- alignment.breakIndentationLevel= current.originalIndentationLevel + continuationIndent
- * indentSize;
- }
- alignment.update();
- break;
- }
- } else {
- switch (current.mode & Alignment.SPLIT_MASK) {
- case Alignment.M_COMPACT_SPLIT:
- case Alignment.M_COMPACT_FIRST_BREAK_SPLIT:
- case Alignment.M_NEXT_PER_LINE_SPLIT:
- case Alignment.M_NEXT_SHIFTED_SPLIT:
- case Alignment.M_ONE_PER_LINE_SPLIT:
- final int indentSize= indentationSize;
- switch (current.chunkKind) {
- case Alignment.CHUNK_METHOD:
- case Alignment.CHUNK_TYPE:
- if ((mode & Alignment.M_INDENT_BY_ONE) != 0) {
- alignment.breakIndentationLevel= indentationLevel + indentSize;
- } else {
- alignment.breakIndentationLevel= indentationLevel + continuationIndent * indentSize;
- }
- alignment.update();
- break;
- case Alignment.CHUNK_FIELD:
- if ((mode & Alignment.M_INDENT_BY_ONE) != 0) {
- alignment.breakIndentationLevel= current.originalIndentationLevel + indentSize;
- } else {
- alignment.breakIndentationLevel= current.originalIndentationLevel + continuationIndent
- * indentSize;
- }
- alignment.update();
- break;
- }
- break;
- }
- }
- }
- return alignment;
- }
-
- public Alignment createMemberAlignment(String name, int mode, int count, int sourceRestart) {
- Alignment mAlignment= createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart);
- mAlignment.breakIndentationLevel= indentationLevel;
- return mAlignment;
- }
-
- public void enterAlignment(Alignment alignment) {
- alignment.enclosing= currentAlignment;
- currentAlignment= alignment;
- }
-
- public void enterMemberAlignment(Alignment alignment) {
- alignment.enclosing= memberAlignment;
- memberAlignment= alignment;
- }
-
- public void exitAlignment(Alignment alignment, boolean discardAlignment) {
- Alignment current= currentAlignment;
- while (current != null) {
- if (current == alignment)
- break;
- current= current.enclosing;
- }
- if (current == null) {
- throw new AbortFormatting("could not find matching alignment: " + alignment); //$NON-NLS-1$
- }
- indentationLevel= alignment.location.outputIndentationLevel;
- numberOfIndentations= alignment.location.numberOfIndentations;
- if (discardAlignment) {
- currentAlignment= alignment.enclosing;
- }
- }
-
- public void exitMemberAlignment(Alignment alignment) {
- Alignment current= memberAlignment;
- while (current != null) {
- if (current == alignment)
- break;
- current= current.enclosing;
- }
- if (current == null) {
- throw new AbortFormatting("could not find matching alignment: " + alignment); //$NON-NLS-1$
- }
- indentationLevel= current.location.outputIndentationLevel;
- numberOfIndentations= current.location.numberOfIndentations;
- memberAlignment= current.enclosing;
- }
-
- public Alignment getAlignment(String name) {
- if (currentAlignment != null) {
- return currentAlignment.getAlignment(name);
- }
- return null;
- }
-
- /**
- * Answer actual indentation level based on true column position
- *
- * @return int
- */
- public int getColumnIndentationLevel() {
- return column - 1;
- }
-
- public String getEmptyLines(int linesNumber) {
- StringBuffer buffer= new StringBuffer();
- if (lastNumberOfNewLines == 0) {
- linesNumber++; // add an extra line breaks
- for (int i= 0; i < linesNumber; i++) {
- if (indentEmptyLines)
- printIndentationIfNecessary(buffer);
- buffer.append(lineSeparator);
- }
- lastNumberOfNewLines+= linesNumber;
- line+= linesNumber;
- column= 1;
- needSpace= false;
- pendingSpace= false;
- } else if (lastNumberOfNewLines == 1) {
- for (int i= 0; i < linesNumber; i++) {
- if (indentEmptyLines)
- printIndentationIfNecessary(buffer);
- buffer.append(lineSeparator);
- }
- lastNumberOfNewLines+= linesNumber;
- line+= linesNumber;
- column= 1;
- needSpace= false;
- pendingSpace= false;
- } else {
- if ((lastNumberOfNewLines - 1) >= linesNumber) {
- // there is no need to add new lines
- return EMPTY_STRING;
- }
- final int realNewLineNumber= linesNumber - lastNumberOfNewLines + 1;
- for (int i= 0; i < realNewLineNumber; i++) {
- if (indentEmptyLines)
- printIndentationIfNecessary(buffer);
- buffer.append(lineSeparator);
- }
- lastNumberOfNewLines+= realNewLineNumber;
- line+= realNewLineNumber;
- column= 1;
- needSpace= false;
- pendingSpace= false;
- }
- return String.valueOf(buffer);
- }
-
- public OptimizedReplaceEdit getLastEdit() {
- if (editsIndex > 0) {
- return edits[editsIndex - 1];
- }
- return null;
- }
-
- Alignment getMemberAlignment() {
- return memberAlignment;
- }
-
- public String getNewLine() {
- if (lastNumberOfNewLines >= 1) {
- column= 1; // ensure that the scribe is at the beginning of a new
- // line
- return EMPTY_STRING;
- }
- line++;
- lastNumberOfNewLines= 1;
- column= 1;
- needSpace= false;
- pendingSpace= false;
- return lineSeparator;
- }
-
- /**
- * Answer next indentation level based on column estimated position (if
- * column is not indented, then use indentationLevel)
- */
- public int getNextIndentationLevel(int someColumn) {
- int indent= someColumn - 1;
- if (indent == 0)
- return indentationLevel;
- if (tabChar == DefaultCodeFormatterOptions.TAB) {
- if (useTabsOnlyForLeadingIndents) {
- return indent;
- }
- int rem= indent % indentationSize;
- int addition= rem == 0 ? 0 : indentationSize - rem; // round to
- // superior
- return indent + addition;
- } else {
- return indent;
- }
- }
-
- private String getPreserveEmptyLines(int count) {
- if (count > 0) {
- if (formatter.preferences.number_of_empty_lines_to_preserve != 0) {
- int linesToPreserve= Math.min(count, formatter.preferences.number_of_empty_lines_to_preserve);
- return getEmptyLines(linesToPreserve);
- } else {
- return getNewLine();
- }
- } else if (preserveNewlines) {
- return getNewLine();
- }
- return EMPTY_STRING;
- }
-
- public TextEdit getRootEdit() {
- MultiTextEdit edit= null;
- int length= textRegionEnd - textRegionStart + 1;
- if (textRegionStart <= 0) {
- if (length <= 0) {
- edit= new MultiTextEdit(0, 0);
- } else {
- edit= new MultiTextEdit(0, textRegionEnd + 1);
- }
- } else {
- edit= new MultiTextEdit(textRegionStart, textRegionEnd - textRegionStart + 1);
- }
- for (int i= 0, max= editsIndex; i < max; i++) {
- OptimizedReplaceEdit currentEdit= edits[i];
- if (isValidEdit(currentEdit)) {
- edit.addChild(new ReplaceEdit(currentEdit.offset, currentEdit.length, currentEdit.replacement));
- }
- }
- edits= null;
- return edit;
- }
-
- public void handleLineTooLong() {
- // search for closest breakable alignment, using tiebreak rules
- // look for outermost breakable one
- int relativeDepth= 0, outerMostDepth= -1;
- Alignment targetAlignment= currentAlignment;
- while (targetAlignment != null) {
- if (targetAlignment.tieBreakRule == Alignment.R_OUTERMOST && targetAlignment.couldBreak()) {
- outerMostDepth= relativeDepth;
- }
- targetAlignment= targetAlignment.enclosing;
- relativeDepth++;
- }
- if (outerMostDepth >= 0) {
- throw new AlignmentException(AlignmentException.LINE_TOO_LONG, outerMostDepth);
- }
- // look for innermost breakable one
- relativeDepth= 0;
- targetAlignment= currentAlignment;
- while (targetAlignment != null) {
- if (targetAlignment.couldBreak()) {
- throw new AlignmentException(AlignmentException.LINE_TOO_LONG, relativeDepth);
- }
- targetAlignment= targetAlignment.enclosing;
- relativeDepth++;
- }
- // did not find any breakable location - proceed
- }
-
- public void indent() {
- indentationLevel+= indentationSize;
- numberOfIndentations++;
- }
-
- /**
- * @param translationUnitSource
- */
- public void initializeScanner(char[] translationUnitSource) {
- scanner.setSource(translationUnitSource);
- scannerEndPosition= translationUnitSource.length;
- scanner.resetTo(0, scannerEndPosition);
- edits= new OptimizedReplaceEdit[INITIAL_SIZE];
- }
-
- /**
- * @param list
- */
- public void setSkipPositions(List list) {
- fSkipPositions= list;
- skipOverInactive= !list.isEmpty();
- }
-
- private boolean isValidEdit(OptimizedReplaceEdit edit) {
- final int editLength= edit.length;
- final int editReplacementLength= edit.replacement.length();
- final int editOffset= edit.offset;
- if (editLength != 0) {
- if (textRegionStart <= editOffset && (editOffset + editLength - 1) <= textRegionEnd) {
- if (editReplacementLength != 0 && editLength == editReplacementLength) {
- for (int i= editOffset, max= editOffset + editLength; i < max; i++) {
- if (scanner.source[i] != edit.replacement.charAt(i - editOffset)) {
- return true;
- }
- }
- return false;
- } else {
- return true;
- }
- } else if (editOffset + editLength == textRegionStart) {
- int i= editOffset;
- for (int max= editOffset + editLength; i < max; i++) {
- int replacementStringIndex= i - editOffset;
- if (replacementStringIndex >= editReplacementLength
- || scanner.source[i] != edit.replacement.charAt(replacementStringIndex)) {
- break;
- }
- }
- if (i - editOffset != editReplacementLength && i != editOffset + editLength - 1) {
- edit.offset= textRegionStart;
- edit.length= 0;
- edit.replacement= edit.replacement.substring(i - editOffset);
- return true;
- }
- }
- } else if (textRegionStart <= editOffset && editOffset <= textRegionEnd) {
- return true;
- } else if (editOffset == scannerEndPosition && editOffset == textRegionEnd + 1) {
- return true;
- }
- return false;
- }
-
- private void preserveEmptyLines(int count, int insertPosition) {
- if (count > 0) {
- if (formatter.preferences.number_of_empty_lines_to_preserve != 0) {
- int linesToPreserve= Math.min(count, formatter.preferences.number_of_empty_lines_to_preserve);
- printEmptyLines(linesToPreserve, insertPosition);
- } else {
- printNewLine(insertPosition);
- }
- } else {
- printNewLine(insertPosition);
- }
- }
-
- public void printRaw(int startOffset, int length) {
- if (startOffset + length < scanner.getCurrentPosition()) {
- // safeguard: don't move backwards
- return;
- }
- boolean savedPreserveWS= preserveWhitespace;
- boolean savedPreserveNL= preserveNewlines;
- boolean savedSkipOverInactive= skipOverInactive;
- int savedScannerEndPos= scannerEndPosition;
- preserveWhitespace= false;
- preserveNewlines= true;
- skipOverInactive= false;
- scannerEndPosition= startOffset + length;
- int parenLevel= 0;
- try {
- scanner.resetTo(startOffset, startOffset + length - 1);
- while (true) {
- boolean hasWhitespace= printComment();
- currentToken= scanner.nextToken();
- if (currentToken == null) {
- if (hasWhitespace) {
- space();
- }
- break;
- }
- switch (currentToken.type) {
- case Token.tLBRACE:
- scanner.resetTo(scanner.getCurrentTokenStartPosition(), scannerEndPosition-1);
- formatOpeningBrace(formatter.preferences.brace_position_for_block, formatter.preferences.insert_space_before_opening_brace_in_block);
- if (formatter.preferences.indent_statements_compare_to_block) {
- indent();
- }
- break;
- case Token.tRBRACE:
- scanner.resetTo(scanner.getCurrentTokenStartPosition(), scannerEndPosition-1);
- if (formatter.preferences.indent_statements_compare_to_block) {
- unIndent();
- }
- formatClosingBrace(formatter.preferences.brace_position_for_block);
- break;
- case Token.tLPAREN:
- ++parenLevel;
- print(currentToken.getLength(), hasWhitespace);
- if (parenLevel > 0) {
- for (int i= 0; i < formatter.preferences.continuation_indentation; i++) {
- indent();
- }
- // HACK: avoid indent in same line
- column= indentationLevel + 1;
- }
- break;
- case Token.tRPAREN:
- --parenLevel;
- if (parenLevel >= 0) {
- for (int i= 0; i < formatter.preferences.continuation_indentation; i++) {
- unIndent();
- }
- }
- print(currentToken.getLength(), hasWhitespace);
- break;
- case Token.tSEMI:
- print(currentToken.getLength(), formatter.preferences.insert_space_before_semicolon);
- break;
- case Token.t_else:
- case Token.t_catch:
- if (formatter.preferences.insert_new_line_before_else_in_if_statement) {
- printNewLine(currentToken.offset);
- } else {
- hasWhitespace= true;
- }
- print(currentToken.getLength(), hasWhitespace);
- break;
- default:
- if (currentToken.isVisibilityModifier()
- && !formatter.preferences.indent_access_specifier_compare_to_type_header) {
- int indentLevel= indentationLevel;
- if (indentationLevel > 0)
- unIndent();
- print(currentToken.getLength(), hasWhitespace);
- while (indentationLevel < indentLevel) {
- indent();
- }
- } else {
- print(currentToken.getLength(), hasWhitespace);
- }
- }
- }
- } finally {
- scannerEndPosition= savedScannerEndPos;
- scanner.resetTo(startOffset + length, scannerEndPosition - 1);
- skipOverInactive= savedSkipOverInactive;
- preserveWhitespace= savedPreserveWS;
- preserveNewlines= savedPreserveNL;
- }
- }
-
- private void formatOpeningBrace(String bracePosition, boolean insertSpaceBeforeBrace) {
- if (DefaultCodeFormatterConstants.NEXT_LINE.equals(bracePosition)) {
- printNewLine();
- } else if (DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(bracePosition)) {
- printNewLine();
- indent();
- }
- printNextToken(Token.tLBRACE, insertSpaceBeforeBrace);
-
- printTrailingComment();
- }
-
- private void formatClosingBrace(String block_brace_position) {
- printNextToken(Token.tRBRACE);
- printTrailingComment();
- if (DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(block_brace_position)) {
- unIndent();
- }
- }
-
-
- private void print(int length, boolean considerSpaceIfAny) {
- if (checkLineWrapping && length + column > pageWidth) {
- handleLineTooLong();
- }
- lastNumberOfNewLines= 0;
- printIndentationIfNecessary();
- if (considerSpaceIfAny) {
- space();
- }
- if (pendingSpace) {
- addInsertEdit(scanner.getCurrentTokenStartPosition(), " "); //$NON-NLS-1$
- }
- pendingSpace= false;
- needSpace= false;
- column+= length;
- needSpace= true;
- }
-
- private void printBlockComment(boolean forceNewLine) {
- int currentTokenStartPosition= scanner.getCurrentTokenStartPosition();
- int currentTokenEndPosition= scanner.getCurrentTokenEndPosition() + 1;
-
- scanner.resetTo(currentTokenStartPosition, currentTokenEndPosition - 1);
- int currentCharacter;
- boolean isNewLine= false;
- int start= currentTokenStartPosition;
- int nextCharacterStart= currentTokenStartPosition;
- printIndentationIfNecessary();
- if (pendingSpace) {
- addInsertEdit(currentTokenStartPosition, " "); //$NON-NLS-1$
- }
- needSpace= false;
- pendingSpace= false;
- int previousStart= currentTokenStartPosition;
-
- while (nextCharacterStart <= currentTokenEndPosition && (currentCharacter= scanner.getNextChar()) != -1) {
- nextCharacterStart= scanner.getCurrentPosition();
-
- switch (currentCharacter) {
- case '\r':
- start= previousStart;
- isNewLine= true;
- if (scanner.getNextChar('\n')) {
- currentCharacter= '\n';
- nextCharacterStart= scanner.getCurrentPosition();
- }
- break;
- case '\n':
- start= previousStart;
- isNewLine= true;
- break;
- default:
- if (isNewLine) {
- if (Character.isWhitespace((char) currentCharacter)) {
- int previousStartPosition= scanner.getCurrentPosition();
- while (currentCharacter != -1 && currentCharacter != '\r' && currentCharacter != '\n'
- && Character.isWhitespace((char) currentCharacter)) {
- previousStart= nextCharacterStart;
- previousStartPosition= scanner.getCurrentPosition();
- currentCharacter= scanner.getNextChar();
- nextCharacterStart= scanner.getCurrentPosition();
- }
- if (currentCharacter == '\r' || currentCharacter == '\n') {
- nextCharacterStart= previousStartPosition;
- }
- }
- column= 1;
- line++;
-
- StringBuffer buffer= new StringBuffer();
- buffer.append(lineSeparator);
- printIndentationIfNecessary(buffer);
- buffer.append(' ');
-
- addReplaceEdit(start, previousStart - 1, String.valueOf(buffer));
- } else {
- column+= (nextCharacterStart - previousStart);
- }
- isNewLine= false;
- }
- previousStart= nextCharacterStart;
- scanner.setCurrentPosition(nextCharacterStart);
- }
- lastNumberOfNewLines= 0;
- needSpace= false;
- scanner.resetTo(currentTokenEndPosition, scannerEndPosition - 1);
- if (forceNewLine) {
- startNewLine();
- }
- }
-
- private void printPreprocessorDirective() {
- int currentTokenStartPosition= scanner.getCurrentTokenStartPosition();
- int currentTokenEndPosition= scanner.getCurrentTokenEndPosition() + 1;
-
- scanner.resetTo(currentTokenStartPosition, currentTokenEndPosition - 1);
- int currentCharacter;
- boolean isNewLine= false;
- int nextCharacterStart= currentTokenStartPosition;
- needSpace= false;
- pendingSpace= false;
- int previousStart= currentTokenStartPosition;
-
- while (nextCharacterStart <= currentTokenEndPosition && (currentCharacter= scanner.getNextChar()) != -1) {
- nextCharacterStart= scanner.getCurrentPosition();
-
- switch (currentCharacter) {
- case '\r':
- isNewLine= true;
- if (scanner.getNextChar('\n')) {
- currentCharacter= '\n';
- nextCharacterStart= scanner.getCurrentPosition();
- }
- break;
- case '\n':
- isNewLine= true;
- break;
- default:
- if (isNewLine) {
- column= 1;
- line++;
- } else {
- column+= (nextCharacterStart - previousStart);
- }
- isNewLine= false;
- }
- previousStart= nextCharacterStart;
- scanner.setCurrentPosition(nextCharacterStart);
- }
- lastNumberOfNewLines= 0;
- needSpace= false;
- scanner.resetTo(currentTokenEndPosition, scannerEndPosition - 1);
- }
-
- public void printEndOfTranslationUnit() {
- int currentTokenStartPosition= scanner.getCurrentPosition();
- printRaw(currentTokenStartPosition, scannerEndPosition - currentTokenStartPosition + 1);
- return;
- }
-
- public boolean printComment() {
- // if we have a space between two tokens we ensure it will be dumped in
- // the formatted string
- int currentTokenStartPosition= scanner.getCurrentPosition();
- boolean hasComment= false;
- boolean hasLineComment= false;
- boolean hasWhitespace= false;
- int count= 0;
- while ((currentToken= scanner.nextToken()) != null) {
- Position inactivePos= null;
- if (skipOverInactive) {
- inactivePos= getInactivePosAt(scanner.getCurrentTokenStartPosition());
- if (inactivePos != null) {
- int startOffset= Math.min(scanner.getCurrentTokenStartPosition(), inactivePos.getOffset());
- int endOffset= Math.min(scannerEndPosition, inactivePos.getOffset() + inactivePos.getLength());
- if (startOffset < endOffset) {
- int savedIndentLevel= indentationLevel;
- printRaw(startOffset, endOffset - startOffset);
- while (indentationLevel > savedIndentLevel) {
- unIndent();
- }
- while (indentationLevel < savedIndentLevel) {
- indent();
- }
- scanner.resetTo(endOffset, scanner.eofPosition - 1);
- continue;
- }
- }
- }
- switch (currentToken.type) {
- case Token.tWHITESPACE:
- char[] whiteSpaces= scanner.getCurrentTokenSource();
- count= 0;
- for (int i= 0, max= whiteSpaces.length; i < max; i++) {
- switch (whiteSpaces[i]) {
- case '\r':
- if ((i + 1) < max) {
- if (whiteSpaces[i + 1] == '\n') {
- i++;
- }
- }
- count++;
- break;
- case '\n':
- count++;
- }
- }
- if (count == 0) {
- if (preserveWhitespace) {
- addReplaceEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition(),
- " "); //$NON-NLS-1$
- ++column;
- } else {
- hasWhitespace= true;
- addDeleteEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition());
- }
- } else if (hasComment) {
- if (count == 1) {
- printNewLine(scanner.getCurrentTokenStartPosition());
- } else {
- preserveEmptyLines(count - 1, scanner.getCurrentTokenStartPosition());
- }
- addDeleteEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition());
- } else if (hasLineComment) {
- preserveEmptyLines(count - 1, scanner.getCurrentTokenStartPosition());
- addDeleteEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition());
- } else if (count != 0 && formatter.preferences.number_of_empty_lines_to_preserve != 0) {
- addReplaceEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition(),
- getPreserveEmptyLines(count - 1));
- } else {
- addDeleteEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition());
- }
- currentTokenStartPosition= scanner.getCurrentPosition();
- break;
- case Token.tLINECOMMENT:
- if (count >= 1) {
- if (count > 1) {
- preserveEmptyLines(count - 1, scanner.getCurrentTokenStartPosition());
- } else if (count == 1) {
- printNewLine(scanner.getCurrentTokenStartPosition());
- }
- } else if (hasWhitespace) {
- space();
- }
- hasWhitespace= false;
- printCommentLine();
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasLineComment= true;
- count= 0;
- break;
- case Token.tBLOCKCOMMENT:
- if (count >= 1) {
- if (count > 1) {
- preserveEmptyLines(count - 1, scanner.getCurrentTokenStartPosition());
- } else if (count == 1) {
- printNewLine(scanner.getCurrentTokenStartPosition());
- }
- } else if (hasWhitespace) {
- space();
- }
- hasWhitespace= false;
- printBlockComment(false);
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasLineComment= false;
- hasComment= true;
- count= 0;
- break;
- case Token.tPREPROCESSOR:
- case Token.tPREPROCESSOR_DEFINE:
- case Token.tPREPROCESSOR_INCLUDE:
- if (column != 1)
- printNewLine(scanner.getCurrentTokenStartPosition());
- if (count >= 1) {
- if (count > 1) {
- preserveEmptyLines(count - 1, scanner.getCurrentTokenStartPosition());
- } else if (count == 1) {
- // printNewLine(scanner.getCurrentTokenStartPosition());
- }
- }
- hasWhitespace= false;
- printPreprocessorDirective();
- printNewLine();
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasLineComment= false;
- hasComment= false;
- count= 0;
- break;
- default:
- // step back one token
- scanner.resetTo(currentTokenStartPosition, scannerEndPosition - 1);
- return hasWhitespace;
- }
- }
- return hasWhitespace;
- }
-
- /**
- * @param offset
- * @return
- */
- private Position getInactivePosAt(int offset) {
- for (Iterator iter= fSkipPositions.iterator(); iter.hasNext();) {
- Position pos= (Position) iter.next();
- if (pos.includes(offset)) {
- return pos;
- }
- }
- return null;
- }
-
- private void printCommentLine() {
- int currentTokenStartPosition= scanner.getCurrentTokenStartPosition();
- int currentTokenEndPosition= scanner.getCurrentTokenEndPosition() + 1;
- scanner.resetTo(currentTokenStartPosition, currentTokenEndPosition - 1);
- int currentCharacter;
- int start= currentTokenStartPosition;
- int nextCharacterStart= currentTokenStartPosition;
- printIndentationIfNecessary();
- if (pendingSpace) {
- addInsertEdit(currentTokenStartPosition, " "); //$NON-NLS-1$
- }
- needSpace= false;
- pendingSpace= false;
- int previousStart= currentTokenStartPosition;
-
- loop: while (nextCharacterStart <= currentTokenEndPosition && (currentCharacter= scanner.getNextChar()) != -1) {
- nextCharacterStart= scanner.getCurrentPosition();
-
- switch (currentCharacter) {
- case '\r':
- start= previousStart;
- break loop;
- case '\n':
- start= previousStart;
- break loop;
- }
- previousStart= nextCharacterStart;
- }
- if (start != currentTokenStartPosition) {
- addReplaceEdit(start, currentTokenEndPosition - 1, lineSeparator);
- }
- line++;
- column= 1;
- needSpace= false;
- pendingSpace= false;
- lastNumberOfNewLines= 0;
- scanner.resetTo(currentTokenEndPosition, scannerEndPosition - 1);
- // realign to the proper value
- if (currentAlignment != null) {
- if (memberAlignment != null) {
- // select the last alignment
- if (currentAlignment.location.inputOffset > memberAlignment.location.inputOffset) {
- if (currentAlignment.couldBreak() && currentAlignment.wasSplit) {
- currentAlignment.performFragmentEffect();
- }
- } else {
- indentationLevel= Math.max(indentationLevel, memberAlignment.breakIndentationLevel);
- }
- } else if (currentAlignment.couldBreak() && currentAlignment.wasSplit) {
- currentAlignment.performFragmentEffect();
- }
- }
- }
-
- public void printEmptyLines(int linesNumber) {
- printEmptyLines(linesNumber, scanner.getCurrentTokenEndPosition() + 1);
- }
-
- private void printEmptyLines(int linesNumber, int insertPosition) {
- final String buffer= getEmptyLines(linesNumber);
- if (EMPTY_STRING == buffer)
- return;
-
- addInsertEdit(insertPosition, buffer);
- }
-
- void printIndentationIfNecessary() {
- StringBuffer buffer= new StringBuffer();
- printIndentationIfNecessary(buffer);
- if (buffer.length() > 0) {
- addInsertEdit(scanner.getCurrentTokenStartPosition(), buffer.toString());
- pendingSpace= false;
- }
- }
-
- private void printIndentationIfNecessary(StringBuffer buffer) {
- switch (tabChar) {
- case DefaultCodeFormatterOptions.TAB:
- boolean useTabsForLeadingIndents= useTabsOnlyForLeadingIndents;
- int numberOfLeadingIndents= numberOfIndentations;
- int indentationsAsTab= 0;
- if (useTabsForLeadingIndents) {
- while (column <= indentationLevel) {
- if (indentationsAsTab < numberOfLeadingIndents) {
- buffer.append('\t');
- indentationsAsTab++;
- lastNumberOfNewLines= 0;
- int complement= tabLength - ((column - 1) % tabLength); // amount
- // of
- // space
- column+= complement;
- needSpace= false;
- } else {
- buffer.append(' ');
- column++;
- needSpace= false;
- }
- }
- } else {
- while (column <= indentationLevel) {
- buffer.append('\t');
- lastNumberOfNewLines= 0;
- int complement= tabLength - ((column - 1) % tabLength); // amount
- // of
- // space
- column+= complement;
- needSpace= false;
- }
- }
- break;
- case DefaultCodeFormatterOptions.SPACE:
- while (column <= indentationLevel) {
- buffer.append(' ');
- column++;
- needSpace= false;
- }
- break;
- case DefaultCodeFormatterOptions.MIXED:
- useTabsForLeadingIndents= useTabsOnlyForLeadingIndents;
- numberOfLeadingIndents= numberOfIndentations;
- indentationsAsTab= 0;
- if (useTabsForLeadingIndents) {
- final int columnForLeadingIndents= numberOfLeadingIndents * indentationSize;
- while (column <= indentationLevel) {
- if (column <= columnForLeadingIndents) {
- if ((column - 1 + tabLength) <= indentationLevel) {
- buffer.append('\t');
- column+= tabLength;
- } else if ((column - 1 + indentationSize) <= indentationLevel) {
- // print one indentation
- for (int i= 0, max= indentationSize; i < max; i++) {
- buffer.append(' ');
- column++;
- }
- } else {
- buffer.append(' ');
- column++;
- }
- } else {
- for (int i= column, max= indentationLevel; i <= max; i++) {
- buffer.append(' ');
- column++;
- }
- }
- needSpace= false;
- }
- } else {
- while (column <= indentationLevel) {
- if ((column - 1 + tabLength) <= indentationLevel) {
- buffer.append('\t');
- column+= tabLength;
- } else if ((column - 1 + indentationSize) <= indentationLevel) {
- // print one indentation
- for (int i= 0, max= indentationSize; i < max; i++) {
- buffer.append(' ');
- column++;
- }
- } else {
- buffer.append(' ');
- column++;
- }
- needSpace= false;
- }
- }
- break;
- }
- }
-
- public void startNewLine() {
- if (column > 1) {
- printNewLine();
- }
- }
- public void printNewLine() {
- if (lastNumberOfNewLines >= 1) {
- column= 1; // ensure that the scribe is at the beginning of a new
- // line
- return;
- }
- addInsertEdit(scanner.getCurrentTokenEndPosition() + 1, lineSeparator);
- line++;
- lastNumberOfNewLines= 1;
- column= 1;
- needSpace= false;
- pendingSpace= false;
- }
-
- public void printNewLine(int insertPosition) {
- if (lastNumberOfNewLines >= 1) {
- column= 1; // ensure that the scribe is at the beginning of a new
- // line
- return;
- }
- addInsertEdit(insertPosition, lineSeparator);
- line++;
- lastNumberOfNewLines= 1;
- column= 1;
- needSpace= false;
- pendingSpace= false;
- }
-
- public void printNextToken(int expectedTokenType) {
- printNextToken(expectedTokenType, false);
- }
-
- public void printNextToken(int expectedTokenType, boolean considerSpaceIfAny) {
- printComment();
- currentToken= scanner.nextToken();
- if (currentToken == null || expectedTokenType != currentToken.type) {
- throw new AbortFormatting(
- "[" + line + "/" + column + "] unexpected token type, expecting:" + expectedTokenType + ", actual:" + currentToken);//$NON-NLS-1$//$NON-NLS-2$
- }
- print(currentToken.getLength(), considerSpaceIfAny);
- }
-
- public void printNextToken(int[] expectedTokenTypes) {
- printNextToken(expectedTokenTypes, false);
- }
-
- public void printNextToken(int[] expectedTokenTypes, boolean considerSpaceIfAny) {
- printComment();
- currentToken= scanner.nextToken();
- if (Arrays.binarySearch(expectedTokenTypes, currentToken.type) < 0) {
- StringBuffer expectations= new StringBuffer(5);
- for (int i= 0; i < expectedTokenTypes.length; i++) {
- if (i > 0) {
- expectations.append(',');
- }
- expectations.append(expectedTokenTypes[i]);
- }
- throw new AbortFormatting(
- "unexpected token type, expecting:[" + expectations.toString() + "], actual:" + currentToken);//$NON-NLS-1$//$NON-NLS-2$
- }
- print(currentToken.getLength(), considerSpaceIfAny);
- }
-
- private void printRule(StringBuffer stringBuffer) {
- for (int i= 0; i < pageWidth; i++) {
- if ((i % tabLength) == 0) {
- stringBuffer.append('+');
- } else {
- stringBuffer.append('-');
- }
- }
- stringBuffer.append(lineSeparator);
-
- for (int i= 0; i < (pageWidth / tabLength); i++) {
- stringBuffer.append(i);
- stringBuffer.append('\t');
- }
- }
-
- public void printTrailingComment() {
- // if we have a space between two tokens we ensure it will be dumped in
- // the formatted string
- int currentTokenStartPosition= scanner.getCurrentPosition();
- boolean hasWhitespaces= false;
- boolean hasComment= false;
- boolean hasLineComment= false;
- int count= 0;
- while ((currentToken= scanner.nextToken()) != null) {
- switch (currentToken.type) {
- case Token.tWHITESPACE:
- char[] whiteSpaces= scanner.getCurrentTokenSource();
- for (int i= 0, max= whiteSpaces.length; i < max; i++) {
- switch (whiteSpaces[i]) {
- case '\r':
- if ((i + 1) < max) {
- if (whiteSpaces[i + 1] == '\n') {
- i++;
- }
- }
- count++;
- break;
- case '\n':
- count++;
- }
- }
- if (hasLineComment) {
- if (count >= 1) {
- currentTokenStartPosition= scanner.getCurrentTokenStartPosition();
- preserveEmptyLines(count - 1, currentTokenStartPosition);
- addDeleteEdit(currentTokenStartPosition, scanner.getCurrentTokenEndPosition());
- scanner.resetTo(scanner.getCurrentPosition(), scannerEndPosition - 1);
- return;
- } else {
- scanner.resetTo(currentTokenStartPosition, scannerEndPosition - 1);
- return;
- }
- } else if (count >= 1) {
- if (hasComment) {
- printNewLine(scanner.getCurrentTokenStartPosition());
- }
- scanner.resetTo(currentTokenStartPosition, scannerEndPosition - 1);
- return;
- } else {
- hasWhitespaces= true;
- currentTokenStartPosition= scanner.getCurrentPosition();
- addDeleteEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition());
- }
- break;
- case Token.tLINECOMMENT:
- if (hasWhitespaces) {
- space();
- }
- printCommentLine();
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasLineComment= true;
- break;
- case Token.tBLOCKCOMMENT:
- if (hasWhitespaces) {
- space();
- }
- printBlockComment(false);
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasComment= true;
- break;
- case Token.tPREPROCESSOR:
- case Token.tPREPROCESSOR_DEFINE:
- case Token.tPREPROCESSOR_INCLUDE:
- if (column != 1)
- printNewLine(scanner.getCurrentTokenStartPosition());
- hasWhitespaces= false;
- printPreprocessorDirective();
- startNewLine();
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasLineComment= false;
- hasComment= false;
- count= 0;
- break;
- default:
- // step back one token
- scanner.resetTo(currentTokenStartPosition, scannerEndPosition - 1);
- return;
- }
- }
- }
-
- void redoAlignment(AlignmentException e) {
- if (e.relativeDepth > 0) { // if exception targets a distinct context
- e.relativeDepth--; // record fact that current context got
- // traversed
- currentAlignment= currentAlignment.enclosing; // pop
- // currentLocation
- throw e; // rethrow
- }
- // reset scribe/scanner to restart at this given location
- resetAt(currentAlignment.location);
- scanner.resetTo(currentAlignment.location.inputOffset, scanner.eofPosition - 1);
- // clean alignment chunkKind so it will think it is a new chunk again
- currentAlignment.chunkKind= 0;
- }
-
- void redoMemberAlignment(AlignmentException e) {
- // reset scribe/scanner to restart at this given location
- resetAt(memberAlignment.location);
- scanner.resetTo(memberAlignment.location.inputOffset, scanner.eofPosition - 1);
- // clean alignment chunkKind so it will think it is a new chunk again
- memberAlignment.chunkKind= 0;
- }
-
- public void reset() {
- checkLineWrapping= true;
- line= 0;
- column= 1;
- editsIndex= 0;
- }
-
- private void resetAt(Location location) {
- line= location.outputLine;
- column= location.outputColumn;
- indentationLevel= location.outputIndentationLevel;
- numberOfIndentations= location.numberOfIndentations;
- lastNumberOfNewLines= location.lastNumberOfNewLines;
- needSpace= location.needSpace;
- pendingSpace= location.pendingSpace;
- editsIndex= location.editsIndex;
- if (editsIndex > 0) {
- edits[editsIndex - 1]= location.textEdit;
- }
- }
-
- private void resize() {
- System.arraycopy(edits, 0, (edits= new OptimizedReplaceEdit[editsIndex * 2]), 0, editsIndex);
- }
-
- public void space() {
- if (!needSpace)
- return;
- lastNumberOfNewLines= 0;
- pendingSpace= true;
- column++;
- needSpace= false;
- }
-
- public String toString() {
- StringBuffer stringBuffer= new StringBuffer();
- stringBuffer.append("(page width = " + pageWidth + ") - (tabChar = ");//$NON-NLS-1$//$NON-NLS-2$
- switch (tabChar) {
- case DefaultCodeFormatterOptions.TAB:
- stringBuffer.append("TAB");//$NON-NLS-1$
- break;
- case DefaultCodeFormatterOptions.SPACE:
- stringBuffer.append("SPACE");//$NON-NLS-1$
- break;
- default:
- stringBuffer.append("MIXED");//$NON-NLS-1$
- }
- stringBuffer
- .append(") - (tabSize = " + tabLength + ")")//$NON-NLS-1$//$NON-NLS-2$
- .append(lineSeparator)
- .append(
- "(line = " + line + ") - (column = " + column + ") - (identationLevel = " + indentationLevel + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- .append(lineSeparator)
- .append(
- "(needSpace = " + needSpace + ") - (lastNumberOfNewLines = " + lastNumberOfNewLines + ") - (checkLineWrapping = " + checkLineWrapping + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- .append(lineSeparator).append(
- "==================================================================================") //$NON-NLS-1$
- .append(lineSeparator);
- printRule(stringBuffer);
- return stringBuffer.toString();
- }
-
- public void unIndent() {
- indentationLevel-= indentationSize;
- numberOfIndentations--;
- }
-
- /**
- */
- public void printModifiers() {
- boolean isFirstModifier= true;
- int currentTokenStartPosition= scanner.getCurrentPosition();
- boolean hasComment= false;
- while ((currentToken= scanner.nextToken()) != null) {
- switch (currentToken.type) {
- case Token.t_typedef:
- case Token.t_extern:
- case Token.t_static:
- case Token.t_auto:
- case Token.t_register:
- case Token.t_const:
- case Token.t_signed:
- case Token.t_unsigned:
- case Token.t_volatile:
- case Token.t_virtual:
- case Token.t_mutable:
- case Token.t_explicit:
- case Token.t_friend:
- case Token.t_inline:
- case Token.t_restrict:
- print(currentToken.getLength(), !isFirstModifier);
- isFirstModifier= false;
- currentTokenStartPosition= scanner.getCurrentPosition();
- break;
- case Token.tBLOCKCOMMENT:
- printBlockComment(false);
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasComment= true;
- break;
- case Token.tLINECOMMENT:
- printCommentLine();
- currentTokenStartPosition= scanner.getCurrentPosition();
- break;
- case Token.tWHITESPACE:
- addDeleteEdit(scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition());
- int count= 0;
- char[] whiteSpaces= scanner.getCurrentTokenSource();
- for (int i= 0, max= whiteSpaces.length; i < max; i++) {
- switch (whiteSpaces[i]) {
- case '\r':
- if ((i + 1) < max) {
- if (whiteSpaces[i + 1] == '\n') {
- i++;
- }
- }
- count++;
- break;
- case '\n':
- count++;
- }
- }
- if (count >= 1 && hasComment) {
- printNewLine();
- }
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasComment= false;
- break;
- case Token.tPREPROCESSOR:
- case Token.tPREPROCESSOR_DEFINE:
- case Token.tPREPROCESSOR_INCLUDE:
- if (column != 1)
- printNewLine(scanner.getCurrentTokenStartPosition());
- printPreprocessorDirective();
- printNewLine();
- currentTokenStartPosition= scanner.getCurrentPosition();
- hasComment= false;
- break;
- default:
- // step back one token
- scanner.resetTo(currentTokenStartPosition, scannerEndPosition - 1);
- return;
- }
- }
- }
-
- /**
- * Skip to the next occurrence of the given token type.
- * If successful, the next token will be the epxected token,
- * otherwise the scanner position is left unchanged.
- *
- * @param expectedTokenType
- * @return <code>true</code> if a matching token was skipped to
- */
- public boolean skipToToken(int expectedTokenType) {
- int skipStart= scanner.getCurrentPosition();
- int braceLevel= 0;
- int parenLevel= 0;
- while ((currentToken= scanner.nextToken()) != null) {
- switch (currentToken.type) {
- case Token.tLBRACE:
- if (expectedTokenType != Token.tLBRACE) {
- ++braceLevel;
- }
- break;
- case Token.tRBRACE:
- --braceLevel;
- break;
- case Token.tLPAREN:
- if (expectedTokenType != Token.tLPAREN) {
- ++parenLevel;
- }
- break;
- case Token.tRPAREN:
- --parenLevel;
- break;
- case Token.tWHITESPACE:
- case Token.tLINECOMMENT:
- case Token.tBLOCKCOMMENT:
- case Token.tPREPROCESSOR:
- case Token.tPREPROCESSOR_DEFINE:
- case Token.tPREPROCESSOR_INCLUDE:
- continue;
- }
- if (braceLevel <= 0 && parenLevel <= 0) {
- if (currentToken.type == expectedTokenType) {
- int tokenStart= scanner.getCurrentTokenStartPosition();
- printRaw(skipStart, tokenStart - skipStart);
- scanner.resetTo(tokenStart, scannerEndPosition - 1);
- return true;
- }
- }
- if (braceLevel < 0 || parenLevel < 0) {
- break;
- }
- }
- scanner.resetTo(skipStart, scannerEndPosition - 1);
- return false;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java
deleted file mode 100644
index f5bafbc26a3..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter.align;
-
-import org.eclipse.cdt.internal.formatter.Location;
-import org.eclipse.cdt.internal.formatter.Scribe;
-
-
-/**
- * Alignment management
- *
- * @since 4.0
- */
-public class Alignment {
-
- // name of alignment
- public String name;
-
- // link to enclosing alignment
- public Alignment enclosing;
-
- // start location of this alignment
- public Location location;
-
- // indentation management
- public int fragmentIndex;
- public int fragmentCount;
- public int[] fragmentIndentations;
- public boolean needRedoColumnAlignment;
-
- // chunk management
- public int chunkStartIndex;
- public int chunkKind;
-
- // break management
- public int originalIndentationLevel;
- public int breakIndentationLevel;
- public int shiftBreakIndentationLevel;
- public int[] fragmentBreaks;
- public boolean wasSplit;
-
- public Scribe scribe;
-
- /*
- * Alignment modes
- */
- public static final int M_FORCE = 1; // if bit set, then alignment will be non-optional (default is optional)
- public static final int M_INDENT_ON_COLUMN = 2; // if bit set, broken fragments will be aligned on current location column (default is to break at current indentation level)
- public static final int M_INDENT_BY_ONE = 4; // if bit set, broken fragments will be indented one level below current (not using continuation indentation)
-
- // split modes can be combined either with M_FORCE or M_INDENT_ON_COLUMN
-
- /** foobar(#fragment1, #fragment2, <ul>
- * <li> #fragment3, #fragment4 </li>
- * </ul>
- */
- public static final int M_COMPACT_SPLIT = 16; // fill each line with all possible fragments
-
- /** foobar(<ul>
- * <li> #fragment1, #fragment2, </li>
- * <li> #fragment5, #fragment4, </li>
- * </ul>
- */
- public static final int M_COMPACT_FIRST_BREAK_SPLIT = 32; // compact mode, but will first try to break before first fragment
-
- /** foobar(<ul>
- * <li> #fragment1, </li>
- * <li> #fragment2, </li>
- * <li> #fragment3 </li>
- * <li> #fragment4, </li>
- * </ul>
- */
- public static final int M_ONE_PER_LINE_SPLIT = 32+16; // one fragment per line
-
- /**
- * foobar(<ul>
- * <li> #fragment1, </li>
- * <li> #fragment2, </li>
- * <li> #fragment3, </li>
- * <li> #fragment4, </li>
- * </ul>
- */
- public static final int M_NEXT_SHIFTED_SPLIT = 64; // one fragment per line, subsequent are indented further
-
- /** foobar(#fragment1, <ul>
- * <li> #fragment2, </li>
- * <li> #fragment3 </li>
- * <li> #fragment4, </li>
- * </ul>
- */
- public static final int M_NEXT_PER_LINE_SPLIT = 64+16; // one per line, except first fragment (if possible)
-
- //64+32
- //64+32+16
-
- // mode controlling column alignments
- /**
- * <table BORDER COLS=4 WIDTH="100%" >
- * <tr><td>#fragment1A</td> <td>#fragment2A</td> <td>#fragment3A</td> <td>#very-long-fragment4A</td></tr>
- * <tr><td>#fragment1B</td> <td>#long-fragment2B</td> <td>#fragment3B</td> <td>#fragment4B</td></tr>
- * <tr><td>#very-long-fragment1C</td> <td>#fragment2C</td> <td>#fragment3C</td> <td>#fragment4C</td></tr>
- * </table>
- */
- public static final int M_MULTICOLUMN = 256; // fragments are on same line, but multiple line of fragments will be aligned vertically
-
- public static final int M_NO_ALIGNMENT = 0;
-
- public int mode;
-
- public static final int SPLIT_MASK = M_ONE_PER_LINE_SPLIT | M_NEXT_SHIFTED_SPLIT | M_COMPACT_SPLIT | M_COMPACT_FIRST_BREAK_SPLIT | M_NEXT_PER_LINE_SPLIT;
-
- // alignment tie-break rules - when split is needed, will decide whether innermost/outermost alignment is to be chosen
- public static final int R_OUTERMOST = 1;
- public static final int R_INNERMOST = 2;
- public int tieBreakRule;
-
- // alignment effects on a per fragment basis
- public static int NONE = 0;
- public static int BREAK = 1;
-
- // chunk kind
- public static final int CHUNK_FIELD = 1;
- public static final int CHUNK_METHOD = 2;
- public static final int CHUNK_TYPE = 3;
- public static final int CHUNK_ENUM = 4;
-
- // location to align and break on.
- public Alignment(String name, int mode, int tieBreakRule, Scribe scribe, int fragmentCount, int sourceRestart, int continuationIndent){
-
- this.name = name;
- this.location = new Location(scribe, sourceRestart);
- this.mode = mode;
- this.tieBreakRule = tieBreakRule;
- this.fragmentCount = fragmentCount;
- this.scribe = scribe;
- this.originalIndentationLevel = this.scribe.indentationLevel;
- this.wasSplit = false;
-
- // initialize the break indentation level, using modes and continuationIndentationLevel preference
- final int indentSize = this.scribe.indentationSize;
- int currentColumn = this.location.outputColumn;
- if (currentColumn == 1) {
- currentColumn = this.location.outputIndentationLevel + 1;
- }
-
- if ((mode & M_INDENT_ON_COLUMN) != 0) {
- // indent broken fragments at next indentation level, based on current column
- this.breakIndentationLevel = this.scribe.getNextIndentationLevel(currentColumn);
- if (this.breakIndentationLevel == this.location.outputIndentationLevel) {
- this.breakIndentationLevel += (continuationIndent * indentSize);
- }
- } else if ((mode & M_INDENT_BY_ONE) != 0) {
- // indent broken fragments exactly one level deeper than current indentation
- this.breakIndentationLevel = this.location.outputIndentationLevel + indentSize;
- } else {
- this.breakIndentationLevel = this.location.outputIndentationLevel + continuationIndent * indentSize;
- }
- this.shiftBreakIndentationLevel = this.breakIndentationLevel + indentSize;
-
- this.fragmentIndentations = new int[this.fragmentCount];
- this.fragmentBreaks = new int[this.fragmentCount];
-
- // check for forced alignments
- if ((this.mode & M_FORCE) != 0) {
- couldBreak();
- }
- }
-
- public boolean checkChunkStart(int kind, int startIndex, int sourceRestart) {
- if (this.chunkKind != kind) {
- this.chunkKind = kind;
-
- // when redoing same chunk alignment, must not reset
- if (startIndex != this.chunkStartIndex) {
- this.chunkStartIndex = startIndex;
- this.location.update(this.scribe, sourceRestart);
- reset();
- }
- return true;
- }
- return false;
- }
-
- public void checkColumn() {
- if ((this.mode & M_MULTICOLUMN) != 0) {
- int currentIndentation = this.scribe.getNextIndentationLevel(this.scribe.column+(this.scribe.needSpace ? 1 : 0));
- int fragmentIndentation = this.fragmentIndentations[this.fragmentIndex];
- if (currentIndentation > fragmentIndentation) {
- this.fragmentIndentations[this.fragmentIndex] = currentIndentation;
- if (fragmentIndentation != 0) {
- for (int i = this.fragmentIndex+1; i < this.fragmentCount; i++) {
- this.fragmentIndentations[i] = 0;
- }
- this.needRedoColumnAlignment = true;
- }
- }
- // backtrack only once all fragments got checked
- if (this.needRedoColumnAlignment && this.fragmentIndex == this.fragmentCount-1) { // alignment too small
-
-// if (CodeFormatterVisitor.DEBUG){
-// System.out.println("ALIGNMENT TOO SMALL");
-// System.out.println(this);
-// }
- this.needRedoColumnAlignment = false;
- int relativeDepth = 0;
- Alignment targetAlignment = this.scribe.memberAlignment;
- while (targetAlignment != null){
- if (targetAlignment == this){
- throw new AlignmentException(AlignmentException.ALIGN_TOO_SMALL, relativeDepth);
- }
- targetAlignment = targetAlignment.enclosing;
- relativeDepth++;
- }
- }
- }
- }
-
- public boolean couldBreak(){
- int i;
- switch(mode & SPLIT_MASK){
-
- /* # aligned fragment
- * foo(
- * #AAAAA, #BBBBB,
- * #CCCC);
- */
- case M_COMPACT_FIRST_BREAK_SPLIT :
- if (this.fragmentBreaks[0] == NONE) {
- this.fragmentBreaks[0] = BREAK;
- this.fragmentIndentations[0] = this.breakIndentationLevel;
- return wasSplit = true;
- }
- i = this.fragmentIndex;
- do {
- if (this.fragmentBreaks[i] == NONE) {
- this.fragmentBreaks[i] = BREAK;
- this.fragmentIndentations[i] = this.breakIndentationLevel;
- return wasSplit = true;
- }
- } while (--i >= 0);
- break;
- /* # aligned fragment
- * foo(#AAAAA, #BBBBB,
- * #CCCC);
- */
- case M_COMPACT_SPLIT :
- i = this.fragmentIndex;
- do {
- if (this.fragmentBreaks[i] == NONE) {
- this.fragmentBreaks[i] = BREAK;
- this.fragmentIndentations[i] = this.breakIndentationLevel;
- return wasSplit = true;
- }
- } while (--i >= 0);
- break;
-
- /* # aligned fragment
- * foo(
- * #AAAAA,
- * #BBBBB,
- * #CCCC);
- */
- case M_NEXT_SHIFTED_SPLIT :
- if (this.fragmentBreaks[0] == NONE) {
- this.fragmentBreaks[0] = BREAK;
- this.fragmentIndentations[0] = this.breakIndentationLevel;
- for (i = 1; i < this.fragmentCount; i++){
- this.fragmentBreaks[i] = BREAK;
- this.fragmentIndentations[i] = this.shiftBreakIndentationLevel;
- }
- return wasSplit = true;
- }
- break;
-
- /* # aligned fragment
- * foo(
- * #AAAAA,
- * #BBBBB,
- * #CCCC);
- */
- case M_ONE_PER_LINE_SPLIT :
- if (this.fragmentBreaks[0] == NONE) {
- for (i = 0; i < this.fragmentCount; i++){
- this.fragmentBreaks[i] = BREAK;
- this.fragmentIndentations[i] = this.breakIndentationLevel;
- }
- return wasSplit = true;
- }
- /* # aligned fragment
- * foo(#AAAAA,
- * #BBBBB,
- * #CCCC);
- */
- case M_NEXT_PER_LINE_SPLIT :
- if (this.fragmentBreaks[0] == NONE) {
- if (this.fragmentCount > 1
- && this.fragmentBreaks[1] == NONE) {
- if ((this.mode & M_INDENT_ON_COLUMN) != 0) {
- this.fragmentIndentations[0] = this.breakIndentationLevel;
- }
- for (i = 1; i < this.fragmentCount; i++) {
- this.fragmentBreaks[i] = BREAK;
- this.fragmentIndentations[i] = this.breakIndentationLevel;
- }
- return wasSplit = true;
- }
- }
- break;
- }
- return false; // cannot split better
- }
-
- public Alignment getAlignment(String targetName) {
-
- if (targetName.equals(this.name)) return this;
- if (this.enclosing == null) return null;
-
- return this.enclosing.getAlignment(targetName);
- }
-
- // perform alignment effect for current fragment
- public void performFragmentEffect(){
- if ((this.mode & M_MULTICOLUMN) == 0) {
- switch(this.mode & SPLIT_MASK) {
- case Alignment.M_COMPACT_SPLIT :
- case Alignment.M_COMPACT_FIRST_BREAK_SPLIT :
- case Alignment.M_NEXT_PER_LINE_SPLIT :
- case Alignment.M_NEXT_SHIFTED_SPLIT :
- case Alignment.M_ONE_PER_LINE_SPLIT :
- break;
- default:
- return;
- }
- }
-
- if (this.fragmentBreaks[this.fragmentIndex] == BREAK) {
- this.scribe.startNewLine();
- }
- if (this.fragmentIndentations[this.fragmentIndex] > 0) {
- this.scribe.indentationLevel = this.fragmentIndentations[this.fragmentIndex];
- }
- }
-
- // reset fragment indentation/break status
- public void reset() {
-
- if (fragmentCount > 0){
- this.fragmentIndentations = new int[this.fragmentCount];
- this.fragmentBreaks = new int[this.fragmentCount];
- }
-
- // check for forced alignments
- if ((mode & M_FORCE) != 0) {
- couldBreak();
- }
- }
-
- public void toFragmentsString(StringBuffer buffer){
- // default implementation
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer(10);
- buffer
- .append(getClass().getName())
- .append(':')
- .append("<name: ") //$NON-NLS-1$
- .append(this.name)
- .append(">"); //$NON-NLS-1$
- if (this.enclosing != null) {
- buffer
- .append("<enclosingName: ") //$NON-NLS-1$
- .append(this.enclosing.name)
- .append('>');
- }
- buffer.append('\n');
-
- for (int i = 0; i < this.fragmentCount; i++){
- buffer
- .append(" - fragment ") //$NON-NLS-1$
- .append(i)
- .append(": ") //$NON-NLS-1$
- .append("<break: ") //$NON-NLS-1$
- .append(this.fragmentBreaks[i] > 0 ? "YES" : "NO") //$NON-NLS-1$ //$NON-NLS-2$
- .append(">") //$NON-NLS-1$
- .append("<indent: ") //$NON-NLS-1$
- .append(this.fragmentIndentations[i])
- .append(">\n"); //$NON-NLS-1$
- }
- buffer.append('\n');
- return buffer.toString();
- }
-
- public void update() {
- for (int i = 1; i < this.fragmentCount; i++){
- if (this.fragmentBreaks[i] == BREAK) {
- this.fragmentIndentations[i] = this.breakIndentationLevel;
- }
- }
- }
-
- public boolean isWrapped() {
- for (int i = 0, max = this.fragmentCount; i < max; i++) {
- if (this.fragmentBreaks[i] == BREAK) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/AlignmentException.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/AlignmentException.java
deleted file mode 100644
index 53aca7fc940..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/AlignmentException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter.align;
-
-/**
- * Exception used to backtrack and break available alignments
- * When the exception is thrown, it is assumed that some alignment will be changed.
- *
- * @since 4.0
- */
-public class AlignmentException extends RuntimeException {
-
- private static final long serialVersionUID= -1081237230006524966L;
- public static final int LINE_TOO_LONG = 1;
- public static final int ALIGN_TOO_SMALL = 2;
-
- int reason;
- int value;
- public int relativeDepth;
-
- public AlignmentException(int reason, int relativeDepth) {
- this(reason, 0, relativeDepth);
- }
-
- public AlignmentException(int reason, int value, int relativeDepth) {
- this.reason = reason;
- this.value = value;
- this.relativeDepth = relativeDepth;
- }
-
- public String toString(){
- StringBuffer buffer = new StringBuffer(10);
- switch(this.reason){
- case LINE_TOO_LONG :
- buffer.append("LINE_TOO_LONG"); //$NON-NLS-1$
- break;
- case ALIGN_TOO_SMALL :
- buffer.append("ALIGN_TOO_SMALL"); //$NON-NLS-1$
- break;
- }
- buffer
- .append("<relativeDepth: ") //$NON-NLS-1$
- .append(this.relativeDepth)
- .append(">\n"); //$NON-NLS-1$
- return buffer.toString();
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Scanner.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Scanner.java
deleted file mode 100644
index b9b8d2a2b73..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Scanner.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Anton Leherbauer (Wind River Systems) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter.scanner;
-
-import java.io.CharArrayReader;
-import java.io.Reader;
-
-import org.eclipse.cdt.internal.core.CharOperation;
-
-/**
- * A scanner operating on a character array and allowing to reposition the scanner.
- *
- * @since 4.0
- */
-public class Scanner extends SimpleScanner {
-
- public char[] source;
- public int eofPosition;
- public int startPosition;
-
- public Scanner() {
- setReuseToken(true);
- setSplitPreprocessor(false);
- }
-
- /*
- * @see org.eclipse.cdt.internal.formatter.scanner.SimpleScanner#init(java.io.Reader, java.lang.String)
- */
- protected void init(Reader reader, String filename) {
- // not allowed
- throw new UnsupportedOperationException();
- }
-
- /**
- * Set the source text as character array.
- *
- * @param source the source text
- */
- public void setSource(char[] source) {
- this.source= source;
- fContext= new ScannerContext().initialize(new CharArrayReader(source));
- startPosition= -1;
- eofPosition= source.length;
- }
-
- /**
- * Reset scanner to given inclusive start and end offsets
- * @param start inclusive start offset
- * @param end inclusive end offset
- */
- public void resetTo(int start, int end) {
- Reader reader;
- if (end >= source.length-1) {
- reader= new CharArrayReader(source);
- } else {
- reader= new CharArrayReader(source, 0, Math.min(source.length, end+1));
- }
- fContext= new ScannerContext().initialize(reader, start);
- startPosition= start;
- if (source != null && source.length < end) {
- eofPosition = source.length;
- } else {
- eofPosition = end < Integer.MAX_VALUE ? end + 1 : end;
- }
- }
-
- /**
- * Get the start offset of the current token.
- * @return the start offset of the current token
- */
- public int getCurrentTokenStartPosition() {
- return fCurrentToken.offset;
- }
-
- /**
- * Get the inclusive end offset of the current token.
- * @return the inclusive end offset of the current token
- */
- public int getCurrentTokenEndPosition() {
- return getCurrentPosition() - 1;
- }
-
- /**
- * Get the current scanner offset.
- * @return the current scanner offset
- */
- public int getCurrentPosition() {
- return fContext.getOffset() - fContext.undoStackSize();
- }
-
- /**
- * Get the next character.
- * @return the next character
- */
- public int getNextChar() {
- return getChar();
- }
-
- /**
- * Move to next character iff it is equal to the given expected character.
- * If the characters do not match, the sanner does not move forward.
- *
- * @param c the expected character
- * @return <code>true</code> if the next character was the expected character
- */
- public boolean getNextChar(char c) {
- if (c == getChar()) {
- return true;
- }
- ungetChar(c);
- return false;
- }
-
- /**
- * Set current scanner offset to given offset.
- *
- * @param nextCharacterStart the desired scanner offset
- */
- public void setCurrentPosition(int nextCharacterStart) {
- int currentPos= getCurrentPosition();
- int diff= currentPos - nextCharacterStart;
- if (diff < 0) {
- do {
- getChar();
- ++diff;
- } while(diff < 0);
- } else if (diff == 0) {
- // no-op
- } else if (diff > fTokenBuffer.length()) {
- resetTo(nextCharacterStart, source.length - 1);
- } else /* if (diff <= fTokenBuffer.length()) */ {
- while(diff > 0) {
- if (fTokenBuffer.length() > 0) {
- ungetChar(fTokenBuffer.charAt(fTokenBuffer.length() - 1));
- }
- --diff;
- }
- }
- }
-
- /**
- * Get the text of the current token as a character array.
- * @return the token text
- */
- public char[] getCurrentTokenSource() {
- return fCurrentToken.getText().toCharArray();
- }
-
- /**
- * Get the next token as token type constant.
- *
- * @return the next token type
- */
- public int getNextToken() {
- Token token= nextToken();
- if (token == null) {
- return -1;
- }
- return token.type;
- }
-
- /**
- * For debugging purposes.
- */
- public String toString() {
- if (this.startPosition == this.source.length)
- return "EOF\n\n" + new String(this.source); //$NON-NLS-1$
- if (this.getCurrentPosition() > this.source.length)
- return "behind the EOF\n\n" + new String(this.source); //$NON-NLS-1$
-
- char front[] = new char[this.startPosition];
- System.arraycopy(this.source, 0, front, 0, this.startPosition);
-
- int middleLength = (this.getCurrentPosition() - 1) - this.startPosition + 1;
- char middle[];
- if (middleLength > -1) {
- middle = new char[middleLength];
- System.arraycopy(
- this.source,
- this.startPosition,
- middle,
- 0,
- middleLength);
- } else {
- middle = CharOperation.NO_CHAR;
- }
-
- char end[] = new char[this.source.length - (this.getCurrentPosition() - 1)];
- System.arraycopy(
- this.source,
- (this.getCurrentPosition() - 1) + 1,
- end,
- 0,
- this.source.length - (this.getCurrentPosition() - 1) - 1);
-
- return new String(front)
- + "\n===============================\nStarts here -->" //$NON-NLS-1$
- + new String(middle)
- + "<-- Ends here\n===============================\n" //$NON-NLS-1$
- + new String(end);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/ScannerContext.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/ScannerContext.java
deleted file mode 100644
index 1909a5e90aa..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/ScannerContext.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial implementation
- * Anton Leherbauer - adding tokens for preprocessing directives
- * Markus Schorn - classification of preprocessing directives.
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter.scanner;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Stack;
-
-public class ScannerContext {
- private Reader fReader;
- private int fOffset;
- private Stack fUndo = new Stack();
-
- public ScannerContext() {
- }
- public ScannerContext initialize(Reader r) {
- fReader = r;
- fOffset = 0;
- return this;
- }
- public ScannerContext initialize(Reader r, int offset) {
- try {
- r.skip(offset);
- } catch (IOException exc) {
- throw new RuntimeException(exc);
- }
- fReader = r;
- fOffset = offset;
- return this;
- }
-
- public int read() throws IOException {
- ++fOffset;
- return fReader.read();
- }
-
- /**
- * Returns the offset.
- * @return int
- */
- public final int getOffset() {
- return fOffset;
- }
-
- /**
- * Returns the reader.
- * @return Reader
- */
- public final Reader getReader() {
- return fReader;
- }
-
- public final int undoStackSize() {
- return fUndo.size();
- }
-
- /**
- * Returns the undo.
- * @return int
- */
- public final int popUndo() {
- return ((Integer)fUndo.pop()).intValue();
- }
-
- /**
- * Sets the undo.
- * @param undo The undo to set
- */
- public void pushUndo(int undo) {
- this.fUndo.push(new Integer(undo));
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/SimpleScanner.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/SimpleScanner.java
deleted file mode 100644
index 18088896d2d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/SimpleScanner.java
+++ /dev/null
@@ -1,861 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial implementation
- * Anton Leherbauer - adding tokens for preprocessing directives
- * Markus Schorn - classification of preprocessing directives.
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter.scanner;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.HashMap;
-
-/**
- * A C/C++ lexical scanner, which does no preprocessing,
- * but tokenizes preprocessor directives, whitespace and comments.
- *
- * @since 4.0
- */
-public class SimpleScanner {
-
- private static final int EOFCHAR= -1;
- protected static HashMap fgKeywords= new HashMap();
-
- protected Token fCurrentToken;
- protected ScannerContext fContext;
- protected StringBuffer fTokenBuffer= new StringBuffer();
- private int fPreprocessorToken= 0;
- private boolean fReuseToken;
- private boolean fSplitPreprocessor;
-
- /**
- *
- */
- public SimpleScanner() {
- super();
- }
-
- public void setReuseToken(boolean val) {
- fReuseToken= val;
- if (val) {
- fCurrentToken= new Token(0, null);
- }
- }
-
- public void setSplitPreprocessor(boolean val) {
- fSplitPreprocessor= val;
- }
-
- protected void init(Reader reader, String filename) {
- fReuseToken= false;
- fSplitPreprocessor= true;
- fPreprocessorToken= 0;
- fContext = new ScannerContext().initialize(reader);
- }
-
- public SimpleScanner initialize(Reader reader, String filename) {
- init(reader, filename);
- return this;
- }
-
- public void cleanup() {
- fContext= null;
- fTokenBuffer= new StringBuffer();
- fCurrentToken= null;
- }
-
- private final void setCurrentToken(Token t) {
- fCurrentToken = t;
- }
-
- private final Token newToken(int t) {
- if (!fReuseToken) {
- setCurrentToken(new Token(t, fTokenBuffer.toString(), fContext));
- }
- else {
- fCurrentToken.set(t, fTokenBuffer.toString(), fContext);
- }
- return fCurrentToken;
- }
-
- private Token newPreprocessorToken() {
- if (fPreprocessorToken==0) {
- fPreprocessorToken= categorizePreprocessor(fTokenBuffer);
- }
- return newToken(fPreprocessorToken);
- }
-
- private int categorizePreprocessor(StringBuffer text) {
- boolean skipHash= true;
- int i=0;
- for (; i < text.length(); i++) {
- char c= text.charAt(i);
- if (!Character.isWhitespace(c)) {
- if (!skipHash) {
- break;
- }
- skipHash= false;
- if (c != '#') {
- break;
- }
- }
- }
- String innerText= text.substring(i);
- if (innerText.startsWith("include")) { //$NON-NLS-1$
- return Token.tPREPROCESSOR_INCLUDE;
- }
- if (innerText.startsWith("define")) { //$NON-NLS-1$
- return Token.tPREPROCESSOR_DEFINE;
- }
- if (innerText.startsWith("undef")) { //$NON-NLS-1$
- return Token.tPREPROCESSOR_DEFINE;
- }
- return Token.tPREPROCESSOR;
- }
-
- protected final int getChar() {
- return getChar(false);
- }
-
- private int getChar(boolean insideString) {
- int c = EOFCHAR;
-
- if (fContext.undoStackSize() != 0) {
- c = fContext.popUndo();
- } else {
- try {
- c = fContext.read();
- } catch (IOException e) {
- c = EOFCHAR;
- }
- }
-
- fTokenBuffer.append((char) c);
-
- if (!insideString && c == '\\') {
- c = getChar(false);
- if (c == '\r') {
- c = getChar(false);
- if (c == '\n') {
- c = getChar(false);
- }
- } else if (c == '\n') {
- c = getChar(false);
- }
- }
-
- return c;
- }
-
- protected void ungetChar(int c) {
- fTokenBuffer.deleteCharAt(fTokenBuffer.length() - 1);
- fContext.pushUndo(c);
- }
-
- public Token nextToken() {
- fTokenBuffer.setLength(0);
-
- boolean madeMistake = false;
- int c = getChar();
-
- while (c != EOFCHAR) {
- if (fPreprocessorToken != 0) {
- Token token= continuePPDirective(c);
- if (token != null) {
- return token;
- }
- }
-
- if ((c == ' ') || (c == '\r') || (c == '\t') || (c == '\n')) {
- while ((c == ' ') || (c == '\r') || (c == '\t') || (c == '\n')) {
- c = getChar();
- }
- ungetChar(c);
- return newToken(Token.tWHITESPACE);
- } else if (c == '"' || (c == 'L' && !madeMistake)) {
-
- boolean wideString = false;
- if (c == 'L') {
- int oldChar = c;
- c = getChar();
- if (c != '"') {
- // we have made a mistake
- ungetChar(c);
- c = oldChar;
- madeMistake = true;
- continue;
- } else {
- wideString = true;
- }
- }
-
- matchStringLiteral();
- int type = wideString ? Token.tLSTRING : Token.tSTRING;
- return newToken(type);
-
- } else if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) | (c == '_')) {
-
- madeMistake = false;
-
- c = getChar();
-
- while (((c >= 'a') && (c <= 'z'))
- || ((c >= 'A') && (c <= 'Z'))
- || ((c >= '0') && (c <= '9'))
- || (c == '_')) {
- c = getChar();
- }
-
- ungetChar(c);
-
- String ident = fTokenBuffer.toString();
-
- Object tokenTypeObject;
-
- tokenTypeObject = fgKeywords.get(ident);
-
- int tokenType = Token.tIDENTIFIER;
- if (tokenTypeObject != null)
- tokenType = ((Integer)tokenTypeObject).intValue();
-
- return newToken(tokenType);
-
- } else if ((c >= '0') && (c <= '9') || c == '.') {
-
- boolean hex = false;
- boolean floatingPoint = c == '.';
- boolean firstCharZero = c == '0';
-
- c = getChar();
-
- if (c == 'x') {
- if (!firstCharZero && floatingPoint) {
- ungetChar(c);
- return newToken(Token.tDOT);
- }
- hex = true;
- c = getChar();
- }
-
- while ((c >= '0' && c <= '9') || (hex && ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')))) {
- c = getChar();
- }
-
- if (c == '.') {
- if (floatingPoint || hex) {
- if (fTokenBuffer.toString().equals("..") && getChar() == '.') //$NON-NLS-1$
- return newToken(Token.tELIPSE);
- }
-
- floatingPoint = true;
- c = getChar();
- while ((c >= '0' && c <= '9')) {
- c = getChar();
- }
- }
-
- if (c == 'e' || c == 'E') {
- if (!floatingPoint)
- floatingPoint = true;
- // exponent type for floating point
- c = getChar();
-
- // optional + or -
- if (c == '+' || c == '-') {
- c = getChar();
- }
-
- // digit sequence of exponent part
- while ((c >= '0' && c <= '9')) {
- c = getChar();
- }
-
- // optional suffix
- if (c == 'l' || c == 'L' || c == 'f' || c == 'F') {
- c = getChar();
- }
- } else {
- if (floatingPoint) {
- //floating-suffix
- if (c == 'l' || c == 'L' || c == 'f' || c == 'F') {
- c = getChar();
- }
- } else {
- //integer suffix
- if (c == 'u' || c == 'U') {
- c = getChar();
- if (c == 'l' || c == 'L')
- c = getChar();
- } else if (c == 'l' || c == 'L') {
- c = getChar();
- if (c == 'u' || c == 'U')
- c = getChar();
- }
- }
- }
-
- ungetChar(c);
-
- int tokenType;
- String result = fTokenBuffer.toString();
-
- if (floatingPoint && result.equals(".")) //$NON-NLS-1$
- tokenType = Token.tDOT;
- else
- tokenType = floatingPoint ? Token.tFLOATINGPT : Token.tINTEGER;
-
- return newToken(tokenType);
-
- } else if (c == '#') {
-
- return matchPPDirective();
-
- } else {
-
- switch (c) {
- case '\'':
- matchCharLiteral();
- return newToken(Token.tCHAR);
-
-
- case ':':
- c = getChar();
- if (c == ':') {
- return newToken(Token.tCOLONCOLON);
- } else {
- ungetChar(c);
- return newToken(Token.tCOLON);
- }
- case ';':
- return newToken(Token.tSEMI);
- case ',':
- return newToken(Token.tCOMMA);
- case '?':
- return newToken(Token.tQUESTION);
- case '(':
- return newToken(Token.tLPAREN);
- case ')':
- return newToken(Token.tRPAREN);
- case '[':
- return newToken(Token.tLBRACKET);
- case ']':
- return newToken(Token.tRBRACKET);
- case '{':
- return newToken(Token.tLBRACE);
- case '}':
- return newToken(Token.tRBRACE);
- case '+':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tPLUSASSIGN);
- case '+':
- return newToken(Token.tINCR);
- default:
- ungetChar(c);
- return newToken(Token.tPLUS);
- }
- case '-':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tMINUSASSIGN);
- case '-':
- return newToken(Token.tDECR);
- case '>':
- c = getChar();
- switch (c) {
- case '*':
- return newToken(Token.tARROWSTAR);
- default:
- ungetChar(c);
- return newToken(Token.tARROW);
- }
- default:
- ungetChar(c);
- return newToken(Token.tMINUS);
- }
- case '*':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tSTARASSIGN);
- default:
- ungetChar(c);
- return newToken(Token.tSTAR);
- }
- case '%':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tMODASSIGN);
- default:
- ungetChar(c);
- return newToken(Token.tMOD);
- }
- case '^':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tXORASSIGN);
- default:
- ungetChar(c);
- return newToken(Token.tXOR);
- }
- case '&':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tAMPERASSIGN);
- case '&':
- return newToken(Token.tAND);
- default:
- ungetChar(c);
- return newToken(Token.tAMPER);
- }
- case '|':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tBITORASSIGN);
- case '|':
- return newToken(Token.tOR);
- default:
- ungetChar(c);
- return newToken(Token.tBITOR);
- }
- case '~':
- return newToken(Token.tCOMPL);
- case '!':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tNOTEQUAL);
- default:
- ungetChar(c);
- return newToken(Token.tNOT);
- }
- case '=':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tEQUAL);
- default:
- ungetChar(c);
- return newToken(Token.tASSIGN);
- }
- case '<':
- c = getChar();
- switch (c) {
- case '<':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tSHIFTLASSIGN);
- default:
- ungetChar(c);
- return newToken(Token.tSHIFTL);
- }
- case '=':
- return newToken(Token.tLTEQUAL);
- default:
- ungetChar(c);
- return newToken(Token.tLT);
- }
- case '>':
- c = getChar();
- switch (c) {
- case '>':
- c = getChar();
- switch (c) {
- case '=':
- return newToken(Token.tSHIFTRASSIGN);
- default:
- ungetChar(c);
- return newToken(Token.tSHIFTR);
- }
- case '=':
- return newToken(Token.tGTEQUAL);
- default:
- ungetChar(c);
- return newToken(Token.tGT);
- }
- case '.':
- c = getChar();
- switch (c) {
- case '.':
- c = getChar();
- switch (c) {
- case '.':
- return newToken(Token.tELIPSE);
- default:
- break;
- }
- break;
- case '*':
- return newToken(Token.tDOTSTAR);
- default:
- ungetChar(c);
- return newToken(Token.tDOT);
- }
- break;
- case '/':
- c = getChar();
- switch (c) {
- case '/': {
- matchSinglelineComment();
- return newToken(Token.tLINECOMMENT);
- }
- case '*': {
- matchMultilineComment();
- return newToken(Token.tBLOCKCOMMENT);
- }
- case '=':
- return newToken(Token.tDIVASSIGN);
- default:
- ungetChar(c);
- return newToken(Token.tDIV);
- }
- default:
- // Bad character
- return newToken(Token.tBADCHAR);
- }
- // throw EOF;
- }
- }
-
- // we're done
- // throw EOF;
- return null;
- }
-
- private void matchCharLiteral() {
- int c;
- c = getChar(true);
- int next = getChar(true);
- if (c == '\\') {
- if (next >= '0' && next <= '7') {
- do {
- next = getChar(true);
- } while (next >= '0' && next <= '7');
- } else if (next == 'x' || next == 'X' || next == 'u' || next == 'U') {
- do {
- next = getChar(true);
- } while ((next >= '0' && next <= '9') || (next >= 'a' && next <= 'f')
- || (next >= 'A' && next <= 'F'));
- } else {
- next = getChar(true);
- }
- }
- if (next != '\'') {
- ungetChar(next);
- }
- }
-
- private void matchStringLiteral() {
- // string
- boolean escaped= false;
- int c = getChar(true);
-
- LOOP:
- for (;;) {
- if (c == EOFCHAR)
- break;
- if (escaped) {
- escaped= false;
- int nc= getChar(true);
- if (c=='\r' && nc=='\n') {
- nc= getChar(true);
- }
- c= nc;
- }
- else {
- switch(c) {
- case '\\':
- escaped= true;
- break;
- case '"':
- break LOOP;
- case '\r':
- case '\n':
- // unterminated string constant
- ungetChar(c);
- break LOOP;
- }
- c = getChar(true);
- }
- }
- }
-
- /**
- * Matches a preprocesser directive.
- *
- * @return a preprocessor token
- */
- private Token matchPPDirective() {
- if (!fSplitPreprocessor) {
- getRestOfPreprocessorLine();
- return newToken(Token.tPREPROCESSOR);
- }
- return continuePPDirective(getChar());
- }
-
- private Token continuePPDirective(int c) {
- boolean done= false;
- while (!done) {
- switch(c) {
- case '\'':
- if (fTokenBuffer.length() > 1) {
- if (fPreprocessorToken==0) {
- fPreprocessorToken= categorizePreprocessor(fTokenBuffer);
- }
- ungetChar(c);
- return newPreprocessorToken();
- }
- matchCharLiteral();
- return newToken(Token.tCHAR);
-
- case '"':
- if (fTokenBuffer.length() > 1) {
- if (fPreprocessorToken==0) {
- fPreprocessorToken= categorizePreprocessor(fTokenBuffer);
- }
- if (fPreprocessorToken==Token.tPREPROCESSOR_INCLUDE) {
- matchStringLiteral();
- c= getChar();
- break;
- }
- else {
- ungetChar(c);
- return newPreprocessorToken();
- }
- }
- matchStringLiteral();
- return newToken(Token.tSTRING);
- case '/': {
- int next = getChar();
- if (next == '/') {
- Token result= null;
- if (fTokenBuffer.length() > 2) {
- ungetChar(next);
- ungetChar(c);
- result= newPreprocessorToken();
- }
- else {
- matchSinglelineComment();
- result= newToken(Token.tLINECOMMENT);
- }
- fPreprocessorToken= 0;
- return result;
- }
- if (next == '*') {
- if (fTokenBuffer.length() > 2) {
- ungetChar(next);
- ungetChar(c);
- return newPreprocessorToken();
- }
- // multiline comment
- if (matchMultilineComment()) {
- fPreprocessorToken= 0;
- }
- return newToken(Token.tBLOCKCOMMENT);
- }
- c = next;
- break;
- }
- case '\n':
- case '\r':
- case EOFCHAR:
- done= true;
- break;
- default:
- c= getChar();
- break;
- }
- }
- ungetChar(c);
- Token result= null;
- if (fTokenBuffer.length() > 0) {
- result= newPreprocessorToken();
- }
- fPreprocessorToken= 0;
- return result;
- }
-
- /**
- * Read until end of preprocessor directive.
- */
- private void getRestOfPreprocessorLine() {
- int c = getChar();
- while (true) {
- while ((c != '\n') && (c != '\r') && (c != '/') && (c != EOFCHAR)) {
- c = getChar();
- }
- if (c == '/') {
- // we need to peek ahead at the next character to see if
- // this is a comment or not
- int next = getChar();
- if (next == '/') {
- // single line comment
- matchSinglelineComment();
- break;
- } else if (next == '*') {
- // multiline comment
- if (matchMultilineComment())
- break;
- else
- c = getChar();
- continue;
- } else {
- // we are not in a comment
- c = next;
- continue;
- }
- } else {
- ungetChar(c);
- break;
- }
- }
- }
-
- private void matchSinglelineComment() {
- int c = getChar();
- while (c != '\n' && c != EOFCHAR) {
- c = getChar();
- }
- if (c == EOFCHAR) {
- ungetChar(c);
- }
- }
-
- private boolean matchMultilineComment() {
- boolean encounteredNewline = false;
- int state = 0;
- int c = getChar();
- while (state != 2 && c != EOFCHAR) {
- if (c == '\n')
- encounteredNewline = true;
-
- switch (state) {
- case 0 :
- if (c == '*')
- state = 1;
- break;
- case 1 :
- if (c == '/')
- state = 2;
- else if (c != '*')
- state = 0;
- break;
- }
- c = getChar();
- }
- ungetChar(c);
- return encounteredNewline;
- }
-
-
- static {
- fgKeywords.put("and", new Integer(Token.t_and)); //$NON-NLS-1$
- fgKeywords.put("and_eq", new Integer(Token.t_and_eq)); //$NON-NLS-1$
- fgKeywords.put("asm", new Integer(Token.t_asm)); //$NON-NLS-1$
- fgKeywords.put("auto", new Integer(Token.t_auto)); //$NON-NLS-1$
- fgKeywords.put("bitand", new Integer(Token.t_bitand)); //$NON-NLS-1$
- fgKeywords.put("bitor", new Integer(Token.t_bitor)); //$NON-NLS-1$
- fgKeywords.put("bool", new Integer(Token.t_bool)); //$NON-NLS-1$
- fgKeywords.put("break", new Integer(Token.t_break)); //$NON-NLS-1$
- fgKeywords.put("case", new Integer(Token.t_case)); //$NON-NLS-1$
- fgKeywords.put("catch", new Integer(Token.t_catch)); //$NON-NLS-1$
- fgKeywords.put("char", new Integer(Token.t_char)); //$NON-NLS-1$
- fgKeywords.put("class", new Integer(Token.t_class)); //$NON-NLS-1$
- fgKeywords.put("compl", new Integer(Token.t_compl)); //$NON-NLS-1$
- fgKeywords.put("const", new Integer(Token.t_const)); //$NON-NLS-1$
- fgKeywords.put("const_cast", new Integer(Token.t_const_cast)); //$NON-NLS-1$
- fgKeywords.put("continue", new Integer(Token.t_continue)); //$NON-NLS-1$
- fgKeywords.put("default", new Integer(Token.t_default)); //$NON-NLS-1$
- fgKeywords.put("delete", new Integer(Token.t_delete)); //$NON-NLS-1$
- fgKeywords.put("do", new Integer(Token.t_do)); //$NON-NLS-1$
- fgKeywords.put("double", new Integer(Token.t_double)); //$NON-NLS-1$
- fgKeywords.put("dynamic_cast", new Integer(Token.t_dynamic_cast)); //$NON-NLS-1$
- fgKeywords.put("else", new Integer(Token.t_else)); //$NON-NLS-1$
- fgKeywords.put("enum", new Integer(Token.t_enum)); //$NON-NLS-1$
- fgKeywords.put("explicit", new Integer(Token.t_explicit)); //$NON-NLS-1$
- fgKeywords.put("export", new Integer(Token.t_export)); //$NON-NLS-1$
- fgKeywords.put("extern", new Integer(Token.t_extern)); //$NON-NLS-1$
- fgKeywords.put("false", new Integer(Token.t_false)); //$NON-NLS-1$
- fgKeywords.put("float", new Integer(Token.t_float)); //$NON-NLS-1$
- fgKeywords.put("for", new Integer(Token.t_for)); //$NON-NLS-1$
- fgKeywords.put("friend", new Integer(Token.t_friend)); //$NON-NLS-1$
- fgKeywords.put("goto", new Integer(Token.t_goto)); //$NON-NLS-1$
- fgKeywords.put("if", new Integer(Token.t_if)); //$NON-NLS-1$
- fgKeywords.put("inline", new Integer(Token.t_inline)); //$NON-NLS-1$
- fgKeywords.put("int", new Integer(Token.t_int)); //$NON-NLS-1$
- fgKeywords.put("long", new Integer(Token.t_long)); //$NON-NLS-1$
- fgKeywords.put("mutable", new Integer(Token.t_mutable)); //$NON-NLS-1$
- fgKeywords.put("namespace", new Integer(Token.t_namespace)); //$NON-NLS-1$
- fgKeywords.put("new", new Integer(Token.t_new)); //$NON-NLS-1$
- fgKeywords.put("not", new Integer(Token.t_not)); //$NON-NLS-1$
- fgKeywords.put("not_eq", new Integer(Token.t_not_eq)); //$NON-NLS-1$
- fgKeywords.put("operator", new Integer(Token.t_operator)); //$NON-NLS-1$
- fgKeywords.put("or", new Integer(Token.t_or)); //$NON-NLS-1$
- fgKeywords.put("or_eq", new Integer(Token.t_or_eq)); //$NON-NLS-1$
- fgKeywords.put("private", new Integer(Token.t_private)); //$NON-NLS-1$
- fgKeywords.put("protected", new Integer(Token.t_protected)); //$NON-NLS-1$
- fgKeywords.put("public", new Integer(Token.t_public)); //$NON-NLS-1$
- fgKeywords.put("register", new Integer(Token.t_register)); //$NON-NLS-1$
- fgKeywords.put("reinterpret_cast", new Integer(Token.t_reinterpret_cast)); //$NON-NLS-1$
- fgKeywords.put("return", new Integer(Token.t_return)); //$NON-NLS-1$
- fgKeywords.put("short", new Integer(Token.t_short)); //$NON-NLS-1$
- fgKeywords.put("signed", new Integer(Token.t_signed)); //$NON-NLS-1$
- fgKeywords.put("sizeof", new Integer(Token.t_sizeof)); //$NON-NLS-1$
- fgKeywords.put("static", new Integer(Token.t_static)); //$NON-NLS-1$
- fgKeywords.put("static_cast", new Integer(Token.t_static_cast)); //$NON-NLS-1$
- fgKeywords.put("struct", new Integer(Token.t_struct)); //$NON-NLS-1$
- fgKeywords.put("switch", new Integer(Token.t_switch)); //$NON-NLS-1$
- fgKeywords.put("template", new Integer(Token.t_template)); //$NON-NLS-1$
- fgKeywords.put("this", new Integer(Token.t_this)); //$NON-NLS-1$
- fgKeywords.put("throw", new Integer(Token.t_throw)); //$NON-NLS-1$
- fgKeywords.put("true", new Integer(Token.t_true)); //$NON-NLS-1$
- fgKeywords.put("try", new Integer(Token.t_try)); //$NON-NLS-1$
- fgKeywords.put("typedef", new Integer(Token.t_typedef)); //$NON-NLS-1$
- fgKeywords.put("typeid", new Integer(Token.t_typeid)); //$NON-NLS-1$
- fgKeywords.put("typename", new Integer(Token.t_typename)); //$NON-NLS-1$
- fgKeywords.put("union", new Integer(Token.t_union)); //$NON-NLS-1$
- fgKeywords.put("unsigned", new Integer(Token.t_unsigned)); //$NON-NLS-1$
- fgKeywords.put("using", new Integer(Token.t_using)); //$NON-NLS-1$
- fgKeywords.put("virtual", new Integer(Token.t_virtual)); //$NON-NLS-1$
- fgKeywords.put("void", new Integer(Token.t_void)); //$NON-NLS-1$
- fgKeywords.put("volatile", new Integer(Token.t_volatile)); //$NON-NLS-1$
- fgKeywords.put("wchar_t", new Integer(Token.t_wchar_t)); //$NON-NLS-1$
- fgKeywords.put("while", new Integer(Token.t_while)); //$NON-NLS-1$
- fgKeywords.put("xor", new Integer(Token.t_xor)); //$NON-NLS-1$
- fgKeywords.put("xor_eq", new Integer(Token.t_xor_eq)); //$NON-NLS-1$
-
- // additional java keywords
- fgKeywords.put("abstract", new Integer(Token.t_abstract)); //$NON-NLS-1$
- fgKeywords.put("boolean", new Integer(Token.t_boolean)); //$NON-NLS-1$
- fgKeywords.put("byte", new Integer(Token.t_byte)); //$NON-NLS-1$
- fgKeywords.put("extends", new Integer(Token.t_extends)); //$NON-NLS-1$
- fgKeywords.put("final", new Integer(Token.t_final)); //$NON-NLS-1$
- fgKeywords.put("finally", new Integer(Token.t_finally)); //$NON-NLS-1$
- fgKeywords.put("implements", new Integer(Token.t_implements)); //$NON-NLS-1$
- fgKeywords.put("import", new Integer(Token.t_import)); //$NON-NLS-1$
- fgKeywords.put("interface", new Integer(Token.t_interface)); //$NON-NLS-1$
- fgKeywords.put("instanceof", new Integer(Token.t_instanceof)); //$NON-NLS-1$
- fgKeywords.put("native", new Integer(Token.t_native)); //$NON-NLS-1$
- fgKeywords.put("null", new Integer(Token.t_null)); //$NON-NLS-1$
- fgKeywords.put("package", new Integer(Token.t_package)); //$NON-NLS-1$
- fgKeywords.put("super", new Integer(Token.t_super)); //$NON-NLS-1$
- fgKeywords.put("synchronized", new Integer(Token.t_synchronized)); //$NON-NLS-1$
- fgKeywords.put("throws", new Integer(Token.t_throws)); //$NON-NLS-1$
- fgKeywords.put("transient", new Integer(Token.t_transient)); //$NON-NLS-1$
-
- }
-
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Token.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Token.java
deleted file mode 100644
index ce023b3db61..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/scanner/Token.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial implementation
- * Anton Leherbauer - adding tokens for preprocessing directives
- * Markus Schorn - classification of preprocessing directives.
- *******************************************************************************/
-package org.eclipse.cdt.internal.formatter.scanner;
-
-import org.eclipse.cdt.internal.formatter.scanner.ScannerContext;
-
-public class Token {
-
- public int type;
- public String text;
- public int offset;
-
- public Token(int t, String i, ScannerContext context) {
- set(t,i,context);
- }
-
- public void set(int t, String i, ScannerContext context) {
- type = t;
- text = i;
- offset = context.getOffset() - text.length() - context.undoStackSize();
- }
-
- public Token(int t, String i) {
- type = t;
- text = i;
- }
-
- public String toString() {
- return "Token type=" + type + " image =" + text + " offset=" + offset; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public int getType() {
- return type;
- }
-
- public String getText() {
- return text;
- }
-
- public int getOffset() {
- return offset;
- }
-
- public int getLength() {
- return text.length();
- }
-
- public int getDelta(Token other) {
- return other.getOffset() + other.getLength() - getOffset();
- }
-
- public boolean looksLikeExpressionStart() {
- switch (type) {
- case tINTEGER :
- case t_false :
- case t_true :
- case tSTRING :
- case tLSTRING :
- case tFLOATINGPT :
- case tCHAR :
- case tAMPER :
- case tDOT :
- case tLPAREN :
- return true;
- default :
- break;
- }
- return false;
- }
-
- public boolean looksLikeExpressionEnd() {
- switch (type) {
- case tINTEGER :
- case tSTRING :
- case tLSTRING :
- case tFLOATINGPT :
- case tCHAR :
- case tRPAREN :
- case tIDENTIFIER :
- return true;
- default :
- break;
- }
- return false;
- }
-
- public boolean isPointer() {
- return (type == tAMPER || type == tSTAR);
- }
-
- public boolean isOperator() {
- switch (type) {
- case t_new :
- case t_delete :
- case tPLUS :
- case tMINUS :
- case tSTAR :
- case tDIV :
- case tXOR :
- case tMOD :
- case tAMPER :
- case tBITOR :
- case tCOMPL :
- case tNOT :
- case tASSIGN :
- case tLT :
- case tGT :
- case tPLUSASSIGN :
- case tMINUSASSIGN :
- case tSTARASSIGN :
- case tDIVASSIGN :
- case tMODASSIGN :
- case tBITORASSIGN :
- case tAMPERASSIGN :
- case tXORASSIGN :
- case tSHIFTL :
- case tSHIFTR :
- case tSHIFTLASSIGN :
- case tSHIFTRASSIGN :
- case tEQUAL :
- case tNOTEQUAL :
- case tLTEQUAL :
- case tGTEQUAL :
- case tAND :
- case tOR :
- case tINCR :
- case tDECR :
- case tCOMMA :
- case tDOT :
- case tDOTSTAR :
- case tARROW :
- case tARROWSTAR :
- return true;
- default :
- return false;
- }
- }
-
- public boolean isInfixOperator() {
- switch (type) {
- case tPLUS :
- case tMINUS :
- case tSTAR :
- case tDIV :
- case tXOR :
- case tMOD :
- case tAMPER :
- case tBITOR :
- case tASSIGN :
- case tLT :
- case tGT :
- case tPLUSASSIGN :
- case tMINUSASSIGN :
- case tSTARASSIGN :
- case tDIVASSIGN :
- case tMODASSIGN :
- case tBITORASSIGN :
- case tAMPERASSIGN :
- case tXORASSIGN :
- case tSHIFTL :
- case tSHIFTR :
- case tSHIFTLASSIGN :
- case tSHIFTRASSIGN :
- case tEQUAL :
- case tNOTEQUAL :
- case tLTEQUAL :
- case tGTEQUAL :
- case tAND :
- case tOR :
- case tCOLON :
- case tQUESTION :
- return true;
- default :
- return false;
- }
- }
-
- public boolean isPrefixOperator() {
- switch (type) {
- case tPLUS :
- case tMINUS :
- case tSTAR :
- case tAMPER :
- case tCOMPL :
- case tNOT :
- case tINCR :
- case tDECR :
- return true;
- default :
- return false;
- }
- }
-
- public boolean isPostfixOperator() {
- switch (type) {
- case tINCR :
- case tDECR :
- return true;
- default :
- return false;
- }
- }
-
- public boolean isAssignmentOperator() {
- return isAssignmentOperator(type);
- }
- public static boolean isAssignmentOperator(int type) {
- switch (type) {
- case tASSIGN :
- case tPLUSASSIGN :
- case tMINUSASSIGN :
- case tSTARASSIGN :
- case tDIVASSIGN :
- case tAMPERASSIGN :
- case tBITORASSIGN :
- case tXORASSIGN :
- case tMODASSIGN :
- case tSHIFTLASSIGN :
- case tSHIFTRASSIGN :
- return true;
- default :
- return false;
- }
- }
-
- public boolean isControlStmt() {
- switch (type) {
- case t_if :
- case t_else :
- case t_for :
- case t_do :
- case t_while :
- case t_switch :
- case t_try :
- case t_catch :
- case t_finally :
- return true;
- default :
- return false;
- }
- }
-
- public boolean isWhiteSpace() {
- return type == tWHITESPACE;
- }
-
- public boolean isComment() {
- return isLineComment() || isBlockComment();
- }
-
- public boolean isLineComment() {
- return type == tLINECOMMENT;
- }
-
- public boolean isBlockComment() {
- return type == tBLOCKCOMMENT;
- }
-
- public boolean isCaseLabel() {
- return type == t_case || type == t_default;
- }
-
- public boolean isStructType() {
- return isStructType(type);
- }
-
- public static boolean isStructType(int type) {
- return type == t_struct || type == t_union || type == t_class;
- }
-
- public boolean isVisibilityModifier() {
- return isVisibilityModifier(type);
- }
-
- public static boolean isVisibilityModifier(int type) {
- return type == t_public || type == t_protected || type == t_private;
- }
-
- public boolean isEndOfStatement() {
- return type == tSEMI || type == tRBRACE;
- }
-
- public boolean isCPPToken() {
- switch (type) {
- case tCOLONCOLON :
- case t_class :
- case t_namespace :
- case t_using :
- case t_template :
- case t_public :
- case t_protected :
- case t_private :
- case t_operator :
- case t_virtual :
- case t_inline :
- case t_friend :
- case t_mutable :
- case t_new :
- case t_delete :
- case t_reinterpret_cast :
- case t_dynamic_cast :
- case t_static_cast :
- case t_finally :
- return true;
- default :
- return false;
- }
- }
-
- // overrider
- public boolean isStringLiteral() {
- return type == tSTRING || type == tLSTRING;
- }
-
- // overrider
- public boolean isCharacterLiteral() {
- return type == tCHAR;
- }
-
- // overrider
- public boolean isPreprocessor() {
- switch(type) {
- case tPREPROCESSOR:
- case tPREPROCESSOR_DEFINE:
- case tPREPROCESSOR_INCLUDE:
- return true;
- }
- return false;
- }
-
- // overrider
- public boolean isIncludeDirective() {
- return type==tPREPROCESSOR_INCLUDE;
- }
- // overrider
- public boolean isMacroDefinition() {
- return type==tPREPROCESSOR_DEFINE;
- }
-
- // Special Token types (non-grammar tokens)
- public static final int tWHITESPACE = 1000;
- public static final int tLINECOMMENT = 1001;
- public static final int tBLOCKCOMMENT = 1002;
- public static final int tPREPROCESSOR = 1003;
- public static final int tPREPROCESSOR_INCLUDE = 1004;
- public static final int tPREPROCESSOR_DEFINE = 1005;
- public static final int tBADCHAR = 1006;
-
- // Token types
- static public final int tIDENTIFIER = 1;
- static public final int tINTEGER = 2;
- static public final int tCOLONCOLON = 3;
- static public final int tCOLON = 4;
- static public final int tSEMI = 5;
- static public final int tCOMMA = 6;
- static public final int tQUESTION = 7;
- static public final int tLPAREN = 8;
- static public final int tRPAREN = 9;
- static public final int tLBRACKET = 10;
- static public final int tRBRACKET = 11;
- static public final int tLBRACE = 12;
- static public final int tRBRACE = 13;
- static public final int tPLUSASSIGN = 14;
- static public final int tINCR = 15;
- static public final int tPLUS = 16;
- static public final int tMINUSASSIGN = 17;
- static public final int tDECR = 18;
- static public final int tARROWSTAR = 19;
- static public final int tARROW = 20;
- static public final int tMINUS = 21;
- static public final int tSTARASSIGN = 22;
- static public final int tSTAR = 23;
- static public final int tMODASSIGN = 24;
- static public final int tMOD = 25;
- static public final int tXORASSIGN = 26;
- static public final int tXOR = 27;
- static public final int tAMPERASSIGN = 28;
- static public final int tAND = 29;
- static public final int tAMPER = 30;
- static public final int tBITORASSIGN = 31;
- static public final int tOR = 32;
- static public final int tBITOR = 33;
- static public final int tCOMPL = 34;
- static public final int tNOTEQUAL = 35;
- static public final int tNOT = 36;
- static public final int tEQUAL = 37;
- static public final int tASSIGN = 38;
- static public final int tSHIFTL = 40;
- static public final int tLTEQUAL = 41;
- static public final int tLT = 42;
- static public final int tSHIFTRASSIGN = 43;
- static public final int tSHIFTR = 44;
- static public final int tGTEQUAL = 45;
- static public final int tGT = 46;
- static public final int tSHIFTLASSIGN = 47;
- static public final int tELIPSE = 48;
- static public final int tDOTSTAR = 49;
- static public final int tDOT = 50;
- static public final int tDIVASSIGN = 51;
- static public final int tDIV = 52;
- static public final int tCLASSNAME = 53;
- static public final int t_and = 54;
- static public final int t_and_eq = 55;
- static public final int t_asm = 56;
- static public final int t_auto = 57;
- static public final int t_bitand = 58;
- static public final int t_bitor = 59;
- static public final int t_bool = 60;
- static public final int t_break = 61;
- static public final int t_case = 62;
- static public final int t_catch = 63;
- static public final int t_char = 64;
- static public final int t_class = 65;
- static public final int t_compl = 66;
- static public final int t_const = 67;
- static public final int t_const_cast = 69;
- static public final int t_continue = 70;
- static public final int t_default = 71;
- static public final int t_delete = 72;
- static public final int t_do = 73;
- static public final int t_double = 74;
- static public final int t_dynamic_cast = 75;
- static public final int t_else = 76;
- static public final int t_enum = 77;
- static public final int t_explicit = 78;
- static public final int t_export = 79;
- static public final int t_extern = 80;
- static public final int t_false = 81;
- static public final int t_float = 82;
- static public final int t_for = 83;
- static public final int t_friend = 84;
- static public final int t_goto = 85;
- static public final int t_if = 86;
- static public final int t_inline = 87;
- static public final int t_int = 88;
- static public final int t_long = 89;
- static public final int t_mutable = 90;
- static public final int t_namespace = 91;
- static public final int t_new = 92;
- static public final int t_not = 93;
- static public final int t_not_eq = 94;
- static public final int t_operator = 95;
- static public final int t_or = 96;
- static public final int t_or_eq = 97;
- static public final int t_private = 98;
- static public final int t_protected = 99;
- static public final int t_public = 100;
- static public final int t_register = 101;
- static public final int t_reinterpret_cast = 102;
- static public final int t_return = 103;
- static public final int t_short = 104;
- static public final int t_sizeof = 105;
- static public final int t_static = 106;
- static public final int t_static_cast = 107;
- static public final int t_signed = 108;
- static public final int t_struct = 109;
- static public final int t_switch = 110;
- static public final int t_template = 111;
- static public final int t_this = 112;
- static public final int t_throw = 113;
- static public final int t_true = 114;
- static public final int t_try = 115;
- static public final int t_typedef = 116;
- static public final int t_typeid = 117;
- static public final int t_typename = 118;
- static public final int t_union = 119;
- static public final int t_unsigned = 120;
- static public final int t_using = 121;
- static public final int t_virtual = 122;
- static public final int t_void = 123;
- static public final int t_volatile = 124;
- static public final int t_wchar_t = 125;
- static public final int t_while = 126;
- static public final int t_xor = 127;
- static public final int t_xor_eq = 128;
- static public final int tSTRING = 129;
- static public final int tFLOATINGPT = 130;
- static public final int tLSTRING = 131;
- static public final int tCHAR = 132;
- static public final int t_restrict = 136;
- static public final int t_interface = 200;
- static public final int t_import = 201;
- static public final int t_instanceof = 202;
- static public final int t_extends = 203;
- static public final int t_implements = 204;
- static public final int t_final = 205;
- static public final int t_super = 206;
- static public final int t_package = 207;
- static public final int t_boolean = 208;
- static public final int t_abstract = 209;
- static public final int t_finally = 210;
- static public final int t_null = 211;
- static public final int t_synchronized = 212;
- static public final int t_throws = 213;
- static public final int t_byte = 214;
- static public final int t_transient = 215;
- static public final int t_native = 216;
-
-}

Back to the top