use of org.eclipse.core.runtime.preferences.InstanceScope in project xtext-xtend by eclipse.
the class XtendPreferenceStoreAccess method getPreferenceStore.
@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() });
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project ecf by eclipse.
the class AccountStart method saveConnectionDetailsToPreferenceStore.
public void saveConnectionDetailsToPreferenceStore() {
Preferences preferences = new InstanceScope().getNode(ClientPlugin.PLUGIN_ID);
Preferences connections = preferences.node(SAVED);
for (Iterator i = connectionDetails.keySet().iterator(); i.hasNext(); ) {
String target = (String) i.next();
ConnectionDetails details = (ConnectionDetails) connectionDetails.get(target);
Preferences p = connections.node(target);
p.put(ConnectionDetails.CONTAINER_TYPE, details.getContainerType());
p.put(ConnectionDetails.TARGET_URI, details.getTargetURI());
p.put(ConnectionDetails.NICKNAME, details.getNickname());
p.put(ConnectionDetails.PASSWORD, details.getPassword());
}
try {
connections.flush();
} catch (BackingStoreException e) {
ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, ClientPlugin.PLUGIN_ID, BACKING_STORE_SAVE_ERROR, Messages.AccountStart_EXCEPTION_SAVING_CONNECTION_DETAILS, e));
}
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project xtext-eclipse by eclipse.
the class PreferenceStoreAccessTest method testChainedPreferenceStore.
@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"));
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project xtext-eclipse by eclipse.
the class AbstractOutlineWorkbenchTest method setUp.
@SuppressWarnings("deprecation")
@Override
public void setUp() throws Exception {
super.setUp();
preferenceStore = new ScopedPreferenceStore(new InstanceScope(), getEditorId());
comparer = new IOutlineNodeComparer.Default();
modelAsText = "one { two {} three {} } four {}";
file = IResourcesSetupUtil.createFile("test/test.outlinetestlanguage", modelAsText);
editor = openEditor(file);
document = editor.getDocument();
outlineView = editor.getEditorSite().getPage().showView("org.eclipse.ui.views.ContentOutline");
executeAsyncDisplayJobs();
Object adapter = editor.getAdapter(IContentOutlinePage.class);
assertTrue(adapter instanceof SyncableOutlinePage);
outlinePage = (SyncableOutlinePage) adapter;
outlinePage.resetSyncer();
try {
outlinePage.waitForUpdate(EXPECTED_TIMEOUT);
} catch (TimeoutException e) {
// timeout is OK here
System.out.println("Expected timeout exceeded: " + EXPECTED_TIMEOUT);
}
treeViewer = outlinePage.getTreeViewer();
assertSelected(treeViewer);
assertExpanded(treeViewer);
assertTrue(treeViewer.getInput() instanceof IOutlineNode);
IOutlineNode rootNode = (IOutlineNode) treeViewer.getInput();
List<IOutlineNode> children = rootNode.getChildren();
assertEquals(1, children.size());
modelNode = children.get(0);
assertEquals(2, modelNode.getChildren().size());
oneNode = modelNode.getChildren().get(0);
assertEquals(2, oneNode.getChildren().size());
twoNode = oneNode.getChildren().get(0);
threeNode = oneNode.getChildren().get(1);
fourNode = modelNode.getChildren().get(1);
}
Aggregations