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

项目: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    文件:PreferenceStoreHelper.java   
public static IPreferenceStore contributeToPreferenceStore(ITextEditor textEditor,
        IPreferenceStore preferenceStore) {
    try {
        // Get old store
        IPreferenceStore oldStore = getPreferenceStore(textEditor);
        // Create chained store with preference store to add
        IPreferenceStore newStore = new ChainedPreferenceStore(
                new IPreferenceStore[] { preferenceStore, oldStore });
        // Update the text editor with new preference store
        setPreferenceStoreOfTextEditor(textEditor, newStore);
        // Update the source viewer configuration with new preference store
        setPreferenceStoreOfSourceViewerConfiguration(textEditor, newStore);
        return newStore;

    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }

}
项目: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    文件:PropertiesFileEditorPreferencePage.java   
private Control createPreviewer(Composite parent) {

        IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { fOverlayStore, JavaPlugin.getDefault().getCombinedPreferenceStore()});
        fPreviewViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store);
        fColorManager= new JavaColorManager(false);
        PropertiesFileSourceViewerConfiguration configuration= new PropertiesFileSourceViewerConfiguration(fColorManager, store, null, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING);
        fPreviewViewer.configure(configuration);
        Font font= JFaceResources.getFont(PreferenceConstants.PROPERTIES_FILE_EDITOR_TEXT_FONT);
        fPreviewViewer.getTextWidget().setFont(font);
        new SourcePreviewerUpdater(fPreviewViewer, configuration, store);
        fPreviewViewer.setEditable(false);

        String content= loadPreviewContentFromFile("PropertiesFileEditorColorSettingPreviewCode.txt"); //$NON-NLS-1$
        IDocument document= new Document(content);
        PropertiesFileDocumentSetupParticipant.setupDocument(document);
        fPreviewViewer.setDocument(document);

        return fPreviewViewer.getControl();
    }
项目:editorconfig-eclipse    文件:SyntaxColoringPreferencePage.java   
private Control createPreviewer(Composite parent) {

        IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { fOverlayStore,
                EditorConfigUIPlugin.getDefault().getCombinedPreferenceStore() });
        fPreviewViewer = new SourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
        fColorManager = new EditorConfigColorManager(false);
        EditorConfigSourceViewerConfiguration configuration = new EditorConfigSourceViewerConfiguration(fColorManager,
                store, null, IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING);
        fPreviewViewer.configure(configuration);
        Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_CONFIG_EDITOR_TEXT_FONT);
        fPreviewViewer.getTextWidget().setFont(font);
        new SourcePreviewerUpdater(fPreviewViewer, configuration, store);
        fPreviewViewer.setEditable(false);

        String content = loadPreviewContentFromFile("EditorConfigEditorColorSettingPreviewCode.txt"); //$NON-NLS-1$
        IDocument document = new Document(content);
        EditorConfigDocumentSetupParticipant.setupDocument(document);
        fPreviewViewer.setDocument(document);

        return fPreviewViewer.getControl();
    }
项目: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    文件:PropertiesFileEditorPreferencePage.java   
private Control createPreviewer(Composite parent) {

        IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { fOverlayStore, JavaPlugin.getDefault().getCombinedPreferenceStore()});
        fPreviewViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store);
        fColorManager= new JavaColorManager(false);
        PropertiesFileSourceViewerConfiguration configuration= new PropertiesFileSourceViewerConfiguration(fColorManager, store, null, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING);
        fPreviewViewer.configure(configuration);
        Font font= JFaceResources.getFont(PreferenceConstants.PROPERTIES_FILE_EDITOR_TEXT_FONT);
        fPreviewViewer.getTextWidget().setFont(font);
        new SourcePreviewerUpdater(fPreviewViewer, configuration, store);
        fPreviewViewer.setEditable(false);

        String content= loadPreviewContentFromFile("PropertiesFileEditorColorSettingPreviewCode.txt"); //$NON-NLS-1$
        IDocument document= new Document(content);
        PropertiesFileDocumentSetupParticipant.setupDocument(document);
        fPreviewViewer.setDocument(document);

        return fPreviewViewer.getControl();
    }
项目: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}) );
        }
    }
}
项目: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));
}
项目:SparkBuilderGenerator    文件:PreferenceStoreProvider.java   
public PreferenceStoreWrapper providePreferenceStore() {
    IPreferenceStore[] preferenceStores = new IPreferenceStore[2];
    preferenceStores[0] = Activator.getDefault().getPreferenceStore();

    ScopedPreferenceStore jdtCorePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.jdt.core");
    if (currentJavaProject.isPresent()) { // if we are in a project add to search scope
        jdtCorePreferenceStore.setSearchContexts(new IScopeContext[] { new ProjectScope(currentJavaProject.get().getProject()), InstanceScope.INSTANCE });
    }
    preferenceStores[1] = jdtCorePreferenceStore;

    return new PreferenceStoreWrapper(new ChainedPreferenceStore(preferenceStores));
}
项目:fluentmark    文件:AppearanceConfigurationBlock.java   
private Control createPreviewer(Composite parent) {

        IPreferenceStore generalTextStore = FluentMkUI.getDefault().getPreferenceStore();
        IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(),
                new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore });
        fPreviewViewer = new FluentMkSourceViewer(parent, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER,
                store);
        FluentMkSimpleSourceViewerConfiguration configuration = new FluentMkSimpleSourceViewerConfiguration(
                fColorManager, store, null, Partitions.MK_PARTITIONING, false);
        fPreviewViewer.configure(configuration);
        Font font = JFaceResources.getFont(Prefs.EDITOR_TEXT_FONT);
        fPreviewViewer.getTextWidget().setFont(font);
        new PreviewSourceUpdater(fPreviewViewer, configuration, store);

        fPreviewViewer.setEditable(false);
        Cursor arrowCursor = fPreviewViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
        fPreviewViewer.getTextWidget().setCursor(arrowCursor);

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

        String content = loadPreviewContentFromFile("ColorsPreview.md"); //$NON-NLS-1$
        IDocument document = new Document(content);
        FluentMkUI.getDefault().getTextTools().setupDocumentPartitioner(document, Partitions.MK_PARTITIONING);
        fPreviewViewer.setDocument(document);

        return fPreviewViewer.getControl();
    }
项目:typescript.java    文件:TypeScriptMergeViewer.java   
private ChainedPreferenceStore createChainedPreferenceStore(IIDETypeScriptProject project) {
    ArrayList<IPreferenceStore> stores = new ArrayList<>(4);
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()),
                TypeScriptCorePlugin.PLUGIN_ID));
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()),
                TypeScriptUIPlugin.PLUGIN_ID));
    }
    stores.add(JavaScriptPlugin.getDefault().getPreferenceStore());
    stores.add(new PreferencesAdapter(JavaScriptCore.getPlugin().getPluginPreferences()));
    stores.add(new PreferencesAdapter(JSDTTypeScriptUIPlugin.getDefault().getPluginPreferences()));
    stores.add(EditorsUI.getPreferenceStore());
    return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
项目:typescript.java    文件:TypeScriptDocumentProvider.java   
private static IPreferenceStore createProjectSpecificPreferenceStore(IProject project) {
    List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>();
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), TypeScriptUIPlugin.PLUGIN_ID));
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), TypeScriptCorePlugin.PLUGIN_ID));
    }
    stores.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, TypeScriptUIPlugin.PLUGIN_ID));
    stores.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, TypeScriptCorePlugin.PLUGIN_ID));
    stores.add(new ScopedPreferenceStore(DefaultScope.INSTANCE, TypeScriptUIPlugin.PLUGIN_ID));
    stores.add(new ScopedPreferenceStore(DefaultScope.INSTANCE, TypeScriptCorePlugin.PLUGIN_ID));
    return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
项目:typescript.java    文件:JavaScriptLightWeightEditor.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
 *
 * 
 */
private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List stores = new ArrayList();

    // IJavaScriptProject project= EditorUtility.getJavaProject(input);
    // if (project != null) {
    // stores.add(new EclipsePreferencesAdapter(new
    // ProjectScope(project.getProject()), JavaScriptCore.PLUGIN_ID));
    // }
    addPreferenceStores(stores, input);
    return new ChainedPreferenceStore((IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores.size()]));
}
项目:bts    文件:PreferenceStoreAccessImpl.java   
public IPreferenceStore getPreferenceStore() {
    lazyInitialize();
    Activator activator = Activator.getDefault();
    if (activator != null)
        return new ChainedPreferenceStore(new IPreferenceStore[] {
                getWritablePreferenceStore(),
                activator.getPreferenceStore(), 
                EditorsUI.getPreferenceStore() });
    return new ChainedPreferenceStore(new IPreferenceStore[] {
            getWritablePreferenceStore(),
            EditorsUI.getPreferenceStore() });
}
项目:bts    文件:PreferenceStoreAccessImpl.java   
public IPreferenceStore getContextPreferenceStore(Object context) {
    lazyInitialize();
    // may be null on shutdown
    Activator activator = Activator.getDefault();
    if (activator != null)
        return new ChainedPreferenceStore(new IPreferenceStore[] { 
                getWritablePreferenceStore(context),
                activator.getPreferenceStore(),
                EditorsUI.getPreferenceStore()});
    return new ChainedPreferenceStore(new IPreferenceStore[] { 
            getWritablePreferenceStore(context),
            EditorsUI.getPreferenceStore()});
}
项目:APICloud-Studio    文件:AbstractFormatterPreferencePage.java   
/**
 * @param composite
 */
public SourceViewer createSourcePreview(Composite composite, IScriptFormatterFactory factory)
{
    IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
    // TODO - Note that we pass the factory's preferences store and not calling to this.getPrefereceStore.
    // In case we decide to unify the preferences into the this plugin, we might need to change this.
    IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { factory.getPreferenceStore(),
            generalTextStore });
    SourceViewer fPreviewViewer = createPreviewViewer(composite, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL
            | SWT.BORDER, store);
    if (fPreviewViewer == null)
    {
        return null;
    }
    SourceViewerConfiguration configuration = (SourceViewerConfiguration) factory
            .createSimpleSourceViewerConfiguration(fColorManager, store, null, false);
    fPreviewViewer.configure(configuration);
    if (fPreviewViewer.getTextWidget().getTabs() == 0)
    {
        fPreviewViewer.getTextWidget().setTabs(4);
    }
    new ScriptSourcePreviewerUpdater(fPreviewViewer, configuration, store);
    fPreviewViewer.setEditable(false);
    IDocument document = new Document();
    fPreviewViewer.setDocument(document);
    IPartitioningConfiguration partitioningConfiguration = (IPartitioningConfiguration) factory
            .getPartitioningConfiguration();
    CompositePartitionScanner partitionScanner = new CompositePartitionScanner(
            partitioningConfiguration.createSubPartitionScanner(), new NullSubPartitionScanner(),
            new NullPartitionerSwitchStrategy());
    IDocumentPartitioner partitioner = new ExtendedFastPartitioner(partitionScanner,
            partitioningConfiguration.getContentTypes());
    partitionScanner.setPartitioner((IExtendedPartitioner) partitioner);
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);
    return fPreviewViewer;
}
项目:APICloud-Studio    文件:UserAgentManager.java   
/**
 * Process the preference key value associated with UserAgentManager. This method is automatically called when the
 * singleton instance is created. If the preference key value is somehow manipulated outside of UserAgentManager
 * (and it shouldn't be), then this method will need to be invoked to update the in-memory cache of
 * nature/user-agent info.
 */
void loadPreference()
{
    // Grab preference value. We use a ChainedPreferenceStore to be able to migrate the preference location from the
    // UIEplPlugin to the CommonEditorPlugin (the new location that we will use to save the
    // IPreferenceConstants.USER_AGENT_PREFERENCE)
    ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] {
            CommonEditorPlugin.getDefault().getPreferenceStore(), UIEplPlugin.getDefault().getPreferenceStore() });
    String preferenceValue = chainedStore.getString(IPreferenceConstants.USER_AGENT_PREFERENCE);

    Map<String, String[]> result;
    if (!StringUtil.isEmpty(preferenceValue))
    {
        result = extractUserAgents(preferenceValue);
    }
    else
    {
        result = new HashMap<String, String[]>();
        // set defaults
        for (String natureID : ResourceUtil.getAptanaNaturesMap().values())
        {
            result.put(natureID, getDefaultUserAgentIDs(natureID));
        }
    }

    // cache result
    ACTIVE_USER_AGENTS_BY_NATURE_ID = result;
}
项目: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    文件:JavaSourceViewerConfiguration.java   
/**
 * 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 });
}
项目: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);
    }
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditorColoringConfigurationBlock.java   
private Control createPreviewer(Composite parent) {

        IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore();
        IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore });
        fPreviewViewer= new JavaSourceViewer(parent, null, null, false, SWT.H_SCROLL | SWT.BORDER, store);
        SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(fColorManager, store, null, IJavaPartitions.JAVA_PARTITIONING, false);
        fPreviewViewer.configure(configuration);
        // fake 1.5 source to get 1.5 features right.
        configuration.handlePropertyChangeEvent(new PropertyChangeEvent(this, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4, JavaCore.VERSION_1_5));
        Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
        fPreviewViewer.getTextWidget().setFont(font);
        new JavaSourcePreviewerUpdater(fPreviewViewer, configuration, store);

        fPreviewViewer.setEditable(false);
        Cursor arrowCursor= fPreviewViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
        fPreviewViewer.getTextWidget().setCursor(arrowCursor);

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

        String content= loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
        IDocument document= new Document(content);
        JavaPlugin.getDefault().getJavaTextTools().setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
        fPreviewViewer.setDocument(document);

        installSemanticHighlighting();


        return fPreviewViewer.getControl();
    }
项目:Eclipse-Postfix-Code-Completion    文件:JavaMergeViewer.java   
private ChainedPreferenceStore createChainedPreferenceStore(IJavaProject project) {
    ArrayList<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(4);
    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());
return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
  }
项目:idecore    文件:ApexCodeEditor.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
 *
 */
private static IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List<IPreferenceStore> stores = new ArrayList<>(3);

    stores.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, ForceIdeEditorsPlugin.PLUGIN_ID));
    stores.add(new ScopedPreferenceStore(DefaultScope.INSTANCE, ForceIdeEditorsPlugin.PLUGIN_ID));
    stores.add(EditorsUI.getPreferenceStore());

    return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaSourceViewerConfiguration.java   
/**
 * 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 });
}
项目: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);
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditorColoringConfigurationBlock.java   
private Control createPreviewer(Composite parent) {

        IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore();
        IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore });
        fPreviewViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store);
        SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(fColorManager, store, null, IJavaPartitions.JAVA_PARTITIONING, false);
        fPreviewViewer.configure(configuration);
        // fake 1.5 source to get 1.5 features right.
        configuration.handlePropertyChangeEvent(new PropertyChangeEvent(this, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4, JavaCore.VERSION_1_5));
        Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
        fPreviewViewer.getTextWidget().setFont(font);
        new JavaSourcePreviewerUpdater(fPreviewViewer, configuration, store);

        fPreviewViewer.setEditable(false);
        Cursor arrowCursor= fPreviewViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
        fPreviewViewer.getTextWidget().setCursor(arrowCursor);

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

        String content= loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
        IDocument document= new Document(content);
        JavaPlugin.getDefault().getJavaTextTools().setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
        fPreviewViewer.setDocument(document);

        installSemanticHighlighting();


        return fPreviewViewer.getControl();
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaMergeViewer.java   
private ChainedPreferenceStore createChainedPreferenceStore(IJavaProject project) {
    ArrayList<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(4);
    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());
return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
  }
项目:Pydev    文件:PydevPrefs.java   
/**
 * @return a preference store that has the pydev preference store and the default editors text store
 */
public synchronized static IPreferenceStore getChainedPrefStore() {
    if (PydevPrefs.fChainedPrefStore == null) {
        List<IPreferenceStore> stores = getDefaultStores(true);
        PydevPrefs.fChainedPrefStore = new ChainedPreferenceStore(
                stores.toArray(new IPreferenceStore[stores.size()]));
    }
    return PydevPrefs.fChainedPrefStore;
}
项目:Pydev    文件:PyContentMergeViewerCreator.java   
/**
 * Creates a new configuration with the pydev preference store so that the colors appear correctly when using
 * Aptana themes.
 * 
 * Also copies the available data from the original compare configuration to the new configuration.
 */
private CompareConfiguration createNewCompareConfiguration(CompareConfiguration mp) {
    List<IPreferenceStore> stores = PydevPrefs.getDefaultStores(false);
    IPreferenceStore prefs = mp.getPreferenceStore();
    if (prefs != null) {
        //Note, we could use the CompareUIPlugin.getDefault().getPreferenceStore() directly, but it's access
        //is restricted, so, we go to the preferences of the previously created compare configuration.
        stores.add(prefs);
    }

    CompareConfiguration cc = new CompareConfiguration(new ChainedPreferenceStore(
            stores.toArray(new IPreferenceStore[stores.size()])));
    cc.setAncestorImage(mp.getAncestorImage(null));
    cc.setAncestorLabel(mp.getAncestorLabel(null));

    cc.setLeftImage(mp.getLeftImage(null));
    cc.setLeftLabel(mp.getLeftLabel(null));
    cc.setLeftEditable(mp.isLeftEditable());

    cc.setRightImage(mp.getRightImage(null));
    cc.setRightLabel(mp.getRightLabel(null));
    cc.setRightEditable(mp.isRightEditable());

    try {
        cc.setContainer(mp.getContainer());
    } catch (Throwable e) {
        //Ignore: not available in Eclipse 3.2.
    }

    return cc;
}
项目:egradle    文件:AbstractGroovySourceViewerConfiguration.java   
public AbstractGroovySourceViewerConfiguration(IAdaptable adaptable, PreferenceIdentifiable colorNormalText) {
    IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();

    this.fPreferenceStore = new ChainedPreferenceStore(
            new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });

    this.adaptable = adaptable;
    this.colorManager = adaptable.getAdapter(ColorManager.class);
    Assert.isNotNull(colorManager, " adaptable must support color manager");

    this.annotationHoover = new GroovyEditorAnnotationHoover();

    this.defaultTextAttribute = new TextAttribute(
            colorManager.getColor(getPreferences().getColor(colorNormalText)));

}
项目:bts    文件:AbstractDetailsPart.java   
@Override
protected final IPreferenceStore doGetPreferenceStore() {
    return new ChainedPreferenceStore(new IPreferenceStore[] { internalStore, masterPreferenceStore });
}
项目:APICloud-Studio    文件:XMLEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { XMLPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:JSSourceEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { JSPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:DTDEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { DTDPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:CSSSourceEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { CSSPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}