下面列出了怎么用org.eclipse.jface.text.source.ISharedTextColors的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
protected IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) {
// Note: create the minimap overview ruler regardless of whether it should be shown or not
// (the setting to show it will control what's drawn).
if (MinimapOverviewRulerPreferencesPage.useMinimap()) {
IOutlineModel outlineModel = (IOutlineModel) this.getAdapter(IOutlineModel.class);
IOverviewRuler ruler = new MinimapOverviewRuler(getAnnotationAccess(), sharedColors, outlineModel);
Iterator e = getAnnotationPreferences().getAnnotationPreferences().iterator();
while (e.hasNext()) {
AnnotationPreference preference = (AnnotationPreference) e.next();
if (preference.contributesToHeader()) {
ruler.addHeaderAnnotationType(preference.getAnnotationType());
}
}
return ruler;
} else {
return super.createOverviewRuler(sharedColors);
}
}
public MinimapOverviewRuler(IAnnotationAccess annotationAccess, ISharedTextColors sharedColors,
IOutlineModel outlineModel) {
super(annotationAccess, MinimapOverviewRulerPreferencesPage.getMinimapWidth(), sharedColors);
this.fOutlineModel = outlineModel;
propertyListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (MinimapOverviewRulerPreferencesPage.MINIMAP_WIDTH.equals(event.getProperty())) {
updateWidth();
}
}
};
if (outlineModel != null) {
modelListener = new ICallbackListener<IOutlineModel>() {
@Override
public Object call(IOutlineModel obj) {
lastModelChange = System.currentTimeMillis();
update();
return null;
}
};
ICallbackWithListeners<IOutlineModel> onModelChangedListener = outlineModel.getOnModelChangedCallback();
onModelChangedListener.registerListener(modelListener);
}
}
protected ISharedTextColors getSharedColors() {
return EditorsUI.getSharedTextColors();
}
protected ISharedTextColors getSharedColors() {
return EditorsPlugin.getDefault().getSharedTextColors();
}
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager,
IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter)
{
return new XMLSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor);
}
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager,
IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter)
{
return new CSSSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor);
}
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager,
IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter)
{
return new JSSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor);
}
SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager,
IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter);
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager,
IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter)
{
return new HTMLSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor);
}
/**
* Creates a new instance.
*
* @param sharedColors the shared colors provider to use
*/
public CommonLineNumberChangeRulerColumn(ISharedTextColors sharedColors) {
Assert.isNotNull(sharedColors);
fRevisionPainter= new RevisionPainter(this, sharedColors);
fDiffPainter= new DiffPainter(this, sharedColors);
}
protected ISharedTextColors getColorManager() {
return ColorManager.getDefault();
}
/**
* Constructs a overview ruler of the given width using the given annotation
* access and the given color manager.
*
* @param annotationAccess the annotation access
* @param width the width of the vertical ruler
* @param sharedColors the color manager
* @param discolorTemporaryAnnotation <code>true</code> if temporary annotations should be discolored
* @since 3.4
*/
public CopiedOverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors,
boolean discolorTemporaryAnnotation) {
fAnnotationAccess = annotationAccess;
fWidth = width;
fSharedTextColors = sharedColors;
fIsTemporaryAnnotationDiscolored = discolorTemporaryAnnotation;
}
/**
* Constructs a overview ruler of the given width using the given annotation access and the given
* color manager.
* <p><strong>Note:</strong> As of 3.4, temporary annotations are no longer discolored.
* Use {@link #OverviewRuler(IAnnotationAccess, int, ISharedTextColors, boolean)} if you
* want to keep the old behavior.</p>
*
* @param annotationAccess the annotation access
* @param width the width of the vertical ruler
* @param sharedColors the color manager
*/
public CopiedOverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors) {
this(annotationAccess, width, sharedColors, false);
}