本文整理匯總了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));
}
}
});
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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));
}
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}