Example usage for org.eclipse.jface.preference IPreferenceStore setValue

List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore setValue.

Prototype

void setValue(String name, boolean value);

Source Link

Document

Sets the current value of the boolean-valued preference with the given name.

Usage

From source file:com.aptana.ui.preferences.TroubleshootingPreferencePage.java

License:Open Source License

/**
 * Method declared on IPreferencePage. Subclasses should override
 * //from w  w  w.  ja v  a2  s .c o  m
 * @return boolean
 */
public boolean performOk() {
    IPreferenceStore store = getPreferenceStore();
    store.setValue(ICorePreferenceConstants.PREF_DEBUG_LEVEL,
            StatusLevel.values()[debugCombo.getSelectionIndex()].toString());

    String[] currentOptions = EclipseUtil.getCurrentDebuggableComponents();
    EclipseUtil.setBundleDebugOptions(currentOptions, false);

    List<String> al = new ArrayList<String>();
    Object[] elements = categoryViewer.getCheckedElements();
    for (Object i : elements) {
        al.add((String) i);
    }

    String[] newOptions = al.toArray(new String[al.size()]);

    store.setValue(ICorePreferenceConstants.PREF_DEBUG_COMPONENT_LIST, StringUtil.join(",", newOptions)); //$NON-NLS-1$

    EclipseUtil.setBundleDebugOptions(currentOptions, true);
    EclipseUtil.setPlatformDebugging(toggleComponents.getBooleanValue());

    return super.performOk();
}

From source file:com.arc.cdt.debug.seecode.internal.ui.action.ShowAnimationWidgetsActionDelegate.java

License:Open Source License

@Override
public void run(IAction action) {

    IPreferenceStore store = getPreferenceStore();
    String key = getPreferenceKey();
    store.setValue(key, action.isChecked());
    apply(action.isChecked());/*from   w  w  w  .j  a v  a  2 s.c  o m*/
}

From source file:com.archimatetool.editor.diagram.ImageExportProvider.java

License:Open Source License

/**
 * Save any user prefs//from   ww w. j  av a  2s.  c om
 */
protected void savePreferences() {
    IPreferenceStore store = Preferences.STORE;

    // Value of scale
    int scale = fScaleSpinner.getSelection();
    store.setValue(PREFS_IMAGE_SCALE, scale);
}

From source file:com.archimatetool.editor.diagram.ImageExportProviderTests.java

License:Open Source License

@Before
public void onceOnceBeforeEachTest() {
    provider = new ImageExportProvider();
    shell = new Shell();

    // Set prefs to defaults
    IPreferenceStore store = Preferences.STORE;
    store.setValue(ImageExportProvider.PREFS_IMAGE_SCALE, 0);

    rootFigure = new FreeformLayer();
    rootFigure.setBounds(new Rectangle(0, 0, 500, 500));
}

From source file:com.archimatetool.editor.diagram.ImageExportProviderTests.java

License:Open Source License

@Test
public void testPreferencesWereLoaded() {
    IPreferenceStore store = Preferences.STORE;
    store.setValue(ImageExportProvider.PREFS_IMAGE_SCALE, 123);

    provider.init(mock(IExportDialogAdapter.class), shell, rootFigure);

    assertEquals(123, provider.fScaleSpinner.getSelection());
}

From source file:com.archimatetool.editor.preferences.ColoursFontsPreferencePage.java

License:Open Source License

/**
 * @param store/*  ww  w  .  ja  v a2s.c  o m*/
 * Save colors to preference store
 */
private void saveColors(IPreferenceStore store) {
    for (Entry<Object, Color> entry : fColorsCache.entrySet()) {
        Color colorNew = entry.getValue();
        Color colorDefault;
        String key;

        // Element line color default
        if (entry.getKey().equals(DEFAULT_ELEMENT_LINE_COLOR)) {
            // Outline color - use any object eClass as there is only one
            colorDefault = ColorFactory
                    .getInbuiltDefaultLineColor(IArchimatePackage.eINSTANCE.getBusinessActor());
            key = DEFAULT_ELEMENT_LINE_COLOR;
        }
        // Connection line color default
        else if (entry.getKey().equals(DEFAULT_CONNECTION_LINE_COLOR)) {
            // Outline color - use any object eClass as there is only one
            colorDefault = ColorFactory
                    .getInbuiltDefaultLineColor(IArchimatePackage.eINSTANCE.getAssociationRelationship());
            key = DEFAULT_CONNECTION_LINE_COLOR;
        }
        // Fill color default
        else {
            colorDefault = ColorFactory.getInbuiltDefaultFillColor(entry.getKey());
            key = DEFAULT_FILL_COLOR_PREFIX + getColorKey(entry.getKey());
        }

        // If default color
        if (colorNew.equals(colorDefault)) {
            store.setToDefault(key);
        }
        // Else user color
        else {
            store.setValue(key, ColorFactory.convertColorToString(colorNew));
        }
    }
}

From source file:com.archimatetool.editor.tools.GenerateViewDialog.java

License:Open Source License

void savePreferences() {
    IPreferenceStore store = ArchiPlugin.INSTANCE.getPreferenceStore();

    store.setValue(PREFS_ALLCONNECTIONS, fAddAllConnections);
    store.setValue(PREFS_LASTVIEWPOINT, fSelectedViewpoint.getID());
}

From source file:com.archimatetool.export.svg.SVGExportProvider.java

License:Open Source License

/**
 * Save any user prefs// w w  w  .  jav a 2  s. c  o m
 */
protected void savePreferences() {
    IPreferenceStore store = ExportSVGPlugin.getDefault().getPreferenceStore();

    // Embed fonts
    store.setValue(SVG_EXPORT_PREFS_EMBED_FONTS, fEmbedFontsButton.getSelection());

    // Viewbox button selected
    store.setValue(SVG_EXPORT_PREFS_VIEWBOX_ENABLED, fSetViewboxButton.getSelection());

    int min_x = fSpinner1.getSelection();
    int min_y = fSpinner2.getSelection();

    String s = min_x + " " + min_y; //$NON-NLS-1$
    store.setValue(SVG_EXPORT_PREFS_VIEWBOX, s);
}

From source file:com.archimatetool.export.svg.SVGExportProviderTests.java

License:Open Source License

@Test
public void testPreferencesWereLoaded() {
    IPreferenceStore store = ExportSVGPlugin.getDefault().getPreferenceStore();

    store.setValue(IPreferenceConstants.SVG_EXPORT_PREFS_EMBED_FONTS, false);
    store.setValue(IPreferenceConstants.SVG_EXPORT_PREFS_VIEWBOX_ENABLED, false);
    store.setValue(IPreferenceConstants.SVG_EXPORT_PREFS_VIEWBOX, "5 6");

    provider.init(mock(IExportDialogAdapter.class), shell, rootFigure);

    assertFalse(provider.fEmbedFontsButton.getSelection());
    assertFalse(provider.fSetViewboxButton.getSelection());

    assertEquals(5, provider.fSpinner1.getSelection());
    assertEquals(6, provider.fSpinner2.getSelection());
}

From source file:com.asakusafw.shafu.ui.fields.FieldPreferencePage.java

License:Apache License

@Override
public boolean performOk() {
    IPreferenceStore prefs = getPreferenceStore();
    for (IPreferenceField field : fields.values()) {
        String key = field.getKey();
        String value = values.get(key);
        if (value == null) {
            prefs.setToDefault(key);/*from   w w w  .  j ava  2s  . com*/
        } else {
            prefs.setValue(key, value);
        }
    }
    return true;
}