Java 类org.eclipse.ui.editors.text.EditorsUI 实例源码

项目:eclipse-batch-editor    文件:BatchSourceViewerConfiguration.java   
/**
 * Creates configuration by given adaptable
 * 
 * @param adaptable
 *            must provide {@link ColorManager} and {@link IFile}
 */
public BatchSourceViewerConfiguration(IAdaptable adaptable) {
    IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
    this.fPreferenceStore = new ChainedPreferenceStore(
            new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });

    Assert.isNotNull(adaptable, "adaptable may not be null!");
    this.annotationHoover = new BatchEditorAnnotationHoover();

    this.contentAssistant = new ContentAssistant();
    contentAssistProcessor = new BatchEditorSimpleWordContentAssistProcessor();
    contentAssistant.enableColoredLabels(true);

    contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
    for (BatchDocumentIdentifier identifier: BatchDocumentIdentifiers.values()){
        contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
    }

    contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());

    this.colorManager = adaptable.getAdapter(ColorManager.class);
    Assert.isNotNull(colorManager, " adaptable must support color manager");
    this.defaultTextAttribute = new TextAttribute(
            colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
    this.adaptable=adaptable;
}
项目:eclipse-bash-editor    文件:BashSourceViewerConfiguration.java   
/**
 * Creates configuration by given adaptable
 * 
 * @param adaptable
 *            must provide {@link ColorManager} and {@link IFile}
 */
public BashSourceViewerConfiguration(IAdaptable adaptable) {
    IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
    this.fPreferenceStore = new ChainedPreferenceStore(
            new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });

    Assert.isNotNull(adaptable, "adaptable may not be null!");
    this.annotationHoover = new BashEditorAnnotationHoover();

    this.contentAssistant = new ContentAssistant();
    contentAssistProcessor = new BashEditorSimpleWordContentAssistProcessor();
    contentAssistant.enableColoredLabels(true);

    contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
    for (BashDocumentIdentifier identifier: BashDocumentIdentifiers.values()){
        contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
    }

    contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());

    this.colorManager = adaptable.getAdapter(ColorManager.class);
    Assert.isNotNull(colorManager, " adaptable must support color manager");
    this.defaultTextAttribute = new TextAttribute(
            colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
    this.adaptable=adaptable;
}
项目: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());
}
项目:solidity-ide    文件:CustomCSSHelpHoverProvider.java   
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
    String tooltipAffordanceString = EditorsUI
            .getTooltipAffordanceString();
    if (BrowserInformationControl.isAvailable(parent)) {
        String font = "org.eclipse.jdt.ui.javadocfont";
        BrowserInformationControl iControl = new BrowserInformationControl(
                parent, font, false) {
            @Override
            public IInformationControlCreator getInformationPresenterControlCreator() {
                return fInformationPresenterControlCreator;
            }
        };
        addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent,
                tooltipAffordanceString);
    }
}
项目:subclipse    文件:SVNConflictResolver.java   
private String getEditorId(IFileStore file) {
//      IWorkbench workbench= fWindow.getWorkbench();
        IWorkbench workbench = PlatformUI.getWorkbench();
        IEditorRegistry editorRegistry= workbench.getEditorRegistry();
        IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

        // check the OS for in-place editor (OLE on Win32)
        if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
            descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);

        // check the OS for external editor
        if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
            descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);

        if (descriptor != null)
            return descriptor.getId();

        return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
    }
项目:subclipse    文件:SVNConflictResolver.java   
private String getEditorId(IFileStore file) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorRegistry editorRegistry= workbench.getEditorRegistry();
    IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

    // check the OS for in-place editor (OLE on Win32)
    if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
        descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);

    // check the OS for external editor
    if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
        descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);

    if (descriptor != null)
        return descriptor.getId();

    return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
项目:angular-eclipse    文件:AngularUIPreferenceInitializer.java   
@Override
public void initializeDefaultPreferences() {

    IPreferenceStore store = PreferenceConstants.getPreferenceStore();
    EditorsUI.useAnnotationsPreferencePage(store);
    EditorsUI.useQuickDiffPreferencePage(store);
    PreferenceConstants.initializeDefaultValues();

    // Override HTML Editor content assist sort to set at first the HTML
    // Angular proposal in the completion.
    IPreferenceStore htmlStore = HTMLUIPlugin.getDefault().getPreferenceStore();
    String htmlContentAssistSort = htmlStore
            .getDefaultString(HTMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER);
    if (htmlContentAssistSort != null
            && !htmlContentAssistSort.contains("ts.eclipse.ide.angular.ui.proposalCategory.htmlTags\0")) {
        htmlStore.setDefault(HTMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER,
                "ts.eclipse.ide.angular.ui.proposalCategory.htmlTags\0" + htmlContentAssistSort);
    }
}
项目:mesfavoris    文件:HyperlinkSourceViewer.java   
private void configurePreferenceKeys() {
    preferenceKeysForEnablement = new HashSet<>();
    preferenceKeysForActivation = new HashSet<>();
    // Global settings (master switch)
    preferenceKeysForEnablement
            .add(AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED);
    preferenceKeysForActivation
            .add(AbstractTextEditor.PREFERENCE_HYPERLINK_KEY_MODIFIER);
    // All applicable individual hyperlink detectors settings.
    Map targets = configuration.getHyperlinkDetectorTargets(this);
    for (HyperlinkDetectorDescriptor desc : EditorsUI
            .getHyperlinkDetectorRegistry()
            .getHyperlinkDetectorDescriptors()) {
        if (targets.keySet().contains(desc.getTargetId())) {
            preferenceKeysForEnablement.add(desc.getId());
            preferenceKeysForActivation.add(desc.getId()
                    + HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX);
        }
    }
}
项目:statecharts    文件:CustomCSSHelpHoverProvider.java   
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
    String tooltipAffordanceString = EditorsUI
            .getTooltipAffordanceString();
    if (BrowserInformationControl.isAvailable(parent)) {
        String font = "org.eclipse.jdt.ui.javadocfont";
        BrowserInformationControl iControl = new BrowserInformationControl(
                parent, font, false) {
            @Override
            public IInformationControlCreator getInformationPresenterControlCreator() {
                return fInformationPresenterControlCreator;
            }
        };
        addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent,
                tooltipAffordanceString);
    }
}
项目:JuliaDT    文件:JuliaEditorPreferencesInitializer.java   
public void initializeDefaultPreferences() {
  IPreferenceStore store = JuliaEditorPlugin.getDefault().getPreferenceStore();
  EditorsUI.useAnnotationsPreferencePage(store);
  EditorsUI.useQuickDiffPreferencePage(store);
  PreferenceConstants.initializeDefaultValues(store);
  PreferenceConverter.setDefault(store, JuliaColourConstants.COMMENT, COMMENT_COLOUR);
  PreferenceConverter.setDefault(store, JuliaColourConstants.KEYWORD, KEYWORD_COLOUR);
  PreferenceConverter.setDefault(store, JuliaColourConstants.STRING, STRING_COLOUR);

  store.setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
  store
      .setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);

  store.setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
  store
      .setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);

  store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 4);
  store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true);

  store.setDefault(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB);
  store.setDefault(CodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
  store.setDefault(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "4");
}
项目:brainfuck    文件:BfPreferenceInitializer.java   
@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = BfActivator.getDefault().getPreferenceStore();
    store.setDefault(TEMPLATE_KEY, "");

    IPreferenceStore editorStore = EditorsUI.getPreferenceStore();
    editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS, true);
    editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_CARET, false);
    editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_ENCLOSING, false);
    PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY));

    PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_KEY_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_MAGENTA));
    PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_OTHER_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY));
    PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_COMMENT_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GREEN));
    PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_TEMPLATE_PARAMS_COLOR, getSystemColorRGB(SWT.COLOR_BLUE));

    editorStore.setDefault(EditorConstants.PREF_EDITOR_CLOSE_BRACKET, true);
}
项目:gama    文件:GamlHoverProvider.java   
@Override
public IInformationControl doCreateInformationControl(final Shell parent) {

    final String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
    if (BrowserInformationControl.isAvailable(parent)) {
        final String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME:
                                                                // PreferenceConstants.APPEARANCE_JAVADOC_FONT;
        final IXtextBrowserInformationControl iControl =
                new GamlInformationControl(parent, font, tooltipAffordanceString) {

                };
        addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent, tooltipAffordanceString);
    }
}
项目:GLSL-Eclipse    文件:GlslEditor.java   
@Override
protected ISourceViewer createSourceViewer(Composite parent,
        IVerticalRuler ruler, int styles) {

    ISourceViewer sourceViewer = super.createSourceViewer(parent, ruler, styles);

    // Apply preference settings from the default editor
    IPreferenceStore store = EditorsUI.getPreferenceStore();

    Color backgroundColor = PreferenceUtils.colorFromString(
            store.getString(PREFERENCE_COLOR_BACKGROUND));
    Color foregroundColor = PreferenceUtils.colorFromString(
            store.getString(PREFERENCE_COLOR_FOREGROUND));
    Color selectionBackgroundColor = PreferenceUtils.colorFromString(
            store.getString(PREFERENCE_COLOR_SELECTION_BACKGROUND), new RGB(99, 99, 99));
    Color selectionForegroundColor = PreferenceUtils.colorFromString(
            store.getString(PREFERENCE_COLOR_SELECTION_FOREGROUND), new RGB(0, 0, 0));

    final StyledText textWidget = sourceViewer.getTextWidget();
    textWidget.setBackground(backgroundColor);
    textWidget.setForeground(foregroundColor);
    textWidget.setSelectionBackground(selectionBackgroundColor);
    textWidget.setSelectionForeground(selectionForegroundColor);

    return sourceViewer;
}
项目:APICloud-Studio    文件:AbstractDocumentationHover.java   
public IInformationControl doCreateInformationControl(Shell parent)
{
    if (CustomBrowserInformationControl.isAvailable(parent))
    {
        CustomBrowserInformationControl iControl = new CustomBrowserInformationControl(parent, null,
                EditorsUI.getTooltipAffordanceString())
        {
            public IInformationControlCreator getInformationPresenterControlCreator()
            {
                return informationPresenterControlCreator;
            }
        };
        iControl.setBackgroundColor(getBackgroundColor());
        iControl.setForegroundColor(getForegroundColor());
        return iControl;
    }
    else
    {
        // return new ThemedInformationControl(parent, null, EditorsUI.getTooltipAffordanceString());
        return new DefaultInformationControl(parent, true);
    }
}
项目:APICloud-Studio    文件:SVNConflictResolver.java   
private String getEditorId(IFileStore file) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorRegistry editorRegistry= workbench.getEditorRegistry();
    IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

    // check the OS for in-place editor (OLE on Win32)
    if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
        descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);

    // check the OS for external editor
    if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
        descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);

    if (descriptor != null)
        return descriptor.getId();

    return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
项目: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);
}
项目:Eclipse-Postfix-Code-Completion    文件:PropertiesFileSourceViewerConfiguration.java   
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
        return null;

    IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
        @Override
        protected IContentType getContentType() {
            return PROPERTIES_CONTENT_TYPE;
        }
    };

    MonoReconciler reconciler= new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
/**
 * Creates and returns the preference store for this Java editor with the given input.
 *
 * @param input The editor input for which to create the preference store
 * @return the preference store for this editor
 *
 * @since 3.0
 */
private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(3);

    IJavaProject project= EditorUtility.getJavaProject(input);
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()), JavaCore.PLUGIN_ID));
    }

    stores.add(JavaPlugin.getDefault().getPreferenceStore());
    stores.add(new PreferencesAdapter(JavaPlugin.getJavaCorePluginPreferences()));
    stores.add(EditorsUI.getPreferenceStore());
    stores.add(PlatformUI.getPreferenceStore());

    return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
项目:Eclipse-Postfix-Code-Completion    文件:JavadocHover.java   
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
    String tooltipAffordanceString= fAdditionalInfoAffordance ? JavaPlugin.getAdditionalInfoAffordanceString() : EditorsUI.getTooltipAffordanceString();
    if (BrowserInformationControl.isAvailable(parent)) {
        String font= PreferenceConstants.APPEARANCE_JAVADOC_FONT;
        BrowserInformationControl iControl= new BrowserInformationControl(parent, font, tooltipAffordanceString) {
            /*
             * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator()
             */
            @Override
            public IInformationControlCreator getInformationPresenterControlCreator() {
                return fInformationPresenterControlCreator;
            }
        };
        addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent, tooltipAffordanceString);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SpellCheckEngine.java   
public final void propertyChange(final PropertyChangeEvent event) {
    if (event.getProperty().equals(PreferenceConstants.SPELLING_LOCALE)) {
        resetSpellChecker();
        return;
    }

    if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY)) {
        resetUserDictionary();
        return;
    }

    if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY_ENCODING)) {
        resetUserDictionary();
        return;
    }

    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        if (this == fgEngine)
            SpellCheckEngine.shutdownInstance();
        else
            shutdown();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SpellCheckEngine.java   
public synchronized final void shutdown() {

        JavaPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
        EditorsUI.getPreferenceStore().removePropertyChangeListener(this);

        ISpellDictionary dictionary= null;
        for (final Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) {
            dictionary= iterator.next();
            dictionary.unload();
        }
        fGlobalDictionaries= null;

        for (final Iterator<ISpellDictionary> iterator= fLocaleDictionaries.values().iterator(); iterator.hasNext();) {
            dictionary= iterator.next();
            dictionary.unload();
        }
        fLocaleDictionaries= null;

        fUserDictionary= null;
        fChecker= null;
    }
项目:editorconfig-eclipse    文件:EditorConfigSourceViewerConfiguration.java   
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
        return null;

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
        @Override
        protected IContentType getContentType() {
            return EditorConfigTextTools.EDITORCONFIG_CONTENT_TYPE;
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目: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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:PropertiesFileSourceViewerConfiguration.java   
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
        return null;

    IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
        @Override
        protected IContentType getContentType() {
            return PROPERTIES_CONTENT_TYPE;
        }
    };

    MonoReconciler reconciler= new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
/**
 * Creates and returns the preference store for this Java editor with the given input.
 *
 * @param input The editor input for which to create the preference store
 * @return the preference store for this editor
 *
 * @since 3.0
 */
private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(3);

    IJavaProject project= EditorUtility.getJavaProject(input);
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()), JavaCore.PLUGIN_ID));
    }

    stores.add(JavaPlugin.getDefault().getPreferenceStore());
    stores.add(new PreferencesAdapter(JavaPlugin.getJavaCorePluginPreferences()));
    stores.add(EditorsUI.getPreferenceStore());
    stores.add(PlatformUI.getPreferenceStore());

    return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavadocHover.java   
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
    String tooltipAffordanceString= fAdditionalInfoAffordance ? JavaPlugin.getAdditionalInfoAffordanceString() : EditorsUI.getTooltipAffordanceString();
    if (BrowserInformationControl.isAvailable(parent)) {
        String font= PreferenceConstants.APPEARANCE_JAVADOC_FONT;
        BrowserInformationControl iControl= new BrowserInformationControl(parent, font, tooltipAffordanceString) {
            /*
             * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator()
             */
            @Override
            public IInformationControlCreator getInformationPresenterControlCreator() {
                return fInformationPresenterControlCreator;
            }
        };
        addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent, tooltipAffordanceString);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SpellCheckEngine.java   
public final void propertyChange(final PropertyChangeEvent event) {
    if (event.getProperty().equals(PreferenceConstants.SPELLING_LOCALE)) {
        resetSpellChecker();
        return;
    }

    if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY)) {
        resetUserDictionary();
        return;
    }

    if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY_ENCODING)) {
        resetUserDictionary();
        return;
    }

    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        if (this == fgEngine)
            SpellCheckEngine.shutdownInstance();
        else
            shutdown();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SpellCheckEngine.java   
public synchronized final void shutdown() {

        JavaPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
        EditorsUI.getPreferenceStore().removePropertyChangeListener(this);

        ISpellDictionary dictionary= null;
        for (final Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) {
            dictionary= iterator.next();
            dictionary.unload();
        }
        fGlobalDictionaries= null;

        for (final Iterator<ISpellDictionary> iterator= fLocaleDictionaries.values().iterator(); iterator.hasNext();) {
            dictionary= iterator.next();
            dictionary.unload();
        }
        fLocaleDictionaries= null;

        fUserDictionary= null;
        fChecker= null;
    }
项目:eclipsensis    文件:NSISCommandDialog.java   
private NSISSourceViewer createPreviewer(Composite parent)
{
    NSISSourceViewer previewer = new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL
                    | SWT.BORDER | SWT.WRAP);
    NSISTextUtility.hookSourceViewer(previewer);
    SourceViewerConfiguration configuration = new NSISSourceViewerConfiguration(
                    new ChainedPreferenceStore(new IPreferenceStore[] { NSISPreferences.getInstance().getPreferenceStore(),
                                    EditorsUI.getPreferenceStore() }));
    previewer.configure(configuration);
    new NSISDocumentSetupParticipant().setup(mCommandDoc);
    previewer.setDocument(mCommandDoc);
    previewer.setEditable(false);
    final StyledText textWidget = previewer.getTextWidget();
    textWidget.getCaret().setVisible(false);
    textWidget.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e)
        {
            textWidget.setSelectionRange(e.x, 0);
        }
    });
    return previewer;
}
项目:eclipsensis    文件:NSISEditorPreferencePage.java   
private Control createPreviewer(Composite parent)
{
    mPreviewer= new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    NSISTextUtility.hookSourceViewer(mPreviewer);
    SourceViewerConfiguration configuration= new NSISSourceViewerConfiguration(new ChainedPreferenceStore(new IPreferenceStore[]{mPreferenceStore,getPreferenceStore(), EditorsUI.getPreferenceStore()}));
    mPreviewer.configure(configuration);

    InputStream is = null;
    String content= ""; //$NON-NLS-1$
    try {
        is = getClass().getResourceAsStream("NSISPreview.txt"); //$NON-NLS-1$
        content= new String(IOUtility.loadContentFromStream(is));
    }
    catch(Exception e) {
        EclipseNSISPlugin.getDefault().log(e);
    }
    finally {
        IOUtility.closeIO(is);
    }
    IDocument document= new Document(content);
    new NSISDocumentSetupParticipant().setup(document);
    mPreviewer.setDocument(document);
    mPreviewer.setEditable(false);

    return mPreviewer.getControl();
}
项目:eclipsensis    文件:NSISTemplatePreferencePage.java   
@Override
protected SourceViewer createViewer(Composite parent)
{
    mViewer = new NSISTemplateSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    NSISTextUtility.hookSourceViewer(mViewer);
    SourceViewerConfiguration configuration = new NSISTemplateSourceViewerConfiguration(new ChainedPreferenceStore(
            new IPreferenceStore[] { getPreferenceStore(), EditorsUI.getPreferenceStore() }));
    mViewer.configure(configuration);

    IDocument document = new Document();
    new NSISDocumentSetupParticipant().setup(document);
    mViewer.setDocument(document);
    mViewer.setEditable(false);

    return mViewer;
}
项目:birt    文件:DecoratedScriptEditor.java   
/**
 * Constructs a decorated script editor with the specified parent and the
 * specified script.
 * 
 * @param parent
 *            the parent editor.
 * @param script
 *            the script to edit
 */
public DecoratedScriptEditor( IEditorPart parent, String script )
{
    super( );
    this.parent = parent;
    this.sourceViewerConfiguration = new ScriptSourceViewerConfiguration( context );
    setSourceViewerConfiguration( this.sourceViewerConfiguration );
    setDocumentProvider( new ScriptDocumentProvider( parent ) );
    setScript( script );

    IPreferences preferences = PreferenceFactory.getInstance( )
            .getPreferences( ReportPlugin.getDefault( ) );
    if ( preferences instanceof PreferenceWrapper )
    {
        IPreferenceStore store = ( (PreferenceWrapper) preferences ).getPrefsStore( );
        if ( store != null )
        {
            IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
            setPreferenceStore( new ChainedPreferenceStore(new IPreferenceStore[]{store, baseEditorPrefs}) );
        }
    }
}
项目:birt    文件:AbstractSyntaxColoringPage.java   
public void dispose() {
    if (fForegroundColor != null) {
        fForegroundColor.dispose();
        fForegroundColor = null;
    }
    if (fBackgroundColor != null) {
        fBackgroundColor.dispose();
        fBackgroundColor = null;
    }
    if (fSelectionForegroundColor != null) {
        fSelectionForegroundColor.dispose();
        fSelectionForegroundColor = null;
    }
    if (fSelectionBackgroundColor != null) {
        fSelectionBackgroundColor.dispose();
        fSelectionBackgroundColor = null;
    }
    if (fListener != null) {
        final IPreferenceStore store = EditorsUI.getPreferenceStore();
        if (store != null) {
            store.removePropertyChangeListener(fListener);
        }
    }
    super.dispose();
}
项目:Pydev    文件:PyOpenResourceAction.java   
@Override
protected void openFiles(PythonpathZipChildTreeNode[] pythonPathFilesSelected) {
    for (PythonpathZipChildTreeNode n : pythonPathFilesSelected) {
        try {
            if (PythonPathHelper.isValidSourceFile(n.zipPath)) {
                new PyOpenAction().run(new ItemPointer(n.zipStructure.file, new Location(), new Location(), null,
                        n.zipPath));
            } else {
                IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry();
                IEditorDescriptor defaultEditor = editorReg.getDefaultEditor(n.zipPath);
                PydevZipFileStorage storage = new PydevZipFileStorage(n.zipStructure.file, n.zipPath);
                PydevZipFileEditorInput input = new PydevZipFileEditorInput(storage);

                if (defaultEditor != null) {
                    IDE.openEditor(page, input, defaultEditor.getId());
                } else {
                    IDE.openEditor(page, input, EditorsUI.DEFAULT_TEXT_EDITOR_ID);
                }
            }
        } catch (PartInitException e) {
            Log.log(e);
        }
    }
}
项目:Pydev    文件:PyEditConfigurationWithoutEditor.java   
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

    SpellingService spellingService = EditorsUI.getSpellingService();
    if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) {
        return null;
    }

    //Overridden (just) to return a PyReconciler!
    IReconcilingStrategy strategy = new PyReconciler(sourceViewer, spellingService);

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setIsIncrementalReconciler(false);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    reconciler.setDelay(500);
    return reconciler;
}
项目:Pydev    文件:AbstractPyEditorTextHover.java   
@Override
public IInformationControlCreator getHoverControlCreator() {
    return new IInformationControlCreator() {

        @Override
        public IInformationControl createInformationControl(Shell parent) {
            String tooltipAffordanceString = null;
            try {
                tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
            } catch (Throwable e) {
                //Not available on Eclipse 3.2
            }
            informationControl = new PyInformationControl(parent, tooltipAffordanceString,
                    informationPresenter);
            return informationControl;
        }
    };
}
项目:eclipse.spellchecker    文件:SpellCheckEngine.java   
public final void propertyChange(final PropertyChangeEvent event) {
    if (event.getProperty().equals(PreferenceConstants.SPELLING_LOCALE)) {
        resetSpellChecker();
        return;
    }

    if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY)) {
        resetUserDictionary();
        return;
    }

    if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY_ENCODING)) {
        resetUserDictionary();
        return;
    }

    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        if (this == fgEngine)
            SpellCheckEngine.shutdownInstance();
        else
            shutdown();
    }
}
项目:eclipse.spellchecker    文件:SpellCheckEngine.java   
public synchronized final void shutdown() {

        Activator.getDefault().getPreferenceStore().removePropertyChangeListener(this);
        EditorsUI.getPreferenceStore().removePropertyChangeListener(this);

        ISpellDictionary dictionary= null;
        for (final Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) {
            dictionary= iterator.next();
            dictionary.unload();
        }
        fGlobalDictionaries= null;

        for (final Iterator<ISpellDictionary> iterator= fLocaleDictionaries.values().iterator(); iterator.hasNext();) {
            dictionary= iterator.next();
            dictionary.unload();
        }
        fLocaleDictionaries= null;

        fUserDictionary= null;
        fChecker= null;
    }
项目:goclipse    文件:AbstractLangEditor.java   
protected IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>(4);

    IProject project = EditorUtils.getAssociatedProject(input);
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), LangUIPlugin.PLUGIN_ID));
    }

    stores.add(LangUIPlugin.getInstance().getPreferenceStore());
    stores.add(LangUIPlugin.getInstance().getCorePreferenceStore());

    alterCombinedPreferenceStores_beforeEditorsUI(stores);
    stores.add(EditorsUI.getPreferenceStore());

    return new ChainedPreferenceStore(ArrayUtil.createFrom(stores, IPreferenceStore.class));
}