use of org.eclipse.jface.preference.IPreferenceStore in project bndtools by bndtools.
the class BndProjectPropertyPage method performOk.
@Override
public boolean performOk() {
IPreferenceStore store = getPreferenceStore();
store.setValue(CompileErrorAction.PREFERENCE_KEY, action.name());
return true;
}
use of org.eclipse.jface.preference.IPreferenceStore in project bndtools by bndtools.
the class BndProjectPropertyPage method createContents.
/**
* Create contents of the property page.
*
* @param parent
*/
@Override
public Control createContents(Composite parent) {
// CREATE CONTROLS
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new GridLayout(1, false));
Group grpJavaCompilationErrors = new Group(container, SWT.NONE);
grpJavaCompilationErrors.setLayout(new GridLayout(1, false));
grpJavaCompilationErrors.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
grpJavaCompilationErrors.setText("Java Compilation Errors");
Label lblHowShouldBndtools = new Label(grpJavaCompilationErrors, SWT.WRAP);
lblHowShouldBndtools.setBounds(0, 0, 59, 14);
lblHowShouldBndtools.setText("How should Bndtools proceed when Java compilation errors exist?");
final Button btnDelete = new Button(grpJavaCompilationErrors, SWT.RADIO);
btnDelete.setText("Delete the output bundle");
final Button btnSkip = new Button(grpJavaCompilationErrors, SWT.RADIO);
btnSkip.setText("Skip building the output bundle (default)");
final Button btnContinue = new Button(grpJavaCompilationErrors, SWT.RADIO);
btnContinue.setText("Continue building the bundle");
// LOAD DATA
IPreferenceStore store = getPreferenceStore();
action = CompileErrorAction.parse(store.getString(CompileErrorAction.PREFERENCE_KEY));
switch(action) {
case delete:
btnDelete.setSelection(true);
btnSkip.setSelection(false);
btnContinue.setSelection(false);
break;
case skip:
default:
btnDelete.setSelection(false);
btnSkip.setSelection(true);
btnContinue.setSelection(false);
break;
case build:
btnDelete.setSelection(false);
btnSkip.setSelection(false);
btnContinue.setSelection(true);
break;
}
// LISTENERS
SelectionAdapter errorActionListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (btnDelete.getSelection())
action = CompileErrorAction.delete;
else if (btnSkip.getSelection())
action = CompileErrorAction.skip;
else if (btnContinue.getSelection())
action = CompileErrorAction.build;
}
};
btnDelete.addSelectionListener(errorActionListener);
btnSkip.addSelectionListener(errorActionListener);
btnContinue.addSelectionListener(errorActionListener);
return container;
}
use of org.eclipse.jface.preference.IPreferenceStore in project eclipse.platform.text by eclipse.
the class ChainedPreferenceStoreTest method testChainedStore1.
/**
* Assertion failed in ChainedPreferenceStore.handlePropertyChangeEvent(..)
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=52827
*/
@Test
public void testChainedStore1() {
IPreferenceStore store1 = new PreferenceStore();
IPreferenceStore store2 = new PreferenceStore();
IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
// simulated removal with newValue != null
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE);
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
assertEquals(1, fEvents.size());
PropertyChangeEvent event = fEvents.get(0);
assertEquals(store1, event.getSource());
assertEquals(PROPERTY, event.getProperty());
assertEquals(VALUE, event.getOldValue());
assertEquals(DEFAULT_DEFAULT_VALUE, event.getNewValue());
}
use of org.eclipse.jface.preference.IPreferenceStore in project eclipse.platform.text by eclipse.
the class ChainedPreferenceStoreTest method testChainedStore0.
/**
* [implementation] ChainedPreferenceStore
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=69419
*/
@Test
public void testChainedStore0() {
IPreferenceStore store1 = new PreferenceStore();
IPreferenceStore store2 = new PreferenceStore();
IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
store2.setDefault(PROPERTY, DEFAULT_VALUE);
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
// simulated removal with newValue != null
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE);
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
assertEquals(1, fEvents.size());
PropertyChangeEvent event = fEvents.get(0);
assertEquals(chainedStore, event.getSource());
assertEquals(PROPERTY, event.getProperty());
assertEquals(VALUE, event.getOldValue());
assertEquals(DEFAULT_VALUE, event.getNewValue());
}
use of org.eclipse.jface.preference.IPreferenceStore in project eclipse.platform.text by eclipse.
the class TextSearchEngineRegistry method getPreferredEngineID.
private String getPreferredEngineID() {
IPreferenceStore prefs = SearchPlugin.getDefault().getPreferenceStore();
String preferedEngine = prefs.getString(SearchPreferencePage.TEXT_SEARCH_ENGINE);
return preferedEngine;
}
Aggregations