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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2016-05-25 18:46:41 -07:00
parent 69d3441795
commit 3bd964832a
5 changed files with 27 additions and 101 deletions

View file

@ -20,7 +20,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
* @since 5.0 * @since 5.0
*/ */
public class ProgressMonitorAndCanceler extends NullProgressMonitor implements ICanceler { public class ProgressMonitorAndCanceler extends NullProgressMonitor implements ICanceler {
private ICancelable fCancelable; private ICancelable fCancelable;
@Override @Override
@ -41,5 +40,4 @@ public class ProgressMonitorAndCanceler extends NullProgressMonitor implements I
fCancelable= null; fCancelable= null;
} }
} }
} }

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.core.parser;
import org.eclipse.cdt.internal.core.dom.parser.ParserLogServiceWrapper; import org.eclipse.cdt.internal.core.dom.parser.ParserLogServiceWrapper;
public abstract class AbstractParserLogService implements IParserLogService { public abstract class AbstractParserLogService implements IParserLogService {
/** /**
* @since 5.4 * @since 5.4
*/ */

View file

@ -12,14 +12,9 @@ package org.eclipse.cdt.core.parser;
/** /**
* @author jcamelon * @author jcamelon
*
*/ */
public interface IParserLogService public interface IParserLogService {
{ public void traceLog(String message);
public void traceLog( String message );
// public void errorLog( String message );
public boolean isTracing(); public boolean isTracing();
} }

View file

@ -23,10 +23,8 @@ import org.eclipse.core.runtime.Platform;
/** /**
* @author jcamelon * @author jcamelon
*
*/ */
public class ParserLogService extends AbstractParserLogService implements ICanceler { public class ParserLogService extends AbstractParserLogService implements ICanceler {
private final DebugLogConstants topic; private final DebugLogConstants topic;
private final boolean fIsTracing; private final boolean fIsTracing;
private final boolean fIsTracingExceptions; private final boolean fIsTracingExceptions;
@ -39,19 +37,18 @@ public class ParserLogService extends AbstractParserLogService implements ICance
public ParserLogService(DebugLogConstants constant, ICanceler canceler) { public ParserLogService(DebugLogConstants constant, ICanceler canceler) {
topic = constant; topic = constant;
if (CCorePlugin.getDefault() == null) { if (CCorePlugin.getDefault() == null) {
fIsTracing= fIsTracingExceptions= false; fIsTracingExceptions= false;
} fIsTracing= false;
else { } else {
fIsTracingExceptions= Util.PARSER_EXCEPTIONS; fIsTracingExceptions= Util.PARSER_EXCEPTIONS;
fIsTracing= Util.isActive(topic); fIsTracing= Util.isActive(topic);
} }
fCanceler= canceler; fCanceler= canceler;
} }
@Override @Override
public void traceLog(String message) { public void traceLog(String message) {
Util.debugLog( message, topic ); Util.debugLog(message, topic);
} }
@Override @Override
@ -67,7 +64,7 @@ public class ParserLogService extends AbstractParserLogService implements ICance
@Override @Override
public void errorLog(String message) { public void errorLog(String message) {
Util.log( message, ICLogConstants.CDT ); Util.log(message, ICLogConstants.CDT);
} }
@Override @Override
@ -80,9 +77,6 @@ public class ParserLogService extends AbstractParserLogService implements ICance
return fIsTracingExceptions; return fIsTracingExceptions;
} }
/*
* @see org.eclipse.cdt.internal.core.util.ICanceler#setCancelable(org.eclipse.cdt.internal.core.util.ICancelable)
*/
@Override @Override
public void setCancelable(ICancelable cancelable) { public void setCancelable(ICancelable cancelable) {
if (fCanceler != null) { if (fCanceler != null) {

View file

@ -114,7 +114,6 @@ import org.eclipse.cdt.internal.ui.text.doctools.DocCommentOwnerManager;
import org.eclipse.cdt.internal.ui.typehierarchy.THInformationControl; import org.eclipse.cdt.internal.ui.typehierarchy.THInformationControl;
import org.eclipse.cdt.internal.ui.typehierarchy.THInformationProvider; import org.eclipse.cdt.internal.ui.typehierarchy.THInformationProvider;
/** /**
* Configuration for a <code>SourceViewer</code> which shows C/C++ code. * Configuration for a <code>SourceViewer</code> which shows C/C++ code.
* <p> * <p>
@ -124,7 +123,6 @@ import org.eclipse.cdt.internal.ui.typehierarchy.THInformationProvider;
* @since 5.1 * @since 5.1
*/ */
public class CSourceViewerConfiguration extends TextSourceViewerConfiguration { public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
protected ITextEditor fTextEditor; protected ITextEditor fTextEditor;
/** /**
* The document partitioning. * The document partitioning.
@ -297,14 +295,14 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
reconciler.setRepairer(dr, ICPartitions.C_MULTI_LINE_COMMENT); reconciler.setRepairer(dr, ICPartitions.C_MULTI_LINE_COMMENT);
ICTokenScanner docCommentSingleScanner= getSinglelineDocCommentScanner(getProject()); ICTokenScanner docCommentSingleScanner= getSinglelineDocCommentScanner(getProject());
if(docCommentSingleScanner!=null) { if (docCommentSingleScanner!=null) {
dr= new DefaultDamagerRepairer(docCommentSingleScanner); dr= new DefaultDamagerRepairer(docCommentSingleScanner);
reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_DOC_COMMENT); reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_DOC_COMMENT);
reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_DOC_COMMENT); reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_DOC_COMMENT);
} }
ICTokenScanner docCommentMultiScanner= getMultilineDocCommentScanner(getProject()); ICTokenScanner docCommentMultiScanner= getMultilineDocCommentScanner(getProject());
if(docCommentMultiScanner!=null) { if (docCommentMultiScanner!=null) {
dr= new DefaultDamagerRepairer(docCommentMultiScanner); dr= new DefaultDamagerRepairer(docCommentMultiScanner);
reconciler.setDamager(dr, ICPartitions.C_MULTI_LINE_DOC_COMMENT); reconciler.setDamager(dr, ICPartitions.C_MULTI_LINE_DOC_COMMENT);
reconciler.setRepairer(dr, ICPartitions.C_MULTI_LINE_DOC_COMMENT); reconciler.setRepairer(dr, ICPartitions.C_MULTI_LINE_DOC_COMMENT);
@ -384,7 +382,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
} }
/** /**
* @return the code scanner for the given language * Returns the code scanner for the given language.
*/ */
protected RuleBasedScanner getCodeScanner(ILanguage language) { protected RuleBasedScanner getCodeScanner(ILanguage language) {
if (fCodeScanner != null) { if (fCodeScanner != null) {
@ -392,12 +390,11 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
} }
RuleBasedScanner scanner= null; RuleBasedScanner scanner= null;
if(language != null) { if (language != null) {
ICLanguageKeywords keywords = language.getAdapter(ICLanguageKeywords.class); ICLanguageKeywords keywords = language.getAdapter(ICLanguageKeywords.class);
if(keywords != null) { if (keywords != null) {
scanner = new CCodeScanner(getTokenStoreFactory(), keywords); scanner = new CCodeScanner(getTokenStoreFactory(), keywords);
} } else {
else {
ILanguageUI languageUI = language.getAdapter(ILanguageUI.class); ILanguageUI languageUI = language.getAdapter(ILanguageUI.class);
if (languageUI != null) if (languageUI != null)
scanner = languageUI.getCodeScanner(); scanner = languageUI.getCodeScanner();
@ -413,9 +410,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return scanner; return scanner;
} }
/*
* @see SourceViewerConfiguration#getContentAssistant(ISourceViewer)
*/
@Override @Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
if (getEditor() == null) { if (getEditor() == null) {
@ -472,10 +466,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return settings; return settings;
} }
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getQuickAssistAssistant(org.eclipse.jface.text.source.ISourceViewer)
* @since 5.0
*/
@Override @Override
public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) { public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
if (getEditor() != null) if (getEditor() != null)
@ -483,14 +473,10 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return null; return null;
} }
/*
* @see org.eclipse.ui.editors.text.TextSourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override @Override
public IReconciler getReconciler(ISourceViewer sourceViewer) { public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (fTextEditor != null) { if (fTextEditor != null) {
//Delay changed and non-incremental reconciler used due to // Delay changed and non-incremental reconciler used due to PR 130089.
//PR 130089
CCompositeReconcilingStrategy strategy= CCompositeReconcilingStrategy strategy=
new CCompositeReconcilingStrategy(sourceViewer, fTextEditor, getConfiguredDocumentPartitioning(sourceViewer)); new CCompositeReconcilingStrategy(sourceViewer, fTextEditor, getConfiguredDocumentPartitioning(sourceViewer));
MonoReconciler reconciler= new CReconciler(fTextEditor, strategy); MonoReconciler reconciler= new CReconciler(fTextEditor, strategy);
@ -502,9 +488,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return null; return null;
} }
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
*/
@Override @Override
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
String partitioning= getConfiguredDocumentPartitioning(sourceViewer); String partitioning= getConfiguredDocumentPartitioning(sourceViewer);
@ -539,7 +522,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getCommentOwner(getProject()); IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getCommentOwner(getProject());
ITextDoubleClickStrategy single= owner.getSinglelineConfiguration().createDoubleClickStrategy(); ITextDoubleClickStrategy single= owner.getSinglelineConfiguration().createDoubleClickStrategy();
return single != null ? single : new DefaultTextDoubleClickStrategy(); return single != null ? single : new DefaultTextDoubleClickStrategy();
} else if(ICPartitions.C_MULTI_LINE_DOC_COMMENT.equals(contentType)) { } else if (ICPartitions.C_MULTI_LINE_DOC_COMMENT.equals(contentType)) {
IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getCommentOwner(getProject()); IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getCommentOwner(getProject());
ITextDoubleClickStrategy multi= owner.getMultilineConfiguration().createDoubleClickStrategy(); ITextDoubleClickStrategy multi= owner.getMultilineConfiguration().createDoubleClickStrategy();
return multi!=null ? multi : new DefaultTextDoubleClickStrategy(); return multi!=null ? multi : new DefaultTextDoubleClickStrategy();
@ -552,17 +535,11 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return new CDoubleClickSelector(); return new CDoubleClickSelector();
} }
/**
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getDefaultPrefixes(ISourceViewer, String)
*/
@Override @Override
public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) { public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) {
return new String[] { "//", "//!", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return new String[] { "//", "//!", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} }
/*
* @see SourceViewerConfiguration#getIndentPrefixes(ISourceViewer, String)
*/
@Override @Override
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
ICProject project= getCProject(); ICProject project= getCProject();
@ -571,21 +548,23 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
boolean allowTabs= tabWidth <= indentWidth; boolean allowTabs= tabWidth <= indentWidth;
String indentMode; String indentMode;
if (project == null) if (project == null) {
indentMode= CCorePlugin.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR); indentMode= CCorePlugin.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
else } else {
indentMode= project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, true); indentMode= project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, true);
}
boolean useSpaces= CCorePlugin.SPACE.equals(indentMode) || DefaultCodeFormatterConstants.MIXED.equals(indentMode); boolean useSpaces= CCorePlugin.SPACE.equals(indentMode) || DefaultCodeFormatterConstants.MIXED.equals(indentMode);
// assert allowTabs || useSpaces; // assert allowTabs || useSpaces;
if (!allowTabs) if (!allowTabs) {
return new String[] { getStringWithSpaces(indentWidth), "" }; //$NON-NLS-1$ return new String[] { getStringWithSpaces(indentWidth), "" }; //$NON-NLS-1$
else if (!useSpaces) } else if (!useSpaces) {
return getIndentPrefixesForTab(tabWidth); return getIndentPrefixesForTab(tabWidth);
else } else {
return getIndentPrefixesForSpaces(tabWidth); return getIndentPrefixesForSpaces(tabWidth);
}
} }
/** /**
@ -649,9 +628,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return element.getCProject(); return element.getCProject();
} }
/*
* @see SourceViewerConfiguration#getTabWidth(ISourceViewer)
*/
@Override @Override
public int getTabWidth(ISourceViewer sourceViewer) { public int getTabWidth(ISourceViewer sourceViewer) {
return CodeFormatterUtil.getTabWidth(getCProject()); return CodeFormatterUtil.getTabWidth(getCProject());
@ -659,8 +635,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
/** /**
* Returns the configured indent width for this viewer. * Returns the configured indent width for this viewer.
* @param sourceViewer
* @return the indent width
*/ */
public int getIndentWidth(ISourceViewer sourceViewer) { public int getIndentWidth(ISourceViewer sourceViewer) {
return CodeFormatterUtil.getIndentWidth(getCProject()); return CodeFormatterUtil.getIndentWidth(getCProject());
@ -675,16 +649,14 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
public boolean useSpacesOnly(ISourceViewer sourceViewer) { public boolean useSpacesOnly(ISourceViewer sourceViewer) {
ICProject project= getCProject(); ICProject project= getCProject();
String option; String option;
if (project == null) if (project == null) {
option= CCorePlugin.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR); option= CCorePlugin.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
else } else {
option= project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, true); option= project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, true);
}
return CCorePlugin.SPACE.equals(option); return CCorePlugin.SPACE.equals(option);
} }
/**
* @see SourceViewerConfiguration#getAnnotationHover(ISourceViewer)
*/
@Override @Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new HTMLAnnotationHover() { return new HTMLAnnotationHover() {
@ -695,10 +667,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
}; };
} }
/*
* @see SourceViewerConfiguration#getConfiguredTextHoverStateMasks(ISourceViewer, String)
* @since 2.1
*/
@Override @Override
public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType) { public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType) {
CEditorTextHoverDescriptor[] hoverDescs= CUIPlugin.getDefault().getCEditorTextHoverDescriptors(); CEditorTextHoverDescriptor[] hoverDescs= CUIPlugin.getDefault().getCEditorTextHoverDescriptors();
@ -725,10 +693,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return shortenedStateMasks; return shortenedStateMasks;
} }
/*
* @see SourceViewerConfiguration#getTextHover(ISourceViewer, String, int)
* @since 2.1
*/
@Override @Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) { public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
CEditorTextHoverDescriptor[] hoverDescs= CUIPlugin.getDefault().getCEditorTextHoverDescriptors(); CEditorTextHoverDescriptor[] hoverDescs= CUIPlugin.getDefault().getCEditorTextHoverDescriptors();
@ -742,17 +706,11 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return null; return null;
} }
/*
* @see SourceViewerConfiguration#getTextHover(ISourceViewer, String)
*/
@Override @Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
return getTextHover(sourceViewer, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK); return getTextHover(sourceViewer, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
} }
/**
* @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer)
*/
@Override @Override
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return new String[] { return new String[] {
@ -767,12 +725,8 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
}; };
} }
/**
* @see SourceViewerConfiguration#getContentFormatter(ISourceViewer)
*/
@Override @Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) { public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
final MultiPassContentFormatter formatter = final MultiPassContentFormatter formatter =
new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer),
IDocument.DEFAULT_CONTENT_TYPE); IDocument.DEFAULT_CONTENT_TYPE);
@ -798,10 +752,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return false; return false;
} }
/*
* @see SourceViewerConfiguration#getHoverControlCreator(ISourceViewer)
* @since 2.0
*/
@Override @Override
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) { public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
return new IInformationControlCreator() { return new IInformationControlCreator() {
@ -830,10 +780,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
}; };
} }
/*
* @see SourceViewerConfiguration#getInformationPresenter(ISourceViewer)
* @since 2.0
*/
@Override @Override
public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) { public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
InformationPresenter presenter= new InformationPresenter(getInformationPresenterControlCreator(sourceViewer)); InformationPresenter presenter= new InformationPresenter(getInformationPresenterControlCreator(sourceViewer));
@ -888,9 +834,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
fPreprocessorScanner.adaptToPreferenceChange(event); fPreprocessorScanner.adaptToPreferenceChange(event);
} }
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override @Override
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) { public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
if (fDocumentPartitioning != null) if (fDocumentPartitioning != null)
@ -919,7 +862,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
/** /**
* Creates control for outline presentation in editor. * Creates control for outline presentation in editor.
* @return Control.
*/ */
protected IInformationControlCreator getHierarchyControlCreator() { protected IInformationControlCreator getHierarchyControlCreator() {
final IInformationControlCreator conrolCreator = new IInformationControlCreator() { final IInformationControlCreator conrolCreator = new IInformationControlCreator() {
@ -975,7 +917,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
} }
/** /**
* Reset cached language dependent scanners. * Resets cached language dependent scanners.
*/ */
public void resetScanners() { public void resetScanners() {
fCodeScanner= null; fCodeScanner= null;
@ -1019,7 +961,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
/** /**
* Creates control for macro exploration in editor. * Creates control for macro exploration in editor.
* @return Control.
*/ */
protected IInformationControlCreator getMacroExplorationControlCreator() { protected IInformationControlCreator getMacroExplorationControlCreator() {
final IInformationControlCreator conrolCreator = new IInformationControlCreator() { final IInformationControlCreator conrolCreator = new IInformationControlCreator() {
@ -1033,7 +974,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
/** /**
* @return the IProject associated with this CSourceViewerConfiguration, or null if * @return the IProject associated with this CSourceViewerConfiguration, or null if
* no IProject could be determined * no IProject could be determined
*/ */
protected IProject getProject() { protected IProject getProject() {
ICProject cproject= getCProject(); ICProject cproject= getCProject();
@ -1055,5 +996,4 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
targets.put("org.eclipse.cdt.ui.cCode", fTextEditor); //$NON-NLS-1$ targets.put("org.eclipse.cdt.ui.cCode", fTextEditor); //$NON-NLS-1$
return targets; return targets;
} }
} }