當前位置: 首頁>>代碼示例>>Java>>正文


Java ScopedPreferenceStore類代碼示例

本文整理匯總了Java中org.eclipse.ui.preferences.ScopedPreferenceStore的典型用法代碼示例。如果您正苦於以下問題:Java ScopedPreferenceStore類的具體用法?Java ScopedPreferenceStore怎麽用?Java ScopedPreferenceStore使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ScopedPreferenceStore類屬於org.eclipse.ui.preferences包,在下文中一共展示了ScopedPreferenceStore類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SynchronizeLabelDecorator

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
public SynchronizeLabelDecorator(final Subscriber subscriber) {
    this.subscriber = subscriber;

    preferenceStore = new ScopedPreferenceStore(new InstanceScope(), TEAM_UI_PLUGIN_ID);

    decorate = Boolean.TRUE.equals(preferenceStore.getBoolean(DECORATION_PREFERENCE_CONSTANT));

    preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (event.getProperty().equals(DECORATION_PREFERENCE_CONSTANT)) {
                /*
                 * Note that we compare against the string value of the
                 * preference here. Preferences are not strongly typed
                 * (they're strings under the hood), so in the property
                 * change event, we're given the string value.
                 */
                decorate = "true".equals(event.getNewValue()); //$NON-NLS-1$

                ((ILabelProviderListener) listeners.getListener()).labelProviderChanged(
                    new LabelProviderChangedEvent(SynchronizeLabelDecorator.this));
            }
        }
    });
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:26,代碼來源:SynchronizeLabelDecorator.java

示例2: forceStaticImports

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
private void forceStaticImports() {
	try {
		IPreferenceStore s = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.jdt.ui");
		String favorites = s.getString(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS);
		for (String f : defaultFavorites) {
			if (!favorites.contains(f)) {
				if (!favorites.isEmpty()) {
					favorites += ";";
				}
				favorites += f;
			}
		}
		Log.info("forcing favorite static members: " + favorites);
		s.setValue(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, favorites);
	} catch (Exception e) {
		Log.error(e);
	}
}
 
開發者ID:cincheo,項目名稱:jsweet-eclipse-plugin,代碼行數:19,代碼來源:JSweetBuilder.java

示例3: getVersion

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
public static String getVersion(IResource resource, JasperReportsConfiguration jContext, boolean showDialog) {
	String version = jContext.getProperty(StudioPreferencePage.JSS_COMPATIBILITY_VERSION, LAST_VERSION);
	if (showDialog && jContext.getPropertyBoolean(StudioPreferencePage.JSS_COMPATIBILITY_SHOW_DIALOG, false)) {
		VersionDialog dialog = new VersionDialog(Display.getDefault().getActiveShell(), version, resource);
		if (dialog.open() == Dialog.OK) {
			version = dialog.getVersion();
			try {
				ScopedPreferenceStore pstore = JaspersoftStudioPlugin.getInstance().getPreferenceStore(resource,
						JaspersoftStudioPlugin.getUniqueIdentifier());
				pstore.setValue(StudioPreferencePage.JSS_COMPATIBILITY_VERSION, version);

				// resource.setPersistentProperty(new QualifiedName(JaspersoftStudioPlugin.getUniqueIdentifier(),
				// StudioPreferencePage.JSS_COMPATIBILITY_VERSION), version);
				if (dialog.isHideNext())
					pstore.setValue(StudioPreferencePage.JSS_COMPATIBILITY_SHOW_DIALOG, false);
				pstore.save();
				// resource.setPersistentProperty(new QualifiedName(JaspersoftStudioPlugin.getUniqueIdentifier(),
				// StudioPreferencePage.JSS_COMPATIBILITY_SHOW_DIALOG), "false");
			} catch (IOException e) {
				e.printStackTrace();
			}

		}
	}
	return version;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:27,代碼來源:JRXmlWriterHelper.java

示例4: performOk

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
@Override
public boolean performOk()
{
	boolean result = super.performOk();
	if (result && isProjectPropertyPage())
	{
		// try
		// {
		ScopedPreferenceStore store = (ScopedPreferenceStore)getPreferenceStore();
		store.setValue(USE_PROJECT_SETTINGS, useProjectSettingsButton.getSelection());
		// store.save();
		// }
		// catch (IOException e)
		// {
		// e.printStackTrace();
		// }
	}
	return result;
}
 
開發者ID:mybatis,項目名稱:mybatipse,代碼行數:20,代碼來源:ScopedFieldEditorPreferencePage.java

示例5: adjustTodoTags

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
@Override
public void adjustTodoTags() {
    ScopedPreferenceStore jdt = new ScopedPreferenceStore(InstanceScope.INSTANCE, JDT_PROPERTIES_QUALIFIER);
    
    String taskTags = jdt.getString(TODO_TASK_TAG_PROPERTY_QUALIFIER);
    if (taskTags.contains(TODO_TASK_TAG)) {
        return;
    }
    taskTags = taskTags + "," + TODO_TASK_TAG;
    jdt.putValue(TODO_TASK_TAG_PROPERTY_QUALIFIER, taskTags);
    
    String taskPriorities = jdt.getString(TODO_TASK_PRIORITY_PROPERTY_QUALIFIER);
    taskPriorities = taskPriorities + "," + TODO_TASK_PRIORITY;
    jdt.putValue(TODO_TASK_PRIORITY_PROPERTY_QUALIFIER, taskPriorities);
    
    try {
        jdt.save();
    } catch (IOException e) {
        LOGGER.warn("Could not save preferences.", e);
    }
}
 
開發者ID:kopl,項目名稱:SPLevo,代碼行數:22,代碼來源:JaMoPPTodoTagCustomizer.java

示例6: Preferences

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
/**
 * Constructor internally implements a singleton, not visible to class
 * users. The preferences are stored on a per eclipse installation basis.
 */
private Preferences() {
	store = (ScopedPreferenceStore) Activator.getDefault()
			.getPreferenceStore();
	store.setDefault(LOGGING_ENABLED_KEY, false);
	store.setDefault(AUTHENTICATION_ENABLED_KEY, true);
	store.setDefault(USERID_KEY, "");
	store.setDefault(PROG_EXP_KEY, "");
	store.setDefault(SERVER_KEY, WatchDogGlobals.DEFAULT_SERVER_URI);
	store.setDefault(WORKSPACES_KEY, "");
	store.setDefault(TRANSFERED_INTERVALS_KEY, 0);
	store.setDefault(LAST_TRANSFERED_INTERVALS_KEY, "never");
	store.setDefault(TRANSFERED_EVENTS_KEY, 0);
	store.setDefault(LAST_TRANSFERED_EVENTS_KEY, "never");
	store.setDefault(IS_OLD_VERSION, false);
	store.setDefault(IS_BIG_UPDATE_ANSWERED, false);
	store.setDefault(IS_BIG_UPDATE_AVAILABLE, false);

	projectSettings = readSerializedWorkspaceSettings(WORKSPACES_KEY);
}
 
開發者ID:TestRoots,項目名稱:watchdog,代碼行數:24,代碼來源:Preferences.java

示例7: createPlottingSystem

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
/**
 * Reads the extension points for the plotting systems registered and returns
 * a plotting system based on the users current preferences.
 * 
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> IPlottingSystem<T> createPlottingSystem() throws Exception {

	final ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE,"org.dawb.workbench.ui");
	String plotType = store.getString("org.dawb.plotting.system.choice");
	if (plotType.isEmpty()) plotType = System.getProperty("org.dawb.plotting.system.choice");// For Geoff et. al. can override.
	if (plotType==null) plotType = "org.dawb.workbench.editors.plotting.lightWeightPlottingSystem"; // That is usually around

	IPlottingSystem<T> system = createPlottingSystem(plotType);
	if (system!=null) return system;

	IConfigurationElement[] systems = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.dawnsci.plotting.api.plottingClass");
	if (systems.length == 0) {
		return null;
	}

	IPlottingSystem<T> ifnotfound = (IPlottingSystem<T>)systems[0].createExecutableExtension("class");
	store.setValue("org.dawb.plotting.system.choice", systems[0].getAttribute("id"));
	return ifnotfound;
}
 
開發者ID:eclipse,項目名稱:dawnsci,代碼行數:27,代碼來源:PlottingFactory.java

示例8: initializePreference

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
private void initializePreference(String associationId, boolean enablement, String bundleId, String enablementPref)
{
    if(!PREFERENCES.contains(associationId)) {
        boolean enablement2 = enablement;
        if(enablementPref != null) {
            Bundle bundle = Platform.getBundle(bundleId);
            if(bundle != null) {
                IPreferenceStore prefs = new ScopedPreferenceStore(new InstanceScope(), bundle.getSymbolicName());
                if(prefs.contains(enablementPref)) {
                    enablement2 = prefs.getBoolean(enablementPref);
                }
            }
        }
        PREFERENCES.setValue(associationId,Boolean.toString(enablement2));
    }
}
 
開發者ID:henrikor2,項目名稱:eclipsensis,代碼行數:17,代碼來源:FileAssociationChecker.java

示例9: getEclipseEditorForeground

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
public static Color getEclipseEditorForeground( )
{
	ScopedPreferenceStore preferenceStore = new ScopedPreferenceStore( InstanceScope.INSTANCE,
			"org.eclipse.ui.editors" );//$NON-NLS-1$
	Color color = null;
	if ( preferenceStore != null )
	{
		color = preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT ) ? null
				: createColor( preferenceStore,
						AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND,
						Display.getCurrent( ) );
	}
	if ( color == null )
	{
		color = Display.getDefault( )
				.getSystemColor( SWT.COLOR_LIST_FOREGROUND );
	}
	return color;
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:20,代碼來源:UIUtil.java

示例10: getEclipseEditorBackground

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
public static Color getEclipseEditorBackground( )
{
	ScopedPreferenceStore preferenceStore = new ScopedPreferenceStore( InstanceScope.INSTANCE,
			"org.eclipse.ui.editors" );//$NON-NLS-1$
	Color color = null;
	if ( preferenceStore != null )
	{
		color = preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT ) ? null
				: createColor( preferenceStore,
						AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
						Display.getCurrent( ) );
	}
	if ( color == null )
	{
		color = Display.getDefault( )
				.getSystemColor( SWT.COLOR_LIST_BACKGROUND );
	}
	return color;
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:20,代碼來源:UIUtil.java

示例11: setUp

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
@Override
public void setUp() throws Exception {
	super.setUp();
	preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, getEditorId());
	comparer = new IOutlineNodeComparer.Default();

	// when using in XPECT, XPECT already creates the project structure
	if (shouldCreateProjectStructure()) {
		createProjectStructure();
	}
	//
	openXtextDocument();
	openOutlineView();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:AbstractOutlineWorkbenchTest.java

示例12: resolve

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
/**
 * Resolve a path like <code>instance://org.example.bundle/path/to/boolean</code> to an
 * {@link IPreferenceStore}.
 * 
 * @param preferenceUri the preference path
 * @return the corresponding store
 * @throws IllegalArgumentException if unable to resolve the URI
 */
public static IPreferenceStore resolve(URI preferenceUri) throws IllegalArgumentException {
  IScopeContext context = resolveScopeContext(preferenceUri.getScheme());
  String path = preferenceUri.getHost();
  if (preferenceUri.getPath() != null) {
    path += preferenceUri.getPath();
  }
  return new ScopedPreferenceStore(context, path);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:17,代碼來源:PreferenceResolver.java

示例13: testResolveInstance

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
@Test
public void testResolveInstance() throws IllegalArgumentException, URISyntaxException {
  IPreferenceStore store = PreferenceResolver.resolve(new URI("instance://com.google.test/foo"));
  assertTrue(store instanceof ScopedPreferenceStore);

  IEclipsePreferences[] nodes = ((ScopedPreferenceStore) store).getPreferenceNodes(false);
  assertEquals(1, nodes.length);
  assertEquals("/instance/com.google.test/foo", nodes[0].absolutePath());
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:10,代碼來源:PreferenceResolverTest.java

示例14: testResolveConfig

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
@Test
public void testResolveConfig() throws IllegalArgumentException, URISyntaxException {
  IPreferenceStore store =
      PreferenceResolver.resolve(new URI("configuration://com.google.test/foo"));
  assertTrue(store instanceof ScopedPreferenceStore);

  IEclipsePreferences[] nodes = ((ScopedPreferenceStore) store).getPreferenceNodes(false);
  assertEquals(1, nodes.length);
  assertEquals("/configuration/com.google.test/foo", nodes[0].absolutePath());
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:11,代碼來源:PreferenceResolverTest.java

示例15: getPreferenceStore

import org.eclipse.ui.preferences.ScopedPreferenceStore; //導入依賴的package包/類
public static IPreferenceStore getPreferenceStore(IProject project) {
	if (project != null) {
		IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID);
		if(store.getBoolean(PreferenceConstants.GENERATOR_PROJECT_SETTINGS))
		return store;
	}
	return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);//Activator.PLUGIN_ID);
}
 
開發者ID:UrsZeidler,項目名稱:uml2solidity,代碼行數:9,代碼來源:PreferenceConstants.java


注:本文中的org.eclipse.ui.preferences.ScopedPreferenceStore類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。