Search in sources :

Example 71 with IPreferenceStore

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;
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 72 with IPreferenceStore

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 73 with IPreferenceStore

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());
}
Also used : PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) PreferenceStore(org.eclipse.jface.preference.PreferenceStore) Test(org.junit.Test)

Example 74 with IPreferenceStore

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());
}
Also used : PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) PreferenceStore(org.eclipse.jface.preference.PreferenceStore) Test(org.junit.Test)

Example 75 with IPreferenceStore

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;
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)311 ArrayList (java.util.ArrayList)35 Test (org.junit.Test)23 Hashtable (java.util.Hashtable)19 File (java.io.File)18 Before (org.junit.Before)17 List (java.util.List)14 IPath (org.eclipse.core.runtime.IPath)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)13 IOException (java.io.IOException)12 MessageDialogWithToggle (org.eclipse.jface.dialogs.MessageDialogWithToggle)12 IElementParameter (org.talend.core.model.process.IElementParameter)12 CoreException (org.eclipse.core.runtime.CoreException)11 Path (org.eclipse.core.runtime.Path)11 Font (org.eclipse.swt.graphics.Font)11 Point (org.eclipse.swt.graphics.Point)11 Composite (org.eclipse.swt.widgets.Composite)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 IStatus (org.eclipse.core.runtime.IStatus)10 StyledText (org.eclipse.swt.custom.StyledText)10