Class JavaSourceViewerConfiguration
- java.lang.Object
-
- org.eclipse.jface.text.source.SourceViewerConfiguration
-
- org.eclipse.ui.editors.text.TextSourceViewerConfiguration
-
- org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration
-
public class JavaSourceViewerConfiguration extends TextSourceViewerConfiguration
Configuration for a source viewer which shows Java code.This class may be instantiated; it is not intended to be subclassed.
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PREFERENCE_TAB_WIDTH
Deprecated.As of 3.0, replaced byAbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH
static String
SPACES_FOR_TABS
Deprecated.as of 3.1 useDefaultCodeFormatterConstants.FORMATTER_TAB_CHAR
-
Fields inherited from class org.eclipse.ui.editors.text.TextSourceViewerConfiguration
fPreferenceStore
-
-
Constructor Summary
Constructors Constructor Description JavaSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor, String partitioning)
Creates a new Java source viewer configuration for viewers in the given editor using the given preference store, the color manager and the specified document partitioning.JavaSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor, String partitioning, boolean isModuleInfo)
Creates a new Java source viewer configuration for viewers in the given editor using the given preference store, the color manager and the specified document partitioning.JavaSourceViewerConfiguration(JavaTextTools tools, ITextEditor editor)
Deprecated.As of 3.0, replaced byJavaSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
affectsTextPresentation(PropertyChangeEvent event)
Determines whether the preference change encoded by the given event changes the behavior of one of its contained components.IAnnotationHover
getAnnotationHover(ISourceViewer sourceViewer)
IAutoEditStrategy[]
getAutoEditStrategies(ISourceViewer sourceViewer, String contentType)
protected RuleBasedScanner
getCodeScanner()
Returns the Java source code scanner for this configuration.protected IColorManager
getColorManager()
Returns the color manager for this configuration.String[]
getConfiguredContentTypes(ISourceViewer sourceViewer)
String
getConfiguredDocumentPartitioning(ISourceViewer sourceViewer)
int[]
getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType)
IContentAssistant
getContentAssistant(ISourceViewer sourceViewer)
IContentFormatter
getContentFormatter(ISourceViewer sourceViewer)
String[]
getDefaultPrefixes(ISourceViewer sourceViewer, String contentType)
ITextDoubleClickStrategy
getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType)
protected ITextEditor
getEditor()
Returns the editor in which the configured viewer(s) will reside.IInformationPresenter
getHierarchyPresenter(ISourceViewer sourceViewer, boolean doCodeResolve)
Returns the hierarchy presenter which will determine and shown type hierarchy information requested for the current cursor position.protected Map<String,IAdaptable>
getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
String[]
getIndentPrefixes(ISourceViewer sourceViewer, String contentType)
IInformationControlCreator
getInformationControlCreator(ISourceViewer sourceViewer)
IInformationPresenter
getInformationPresenter(ISourceViewer sourceViewer)
protected RuleBasedScanner
getJavaDocScanner()
Returns the JavaDoc scanner for this configuration.protected RuleBasedScanner
getMultilineCommentScanner()
Returns the Java multi-line comment scanner for this configuration.IInformationPresenter
getOutlinePresenter(ISourceViewer sourceViewer, boolean doCodeResolve)
Returns the outline presenter which will determine and shown information requested for the current cursor position.IAnnotationHover
getOverviewRulerAnnotationHover(ISourceViewer sourceViewer)
protected IPreferenceStore
getPreferenceStore()
Deprecated.As of 3.0IPresentationReconciler
getPresentationReconciler(ISourceViewer sourceViewer)
IQuickAssistAssistant
getQuickAssistAssistant(ISourceViewer sourceViewer)
IReconciler
getReconciler(ISourceViewer sourceViewer)
protected RuleBasedScanner
getSinglelineCommentScanner()
Returns the Java single-line comment scanner for this configuration.protected RuleBasedScanner
getStringScanner()
Returns the Java string scanner for this configuration.int
getTabWidth(ISourceViewer sourceViewer)
ITextHover
getTextHover(ISourceViewer sourceViewer, String contentType)
ITextHover
getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask)
void
handlePropertyChangeEvent(PropertyChangeEvent event)
Adapts the behavior of the contained components to the change encoded in the given event.-
Methods inherited from class org.eclipse.ui.editors.text.TextSourceViewerConfiguration
computeStateMask, findLocalizedModifier, getHyperlinkDetectors, getHyperlinkPresenter, getHyperlinkStateMask, getRegisteredHyperlinkDetectors, getUndoManager, isShowInOverviewRuler, isShowInVerticalRuler, isShownInText
-
Methods inherited from class org.eclipse.jface.text.source.SourceViewerConfiguration
getAutoIndentStrategy, getCodeMiningProviders, getIndentPrefixesForTab
-
-
-
-
Field Detail
-
PREFERENCE_TAB_WIDTH
@Deprecated public static final String PREFERENCE_TAB_WIDTH
Deprecated.As of 3.0, replaced byAbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH
Preference key used to look up display tab width.- Since:
- 2.0
- See Also:
- Constant Field Values
-
SPACES_FOR_TABS
@Deprecated public static final String SPACES_FOR_TABS
Deprecated.as of 3.1 useDefaultCodeFormatterConstants.FORMATTER_TAB_CHAR
Preference key for inserting spaces rather than tabs.- Since:
- 2.0
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JavaSourceViewerConfiguration
public JavaSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor, String partitioning)
Creates a new Java source viewer configuration for viewers in the given editor using the given preference store, the color manager and the specified document partitioning.Creates a Java source viewer configuration in the new setup without text tools. Clients are allowed to call
handlePropertyChangeEvent(PropertyChangeEvent)
and disallowed to callgetPreferenceStore()
on the resulting Java source viewer configuration.- Parameters:
colorManager
- the color managerpreferenceStore
- the preference store, can be read-onlyeditor
- the editor in which the configured viewer(s) will reside, ornull
if nonepartitioning
- the document partitioning for this configuration, ornull
for the default partitioning- Since:
- 3.0
-
JavaSourceViewerConfiguration
public JavaSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor, String partitioning, boolean isModuleInfo)
Creates a new Java source viewer configuration for viewers in the given editor using the given preference store, the color manager and the specified document partitioning.Creates a Java source viewer configuration in the new setup without text tools. Clients are allowed to call
handlePropertyChangeEvent(PropertyChangeEvent)
and disallowed to callgetPreferenceStore()
on the resulting Java source viewer configuration.- Parameters:
colorManager
- the color managerpreferenceStore
- the preference store, can be read-onlyeditor
- the editor in which the configured viewer(s) will reside, ornull
if nonepartitioning
- the document partitioning for this configuration, ornull
for the default partitioningisModuleInfo
-true
ifJavaCodeScanner
should be initialized for module-info code- Since:
- 3.14
-
JavaSourceViewerConfiguration
@Deprecated public JavaSourceViewerConfiguration(JavaTextTools tools, ITextEditor editor)
Deprecated.As of 3.0, replaced byJavaSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String)
Creates a new Java source viewer configuration for viewers in the given editor using the given Java tools.- Parameters:
tools
- the Java text tools to be usededitor
- the editor in which the configured viewer(s) will reside, ornull
if none- See Also:
JavaTextTools
-
-
Method Detail
-
getCodeScanner
protected RuleBasedScanner getCodeScanner()
Returns the Java source code scanner for this configuration.- Returns:
- the Java source code scanner
-
getMultilineCommentScanner
protected RuleBasedScanner getMultilineCommentScanner()
Returns the Java multi-line comment scanner for this configuration.- Returns:
- the Java multi-line comment scanner
- Since:
- 2.0
-
getSinglelineCommentScanner
protected RuleBasedScanner getSinglelineCommentScanner()
Returns the Java single-line comment scanner for this configuration.- Returns:
- the Java single-line comment scanner
- Since:
- 2.0
-
getStringScanner
protected RuleBasedScanner getStringScanner()
Returns the Java string scanner for this configuration.- Returns:
- the Java string scanner
- Since:
- 2.0
-
getJavaDocScanner
protected RuleBasedScanner getJavaDocScanner()
Returns the JavaDoc scanner for this configuration.- Returns:
- the JavaDoc scanner
-
getColorManager
protected IColorManager getColorManager()
Returns the color manager for this configuration.- Returns:
- the color manager
-
getEditor
protected ITextEditor getEditor()
Returns the editor in which the configured viewer(s) will reside.- Returns:
- the enclosing editor
-
getPreferenceStore
@Deprecated protected IPreferenceStore getPreferenceStore()
Deprecated.As of 3.0Returns the preference store used by this configuration to initialize the individual bits and pieces.Clients are not allowed to call this method if the new setup without text tools is in use.
- Returns:
- the preference store used to initialize this configuration
- Since:
- 2.0
- See Also:
JavaSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String)
-
getPresentationReconciler
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
- Overrides:
getPresentationReconciler
in classSourceViewerConfiguration
-
getContentAssistant
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
- Overrides:
getContentAssistant
in classSourceViewerConfiguration
-
getQuickAssistAssistant
public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer)
- Overrides:
getQuickAssistAssistant
in classTextSourceViewerConfiguration
-
getReconciler
public IReconciler getReconciler(ISourceViewer sourceViewer)
- Overrides:
getReconciler
in classTextSourceViewerConfiguration
-
getAutoEditStrategies
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType)
- Overrides:
getAutoEditStrategies
in classSourceViewerConfiguration
-
getDoubleClickStrategy
public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType)
- Overrides:
getDoubleClickStrategy
in classSourceViewerConfiguration
-
getDefaultPrefixes
public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType)
- Overrides:
getDefaultPrefixes
in classSourceViewerConfiguration
-
getIndentPrefixes
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType)
- Overrides:
getIndentPrefixes
in classTextSourceViewerConfiguration
-
getTabWidth
public int getTabWidth(ISourceViewer sourceViewer)
- Overrides:
getTabWidth
in classTextSourceViewerConfiguration
-
getAnnotationHover
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer)
- Overrides:
getAnnotationHover
in classTextSourceViewerConfiguration
-
getOverviewRulerAnnotationHover
public IAnnotationHover getOverviewRulerAnnotationHover(ISourceViewer sourceViewer)
- Overrides:
getOverviewRulerAnnotationHover
in classTextSourceViewerConfiguration
-
getConfiguredTextHoverStateMasks
public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType)
- Overrides:
getConfiguredTextHoverStateMasks
in classTextSourceViewerConfiguration
-
getTextHover
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask)
- Overrides:
getTextHover
in classSourceViewerConfiguration
-
getTextHover
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType)
- Overrides:
getTextHover
in classTextSourceViewerConfiguration
-
getConfiguredContentTypes
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer)
- Overrides:
getConfiguredContentTypes
in classSourceViewerConfiguration
-
getConfiguredDocumentPartitioning
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer)
- Overrides:
getConfiguredDocumentPartitioning
in classSourceViewerConfiguration
-
getContentFormatter
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer)
- Overrides:
getContentFormatter
in classSourceViewerConfiguration
-
getInformationControlCreator
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer)
- Overrides:
getInformationControlCreator
in classSourceViewerConfiguration
-
getInformationPresenter
public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer)
- Overrides:
getInformationPresenter
in classSourceViewerConfiguration
-
getOutlinePresenter
public IInformationPresenter getOutlinePresenter(ISourceViewer sourceViewer, boolean doCodeResolve)
Returns the outline presenter which will determine and shown information requested for the current cursor position.- Parameters:
sourceViewer
- the source viewer to be configured by this configurationdoCodeResolve
- a boolean which specifies whether code resolve should be used to compute the Java element- Returns:
- an information presenter
- Since:
- 2.1
-
getHierarchyPresenter
public IInformationPresenter getHierarchyPresenter(ISourceViewer sourceViewer, boolean doCodeResolve)
Returns the hierarchy presenter which will determine and shown type hierarchy information requested for the current cursor position.- Parameters:
sourceViewer
- the source viewer to be configured by this configurationdoCodeResolve
- a boolean which specifies whether code resolve should be used to compute the Java element- Returns:
- an information presenter
- Since:
- 3.0
-
affectsTextPresentation
public boolean affectsTextPresentation(PropertyChangeEvent event)
Determines whether the preference change encoded by the given event changes the behavior of one of its contained components.- Parameters:
event
- the event to be investigated- Returns:
true
if event causes a behavioral change- Since:
- 3.0
-
handlePropertyChangeEvent
public void handlePropertyChangeEvent(PropertyChangeEvent event)
Adapts the behavior of the contained components to the change encoded in the given event.Clients are not allowed to call this method if the old setup with text tools is in use.
- Parameters:
event
- the event to which to adapt- Since:
- 3.0
- See Also:
JavaSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String)
-
getHyperlinkDetectorTargets
protected Map<String,IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
- Overrides:
getHyperlinkDetectorTargets
in classTextSourceViewerConfiguration
-
-