org.eclipse.ui.texteditor.ChainedPreferenceStore Java Examples

The following examples show how to use org.eclipse.ui.texteditor.ChainedPreferenceStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractLangEditor.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
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));
}
 
Example #2
Source File: DecoratedScriptEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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}) );
		}
	}
}
 
Example #3
Source File: SyntaxColoringPreferencePage.java    From editorconfig-eclipse with Apache License 2.0 6 votes vote down vote up
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();
	}
 
Example #4
Source File: XtendPreferenceStoreAccess.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@SuppressWarnings("all")
@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
	IProject project = getProject(context);
	if (project == null) return getPreferenceStore();
	IPreferenceStore store = super.getContextPreferenceStore(context);
	ProjectScope projectScope = new ProjectScope(project);
	FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(projectScope, JavaCore.PLUGIN_ID);
	jdtStore.setSearchContexts(new IScopeContext[] {
			projectScope,
			new InstanceScope(),
			new ConfigurationScope()
	});
	return new ChainedPreferenceStore(new IPreferenceStore[] {
		store,
		jdtStore,
		PreferenceConstants.getPreferenceStore()
	});
}
 
Example #5
Source File: PropertiesFileEditorPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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();
	}
 
Example #6
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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()]));
}
 
Example #7
Source File: PreferenceStoreAccessImpl.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
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() });
}
 
Example #8
Source File: PyContentMergeViewerCreator.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 = PyDevUiPrefs.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;
}
 
Example #9
Source File: JavaMergeViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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()]));
  }
 
Example #10
Source File: JavaEditorColoringConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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();
	}
 
Example #11
Source File: JavaPreview.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
	}
 
Example #12
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 });
}
 
Example #13
Source File: EditorUtil.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: UserAgentManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #15
Source File: AbstractFormatterPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @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;
}
 
Example #16
Source File: JavaScriptLightWeightEditor.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * 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()]));
}
 
Example #17
Source File: PreferenceStoreAccessTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Test public void testChainedPreferenceStore() {
	ScopedPreferenceStore configurationStore = new ScopedPreferenceStore(new ConfigurationScope(), LANGUAGE_ID);
	configurationStore.setValue("someInt", 12);
	configurationStore.setValue("anotherInt", 12);
	configurationStore.setDefault("thirdInt", 12);
	ScopedPreferenceStore instanceStore = new ScopedPreferenceStore(new InstanceScope(), LANGUAGE_ID);
	instanceStore.setValue("someInt", 13);
	instanceStore.setDefault("anotherInt", 13);
	ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { instanceStore, configurationStore });
	assertEquals(13, chainedStore.getInt("someInt"));
	assertEquals(13, chainedStore.getInt("anotherInt"));
	assertEquals(12, chainedStore.getInt("thirdInt"));
}
 
Example #18
Source File: PreferenceStoreAccessImpl.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
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()});
}
 
Example #19
Source File: PreferenceStoreAccessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("all")
private ChainedPreferenceStore getPluginCssPreferenceStore() {
	return new ChainedPreferenceStore(new IPreferenceStore[] {
			new FixedScopedPreferenceStore(new InstanceScope(), plugin.getBundle().getSymbolicName()),
			new FixedScopedPreferenceStore(new InstanceScope(), Activator.getDefault().getBundle().getSymbolicName())
	});
}
 
Example #20
Source File: PreferenceStoreProvider.java    From SparkBuilderGenerator with MIT License 5 votes vote down vote up
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));
}
 
Example #21
Source File: XtendPreferenceStoreAccess.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("all")
@Override
public IPreferenceStore getPreferenceStore() {
	IPreferenceStore store = super.getPreferenceStore();
	FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(new InstanceScope(), JavaCore.PLUGIN_ID);
	jdtStore.setSearchContexts(new IScopeContext[] {
			new InstanceScope(),
			new ConfigurationScope()
	});
	return new ChainedPreferenceStore(new IPreferenceStore[] {
		store,
		jdtStore,
		PreferenceConstants.getPreferenceStore()
	});
}
 
Example #22
Source File: TypeScriptMergeViewer.java    From typescript.java with MIT License 5 votes vote down vote up
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()]));
}
 
Example #23
Source File: TypeScriptDocumentProvider.java    From typescript.java with MIT License 5 votes vote down vote up
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()]));
}
 
Example #24
Source File: SwaggerEditor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
public SwaggerEditor() {
    super(new SwaggerDocumentProvider(), //
            // ZEN-4361 Missing marker location indicators (Overview Ruler) next to editor
            // scrollbar in KZOE
            new ChainedPreferenceStore(new IPreferenceStore[] { //
                    Activator.getDefault().getPreferenceStore(), //
                    // Preferences store for EditorsPlugin has settings to show/hide the rules and
                    // markers
                    EditorsPlugin.getDefault().getPreferenceStore() }));

    getPreferenceStore().addPropertyChangeListener(validationChangeListener);
}
 
Example #25
Source File: OpenApi3Editor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
public OpenApi3Editor() {
    super(new OpenApi3DocumentProvider(), //
            // ZEN-4361 Missing marker location indicators (Overview Ruler) next to editor
            // scrollbar in KZOE
            new ChainedPreferenceStore(new IPreferenceStore[] { //
                    Activator.getDefault().getPreferenceStore(), //
                    // Preferences store for EditorsPlugin has settings to show/hide the rules and
                    // markers
                    EditorsPlugin.getDefault().getPreferenceStore() }));

    getPreferenceStore().addPropertyChangeListener(validationChangeListener);
}
 
Example #26
Source File: DTDEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { DTDPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #27
Source File: AbstractThemeableEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void initializeEditor()
{
	setPreferenceStore(new ChainedPreferenceStore(new IPreferenceStore[] {
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }));
}
 
Example #28
Source File: XMLEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { XMLPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #29
Source File: HTMLEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { HTMLPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #30
Source File: AbstractDetailsPart.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected final IPreferenceStore doGetPreferenceStore() {
	return new ChainedPreferenceStore(new IPreferenceStore[] { internalStore, masterPreferenceStore });
}