Java 类org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants 实例源码

项目:ec4e    文件:NewEditorConfigWizard.java   
/**
 * Returns the content of the .editorconfig file to generate.
 *
 * @param container
 *
 * @return the content of the .editorconfig file to generate.
 */
private InputStream openContentStream(IContainer container) {
    IPreferenceStore store = EditorsUI.getPreferenceStore();
    boolean spacesForTabs = store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
    int tabWidth = store.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
    String lineDelimiter = getLineDelimiter(container);
    String endOfLine = org.ec4j.core.model.PropertyType.EndOfLineValue.ofEndOfLineString(lineDelimiter).name();

    StringBuilder content = new StringBuilder("# EditorConfig is awesome: http://EditorConfig.org");
    content.append(lineDelimiter);
    content.append(lineDelimiter);
    content.append("[*]");
    content.append(lineDelimiter);
    content.append("indent_style = ");
    content.append(spacesForTabs ? "space" : "tab");
    content.append(lineDelimiter);
    content.append("indent_size = ");
    content.append(tabWidth);
    if (endOfLine != null) {
        content.append(lineDelimiter);
        content.append("end_of_line = ");
        content.append(endOfLine);
    }

    return new ByteArrayInputStream(content.toString().getBytes());
}
项目:velocity-edit    文件:VelocityConfiguration.java   
public String getTab(ISourceViewer isourceviewer)
{
    IPreferenceStore prefs =
    EditorsPlugin.getDefault().getPreferenceStore();
    if (prefs.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS))
    {
      int tabWidth = getTabWidth(isourceviewer);
      StringBuffer sb = new StringBuffer(tabWidth);
      for (int i=0; i<tabWidth; i++)
      {
        sb.append(' ');
      }
      return sb.toString();
    }
    return "\t";
}
项目:APICloud-Studio    文件:ThemeManager.java   
/**
 * Set the FG, BG, selection and current line colors on our editors.
 * 
 * @param theme
 */
private void setAptanaEditorColorsToMatchTheme(Theme theme)
{
    IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode("com.aptana.editor.common"); //$NON-NLS-1$
    prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, false);
    prefs.put(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND, toString(theme.getForeground()));

    prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, false);
    prefs.put(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, toString(theme.getBackground()));

    prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, false);
    prefs.put(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, toString(theme.getForeground()));

    prefs.put(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR,
            toString(theme.getLineHighlightAgainstBG()));
    try
    {
        prefs.flush();
    }
    catch (BackingStoreException e)
    {
        IdeLog.logError(ThemePlugin.getDefault(), e);
    }
}
项目:APICloud-Studio    文件:ThemeableEditorExtension.java   
public void handlePreferenceStoreChanged(PropertyChangeEvent event)
{
    if (event.getProperty().equals(IThemeManager.THEME_CHANGED))
    {
        IThemeableEditor editor = this.fEditor.get();
        overrideThemeColors();
        if (editor != null)
        {
            editor.getISourceViewer().invalidateTextPresentation();
        }
    }
    else if (event.getProperty().equals(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE))
    {
        Object newValue = event.getNewValue();
        if (newValue instanceof Boolean)
        {
            boolean on = (Boolean) newValue;
            fFullLineBackgroundPainter.setHighlightLineEnabled(on);
        }
    }
    else if (event.getProperty().equals(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT))
    {
        overrideRulerColors();
    }
}
项目:APICloud-Studio    文件:CommonSourceViewerConfiguration.java   
/**
 * @return the default indentation string (either tab or spaces which represents a tab)
 */
public String getIndent()
{
    boolean useSpaces = fPreferenceStore
            .getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);

    if (useSpaces)
    {
        int tabWidth = fPreferenceStore.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
        StringBuilder buf = new StringBuilder();

        for (int i = 0; i < tabWidth; ++i)
        {
            buf.append(' ');
        }

        return buf.toString();
    }

    return "\t"; //$NON-NLS-1$
}
项目:APICloud-Studio    文件:CommonEditorPreferencePage.java   
private void setTabSpaceCombo()
{
    IEclipsePreferences store = getPluginPreferenceStore();

    if (store.getBoolean(IPreferenceConstants.USE_GLOBAL_DEFAULTS, false))
    {
        tabSpaceCombo.setText(Messages.CommonEditorPreferencePage_UseDefaultOption);
    }
    else
    {
        boolean useSpaces = store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS,
                true);
        tabSpaceCombo.setText(useSpaces ? Messages.CommonEditorPreferencePage_UseSpacesOption
                : Messages.CommonEditorPreferencePage_UseTabOption);
    }
}
项目:APICloud-Studio    文件:CommonEditorPreferencePage.java   
@Override
protected void performDefaults()
{
    IEclipsePreferences store = getPluginPreferenceStore();

    store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
    store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);

    setPluginDefaults();
    setTabSpaceCombo();
    super.performDefaults();
    try
    {
        store.flush();
    }
    catch (BackingStoreException e)
    {
        IdeLog.logError(CommonEditorPlugin.getDefault(), e);
    }
}
项目:APICloud-Studio    文件:CommonEditorPreferencePage.java   
/**
 * This method re-applies the plugin defaults for the spaces for tabs and tab width preferences from the default
 * scope of the plugin preference store. The default values are taken from getDefaultTabWidth() and
 * getDefaultSpacesForTabs(). The default scope getDefaultPluginPreferenceStore() is used.
 */
protected void setPluginDefaults()
{
    IEclipsePreferences store = getDefaultPluginPreferenceStore();
    if (store == null)
    {
        return;
    }

    store.putBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS,
            getDefaultSpacesForTabs());
    store.putInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, getDefaultTabWidth());
    try
    {
        store.flush();
    }
    catch (BackingStoreException e)
    {
        IdeLog.logError(CommonEditorPlugin.getDefault(), e);
    }
}
项目:APICloud-Studio    文件:CommonEditorPreferencePage.java   
/**
 * This method removes the spaces for tabs and tab width preferences from the default scope of the plugin preference
 * store.
 */
protected void removePluginDefaults()
{
    IEclipsePreferences store = getDefaultPluginPreferenceStore();
    if (store == null)
    {
        return;
    }

    store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
    store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
    try
    {
        store.flush();
    }
    catch (BackingStoreException e)
    {
        IdeLog.logError(CommonEditorPlugin.getDefault(), e);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:PropertiesFileEditor.java   
@Override
protected void initializeEditor() {
    setDocumentProvider(JavaPlugin.getDefault().getPropertiesFileDocumentProvider());
    IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
    setPreferenceStore(store);
    JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
    setSourceViewerConfiguration(new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, this, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING));
    setEditorContextMenuId("#TextEditorContext"); //$NON-NLS-1$
    setRulerContextMenuId("#TextRulerContext"); //$NON-NLS-1$
    setHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR);
    configureInsertMode(SMART_INSERT, false);
    setInsertMode(INSERT);

    // Need to listen on Editors UI preference store because JDT disables this functionality in its preferences.
    fPropertyChangeListener= new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS.equals(event.getProperty()))
                handlePreferenceStoreChanged(event);
        }
    };
    EditorsUI.getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
}
项目:idecore    文件:ApexAutoIndentStrategy.java   
/**
 * Returns the String to use for indenting based on the General/Editors/Text Editors preferences
 * that are respected by the underlying platform editing code.
 * 
 * @return the String to use for indenting
 */
private static String indentStringFromEditorsUIPreferences() {

    IPreferencesService ps = Platform.getPreferencesService();
    boolean spacesForTabs = ps.getBoolean(
            EditorsUI.PLUGIN_ID,
            AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS,
            false,
            null
            );
    if (spacesForTabs) {
        int tabWidth = ps.getInt(
                EditorsUI.PLUGIN_ID,
                AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH,
                4,
                null
                );
        StringBuilder sb = new StringBuilder(tabWidth);
        for (int i = 0; i < tabWidth; i++) {
            sb.append(" ");
        }
        return sb.toString();
    } else {
        return "\t";
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:PropertiesFileEditor.java   
@Override
protected void initializeEditor() {
    setDocumentProvider(JavaPlugin.getDefault().getPropertiesFileDocumentProvider());
    IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
    setPreferenceStore(store);
    JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
    setSourceViewerConfiguration(new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, this, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING));
    setEditorContextMenuId("#TextEditorContext"); //$NON-NLS-1$
    setRulerContextMenuId("#TextRulerContext"); //$NON-NLS-1$
    setHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR);
    configureInsertMode(SMART_INSERT, false);
    setInsertMode(INSERT);

    // Need to listen on Editors UI preference store because JDT disables this functionality in its preferences.
    fPropertyChangeListener= new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS.equals(event.getProperty()))
                handlePreferenceStoreChanged(event);
        }
    };
    EditorsUI.getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
}
项目:Pydev    文件:AbstractBlockCommentAction.java   
/**
 * @return the number of columns to be used (and the char too)
 */
public Tuple<Integer, Character> getColsAndChar() {
    int cols = this.defaultCols;
    char c = '-';

    if (SharedCorePlugin.inTestMode()) {
        // use defaults
    } else {
        IPreferenceStore chainedPrefStore = PydevPrefs.getChainedPrefStore();
        cols = chainedPrefStore.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);

        IPreferenceStore prefs = PydevPrefs.getPreferenceStore();
        c = prefs.getString(getPreferencesNameForChar()).charAt(0);
    }
    return new Tuple<Integer, Character>(cols, c);
}
项目:Pydev    文件:ImportArranger.java   
/**
 * @return the maximum number of columns that may be available in a line.
 */
private static int getMaxCols(boolean multilineImports) {
    final int maxCols;
    if (multilineImports) {
        if (SharedCorePlugin.inTestMode()) {
            maxCols = 80;
        } else {
            IPreferenceStore chainedPrefStore = PydevPrefs.getChainedPrefStore();
            maxCols = chainedPrefStore
                    .getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);
        }
    } else {
        maxCols = Integer.MAX_VALUE;
    }
    return maxCols;
}
项目:goclipse    文件:ViewerColorUpdater.java   
@Override
protected void doConfigureViewer() {
    // ----------- foreground color --------------------
    fForegroundColor = updateColorFromSetting(fForegroundColor,
        AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT,
        AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND);
    styledText.setForeground(fForegroundColor);

    // ---------- background color ----------------------
    fBackgroundColor = updateColorFromSetting(fBackgroundColor,
        AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT,
        AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
    styledText.setBackground(fBackgroundColor);

    // ----------- selection foreground color --------------------
    fSelectionForegroundColor = updateColorFromSetting(fSelectionForegroundColor,
        AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR,
        AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR);
    styledText.setSelectionForeground(fSelectionForegroundColor);

    // ---------- selection background color ----------------------
    fSelectionBackgroundColor = updateColorFromSetting(fSelectionBackgroundColor,
        AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR,
        AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR);
    styledText.setSelectionBackground(fSelectionBackgroundColor);
}
项目:DarwinSPL    文件:DwprofileSourceViewerConfiguration.java   
/**
 * <p>
 * Creates a new editor configuration.
 * </p>
 * 
 * @param resourceProvider the provider for the resource (usually this is the
 * editor)
 * @param colorManager the color manager to use
 */
public DwprofileSourceViewerConfiguration(de.darwinspl.preferences.resource.dwprofile.IDwprofileResourceProvider resourceProvider, de.darwinspl.preferences.resource.dwprofile.ui.IDwprofileAnnotationModelProvider annotationModelProvider, de.darwinspl.preferences.resource.dwprofile.ui.DwprofileColorManager colorManager) {
    super(de.darwinspl.preferences.resource.dwprofile.ui.DwprofileUIPlugin.getDefault().getPreferenceStore());
    this.fPreferenceStore.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, Action.findModifierString(SWT.MOD1));
    this.resourceProvider = resourceProvider;
    this.annotationModelProvider = annotationModelProvider;
    this.colorManager = colorManager;
}
项目:DarwinSPL    文件:HyexpressionSourceViewerConfiguration.java   
/**
 * <p>
 * Creates a new editor configuration.
 * </p>
 * 
 * @param resourceProvider the provider for the resource (usually this is the
 * editor)
 * @param colorManager the color manager to use
 */
public HyexpressionSourceViewerConfiguration(eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionResourceProvider resourceProvider, eu.hyvar.feature.expression.resource.hyexpression.ui.IHyexpressionAnnotationModelProvider annotationModelProvider, eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionColorManager colorManager) {
    super(eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionUIPlugin.getDefault().getPreferenceStore());
    this.fPreferenceStore.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, Action.findModifierString(SWT.MOD1));
    this.resourceProvider = resourceProvider;
    this.annotationModelProvider = annotationModelProvider;
    this.colorManager = colorManager;
}
项目:DarwinSPL    文件:HyvalidityformulaSourceViewerConfiguration.java   
/**
 * <p>
 * Creates a new editor configuration.
 * </p>
 * 
 * @param resourceProvider the provider for the resource (usually this is the
 * editor)
 * @param colorManager the color manager to use
 */
public HyvalidityformulaSourceViewerConfiguration(eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaResourceProvider resourceProvider, eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.IHyvalidityformulaAnnotationModelProvider annotationModelProvider, eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaColorManager colorManager) {
    super(eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaUIPlugin.getDefault().getPreferenceStore());
    this.fPreferenceStore.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, Action.findModifierString(SWT.MOD1));
    this.resourceProvider = resourceProvider;
    this.annotationModelProvider = annotationModelProvider;
    this.colorManager = colorManager;
}
项目:DarwinSPL    文件:HydatavalueSourceViewerConfiguration.java   
/**
 * <p>
 * Creates a new editor configuration.
 * </p>
 * 
 * @param resourceProvider the provider for the resource (usually this is the
 * editor)
 * @param colorManager the color manager to use
 */
public HydatavalueSourceViewerConfiguration(eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueResourceProvider resourceProvider, eu.hyvar.dataValues.resource.hydatavalue.ui.IHydatavalueAnnotationModelProvider annotationModelProvider, eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueColorManager colorManager) {
    super(eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueUIPlugin.getDefault().getPreferenceStore());
    this.fPreferenceStore.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, Action.findModifierString(SWT.MOD1));
    this.resourceProvider = resourceProvider;
    this.annotationModelProvider = annotationModelProvider;
    this.colorManager = colorManager;
}
项目:DarwinSPL    文件:HymappingSourceViewerConfiguration.java   
/**
 * <p>
 * Creates a new editor configuration.
 * </p>
 * 
 * @param resourceProvider the provider for the resource (usually this is the
 * editor)
 * @param colorManager the color manager to use
 */
public HymappingSourceViewerConfiguration(eu.hyvar.feature.mapping.resource.hymapping.IHymappingResourceProvider resourceProvider, eu.hyvar.feature.mapping.resource.hymapping.ui.IHymappingAnnotationModelProvider annotationModelProvider, eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingColorManager colorManager) {
    super(eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingUIPlugin.getDefault().getPreferenceStore());
    this.fPreferenceStore.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, Action.findModifierString(SWT.MOD1));
    this.resourceProvider = resourceProvider;
    this.annotationModelProvider = annotationModelProvider;
    this.colorManager = colorManager;
}
项目:DarwinSPL    文件:HyconstraintsSourceViewerConfiguration.java   
/**
 * <p>
 * Creates a new editor configuration.
 * </p>
 * 
 * @param resourceProvider the provider for the resource (usually this is the
 * editor)
 * @param colorManager the color manager to use
 */
public HyconstraintsSourceViewerConfiguration(eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsResourceProvider resourceProvider, eu.hyvar.feature.constraint.resource.hyconstraints.ui.IHyconstraintsAnnotationModelProvider annotationModelProvider, eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsColorManager colorManager) {
    super(eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsUIPlugin.getDefault().getPreferenceStore());
    this.fPreferenceStore.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, Action.findModifierString(SWT.MOD1));
    this.resourceProvider = resourceProvider;
    this.annotationModelProvider = annotationModelProvider;
    this.colorManager = colorManager;
}
项目:DarwinSPL    文件:HymanifestSourceViewerConfiguration.java   
/**
 * <p>
 * Creates a new editor configuration.
 * </p>
 * 
 * @param resourceProvider the provider for the resource (usually this is the
 * editor)
 * @param colorManager the color manager to use
 */
public HymanifestSourceViewerConfiguration(eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestResourceProvider resourceProvider, eu.hyvar.mspl.manifest.resource.hymanifest.ui.IHymanifestAnnotationModelProvider annotationModelProvider, eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestColorManager colorManager) {
    super(eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestUIPlugin.getDefault().getPreferenceStore());
    this.fPreferenceStore.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
    this.fPreferenceStore.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, Action.findModifierString(SWT.MOD1));
    this.resourceProvider = resourceProvider;
    this.annotationModelProvider = annotationModelProvider;
    this.colorManager = colorManager;
}
项目:texlipse    文件:TexHardLineWrapAction.java   
/** 
 * When the user presses <code>Esc, q</code> or selects from menu bar
 * <code>Wrap Lines</code> this method is invoked.
 * @param action    an action that invokes  
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 */
public void run(IAction action) {
    this.lineLength = TexlipsePlugin.getDefault().getPreferenceStore().getInt(TexlipseProperties.WORDWRAP_LENGTH);
    this.tabWidth = TexlipsePlugin.getDefault().getPreferenceStore().getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
    TexSelections selection = new TexSelections(getTexEditor());
    try {
        doWrapB(selection);
    } catch(BadLocationException e) {
        TexlipsePlugin.log("TexCorrectIndentationAction.run", e);
    }
}
项目:velocity-edit    文件:VelocityConfiguration.java   
public int getTabWidth(ISourceViewer aSourceViewer)
{
    // Get tab width from JDT preferences settings
    IPreferenceStore prefs =
    EditorsPlugin.getDefault().getPreferenceStore();
    int width =  prefs.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
    return width;
}
项目:velocity-edit    文件:VelocityConfiguration.java   
public int getLineWidth(ISourceViewer isourceviewer)
{
    IPreferenceStore prefs =
    EditorsPlugin.getDefault().getPreferenceStore();
    int width =  prefs.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN);
    return width;
}
项目:APICloud-Studio    文件:InvasiveThemeHijacker.java   
protected void setGeneralEditorValues(Theme theme, IEclipsePreferences prefs, boolean revertToDefaults)
{
    if (prefs == null)
        return;
    if (revertToDefaults)
    {
        prefs.remove(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND);
        prefs.remove(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND);
        prefs.remove(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
        prefs.remove(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND);
        prefs.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
    }
    else
    {
        prefs.put(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND,
                StringConverter.asString(theme.getSelectionAgainstBG()));
        prefs.put(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND,
                StringConverter.asString(theme.getForeground()));
        prefs.put(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, StringConverter.asString(theme.getBackground()));
        prefs.put(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, StringConverter.asString(theme.getForeground()));
        prefs.put(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR,
                StringConverter.asString(theme.getLineHighlightAgainstBG()));
    }

    prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, revertToDefaults);
    prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, revertToDefaults);
    prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, revertToDefaults);

    try
    {
        prefs.flush();
    }
    catch (BackingStoreException e)
    {
        IdeLog.logError(ThemePlugin.getDefault(), e);
    }
}
项目:APICloud-Studio    文件:ThemeableEditorExtension.java   
public void createBackgroundPainter(ISourceViewer viewer)
{
    if (fFullLineBackgroundPainter == null)
    {
        if (viewer instanceof ITextViewerExtension2)
        {
            boolean lineHighlight = Platform.getPreferencesService().getBoolean(EditorsUI.PLUGIN_ID,
                    AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, true, null);
            fFullLineBackgroundPainter = new LineBackgroundPainter(viewer);
            fFullLineBackgroundPainter.setHighlightLineEnabled(lineHighlight);
            ITextViewerExtension2 extension = (ITextViewerExtension2) viewer;
            extension.addPainter(fFullLineBackgroundPainter);
        }
    }
}
项目:APICloud-Studio    文件:CommonEditorPreferencePage.java   
public boolean performOk()
{
    IEclipsePreferences store = getPluginPreferenceStore();

    if (tabSpaceCombo.getText().equals(Messages.CommonEditorPreferencePage_UseSpacesOption))
    {
        store.putBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, true);
        store.putBoolean(IPreferenceConstants.USE_GLOBAL_DEFAULTS, false);
    }
    else if (tabSpaceCombo.getText().equals(Messages.CommonEditorPreferencePage_UseTabOption))
    {
        store.putBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, false);
        store.putBoolean(IPreferenceConstants.USE_GLOBAL_DEFAULTS, false);
    }
    else
    {
        removePluginDefaults();
        store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
        store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
        store.putBoolean(IPreferenceConstants.USE_GLOBAL_DEFAULTS, true);
    }

    try
    {
        store.flush();
    }
    catch (BackingStoreException e)
    {
        IdeLog.logError(CommonEditorPlugin.getDefault(), e);
    }
    return super.performOk();
}
项目:APICloud-Studio    文件:CommonEditorPreferencePage.java   
/**
 * The default value for spaces for tabs preference. (Used with getDefaultPluginPreferenceStore() )
 * 
 * @return
 */

protected boolean getDefaultSpacesForTabs()
{
    return getChainedEditorPreferenceStore().getBoolean(
            AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
}
项目:APICloud-Studio    文件:CommonEditorPreferencePage.java   
/**
 * The default value used for tab width preference. (Used with getDefaultPluginPreferenceStore() )
 * 
 * @return
 */

protected int getDefaultTabWidth()
{
    return getChainedEditorPreferenceStore()
            .getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
}
项目:APICloud-Studio    文件:EditorUtil.java   
/**
 * Retrieves the indentation settings from the given preferences qualifier, or falls back on default settings if the
 * given qualifier is null, or the value of the indent-size is smaller than 1.
 */
public static int getSpaceIndentSize(String preferencesQualifier)
{
    int spaceIndentSize = 0;
    if (preferencesQualifier != null)
    {
        spaceIndentSize = Platform.getPreferencesService().getInt(preferencesQualifier,
                AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 0, null);
    }
    // Fall back on CommonEditorPlugin or EditorsPlugin values if none are set for current editor
    return (spaceIndentSize > 0) ? spaceIndentSize : getDefaultSpaceIndentSize(preferencesQualifier);
}
项目:APICloud-Studio    文件:EditorUtil.java   
public static int getDefaultSpaceIndentSize(String preferencesQualifier)
{
    int spaceIndentSize = 0;
    if (CommonEditorPlugin.getDefault() != null && EditorsPlugin.getDefault() != null)
    {
        spaceIndentSize = new ChainedPreferenceStore(new IPreferenceStore[] {
                CommonEditorPlugin.getDefault().getPreferenceStore(),
                EditorsPlugin.getDefault().getPreferenceStore() })
                .getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
    }
    return (spaceIndentSize > 0) ? spaceIndentSize : DEFAULT_SPACE_INDENT_SIZE;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaSourceViewer.java   
public void propertyChange(PropertyChangeEvent event) {
    String property = event.getProperty();
    if (AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND.equals(property)
            || AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property)
            || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND.equals(property)
            || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR.equals(property))
    {
        initializeViewerColors();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:ActionUtil.java   
public static boolean isEditable(Shell shell, IJavaElement element) {
    if (! isProcessable(shell, element))
        return false;

    IJavaElement cu= element.getAncestor(IJavaElement.COMPILATION_UNIT);
    if (cu != null) {
        IResource resource= cu.getResource();
        if (resource != null && resource.isDerived(IResource.CHECK_ANCESTORS)) {

            // see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#validateEditorInputState()
            final String warnKey= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WARN_IF_INPUT_DERIVED;
            IPreferenceStore store= EditorsUI.getPreferenceStore();
            if (!store.getBoolean(warnKey))
                return true;

            MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion(
                    shell,
                    ActionMessages.ActionUtil_warning_derived_title,
                    Messages.format(ActionMessages.ActionUtil_warning_derived_message, BasicElementLabels.getPathLabel(resource.getFullPath(), false)),
                    ActionMessages.ActionUtil_warning_derived_dontShowAgain,
                    false,
                    null,
                    null);

            EditorsUI.getPreferenceStore().setValue(warnKey, !toggleDialog.getToggleState());

            return toggleDialog.getReturnCode() == IDialogConstants.YES_ID;
        }
    }
    return true;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaPreview.java   
public JavaPreview(Map<String, String> workingValues, Composite parent) {
        JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
        fPreviewDocument= new Document();
        fWorkingValues= workingValues;
        tools.setupJavaDocumentPartitioner( fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING);

        PreferenceStore prioritizedSettings= new PreferenceStore();
        HashMap<String, String> complianceOptions= new HashMap<String, String>();
        JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST);
        for (Entry<String, String> complianceOption : complianceOptions.entrySet()) {
            prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue());
        }

        IPreferenceStore[] chain= { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() };
        fPreferenceStore= new ChainedPreferenceStore(chain);
        fSourceViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
        fSourceViewer.setEditable(false);
        Cursor arrowCursor= fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
        fSourceViewer.getTextWidget().setCursor(arrowCursor);

        // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
//      fSourceViewer.getTextWidget().setCaret(null);

        fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true);
        fSourceViewer.configure(fViewerConfiguration);
        fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));

        fMarginPainter= new MarginPainter(fSourceViewer);
        final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
        fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb));
        fSourceViewer.addPainter(fMarginPainter);

        new JavaSourcePreviewerUpdater();
        fSourceViewer.setDocument(fPreviewDocument);
    }
项目:sadlos2    文件:SadlSourceViewerConfiguration.java   
private IHyperlinkDetector[] getInheritedDetectors (ISourceViewer sourceViewer) {
    if (sourceViewer == null || fPreferenceStore == null)
        return super.getHyperlinkDetectors(sourceViewer);

    if (!fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
        return null;

    return getRegisteredHyperlinkDetectors(sourceViewer);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaSourceViewer.java   
public void propertyChange(PropertyChangeEvent event) {
    String property = event.getProperty();
    if (AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND.equals(property)
            || AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property)
            || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND.equals(property)
            || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR.equals(property)
            || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR.equals(property))
    {
        initializeViewerColors();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ActionUtil.java   
public static boolean isEditable(Shell shell, IJavaElement element) {
    if (! isProcessable(shell, element))
        return false;

    IJavaElement cu= element.getAncestor(IJavaElement.COMPILATION_UNIT);
    if (cu != null) {
        IResource resource= cu.getResource();
        if (resource != null && resource.isDerived(IResource.CHECK_ANCESTORS)) {

            // see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#validateEditorInputState()
            final String warnKey= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WARN_IF_INPUT_DERIVED;
            IPreferenceStore store= EditorsUI.getPreferenceStore();
            if (!store.getBoolean(warnKey))
                return true;

            MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion(
                    shell,
                    ActionMessages.ActionUtil_warning_derived_title,
                    Messages.format(ActionMessages.ActionUtil_warning_derived_message, BasicElementLabels.getPathLabel(resource.getFullPath(), false)),
                    ActionMessages.ActionUtil_warning_derived_dontShowAgain,
                    false,
                    null,
                    null);

            EditorsUI.getPreferenceStore().setValue(warnKey, !toggleDialog.getToggleState());

            return toggleDialog.getReturnCode() == IDialogConstants.YES_ID;
        }
    }
    return true;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaPreview.java   
public JavaPreview(Map<String, String> workingValues, Composite parent) {
        JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
        fPreviewDocument= new Document();
        fWorkingValues= workingValues;
        tools.setupJavaDocumentPartitioner( fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING);

        PreferenceStore prioritizedSettings= new PreferenceStore();
        HashMap<String, String> complianceOptions= new HashMap<String, String>();
        JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST);
        for (Entry<String, String> complianceOption : complianceOptions.entrySet()) {
            prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue());
        }

        IPreferenceStore[] chain= { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() };
        fPreferenceStore= new ChainedPreferenceStore(chain);
        fSourceViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
        fSourceViewer.setEditable(false);
        Cursor arrowCursor= fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
        fSourceViewer.getTextWidget().setCursor(arrowCursor);

        // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
//      fSourceViewer.getTextWidget().setCaret(null);

        fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true);
        fSourceViewer.configure(fViewerConfiguration);
        fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));

        fMarginPainter= new MarginPainter(fSourceViewer);
        final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
        fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb));
        fSourceViewer.addPainter(fMarginPainter);

        new JavaSourcePreviewerUpdater();
        fSourceViewer.setDocument(fPreviewDocument);
    }
项目:eclipsensis    文件:NSISPreferences.java   
@Override
protected boolean migrate(Version settingsVersion)
{
    boolean b = super.migrate(settingsVersion);
    if(EclipseNSISPlugin.getDefault().getVersion().compareTo(settingsVersion) > 0) {
        if(IPluginVersions.VERSION_0_9_6.compareTo(settingsVersion) > 0) {
            mPreferenceStore.setDefault(USE_SPACES_FOR_TABS,true);
            EditorsUI.getPreferenceStore().setValue(
                            AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS,
                            mPreferenceStore.getBoolean(USE_SPACES_FOR_TABS));
            b = true;
        }
    }
    return b;
}