本文整理汇总了Java中org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java InstanceScope.INSTANCE属性的具体用法?Java InstanceScope.INSTANCE怎么用?Java InstanceScope.INSTANCE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.runtime.preferences.InstanceScope
的用法示例。
在下文中一共展示了InstanceScope.INSTANCE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFieldEditors
/**
* Create contents of the preference page.
*/
@Override
protected void createFieldEditors() {
// Create the field editors
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.bbaw.bts.app");
Composite container = (Composite) this.getControl();
container.setLayout(new GridLayout(1, false));
Label activeConfigLB = new Label(container, SWT.NONE);
activeConfigLB.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false,
false, 1, 1));
activeConfigLB.setText("Currently active Configuration");
activeConfigcomboViewer = new ComboViewer(container, SWT.READ_ONLY);
activeConfigcomboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
false, 1, 1));
ComposedAdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider(factory);
activeConfigcomboViewer.setContentProvider(new AdapterFactoryContentProvider(factory));
activeConfigcomboViewer.setLabelProvider(labelProvider);
init(null);
loaded = true;
}
示例2: createFieldEditors
/**
* Create contents of the preference page.
*/
@Override
protected void createFieldEditors() {
// Create the field editors
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.bbaw.bts.app");
// addField(new BooleanFieldEditor("remember_me", "Remember my login credentials on startup", BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
Composite container = (Composite) this.getControl();
container.setLayout(new GridLayout(1, false));
Label lblNewLabel = new Label(container, SWT.NONE);
lblNewLabel.setText("Login Preferences");
btnCheckButton = new Button(container, SWT.CHECK);
btnCheckButton.setText("Remember my login credentials on startup");
init(null);
loaded = true;
}
示例3: forceStaticImports
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);
}
}
示例4: getLineDelimiterPreference
public static String getLineDelimiterPreference(IProject project) {
IScopeContext[] scopeContext;
if (project != null) {
// project preference
scopeContext = new IScopeContext[] {new ProjectScope(project)};
String lineDelimiter =
Platform.getPreferencesService()
.getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
if (lineDelimiter != null) return lineDelimiter;
}
// workspace preference
scopeContext = new IScopeContext[] {InstanceScope.INSTANCE};
String platformDefault =
System.getProperty("line.separator", "\n"); // $NON-NLS-1$ //$NON-NLS-2$
return Platform.getPreferencesService()
.getString(
Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, platformDefault, scopeContext);
}
示例5: loadSaveParticipantOptions
public static Map<String, String> loadSaveParticipantOptions(IScopeContext context) {
IEclipsePreferences node;
if (hasSettingsInScope(context)) {
node= context.getNode(JavaUI.ID_PLUGIN);
} else {
IScopeContext instanceScope= InstanceScope.INSTANCE;
if (hasSettingsInScope(instanceScope)) {
node= instanceScope.getNode(JavaUI.ID_PLUGIN);
} else {
return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
}
}
Map<String, String> result= new HashMap<String, String>();
Set<String> keys= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getKeys();
for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) {
String key= iterator.next();
result.put(key, node.get(SAVE_PARTICIPANT_KEY_PREFIX + key, CleanUpOptions.FALSE));
}
return result;
}
示例6: createPlottingSystem
/**
* 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;
}
示例7: getEclipseEditorBackground
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;
}
示例8: setUp
@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();
}
示例9: readExportDataDefaultPathFromFile
private String readExportDataDefaultPathFromFile() {
IScopeContext context = InstanceScope.INSTANCE;
IEclipsePreferences eclipsePreferences = context.getNode(Activator.PLUGIN_ID);
String exportDataDefaultpath = eclipsePreferences.get(EXPORT_DATA_DEFAULT_PATH, DEFAULT);
exportDataDefaultpath = exportDataDefaultpath.equalsIgnoreCase(DEFAULT) ? " " : exportDataDefaultpath;
return exportDataDefaultpath;
}
示例10: getLineDelimiterPreference
private static String getLineDelimiterPreference(IContainer file) {
IScopeContext[] scopeContext;
if (file != null && file.getProject() != null) {
// project preference
scopeContext = new IScopeContext[] { new ProjectScope(file.getProject()) };
String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME,
Platform.PREF_LINE_SEPARATOR, null, scopeContext);
if (lineDelimiter != null)
return lineDelimiter;
}
// workspace preference
scopeContext = new IScopeContext[] { InstanceScope.INSTANCE };
return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null,
scopeContext);
}
示例11: resolveScopeContext
/**
* Resolve the given scheme to a preference scope.
*
* @param scheme the preference scheme
* @return the corresponding preference scope
* @throws IllegalArgumentException if unable to resolve the scheme to a preference scope
*/
private static IScopeContext resolveScopeContext(String scheme) throws IllegalArgumentException {
switch (scheme) {
case "instance":
return InstanceScope.INSTANCE;
case "configuration":
return ConfigurationScope.INSTANCE;
default:
throw new IllegalArgumentException("Unknown scheme: " + scheme);
}
}
示例12: getPreferenceStore
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);
}
示例13: getPreferenceStore
public static IPreferenceStore getPreferenceStore(IProject project) {
if (project != null) {
IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID);
if(store.getBoolean(PreferenceConstants.COMPILER_PROJECT_SETTINGS)|| store.getBoolean(PreferenceConstants.BUILDER_PROJECT_SETTINGS))
return store;
}
return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);//Activator.PLUGIN_ID);
}
示例14: providePreferenceStore
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));
}
示例15: isAutoBuildEnabled
protected static boolean isAutoBuildEnabled() {
IPreferencesService service = Platform.getPreferencesService();
String qualifier = ResourcesPlugin.getPlugin().getBundle().getSymbolicName();
String key = "description.autobuilding";
IScopeContext[] contexts = { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE };
return service.getBoolean(qualifier, key, false, contexts);
}