/** * Creates and returns a preference store which combines the preference stores from the text tools * and which is read-only. * * @param javaTextTools the Java text tools * @return the combined read-only preference store * @since 3.0 */ private static final IPreferenceStore createPreferenceStore(JavaTextTools javaTextTools) { Assert.isNotNull(javaTextTools); IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore(); if (javaTextTools.getCorePreferenceStore() == null) return new ChainedPreferenceStore( new IPreferenceStore[] {javaTextTools.getPreferenceStore(), generalTextStore}); return new ChainedPreferenceStore( new IPreferenceStore[] { javaTextTools.getPreferenceStore(), new PreferencesAdapter(javaTextTools.getCorePreferenceStore()), generalTextStore }); }
/** * Creates a new Java source viewer configuration for viewers in the given editor using the given * Java tools. * * @param tools the Java text tools to be used * @param editor the editor in which the configured viewer(s) will reside, or <code>null</code> if * none * @see JavaTextTools * @deprecated As of 3.0, replaced by {@link * JavaSourceViewerConfiguration#JavaSourceViewerConfiguration(IColorManager, * IPreferenceStore, ITextEditor, String)} */ public JavaSourceViewerConfiguration(JavaTextTools tools, ITextEditor editor) { super(createPreferenceStore(tools)); fJavaTextTools = tools; fColorManager = tools.getColorManager(); fCodeScanner = (AbstractJavaScanner) fJavaTextTools.getCodeScanner(); fMultilineCommentScanner = (AbstractJavaScanner) fJavaTextTools.getMultilineCommentScanner(); fSinglelineCommentScanner = (AbstractJavaScanner) fJavaTextTools.getSinglelineCommentScanner(); fStringScanner = (AbstractJavaScanner) fJavaTextTools.getStringScanner(); fJavaDocScanner = (AbstractJavaScanner) fJavaTextTools.getJavaDocScanner(); fTextEditor = editor; }
/** * Returns the preference store used by this configuration to initialize the individual bits and * pieces. * * <p>Clients are not allowed to call this method if the new setup without text tools is in use. * * @return the preference store used to initialize this configuration * @see JavaSourceViewerConfiguration#JavaSourceViewerConfiguration(IColorManager, * IPreferenceStore, ITextEditor, String) * @since 2.0 * @deprecated As of 3.0 */ protected IPreferenceStore getPreferenceStore() { Assert.isTrue(!isNewSetup()); return fJavaTextTools.getPreferenceStore(); }