mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Fix for 226682: Need to stop parsing when reconciler is stopped
This commit is contained in:
parent
902a30fae3
commit
52fa978c3c
8 changed files with 201 additions and 51 deletions
|
@ -76,6 +76,7 @@ import org.eclipse.cdt.core.model.IProblemRequestor;
|
|||
import org.eclipse.cdt.core.model.IStructure;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.parser.Keywords;
|
||||
import org.eclipse.cdt.core.parser.ParseError;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTDeclarationAmbiguity;
|
||||
|
@ -90,6 +91,8 @@ import org.eclipse.core.runtime.OperationCanceledException;
|
|||
*/
|
||||
public class CModelBuilder2 implements IContributedModelBuilder {
|
||||
|
||||
private final static boolean DEBUG= Util.isActive(DebugLogConstants.MODEL);
|
||||
|
||||
private final TranslationUnit fTranslationUnit;
|
||||
private final IProgressMonitor fProgressMonitor;
|
||||
|
||||
|
@ -133,13 +136,19 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
|||
else {
|
||||
parseFlags |= ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT;
|
||||
}
|
||||
final IASTTranslationUnit ast= fTranslationUnit.getAST(index, parseFlags);
|
||||
Util.debugLog("CModelBuilder2: parsing " //$NON-NLS-1$
|
||||
+ fTranslationUnit.getElementName()
|
||||
+ " mode="+ (quickParseMode ? "skip all " : "skip indexed ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ " time="+ ( System.currentTimeMillis() - startTime ) + "ms", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
DebugLogConstants.MODEL, false);
|
||||
|
||||
|
||||
final IASTTranslationUnit ast;
|
||||
try {
|
||||
ast= fTranslationUnit.getAST(index, parseFlags, fProgressMonitor);
|
||||
if (DEBUG) Util.debugLog("CModelBuilder2: parsing " //$NON-NLS-1$
|
||||
+ fTranslationUnit.getElementName()
|
||||
+ " mode="+ (quickParseMode ? "skip all " : "skip indexed ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ " time="+ ( System.currentTimeMillis() - startTime ) + "ms", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
DebugLogConstants.MODEL, false);
|
||||
} catch (ParseError e) {
|
||||
checkCanceled();
|
||||
throw e;
|
||||
}
|
||||
if (ast == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -148,7 +157,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
|||
startTime= System.currentTimeMillis();
|
||||
buildModel(ast);
|
||||
elementInfo.setIsStructureKnown(true);
|
||||
Util.debugLog("CModelBuilder2: building " //$NON-NLS-1$
|
||||
if (DEBUG) Util.debugLog("CModelBuilder2: building " //$NON-NLS-1$
|
||||
+"children="+ fTranslationUnit.getElementInfo().internalGetChildren().size() //$NON-NLS-1$
|
||||
+" time="+ (System.currentTimeMillis() - startTime) + "ms", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
DebugLogConstants.MODEL, false);
|
||||
|
@ -171,7 +180,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
|||
|
||||
private void checkCanceled() {
|
||||
if (fProgressMonitor != null && fProgressMonitor.isCanceled()) {
|
||||
Util.debugLog("CModelBuilder2: cancelled ", DebugLogConstants.MODEL, false); //$NON-NLS-1$
|
||||
if (DEBUG) Util.debugLog("CModelBuilder2: cancelled ", DebugLogConstants.MODEL, false); //$NON-NLS-1$
|
||||
throw new OperationCanceledException();
|
||||
}
|
||||
}
|
||||
|
@ -213,6 +222,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
|||
}
|
||||
|
||||
// sort by offset
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<SourceManipulation> children= fTranslationUnit.getElementInfo().internalGetChildren();
|
||||
Collections.sort(children, new Comparator<SourceManipulation>() {
|
||||
public int compare(SourceManipulation o1, SourceManipulation o2) {
|
||||
|
@ -436,21 +446,18 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
|||
if (declSpecifier instanceof IASTCompositeTypeSpecifier) {
|
||||
if (declarator != null) {
|
||||
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);
|
||||
} else {
|
||||
return createCompositeType(parent, (IASTCompositeTypeSpecifier)declSpecifier, isTemplate);
|
||||
}
|
||||
return createCompositeType(parent, (IASTCompositeTypeSpecifier)declSpecifier, isTemplate);
|
||||
} else if (declSpecifier instanceof IASTElaboratedTypeSpecifier) {
|
||||
if (declarator != null) {
|
||||
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);
|
||||
} else {
|
||||
return createElaboratedTypeDeclaration(parent, (IASTElaboratedTypeSpecifier)declSpecifier, isTemplate);
|
||||
}
|
||||
return createElaboratedTypeDeclaration(parent, (IASTElaboratedTypeSpecifier)declSpecifier, isTemplate);
|
||||
} else if (declSpecifier instanceof IASTEnumerationSpecifier) {
|
||||
if (declarator != null) {
|
||||
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);
|
||||
} else {
|
||||
return createEnumeration(parent, (IASTEnumerationSpecifier)declSpecifier);
|
||||
}
|
||||
return createEnumeration(parent, (IASTEnumerationSpecifier)declSpecifier);
|
||||
} else if (declSpecifier instanceof IASTNamedTypeSpecifier) {
|
||||
if (declarator != null) {
|
||||
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);
|
||||
|
@ -1076,7 +1083,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
|||
*
|
||||
* @param element
|
||||
* @param astNode
|
||||
* @throws CModelException
|
||||
* @throws CModelException
|
||||
*/
|
||||
private void setBodyPosition(SourceManipulation element, IASTNode astNode) throws CModelException {
|
||||
setBodyPosition(element.getSourceManipulationInfo(), astNode);
|
||||
|
@ -1115,7 +1122,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
|||
*
|
||||
* @param element
|
||||
* @param astName
|
||||
* @throws CModelException
|
||||
* @throws CModelException
|
||||
*/
|
||||
private void setIdentifierPosition(SourceManipulation element, IASTName astName) throws CModelException {
|
||||
setIdentifierPosition(element.getSourceManipulationInfo(), astName);
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import org.eclipse.cdt.internal.core.util.ICancelable;
|
||||
import org.eclipse.cdt.internal.core.util.ICanceler;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
||||
/**
|
||||
* A progress monitor accepting a <code>ICancelable</code> object to receive the cancel request.
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ProgressMonitorAndCanceler extends NullProgressMonitor implements ICanceler {
|
||||
|
||||
private ICancelable fCancelable;
|
||||
|
||||
public void setCancelable(ICancelable cancelable) {
|
||||
fCancelable= cancelable;
|
||||
checkCanceled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCanceled(boolean canceled) {
|
||||
super.setCanceled(canceled);
|
||||
checkCanceled();
|
||||
}
|
||||
|
||||
private void checkCanceled() {
|
||||
if (fCancelable != null && isCanceled()) {
|
||||
fCancelable.cancel();
|
||||
fCancelable= null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -58,6 +58,7 @@ import org.eclipse.cdt.core.model.IUsing;
|
|||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||
import org.eclipse.cdt.core.parser.ParserUtil;
|
||||
|
@ -67,7 +68,9 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|||
import org.eclipse.cdt.internal.core.dom.NullCodeReaderFactory;
|
||||
import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
|
||||
import org.eclipse.cdt.internal.core.index.IndexBasedCodeReaderFactory;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserLogService;
|
||||
import org.eclipse.cdt.internal.core.pdom.indexer.ProjectIndexerInputAdapter;
|
||||
import org.eclipse.cdt.internal.core.util.ICanceler;
|
||||
import org.eclipse.cdt.internal.core.util.MementoTokenizer;
|
||||
import org.eclipse.core.filesystem.EFS;
|
||||
import org.eclipse.core.filesystem.IFileInfo;
|
||||
|
@ -399,7 +402,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
// if factory is null, default factory must be used
|
||||
if (factory == null) factory = BufferManager.getDefaultBufferManager();
|
||||
|
||||
// In order to be shared, working copies have to denote the same translation unit
|
||||
// In order to be shared, working copies have to denote the same translation unit
|
||||
// AND use the same buffer factory.
|
||||
// Assuming there is a little set of buffer factories, then use a 2 level Map cache.
|
||||
Map sharedWorkingCopies = CModelManager.getDefault().sharedWorkingCopies;
|
||||
|
@ -462,7 +465,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
|
||||
CModelManager manager = CModelManager.getDefault();
|
||||
|
||||
// In order to be shared, working copies have to denote the same translation unit
|
||||
// In order to be shared, working copies have to denote the same translation unit
|
||||
// AND use the same buffer factory.
|
||||
// Assuming there is a little set of buffer factories, then use a 2 level Map cache.
|
||||
Map sharedWorkingCopies = manager.sharedWorkingCopies;
|
||||
|
@ -641,7 +644,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
|
||||
/**
|
||||
* Parse the buffer contents of this element.
|
||||
* @param monitor
|
||||
* @param monitor
|
||||
*/
|
||||
private void parseUsingCModelBuilder(Map newElements, boolean quickParseMode, IProgressMonitor monitor) {
|
||||
try {
|
||||
|
@ -737,7 +740,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
|
||||
if (description == null) {
|
||||
// TODO: Sometimes, CoreModel returns a null ICProjectDescription
|
||||
// so for now, fall back to configuration-less language determination.
|
||||
// so for now, fall back to configuration-less language determination.
|
||||
configuration = null;
|
||||
} else {
|
||||
configuration = description.getActiveConfiguration();
|
||||
|
@ -785,10 +788,14 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
}
|
||||
|
||||
public IASTTranslationUnit getAST() throws CoreException {
|
||||
return getAST(null, 0);
|
||||
return getAST(null, 0, null);
|
||||
}
|
||||
|
||||
public IASTTranslationUnit getAST(IIndex index, int style) throws CoreException {
|
||||
return getAST(index, style, null);
|
||||
}
|
||||
|
||||
public IASTTranslationUnit getAST(IIndex index, int style, IProgressMonitor monitor) throws CoreException {
|
||||
ITranslationUnit configureWith = getSourceContextTU(index, style);
|
||||
|
||||
IScannerInfo scanInfo= configureWith.getScannerInfo( (style & AST_SKIP_IF_NO_BUILD_INFO) == 0);
|
||||
|
@ -814,7 +821,13 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
if (isSourceUnit()) {
|
||||
options |= ILanguage.OPTION_IS_SOURCE_UNIT;
|
||||
}
|
||||
return ((AbstractLanguage)language).getASTTranslationUnit(reader, scanInfo, crf, index, options, ParserUtil.getParserLogService());
|
||||
final IParserLogService log;
|
||||
if (monitor instanceof ICanceler) {
|
||||
log= new ParserLogService(DebugLogConstants.PARSER, (ICanceler)monitor);
|
||||
} else {
|
||||
log= ParserUtil.getParserLogService();
|
||||
}
|
||||
return ((AbstractLanguage)language).getASTTranslationUnit(reader, scanInfo, crf, index, options, log);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -941,8 +954,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the language of the context this file was parsed in. Works only after using
|
||||
* {@link #getAST(IIndex, int)} with the flag {@link ITranslationUnit#AST_CONFIGURE_USING_SOURCE_CONTEXT}.
|
||||
* Return the language of the context this file was parsed in. Works only after using
|
||||
* {@link #getAST(IIndex, int, IProgressMonitor)} with the flag {@link ITranslationUnit#AST_CONFIGURE_USING_SOURCE_CONTEXT}.
|
||||
*/
|
||||
public ILanguage getLanguageOfContext() throws CoreException {
|
||||
final ILanguage result= fLanguageOfContext;
|
||||
|
@ -1020,7 +1033,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
case ICElement.C_TEMPLATE_METHOD_DECLARATION:
|
||||
// search for matching function
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
if (elementType == children[i].getElementType()
|
||||
if (elementType == children[i].getElementType()
|
||||
&& elementName.equals(children[i].getElementName())) {
|
||||
assert children[i] instanceof IFunctionDeclaration;
|
||||
String[] functionParams= ((IFunctionDeclaration)children[i]).getParameterTypes();
|
||||
|
@ -1036,7 +1049,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
case ICElement.C_TEMPLATE_UNION:
|
||||
// search for matching template type
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
if (elementType == children[i].getElementType()
|
||||
if (elementType == children[i].getElementType()
|
||||
&& elementName.equals(children[i].getElementName())) {
|
||||
assert children[i] instanceof ITemplate;
|
||||
String[] templateParams= ((ITemplate)children[i]).getTemplateParameterTypes();
|
||||
|
@ -1050,7 +1063,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
default:
|
||||
// search for matching element
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
if (elementType == children[i].getElementType()
|
||||
if (elementType == children[i].getElementType()
|
||||
&& elementName.equals(children[i].getElementName())) {
|
||||
element= (CElement) children[i];
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.util;
|
||||
|
||||
/**
|
||||
* Interface for cancelable objects.
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public interface ICancelable {
|
||||
|
||||
/**
|
||||
* Marks the receiver cancelled.
|
||||
*/
|
||||
void cancel();
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.util;
|
||||
|
||||
/**
|
||||
* An interface for objects accepting an instance of {@link ICancelable}.
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public interface ICanceler {
|
||||
|
||||
/**
|
||||
* Set the cancelable object.
|
||||
*
|
||||
* @param cancelable the cancelable object
|
||||
*/
|
||||
void setCancelable(ICancelable cancelable);
|
||||
|
||||
}
|
|
@ -40,6 +40,8 @@ import org.eclipse.cdt.core.parser.ParserMode;
|
|||
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||
import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
|
||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
|
||||
import org.eclipse.cdt.internal.core.util.ICancelable;
|
||||
import org.eclipse.cdt.internal.core.util.ICanceler;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +49,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* for the DOM parser framework.
|
||||
*
|
||||
* This class uses the template method pattern, derived classes need only implement
|
||||
* {@link AbstractCLikeLanguage#getScannerExtensionConfiguration()},
|
||||
* {@link AbstractCLikeLanguage#getScannerExtensionConfiguration()},
|
||||
* {@link AbstractCLikeLanguage#getParserLanguage()} and
|
||||
* {@link AbstractCLikeLanguage#createParser(IScanner scanner, ParserMode parserMode,
|
||||
* IParserLogService logService, IIndex index)}.
|
||||
|
@ -115,16 +117,33 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
public IASTTranslationUnit getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo,
|
||||
ICodeReaderFactory codeReaderFactory, IIndex index, int options, IParserLogService log) throws CoreException {
|
||||
|
||||
IScanner scanner= createScanner(reader, scanInfo, codeReaderFactory, log);
|
||||
final IScanner scanner= createScanner(reader, scanInfo, codeReaderFactory, log);
|
||||
scanner.setScanComments((options & OPTION_ADD_COMMENTS) != 0);
|
||||
scanner.setComputeImageLocations((options & OPTION_NO_IMAGE_LOCATIONS) == 0);
|
||||
|
||||
ISourceCodeParser parser= createParser(scanner, log, index, false, options);
|
||||
final ISourceCodeParser parser= createParser(scanner, log, index, false, options);
|
||||
|
||||
// make parser cancelable by reconciler - http://bugs.eclipse.org/226682
|
||||
ICanceler canceler= null;
|
||||
if (log instanceof ICanceler) {
|
||||
canceler= (ICanceler) log;
|
||||
canceler.setCancelable(new ICancelable() {
|
||||
public void cancel() {
|
||||
scanner.cancel();
|
||||
parser.cancel();
|
||||
}});
|
||||
}
|
||||
|
||||
// Parse
|
||||
IASTTranslationUnit ast= parser.parse();
|
||||
ast.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0);
|
||||
return ast;
|
||||
try {
|
||||
// Parse
|
||||
IASTTranslationUnit ast= parser.parse();
|
||||
ast.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0);
|
||||
return ast;
|
||||
} finally {
|
||||
if (canceler != null) {
|
||||
canceler.setCancelable(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,19 +17,25 @@ import org.eclipse.cdt.core.ICLogConstants;
|
|||
import org.eclipse.cdt.core.parser.AbstractParserLogService;
|
||||
import org.eclipse.cdt.internal.core.model.DebugLogConstants;
|
||||
import org.eclipse.cdt.internal.core.model.Util;
|
||||
import org.eclipse.cdt.internal.core.util.ICancelable;
|
||||
import org.eclipse.cdt.internal.core.util.ICanceler;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ParserLogService extends AbstractParserLogService {
|
||||
public class ParserLogService extends AbstractParserLogService implements ICanceler {
|
||||
|
||||
private final DebugLogConstants topic;
|
||||
private final boolean fIsTracing;
|
||||
private final boolean fIsTracingExceptions;
|
||||
private final ICanceler fCanceler;
|
||||
|
||||
|
||||
public ParserLogService(DebugLogConstants constant) {
|
||||
this(constant, null);
|
||||
}
|
||||
|
||||
public ParserLogService(DebugLogConstants constant, ICanceler canceler) {
|
||||
topic = constant;
|
||||
if (CCorePlugin.getDefault() == null) {
|
||||
fIsTracing= fIsTracingExceptions= false;
|
||||
|
@ -38,6 +44,7 @@ public class ParserLogService extends AbstractParserLogService {
|
|||
fIsTracingExceptions= Util.PARSER_EXCEPTIONS;
|
||||
fIsTracing= Util.isActive(topic);
|
||||
}
|
||||
fCanceler= canceler;
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,4 +68,13 @@ public class ParserLogService extends AbstractParserLogService {
|
|||
public boolean isTracingExceptions() {
|
||||
return fIsTracingExceptions;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.internal.core.util.ICanceler#setCancelable(org.eclipse.cdt.internal.core.util.ICancelable)
|
||||
*/
|
||||
public void setCancelable(ICancelable cancelable) {
|
||||
if (fCanceler != null) {
|
||||
fCanceler.setCancelable(cancelable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.content.IContentType;
|
||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
@ -86,6 +85,7 @@ import org.eclipse.cdt.ui.text.doctools.DefaultMultilineCommentAutoEditStrategy;
|
|||
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
||||
import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration;
|
||||
|
||||
import org.eclipse.cdt.internal.core.model.ProgressMonitorAndCanceler;
|
||||
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
|
||||
|
@ -181,7 +181,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
}
|
||||
fPreprocessorScanner= scanner;
|
||||
return fPreprocessorScanner;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color manager for this configuration.
|
||||
|
@ -202,7 +202,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates outline presenter.
|
||||
* Creates outline presenter.
|
||||
* @return Presenter with outline view.
|
||||
*/
|
||||
public IInformationPresenter getOutlinePresenter(ISourceViewer sourceViewer) {
|
||||
|
@ -222,7 +222,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates type hierarchy presenter.
|
||||
* Creates type hierarchy presenter.
|
||||
* @return Presenter with type hierarchy view.
|
||||
*/
|
||||
public IInformationPresenter getHierarchyPresenter(ISourceViewer sourceViewer) {
|
||||
|
@ -321,7 +321,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
*/
|
||||
protected ICTokenScanner getSinglelineDocCommentScanner(IResource resource) {
|
||||
if (fSinglelineDocCommentScanner == null) {
|
||||
IDocCommentViewerConfiguration owner= DocCommentOwnerManager.getInstance().getCommentOwner(resource).getSinglelineConfiguration();
|
||||
IDocCommentViewerConfiguration owner= DocCommentOwnerManager.getInstance().getCommentOwner(resource).getSinglelineConfiguration();
|
||||
fSinglelineDocCommentScanner= owner.createCommentScanner(getTokenStoreFactory());
|
||||
}
|
||||
return fSinglelineDocCommentScanner;
|
||||
|
@ -389,7 +389,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
|
||||
ContentAssistPreference.configure(assistant, fPreferenceStore);
|
||||
|
||||
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
|
||||
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
|
||||
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
|
||||
assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
|
||||
|
||||
|
@ -428,13 +428,13 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
@Override
|
||||
public IReconciler getReconciler(ISourceViewer sourceViewer) {
|
||||
if (fTextEditor != null) {
|
||||
//Delay changed and non-incremental reconciler used due to
|
||||
//Delay changed and non-incremental reconciler used due to
|
||||
//PR 130089
|
||||
CCompositeReconcilingStrategy strategy=
|
||||
new CCompositeReconcilingStrategy(sourceViewer, fTextEditor, getConfiguredDocumentPartitioning(sourceViewer));
|
||||
MonoReconciler reconciler= new CReconciler(fTextEditor, strategy);
|
||||
reconciler.setIsIncrementalReconciler(false);
|
||||
reconciler.setProgressMonitor(new NullProgressMonitor());
|
||||
reconciler.setProgressMonitor(new ProgressMonitorAndCanceler());
|
||||
reconciler.setDelay(500);
|
||||
return reconciler;
|
||||
}
|
||||
|
@ -694,8 +694,8 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
*/
|
||||
@Override
|
||||
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
|
||||
return new String[] {
|
||||
IDocument.DEFAULT_CONTENT_TYPE,
|
||||
return new String[] {
|
||||
IDocument.DEFAULT_CONTENT_TYPE,
|
||||
ICPartitions.C_MULTI_LINE_COMMENT,
|
||||
ICPartitions.C_SINGLE_LINE_COMMENT,
|
||||
ICPartitions.C_STRING,
|
||||
|
@ -712,8 +712,8 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
@Override
|
||||
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
|
||||
|
||||
final MultiPassContentFormatter formatter =
|
||||
new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer),
|
||||
final MultiPassContentFormatter formatter =
|
||||
new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer),
|
||||
IDocument.DEFAULT_CONTENT_TYPE);
|
||||
|
||||
formatter.setMasterStrategy(new CFormattingStrategy());
|
||||
|
@ -849,7 +849,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
public IInformationControl createInformationControl(Shell parent) {
|
||||
int shellStyle= SWT.RESIZE;
|
||||
int treeStyle= SWT.V_SCROLL | SWT.H_SCROLL;
|
||||
return new COutlineInformationControl(parent, shellStyle, treeStyle);
|
||||
return new COutlineInformationControl(parent, shellStyle, treeStyle);
|
||||
}
|
||||
};
|
||||
return conrolCreator;
|
||||
|
@ -867,7 +867,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
|||
public IInformationControl createInformationControl(Shell parent) {
|
||||
int shellStyle= SWT.RESIZE;
|
||||
int treeStyle= SWT.V_SCROLL | SWT.H_SCROLL;
|
||||
return new THInformationControl(parent, shellStyle, treeStyle);
|
||||
return new THInformationControl(parent, shellStyle, treeStyle);
|
||||
}
|
||||
};
|
||||
return conrolCreator;
|
||||
|
|
Loading…
Add table
Reference in a new issue