cdt/cdt_6_0_x/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
author timkelly
Thu, 06 Aug 2009 12:01:58 -0500
changeset 52 42077b7eab6e
parent 51 49c226a8748e
permissions -rw-r--r--
Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     1
/*******************************************************************************
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     3
 * All rights reserved. This program and the accompanying materials
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     4
 * are made available under the terms of the Eclipse Public License v1.0
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     5
 * which accompanies this distribution, and is available at
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     6
 * http://www.eclipse.org/legal/epl-v10.html
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     7
 *
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     8
 * Contributors:
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     9
 *     IBM Corporation - initial API and implementation
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    10
 *     Markus Schorn (Wind River Systems)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    11
 *     Andrew Ferguson (Symbian)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    12
 *     Anton Leherbauer (Wind River Systems)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    13
 *     oyvind.harboe@zylin.com - http://bugs.eclipse.org/250638
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    14
 *******************************************************************************/
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    15
package org.eclipse.cdt.core;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    16
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    17
import java.io.IOException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    18
import java.util.ArrayList;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    19
import java.util.Collection;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    20
import java.util.HashMap;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    21
import java.util.HashSet;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    22
import java.util.List;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    23
import java.util.Map;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    24
import java.util.MissingResourceException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    25
import java.util.ResourceBundle;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    26
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    27
import com.ibm.icu.text.MessageFormat;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    28
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    29
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    30
import org.eclipse.cdt.core.cdtvariables.IUserVarSupplier;
51
49c226a8748e CDT 6.0 from cdt_6_0 branch (eclipse.org cvs repository). This overwrites previous CDT 6.0 merges.
timkelly
parents: 44
diff changeset
    31
import org.eclipse.cdt.core.dom.CDOM;
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    32
import org.eclipse.cdt.core.dom.IPDOMManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    33
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    34
import org.eclipse.cdt.core.index.IIndexManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    35
import org.eclipse.cdt.core.model.CModelException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    36
import org.eclipse.cdt.core.model.CoreModel;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    37
import org.eclipse.cdt.core.model.ITranslationUnit;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    38
import org.eclipse.cdt.core.model.IWorkingCopy;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    39
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    40
import org.eclipse.cdt.core.resources.IConsole;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    41
import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    42
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    43
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    44
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    45
import org.eclipse.cdt.core.settings.model.WriteAccessException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    46
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    47
import org.eclipse.cdt.internal.core.CContentTypes;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    48
import org.eclipse.cdt.internal.core.CDTLogWriter;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    49
import org.eclipse.cdt.internal.core.CdtVarPathEntryVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    50
import org.eclipse.cdt.internal.core.PositionTrackerManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    51
import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    52
import org.eclipse.cdt.internal.core.cdtvariables.UserVarSupplier;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    53
import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    54
import org.eclipse.cdt.internal.core.model.BufferManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    55
import org.eclipse.cdt.internal.core.model.CModelManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    56
import org.eclipse.cdt.internal.core.model.IBufferFactory;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    57
import org.eclipse.cdt.internal.core.model.Util;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    58
import org.eclipse.cdt.internal.core.model.WorkingCopy;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    59
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    60
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    61
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    62
import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    63
import org.eclipse.core.resources.IProject;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    64
import org.eclipse.core.resources.IProjectDescription;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    65
import org.eclipse.core.resources.IResource;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    66
import org.eclipse.core.resources.IWorkspace;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    67
import org.eclipse.core.resources.IWorkspaceRunnable;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    68
import org.eclipse.core.resources.ResourcesPlugin;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    69
import org.eclipse.core.runtime.CoreException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    70
import org.eclipse.core.runtime.IConfigurationElement;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    71
import org.eclipse.core.runtime.IExtension;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    72
import org.eclipse.core.runtime.IExtensionPoint;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    73
import org.eclipse.core.runtime.IProgressMonitor;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    74
import org.eclipse.core.runtime.IStatus;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    75
import org.eclipse.core.runtime.NullProgressMonitor;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    76
import org.eclipse.core.runtime.OperationCanceledException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    77
import org.eclipse.core.runtime.Platform;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    78
import org.eclipse.core.runtime.Plugin;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    79
import org.eclipse.core.runtime.Preferences;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    80
import org.eclipse.core.runtime.Status;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    81
import org.eclipse.core.runtime.SubProgressMonitor;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    82
import org.eclipse.core.runtime.content.IContentType;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    83
import org.eclipse.core.runtime.jobs.Job;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    84
import org.osgi.framework.BundleContext;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    85
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    86
/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    87
 * CCorePlugin is the life-cycle owner of the core plug-in, and starting point for access to many core APIs.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    88
 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    89
 * @noextend This class is not intended to be subclassed by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    90
 * @noinstantiate This class is not intended to be instantiated by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    91
 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    92
public class CCorePlugin extends Plugin {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    93
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    94
	public static final int STATUS_CDTPROJECT_EXISTS = 1;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    95
	public static final int STATUS_CDTPROJECT_MISMATCH = 2;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    96
	public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    97
	/**
51
49c226a8748e CDT 6.0 from cdt_6_0 branch (eclipse.org cvs repository). This overwrites previous CDT 6.0 merges.
timkelly
parents: 44
diff changeset
    98
	 * Will be public and final in the next CDT version.
49c226a8748e CDT 6.0 from cdt_6_0 branch (eclipse.org cvs repository). This overwrites previous CDT 6.0 merges.
timkelly
parents: 44
diff changeset
    99
	 * @noreference
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   100
	 */
51
49c226a8748e CDT 6.0 from cdt_6_0 branch (eclipse.org cvs repository). This overwrites previous CDT 6.0 merges.
timkelly
parents: 44
diff changeset
   101
	public static int STATUS_PDOM_TOO_LARGE = 4;
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   102
	public static final String PLUGIN_ID = "org.eclipse.cdt.core"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   103
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   104
	public static final String BUILDER_MODEL_ID = PLUGIN_ID + ".CBuildModel"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   105
	public static final String BINARY_PARSER_SIMPLE_ID = "BinaryParser"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   106
	public final static String BINARY_PARSER_UNIQ_ID = PLUGIN_ID + "." + BINARY_PARSER_SIMPLE_ID; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   107
	public final static String PREF_BINARY_PARSER = "binaryparser"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   108
	public final static String DEFAULT_BINARY_PARSER_SIMPLE_ID = "ELF"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   109
	public final static String DEFAULT_BINARY_PARSER_UNIQ_ID = PLUGIN_ID + "." + DEFAULT_BINARY_PARSER_SIMPLE_ID; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   110
	public final static String PREF_USE_STRUCTURAL_PARSE_MODE = "useStructualParseMode"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   111
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   112
	public static final String INDEX_SIMPLE_ID = "CIndex"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   113
	public static final String INDEX_UNIQ_ID = PLUGIN_ID + "." + INDEX_SIMPLE_ID; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   114
	 		
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   115
	public static final String INDEXER_SIMPLE_ID = "CIndexer"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   116
	public static final String INDEXER_UNIQ_ID = PLUGIN_ID + "." + INDEXER_SIMPLE_ID; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   117
	public static final String PREF_INDEXER = "indexer"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   118
	public static final String DEFAULT_INDEXER = IPDOMManager.ID_FAST_INDEXER;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   119
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   120
	public final static String ERROR_PARSER_SIMPLE_ID = "ErrorParser"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   121
	public final static String ERROR_PARSER_UNIQ_ID = PLUGIN_ID + "." + ERROR_PARSER_SIMPLE_ID; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   122
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   123
	// default store for pathentry
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   124
	public final static String DEFAULT_PATHENTRY_STORE_ID = PLUGIN_ID + ".cdtPathEntryStore"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   125
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   126
	// Build Model Interface Discovery
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   127
	public final static String BUILD_SCANNER_INFO_SIMPLE_ID = "ScannerInfoProvider"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   128
	public final static String BUILD_SCANNER_INFO_UNIQ_ID = PLUGIN_ID + "." + BUILD_SCANNER_INFO_SIMPLE_ID; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   129
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   130
	public static final String DEFAULT_PROVIDER_ID = CCorePlugin.PLUGIN_ID + ".defaultConfigDataProvider"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   131
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   132
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   133
	 * Name of the extension point for contributing a source code formatter
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   134
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   135
	public static final String FORMATTER_EXTPOINT_ID = "CodeFormatter" ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   136
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   137
    /**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   138
     * Possible  configurable option ID.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   139
     * @see #getDefaultOptions
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   140
     */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   141
    public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   142
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   143
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   144
	 * IContentType id for C Source Unit
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   145
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   146
	public final static String CONTENT_TYPE_CSOURCE =  "org.eclipse.cdt.core.cSource"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   147
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   148
	 * IContentType id for C Header Unit
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   149
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   150
	public final static String CONTENT_TYPE_CHEADER =  "org.eclipse.cdt.core.cHeader"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   151
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   152
	 * IContentType id for C++ Source Unit
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   153
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   154
	public final static String CONTENT_TYPE_CXXSOURCE = "org.eclipse.cdt.core.cxxSource"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   155
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   156
	 * IContentType id for C++ Header Unit
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   157
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   158
	public final static String CONTENT_TYPE_CXXHEADER = "org.eclipse.cdt.core.cxxHeader"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   159
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   160
	 * IContentType id for ASM Unit
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   161
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   162
	public final static String CONTENT_TYPE_ASMSOURCE = "org.eclipse.cdt.core.asmSource"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   163
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   164
	 * IContentType id for Binary Files
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   165
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   166
	public final static String CONTENT_TYPE_BINARYFILE = "org.eclipse.cdt.core.binaryFile"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   167
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   168
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   169
	 * Possible  configurable option value.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   170
	 * @see #getDefaultOptions()
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   171
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   172
	public static final String INSERT = "insert"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   173
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   174
	 * Possible  configurable option value.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   175
	 * @see #getDefaultOptions()
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   176
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   177
	public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   178
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   179
	 * Possible  configurable option value.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   180
	 * @see #getDefaultOptions()
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   181
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   182
	public static final String TAB = "tab"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   183
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   184
	 * Possible  configurable option value.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   185
	 * @see #getDefaultOptions()
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   186
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   187
	public static final String SPACE = "space"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   188
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   189
	private static CCorePlugin fgCPlugin;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   190
	private static ResourceBundle fgResourceBundle;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   191
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   192
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   193
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   194
	 * @noreference This field is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   195
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   196
    public CDTLogWriter cdtLog = null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   197
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   198
	private CProjectDescriptionManager fNewCProjectDescriptionManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   199
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   200
	private CoreModel fCoreModel;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   201
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   202
	private PDOMManager pdomManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   203
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   204
	private CdtVarPathEntryVariableManager fPathEntryVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   205
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   206
	// -------- static methods --------
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   207
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   208
	static {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   209
		try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   210
			fgResourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.internal.core.CCorePluginResources"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   211
		} catch (MissingResourceException x) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   212
			fgResourceBundle = null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   213
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   214
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   215
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   216
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   217
     * Returns the shared working copies currently registered for the default buffer factory. 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   218
	 * @since 5.1
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   219
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   220
	public static IWorkingCopy[] getSharedWorkingCopies() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   221
		return getSharedWorkingCopies(null);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   222
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   223
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   224
	public static String getResourceString(String key) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   225
		try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   226
			return fgResourceBundle.getString(key);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   227
		} catch (MissingResourceException e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   228
			return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   229
		} catch (NullPointerException e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   230
			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   231
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   232
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   233
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   234
	public static IWorkspace getWorkspace() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   235
		return ResourcesPlugin.getWorkspace();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   236
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   237
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   238
	public static String getFormattedString(String key, String arg) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   239
		return MessageFormat.format(getResourceString(key), new Object[] { arg });
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   240
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   241
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   242
	@SuppressWarnings("cast") // java.text.MessageFormat would require the cast
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   243
	public static String getFormattedString(String key, String[] args) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   244
		return MessageFormat.format(getResourceString(key), (Object[])args);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   245
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   246
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   247
	public static ResourceBundle getResourceBundle() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   248
		return fgResourceBundle;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   249
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   250
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   251
    public static IPositionTrackerManager getPositionTrackerManager() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   252
        return PositionTrackerManager.getInstance();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   253
    }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   254
    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   255
	public static CCorePlugin getDefault() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   256
		return fgCPlugin;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   257
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   258
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   259
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   260
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   261
	 * @see Plugin#shutdown
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   262
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   263
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   264
	public void stop(BundleContext context) throws Exception {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   265
		try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   266
			pdomManager.shutdown();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   267
			
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   268
            PositionTrackerManager.getInstance().uninstall();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   269
            
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   270
//			if (fDescriptorManager != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   271
//				fDescriptorManager.shutdown();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   272
//			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   273
            
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   274
			if (fCoreModel != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   275
				fCoreModel.shutdown();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   276
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   277
			
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   278
			if (cdtLog != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   279
				cdtLog.shutdown();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   280
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   281
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   282
			if (fPathEntryVariableManager != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   283
				fPathEntryVariableManager.shutdown();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   284
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   285
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   286
            fNewCProjectDescriptionManager.shutdown();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   287
            ResourceLookup.shutdown();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   288
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   289
			savePluginPreferences();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   290
		} finally {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   291
			super.stop(context);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   292
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   293
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   294
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   295
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   296
	 * @see Plugin#startup
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   297
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   298
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   299
	public void start(BundleContext context) throws Exception {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   300
		super.start(context);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   301
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   302
		// do harmless stuff first.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   303
		cdtLog = new CDTLogWriter(CCorePlugin.getDefault().getStateLocation().append(".log").toFile()); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   304
		configurePluginDebugOptions();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   305
        PositionTrackerManager.getInstance().install();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   306
        ResourceLookup.startup();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   307
        
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   308
        // new project model needs to register the resource listener first.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   309
		fNewCProjectDescriptionManager= CProjectDescriptionManager.getInstance();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   310
		final Job post1= fNewCProjectDescriptionManager.startup();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   311
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   312
		fPathEntryVariableManager = new CdtVarPathEntryVariableManager();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   313
		fPathEntryVariableManager.startup();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   314
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   315
		fCoreModel = CoreModel.getDefault();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   316
		fCoreModel.startup();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   317
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   318
		pdomManager = new PDOMManager();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   319
		final Job post2= pdomManager.startup();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   320
        
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   321
        // bug 186755, when started after the platform has been started the job manager
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   322
        // is no longer suspended. So we have to start a job at the very end to make
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   323
        // sure we don't trigger a concurrent plug-in activation from within the job.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   324
		post1.schedule();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   325
		post2.schedule();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   326
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   327
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   328
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   329
     * TODO: Add all options here
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   330
     * Returns a table of all known configurable options with their default values.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   331
     * These options allow to configure the behavior of the underlying components.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   332
     * The client may safely use the result as a template that they can modify and
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   333
     * then pass to <code>setOptions</code>.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   334
     * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   335
     * Helper constants have been defined on CCorePlugin for each of the option ID and 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   336
     * their possible constant values.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   337
     * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   338
     * Note: more options might be added in further releases.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   339
     * <pre>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   340
     * RECOGNIZED OPTIONS:
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   341
     * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   342
     * CORE / Specify Default Source Encoding Format
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   343
     *    Get the encoding format for translated sources. This setting is read-only, it is equivalent
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   344
     *    to 'ResourcesPlugin.getEncoding()'.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   345
     *     - option id:         "org.eclipse.cdt.core.encoding"
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   346
     *     - possible values:   { any of the supported encoding names}.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   347
     *     - default:           <platform default>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   348
     * </pre>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   349
     * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   350
     * @return a mutable map containing the default settings of all known options
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   351
     *   (key type: <code>String</code>; value type: <code>String</code>)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   352
     * @see #setOptions
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   353
     */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   354
    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   355
    public static HashMap<String, String> getDefaultOptions()
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   356
    {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   357
        HashMap<String, String> defaultOptions = new HashMap<String, String>(10);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   358
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   359
        // see #initializeDefaultPluginPreferences() for changing default settings
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   360
        Preferences preferences = getDefault().getPluginPreferences();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   361
        HashSet<String> optionNames = CModelManager.OptionNames;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   362
        
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   363
        // get preferences set to their default
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   364
        for (String propertyName : preferences.defaultPropertyNames()){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   365
            if (optionNames.contains(propertyName))
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   366
                defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   367
        }       
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   368
        // get preferences not set to their default
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   369
        for (String propertyName : preferences.propertyNames()) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   370
            if (optionNames.contains(propertyName)) 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   371
                defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   372
        }       
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   373
        // get encoding through resource plugin
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   374
        defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   375
        
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   376
        return defaultOptions;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   377
    }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   378
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   379
   
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   380
    /**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   381
     * Helper method for returning one option value only. Equivalent to <code>(String)CCorePlugin.getOptions().get(optionName)</code>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   382
     * Note that it may answer <code>null</code> if this option does not exist.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   383
     * <p>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   384
     * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   385
     * </p>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   386
     * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   387
     * @param optionName the name of an option
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   388
     * @return the String value of a given option
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   389
     * @see CCorePlugin#getDefaultOptions
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   390
     */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   391
    public static String getOption(String optionName) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   392
        
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   393
        if (CORE_ENCODING.equals(optionName)){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   394
            return ResourcesPlugin.getEncoding();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   395
        }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   396
        if (CModelManager.OptionNames.contains(optionName)){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   397
            Preferences preferences = getDefault().getPluginPreferences();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   398
            return preferences.getString(optionName).trim();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   399
        }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   400
        return null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   401
    }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   402
    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   403
    /**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   404
     * Returns the table of the current options. Initially, all options have their default values,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   405
     * and this method returns a table that includes all known options.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   406
     * <p>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   407
     * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   408
     * </p>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   409
     * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   410
     * @return table of current settings of all options 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   411
     *   (key type: <code>String</code>; value type: <code>String</code>)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   412
     * @see CCorePlugin#getDefaultOptions
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   413
     */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   414
    public static HashMap<String, String> getOptions() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   415
        
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   416
        HashMap<String, String> options = new HashMap<String, String>(10);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   417
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   418
        // see #initializeDefaultPluginPreferences() for changing default settings
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   419
        Plugin plugin = getDefault();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   420
        if (plugin != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   421
            Preferences preferences = plugin.getPluginPreferences();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   422
            HashSet<String> optionNames = CModelManager.OptionNames;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   423
            
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   424
            // get preferences set to their default
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   425
            for (String propertyName : preferences.defaultPropertyNames()){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   426
                if (optionNames.contains(propertyName)){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   427
                    options.put(propertyName, preferences.getDefaultString(propertyName));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   428
                }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   429
            }       
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   430
            // get preferences not set to their default
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   431
            for (String propertyName : preferences.propertyNames()){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   432
                if (optionNames.contains(propertyName)){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   433
                    options.put(propertyName, preferences.getString(propertyName).trim());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   434
                }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   435
            }       
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   436
            // get encoding through resource plugin
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   437
            options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   438
        }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   439
        return options;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   440
    }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   441
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   442
    /**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   443
     * Sets the current table of options. All and only the options explicitly included in the given table 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   444
     * are remembered; all previous option settings are forgotten, including ones not explicitly
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   445
     * mentioned.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   446
     * <p>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   447
     * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   448
     * </p>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   449
     * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   450
     * @param newOptions the new options (key type: <code>String</code>; value type: <code>String</code>),
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   451
     *   or <code>null</code> to reset all options to their default values
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   452
     * @see CCorePlugin#getDefaultOptions
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   453
     */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   454
    public static void setOptions(HashMap<String, String> newOptions) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   455
    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   456
        // see #initializeDefaultPluginPreferences() for changing default settings
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   457
        Preferences preferences = getDefault().getPluginPreferences();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   458
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   459
        if (newOptions == null){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   460
            newOptions = getDefaultOptions();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   461
        }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   462
        for (String key : newOptions.keySet()){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   463
            if (!CModelManager.OptionNames.contains(key)) continue; // unrecognized option
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   464
            if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   465
            String value = newOptions.get(key);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   466
            preferences.setValue(key, value);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   467
        }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   468
    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   469
        // persist options
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   470
        getDefault().savePluginPreferences();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   471
    }    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   472
    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   473
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   474
	public IConsole getConsole(String id) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   475
		try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   476
	        IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "CBuildConsole"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   477
			if (extension != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   478
				IExtension[] extensions = extension.getExtensions();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   479
				for (IExtension extension2 : extensions) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   480
					IConfigurationElement[] configElements = extension2.getConfigurationElements();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   481
					for (IConfigurationElement configElement : configElements) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   482
						String consoleID = configElement.getAttribute("id"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   483
						if ((id == null && consoleID == null) || (id != null && id.equals(consoleID))) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   484
							return (IConsole) configElement.createExecutableExtension("class"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   485
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   486
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   487
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   488
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   489
		} catch (CoreException e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   490
			log(e);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   491
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   492
		return new IConsole() { // return a null console
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   493
			private ConsoleOutputStream nullStream = new ConsoleOutputStream() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   494
			    @Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   495
				public void write(byte[] b) throws IOException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   496
			    }			    
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   497
				@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   498
				public void write(byte[] b, int off, int len) throws IOException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   499
				}					
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   500
				@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   501
				public void write(int c) throws IOException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   502
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   503
			};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   504
			
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   505
			public void start(IProject project) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   506
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   507
		    // this can be a null console....
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   508
			public ConsoleOutputStream getOutputStream() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   509
				return nullStream;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   510
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   511
			public ConsoleOutputStream getInfoStream() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   512
				return nullStream; 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   513
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   514
			public ConsoleOutputStream getErrorStream() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   515
				return nullStream;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   516
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   517
		};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   518
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   519
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   520
	public IConsole getConsole() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   521
		String consoleID = System.getProperty("org.eclipse.cdt.core.console"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   522
		return getConsole(consoleID);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   523
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   524
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   525
	public ICExtensionReference[] getBinaryParserExtensions(IProject project) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   526
		ICExtensionReference ext[] = new ICExtensionReference[0];
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   527
		if (project != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   528
			try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   529
				ICDescriptor cdesc = getCProjectDescription(project, false);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   530
				if (cdesc==null)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   531
					return ext;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   532
				ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID, true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   533
				if (cextensions != null && cextensions.length > 0)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   534
					ext = cextensions;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   535
			} catch (CoreException e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   536
				log(e);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   537
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   538
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   539
		return ext;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   540
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   541
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   542
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   543
	 * @deprecated - use getBinaryParserExtensions(IProject project)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   544
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   545
	@Deprecated
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   546
	public IBinaryParser[] getBinaryParser(IProject project) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   547
		IBinaryParser parsers[] = null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   548
		if (project != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   549
			try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   550
				ICDescriptor cdesc = getCProjectDescription(project, false);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   551
				ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID, true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   552
				if (cextensions.length > 0) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   553
					ArrayList<IBinaryParser> list = new ArrayList<IBinaryParser>(cextensions.length);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   554
					for (ICExtensionReference ref : cextensions) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   555
						IBinaryParser parser = null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   556
						try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   557
							parser = (IBinaryParser)ref.createExtension();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   558
						} catch (ClassCastException e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   559
							log(e); // wrong binary parser definition ?
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   560
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   561
						if (parser != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   562
							list.add(parser); 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   563
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   564
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   565
					parsers = new IBinaryParser[list.size()];
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   566
					list.toArray(parsers);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   567
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   568
			} catch (CoreException e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   569
				// ignore since we fall back to a default....
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   570
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   571
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   572
		if (parsers == null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   573
			IBinaryParser parser = getDefaultBinaryParser();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   574
			if (parser != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   575
				parsers = new IBinaryParser[] {parser};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   576
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   577
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   578
		return parsers;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   579
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   580
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   581
	public IBinaryParser getDefaultBinaryParser() throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   582
		IBinaryParser parser = null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   583
		String id = getPluginPreferences().getDefaultString(PREF_BINARY_PARSER);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   584
		if (id == null || id.length() == 0) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   585
			id = DEFAULT_BINARY_PARSER_UNIQ_ID;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   586
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   587
        IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, BINARY_PARSER_SIMPLE_ID);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   588
		IExtension extension = extensionPoint.getExtension(id);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   589
		if (extension != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   590
			IConfigurationElement element[] = extension.getConfigurationElements();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   591
			for (IConfigurationElement element2 : element) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   592
				if (element2.getName().equalsIgnoreCase("cextension")) { //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   593
					parser = (IBinaryParser) element2.createExecutableExtension("run"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   594
					break;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   595
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   596
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   597
		} else {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   598
			IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CCorePlugin.exception.noBinaryFormat"), null); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   599
			throw new CoreException(s);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   600
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   601
		return parser;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   602
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   603
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   604
	public CoreModel getCoreModel() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   605
		return fCoreModel;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   606
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   607
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   608
	public static IIndexManager getIndexManager() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   609
		return getDefault().pdomManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   610
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   611
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   612
	public IPathEntryVariableManager getPathEntryVariableManager() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   613
		return fPathEntryVariableManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   614
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   615
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   616
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   617
	 * @deprecated use {@link #getProjectDescription(IProject, boolean)} instead
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   618
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   619
	@Deprecated
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   620
	public ICDescriptor getCProjectDescription(IProject project) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   621
		return fNewCProjectDescriptionManager.getDescriptorManager().getDescriptor(project);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   622
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   623
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   624
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   625
	 * Please use {@link #getProjectDescription(IProject, boolean)} to fetch the
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   626
	 * ICProjectDescription for the project. And use {@link ICProjectDescription#getConfigurations()} 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   627
	 * to get an array of ICConfigurationDescriptions, which have similar API to ICDescriptor,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   628
	 * allowing you to store settings and configure extensions at the Configuration level
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   629
	 * rather than at the project level.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   630
	 *
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   631
	 * @param project
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   632
	 * @param create
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   633
	 * @return ICDescriptor or <b>null</b> if <b>create</b> is <b>false</b> and no .cdtproject file exists on disk.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   634
	 * @throws CoreException
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   635
	 * @deprecated
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   636
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   637
	@Deprecated
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   638
	public ICDescriptor getCProjectDescription(IProject project, boolean create) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   639
		return fNewCProjectDescriptionManager.getDescriptorManager().getDescriptor(project, create);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   640
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   641
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   642
	public void mapCProjectOwner(IProject project, String id, boolean override) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   643
		try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   644
		if (!override) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   645
			fNewCProjectDescriptionManager.getDescriptorManager().configure(project, id);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   646
		} else {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   647
			fNewCProjectDescriptionManager.getDescriptorManager().convert(project, id);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   648
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   649
		} catch (Exception e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   650
			throw ExceptionFactory.createCoreException(e);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   651
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   652
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   653
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   654
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   655
	 * @deprecated Settings should be set per ICConfigurationDescription rather than
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   656
	 * global to the project.  Please use {@link #getProjectDescription(IProject, boolean)} 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   657
	 * to fetch the ICProjectDescription for the project. And use 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   658
	 * {@link ICProjectDescription#getConfigurations()} to get an array of 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   659
	 * ICConfigurationDescriptions, which have similar API to ICDescriptor,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   660
	 * allowing you to store settings and configure extensions at the Configuration level
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   661
	 * rather than at the project level.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   662
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   663
	@Deprecated
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   664
	public ICDescriptorManager getCDescriptorManager() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   665
		return fNewCProjectDescriptionManager.getDescriptorManager();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   666
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   667
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   668
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   669
	 * Creates a C project resource given the project handle and description.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   670
	 *
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   671
	 * @param description the project description to create a project resource for
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   672
	 * @param projectHandle the project handle to create a project resource for
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   673
	 * @param monitor the progress monitor to show visual progress with
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   674
	 * @param projectID required for mapping the project to an owner
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   675
	 *
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   676
	 * @exception CoreException if the operation fails
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   677
	 * @exception OperationCanceledException if the operation is canceled
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   678
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   679
	public IProject createCProject(
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   680
		final IProjectDescription description,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   681
		final IProject projectHandle,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   682
		IProgressMonitor monitor,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   683
		final String projectID)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   684
		throws CoreException, OperationCanceledException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   685
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   686
		getWorkspace().run(new IWorkspaceRunnable() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   687
			public void run(IProgressMonitor monitor) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   688
				try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   689
					if (monitor == null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   690
						monitor = new NullProgressMonitor();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   691
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   692
					monitor.beginTask("Creating C Project...", 3); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   693
					if (!projectHandle.exists()) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   694
						projectHandle.create(description, new SubProgressMonitor(monitor, 1));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   695
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   696
					
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   697
					if (monitor.isCanceled()) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   698
						throw new OperationCanceledException();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   699
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   700
					
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   701
					// Open first.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   702
					projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   703
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   704
					mapCProjectOwner(projectHandle, projectID, false);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   705
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   706
					// Add C Nature ... does not add duplicates
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   707
					CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   708
				} finally {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   709
					monitor.done();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   710
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   711
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   712
		}, getWorkspace().getRoot(), 0, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   713
		return projectHandle;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   714
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   715
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   716
	public IProject createCDTProject(
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   717
			final IProjectDescription description,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   718
			final IProject projectHandle,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   719
			IProgressMonitor monitor) throws CoreException, OperationCanceledException{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   720
		return createCDTProject(description, projectHandle, null, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   721
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   722
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   723
	public IProject createCDTProject(
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   724
			final IProjectDescription description,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   725
			final IProject projectHandle,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   726
			final String bsId,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   727
			IProgressMonitor monitor)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   728
			throws CoreException, OperationCanceledException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   729
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   730
			getWorkspace().run(new IWorkspaceRunnable() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   731
				public void run(IProgressMonitor monitor) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   732
					try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   733
						if (monitor == null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   734
							monitor = new NullProgressMonitor();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   735
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   736
						monitor.beginTask("Creating C Project...", 3); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   737
						if (!projectHandle.exists()) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   738
							projectHandle.create(description, new SubProgressMonitor(monitor, 1));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   739
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   740
						
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   741
						if (monitor.isCanceled()) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   742
							throw new OperationCanceledException();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   743
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   744
						
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   745
						// Open first.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   746
						projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   747
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   748
//						mapCProjectOwner(projectHandle, projectID, false);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   749
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   750
						// Add C Nature ... does not add duplicates
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   751
						CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   752
						
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   753
						if(bsId != null){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   754
							ICProjectDescription projDes = createProjectDescription(projectHandle, true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   755
							ICConfigurationDescription cfgs[] = projDes.getConfigurations();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   756
							ICConfigurationDescription cfg = null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   757
							for (ICConfigurationDescription cfg2 : cfgs) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   758
								if(bsId.equals(cfg2.getBuildSystemId())){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   759
									cfg = cfg2;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   760
									break;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   761
								}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   762
							}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   763
							
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   764
							if(cfg == null){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   765
								ICConfigurationDescription prefCfg = getPreferenceConfiguration(bsId);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   766
								if(prefCfg != null){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   767
									cfg = projDes.createConfiguration(CDataUtil.genId(prefCfg.getId()), prefCfg.getName(), prefCfg);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   768
								}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   769
							}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   770
							
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   771
							if(cfg != null){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   772
								setProjectDescription(projectHandle, projDes);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   773
							}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   774
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   775
					} finally {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   776
						monitor.done();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   777
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   778
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   779
			}, getWorkspace().getRoot(), 0, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   780
			return projectHandle;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   781
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   782
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   783
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   784
	 * Method convertProjectFromCtoCC converts
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   785
	 * a C Project to a C++ Project
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   786
	 * The newProject MUST, not be null, already have a C Nature 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   787
	 * && must NOT already have a C++ Nature
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   788
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   789
	 * @param projectHandle
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   790
	 * @param monitor
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   791
	 * @throws CoreException
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   792
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   793
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   794
	public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   795
		if ((projectHandle != null)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   796
			&& projectHandle.hasNature(CProjectNature.C_NATURE_ID)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   797
			&& !projectHandle.hasNature(CCProjectNature.CC_NATURE_ID)) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   798
			// Add C++ Nature ... does not add duplicates        
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   799
			CCProjectNature.addCCNature(projectHandle, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   800
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   801
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   802
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   803
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   804
	 * Method to convert a project to a C nature 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   805
	 * All checks should have been done externally
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   806
	 * (as in the Conversion Wizards). 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   807
	 * This method blindly does the conversion.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   808
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   809
	public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   810
		throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   811
		if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   812
			return;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   813
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   814
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   815
		IProjectDescription description = workspace.newProjectDescription(projectHandle.getName());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   816
		description.setLocation(projectHandle.getFullPath());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   817
		createCProject(description, projectHandle, monitor, projectID);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   818
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   819
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   820
	public void convertProjectToNewC(IProject projectHandle, String bsId, IProgressMonitor monitor)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   821
		throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   822
		if ((projectHandle == null) || (monitor == null) || (bsId == null)) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   823
			throw new NullPointerException();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   824
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   825
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   826
		IProjectDescription description = workspace.newProjectDescription(projectHandle.getName());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   827
		description.setLocation(projectHandle.getFullPath());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   828
		createCDTProject(description, projectHandle, bsId, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   829
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   830
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   831
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   832
	 * Method to convert a project to a C++ nature 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   833
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   834
	public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   835
		throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   836
		if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   837
			return;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   838
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   839
		createCProject(projectHandle.getDescription(), projectHandle, monitor, projectID);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   840
		// now add C++ nature
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   841
		convertProjectFromCtoCC(projectHandle, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   842
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   843
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   844
	public void convertProjectToNewCC(IProject projectHandle, String bsId, IProgressMonitor monitor)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   845
		throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   846
		if ((projectHandle == null) || (monitor == null) || (bsId == null)) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   847
			throw new NullPointerException();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   848
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   849
		createCDTProject(projectHandle.getDescription(), projectHandle, bsId, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   850
		// now add C++ nature
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   851
		convertProjectFromCtoCC(projectHandle, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   852
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   853
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   854
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   855
	 * Get the IProcessList contributed interface for the platform.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   856
	 * @return IProcessList
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   857
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   858
	public IProcessList getProcessList() throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   859
        IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "ProcessList"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   860
		if (extension != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   861
			IExtension[] extensions = extension.getExtensions();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   862
			IConfigurationElement defaultContributor = null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   863
			for (IExtension extension2 : extensions) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   864
				IConfigurationElement[] configElements = extension2.getConfigurationElements();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   865
				for (IConfigurationElement configElement : configElements) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   866
					if (configElement.getName().equals("processList")) { //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   867
						String platform = configElement.getAttribute("platform"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   868
						if (platform == null ) { // first contributor found with not platform will be default.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   869
							if (defaultContributor == null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   870
								defaultContributor = configElement;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   871
							}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   872
						} else if (platform.equals(Platform.getOS())) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   873
							// found explicit contributor for this platform.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   874
							return (IProcessList) configElement.createExecutableExtension("class"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   875
						}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   876
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   877
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   878
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   879
			if ( defaultContributor != null) { 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   880
				return (IProcessList) defaultContributor.createExecutableExtension("class"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   881
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   882
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   883
		return null;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   884
		
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   885
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   886
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   887
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   888
	 * Array of error parsers ids.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   889
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   890
	public String[] getAllErrorParsersIDs() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   891
        IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, ERROR_PARSER_SIMPLE_ID);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   892
		String[] empty = new String[0];
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   893
		if (extension != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   894
			IExtension[] extensions = extension.getExtensions();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   895
			ArrayList<String> list = new ArrayList<String>(extensions.length);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   896
			for (IExtension e : extensions)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   897
				list.add(e.getUniqueIdentifier());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   898
			return list.toArray(empty);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   899
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   900
		return empty;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   901
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   902
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   903
	public IErrorParser[] getErrorParser(String id) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   904
		IErrorParser[] empty = new IErrorParser[0];
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   905
		try {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   906
	        IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, ERROR_PARSER_SIMPLE_ID);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   907
			if (extension != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   908
				IExtension[] extensions = extension.getExtensions();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   909
				List<IErrorParser> list = new ArrayList<IErrorParser>(extensions.length);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   910
				for (IExtension e : extensions) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   911
					String parserID = e.getUniqueIdentifier();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   912
					if ((id == null && parserID != null) || (id != null && id.equals(parserID))) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   913
						for (IConfigurationElement ce : e.getConfigurationElements())
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   914
							list.add((IErrorParser)ce.createExecutableExtension("class")); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   915
					}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   916
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   917
				return list.toArray(empty);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   918
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   919
		} catch (CoreException e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   920
			log(e);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   921
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   922
		return empty;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   923
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   924
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   925
	public IScannerInfoProvider getScannerInfoProvider(IProject project) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   926
		return fNewCProjectDescriptionManager.getScannerInfoProviderProxy(project);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   927
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   928
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   929
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   930
	 * Helper function, returning the content type for a filename
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   931
	 * Same as: <pre>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   932
	 * 	getContentType(null, filename)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   933
	 * </pre>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   934
	 * @param filename
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   935
	 * @return the content type found, or <code>null</code>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   936
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   937
	public static IContentType getContentType(String filename) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   938
		return CContentTypes.getContentType(null, filename);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   939
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   940
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   941
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   942
	 * Returns the content type for a filename. The method respects
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   943
	 * project specific content type definitions. The lookup prefers case-
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   944
	 * sensitive matches over the others.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   945
	 * @param project a project with possible project specific settings. Can be <code>null</code>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   946
	 * @param filename a filename to compute the content type for
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   947
	 * @return the content type found or <code>null</code>
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   948
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   949
	public static IContentType getContentType(IProject project, String filename) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   950
		return CContentTypes.getContentType(project, filename);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   951
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   952
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   953
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   954
	 * Tests whether the given project uses its project specific content types.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   955
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   956
	public static boolean usesProjectSpecificContentTypes(IProject project) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   957
		return CContentTypes.usesProjectSpecificContentTypes(project);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   958
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   959
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   960
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   961
	 * Enables or disables the project specific content types.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   962
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   963
	public static void setUseProjectSpecificContentTypes(IProject project, boolean val) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   964
		CContentTypes.setUseProjectSpecificContentTypes(project, val);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   965
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   966
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   967
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   968
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   969
	private static final String MODEL = CCorePlugin.PLUGIN_ID + "/debug/model" ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   970
	private static final String PARSER = CCorePlugin.PLUGIN_ID + "/debug/parser" ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   971
	private static final String PARSER_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   972
	private static final String SCANNER = CCorePlugin.PLUGIN_ID + "/debug/scanner"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   973
	private static final String DELTA = CCorePlugin.PLUGIN_ID + "/debug/deltaprocessor" ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   974
	//private static final String CONTENTASSIST = CCorePlugin.PLUGIN_ID + "/debug/contentassist" ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   975
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   976
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   977
	 * Configure the plug-in with respect to option settings defined in ".options" file
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   978
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   979
	public void configurePluginDebugOptions() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   980
		
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   981
		if(CCorePlugin.getDefault().isDebugging()) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   982
			String option = Platform.getDebugOption(PARSER);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   983
			if(option != null) Util.VERBOSE_PARSER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   984
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   985
			option = Platform.getDebugOption(PARSER_EXCEPTIONS);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   986
			if( option != null ) Util.PARSER_EXCEPTIONS = option.equalsIgnoreCase("true"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   987
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   988
			option = Platform.getDebugOption(SCANNER);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   989
			if( option != null ) Util.VERBOSE_SCANNER = option.equalsIgnoreCase("true"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   990
			
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   991
			option = Platform.getDebugOption(MODEL);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   992
			if(option != null) Util.VERBOSE_MODEL = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   993
			
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   994
			option = Platform.getDebugOption(DELTA);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   995
			if(option != null) Util.VERBOSE_DELTA= option.equalsIgnoreCase("true") ; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   996
			
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   997
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   998
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   999
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1000
	// Preference to turn on/off the use of structural parse mode to build the CModel
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1001
	public void setStructuralParseMode(boolean useNewParser) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1002
		getPluginPreferences().setValue(PREF_USE_STRUCTURAL_PARSE_MODE, useNewParser);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1003
		savePluginPreferences();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1004
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1005
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1006
	public boolean useStructuralParseMode() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1007
		return getPluginPreferences().getBoolean(PREF_USE_STRUCTURAL_PARSE_MODE);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1008
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1009
	
51
49c226a8748e CDT 6.0 from cdt_6_0 branch (eclipse.org cvs repository). This overwrites previous CDT 6.0 merges.
timkelly
parents: 44
diff changeset
  1010
	public CDOM getDOM() {
49c226a8748e CDT 6.0 from cdt_6_0 branch (eclipse.org cvs repository). This overwrites previous CDT 6.0 merges.
timkelly
parents: 44
diff changeset
  1011
	    return CDOM.getInstance();
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1012
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1013
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1014
	public ICdtVariableManager getCdtVariableManager(){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1015
		return CdtVariableManager.getDefault();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1016
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1017
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1018
	public IEnvironmentVariableManager getBuildEnvironmentManager(){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1019
		return EnvironmentVariableManager.getDefault();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1020
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1021
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1022
	public ICConfigurationDescription getPreferenceConfiguration(String buildSystemId) throws CoreException{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1023
		return fNewCProjectDescriptionManager.getPreferenceConfiguration(buildSystemId);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1024
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1025
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1026
	public ICConfigurationDescription getPreferenceConfiguration(String buildSystemId, boolean write) throws CoreException{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1027
		return fNewCProjectDescriptionManager.getPreferenceConfiguration(buildSystemId, write);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1028
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1029
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1030
	public void setPreferenceConfiguration(String buildSystemId, ICConfigurationDescription des) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1031
		fNewCProjectDescriptionManager.setPreferenceConfiguration(buildSystemId, des);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1032
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1033
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1034
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1035
	 * this method is a full equivalent to <code>createProjectDescription(IProject, boolean, false)</code>.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1036
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1037
	 * @see #createProjectDescription(IProject, boolean, boolean)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1038
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1039
	public ICProjectDescription createProjectDescription(IProject project, boolean loadIfExists) throws CoreException{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1040
		return fNewCProjectDescriptionManager.createProjectDescription(project, loadIfExists);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1041
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1042
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1043
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1044
	 * the method creates and returns a writable project description
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1045
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1046
	 * @param project project for which the project description is requested
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1047
	 * @param loadIfExists if true the method first tries to load and return the project description
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1048
	 * from the settings file (.cproject)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1049
	 * if false, the stored settings are ignored and the new (empty) project description is created
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1050
	 * @param creating if true the created project description will be contain the true "isCdtProjectCreating" state.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1051
	 * NOTE: in case the project already contains the project description AND its "isCdtProjectCreating" is false
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1052
	 * the resulting description will be created with the false "isCdtProjectCreating" state
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1053
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1054
	 * NOTE: changes made to the returned project description will not be applied until the {@link #setProjectDescription(IProject, ICProjectDescription)} is called 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1055
	 * @return {@link ICProjectDescription}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1056
	 * @throws CoreException
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1057
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1058
	public ICProjectDescription createProjectDescription(IProject project, boolean loadIfExists, boolean creating) throws CoreException{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1059
		return fNewCProjectDescriptionManager.createProjectDescription(project, loadIfExists, creating);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1060
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1061
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1062
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1063
	 * returns the project description associated with this project or null if the project does not contain the
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1064
	 * CDT data associated with it. 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1065
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1066
	 * this is a convenience method fully equivalent to getProjectDescription(project, true)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1067
	 * see {@link #getProjectDescription(IProject, boolean)} for more detail
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1068
	 * @param project
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1069
	 * @return a writable copy of the ICProjectDescription or null if the project does not contain the
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1070
	 * CDT data associated with it. 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1071
	 * Note: changes to the project description will not be reflected/used by the core
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1072
	 * until the {@link #setProjectDescription(IProject, ICProjectDescription)} is called
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1073
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1074
	 * @see #getProjectDescription(IProject, boolean)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1075
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1076
	public ICProjectDescription getProjectDescription(IProject project){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1077
		return fNewCProjectDescriptionManager.getProjectDescription(project);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1078
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1079
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1080
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1081
	 * this method is called to save/apply the project description
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1082
	 * the method should be called to apply changes made to the project description
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1083
	 * returned by the {@link #getProjectDescription(IProject, boolean)} or {@link #createProjectDescription(IProject, boolean)} 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1084
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1085
	 * @param project
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1086
	 * @param des
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1087
	 * @throws CoreException
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1088
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1089
	 * @see #getProjectDescription(IProject, boolean)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1090
	 * @see #createProjectDescription(IProject, boolean)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1091
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1092
	public void setProjectDescription(IProject project, ICProjectDescription des) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1093
		fNewCProjectDescriptionManager.setProjectDescription(project, des);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1094
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1095
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1096
	public void setProjectDescription(IProject project, ICProjectDescription des, boolean force, IProgressMonitor monitor) throws CoreException {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1097
		fNewCProjectDescriptionManager.setProjectDescription(project, des, force, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1098
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1099
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1100
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1101
	 * returns the project description associated with this project or null if the project does not contain the
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1102
	 * CDT data associated with it. 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1103
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1104
	 * @param project project for which the description is requested
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1105
	 * @param write if true, the writable description copy is returned. 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1106
	 * If false the cached read-only description is returned.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1107
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1108
	 * CDT core maintains the cached project description settings. If only read access is needed to description,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1109
	 * then the read-only project description should be obtained.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1110
	 * This description always operates with cached data and thus it is better to use it for performance reasons
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1111
	 * All set* calls to the read-only description result in the {@link WriteAccessException}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1112
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1113
	 * When the writable description is requested, the description copy is created.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1114
	 * Changes to this description will not be reflected/used by the core and Build System untill the
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1115
	 * {@link #setProjectDescription(IProject, ICProjectDescription)} is called
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1116
	 *
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1117
	 * Each getProjectDescription(project, true) returns a new copy of the project description 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1118
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1119
	 * The writable description uses the cached data untill the first set call
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1120
	 * after that the description communicates directly to the Build System
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1121
	 * i.e. the implementer of the org.eclipse.cdt.core.CConfigurationDataProvider extension
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1122
	 * This ensures the Core<->Build System settings integrity
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1123
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1124
	 * @return {@link ICProjectDescription} or null if the project does not contain the
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1125
	 * CDT data associated with it. 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1126
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1127
	public ICProjectDescription getProjectDescription(IProject project, boolean write){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1128
		return fNewCProjectDescriptionManager.getProjectDescription(project, write);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1129
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1130
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1131
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1132
	 * forces the cached data of the specified projects to be re-calculated.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1133
	 * if the <code>projects</code> argument is <code>null</code> al projects 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1134
	 * within the workspace are updated
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1135
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1136
	 * @param projects
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1137
	 * @param monitor
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1138
	 * @throws CoreException 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1139
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1140
	public void updateProjectDescriptions(IProject projects[], IProgressMonitor monitor) throws CoreException{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1141
		fNewCProjectDescriptionManager.updateProjectDescriptions(projects, monitor);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1142
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1143
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1144
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1145
	 * Answers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1146
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1147
	public boolean isNewStyleProject(IProject project){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1148
		return fNewCProjectDescriptionManager.isNewStyleProject(project);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1149
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1150
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1151
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1152
	 * Answers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1153
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1154
	public boolean isNewStyleProject(ICProjectDescription des){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1155
		return fNewCProjectDescriptionManager.isNewStyleProject(des);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1156
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1157
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1158
	public ICProjectDescriptionManager getProjectDescriptionManager(){
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1159
		return fNewCProjectDescriptionManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1160
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1161
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1162
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1163
	 * @return editable User-variable's supplier 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1164
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1165
	public static IUserVarSupplier getUserVarSupplier() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1166
		return UserVarSupplier.getInstance();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1167
	}
44
b0f794238767 Merge CDT bug 181020 (from CDT patch, not from patch from Carbide Bug 9031)
timkelly
parents: 43
diff changeset
  1168
	
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1169
	// NON-API
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1170
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1171
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1172
	 * @noreference This constructor is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1173
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1174
	public CCorePlugin() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1175
		super();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1176
		fgCPlugin = this;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1177
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1178
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1179
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1180
	 * Answers the shared working copies currently registered for this buffer factory. 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1181
	 * Working copies can be shared by several clients using the same buffer factory,see 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1182
	 * <code>IWorkingCopy.getSharedWorkingCopy</code>.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1183
	 * 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1184
	 * @param factory the given buffer factory
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1185
	 * @return the list of shared working copies for a given buffer factory
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1186
	 * @see IWorkingCopy
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1187
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1188
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1189
	public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1190
		// if factory is null, default factory must be used
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1191
		if (factory == null)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1192
			factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1193
		Map<IBufferFactory, Map<ITranslationUnit, WorkingCopy>> sharedWorkingCopies = CModelManager
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1194
				.getDefault().sharedWorkingCopies;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1195
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1196
		Map<ITranslationUnit, WorkingCopy> perFactoryWorkingCopies = sharedWorkingCopies.get(factory);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1197
		if (perFactoryWorkingCopies == null)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1198
			return CModelManager.NoWorkingCopy;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1199
		Collection<WorkingCopy> copies = perFactoryWorkingCopies.values();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1200
		IWorkingCopy[] result = new IWorkingCopy[copies.size()];
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1201
		copies.toArray(result);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1202
		return result;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1203
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1204
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1205
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1206
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1207
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1208
	public static void log(String e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1209
		log(createStatus(e));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1210
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1211
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1212
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1213
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1214
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1215
	public static void log(Throwable e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1216
		String msg= e.getMessage();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1217
		if (msg == null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1218
			log("Error", e); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1219
		} else {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1220
			log("Error: " + msg, e); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1221
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1222
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1223
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1224
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1225
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1226
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1227
	public static void log(String message, Throwable e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1228
		Throwable nestedException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1229
		if (e instanceof CModelException 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1230
				&& (nestedException = ((CModelException)e).getException()) != null) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1231
			e = nestedException;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1232
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1233
		log(createStatus(message, e));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1234
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1235
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1236
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1237
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1238
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1239
	public static IStatus createStatus(String msg) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1240
		return createStatus(msg, null);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1241
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1242
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1243
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1244
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1245
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1246
	public static IStatus createStatus(String msg, Throwable e) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1247
		return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, msg, e);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1248
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1249
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1250
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1251
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1252
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1253
	public static void log(IStatus status) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1254
		getDefault().getLog().log(status);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1255
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1256
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1257
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1258
	 * @deprecated use getIndexManager().
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1259
	 * @noreference This method is not intended to be referenced by clients.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1260
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1261
	@Deprecated
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1262
	public static IPDOMManager getPDOMManager() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1263
		return getDefault().pdomManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1264
	}
52
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1265
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1266
	/**
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1267
	 * Returns preference controlling whether source roots are shown at the top of projects
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1268
	 * or embedded within the resource tree of projects when they are not top level folders.
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1269
	 * 
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1270
	 * @return boolean preference value
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1271
	 */
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1272
	public static boolean showSourceRootsAtTopOfProject() {
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1273
		return getDefault().getPluginPreferences().getBoolean( CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT);
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
  1274
	}
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
  1275
}