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

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

Introduction

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

Prototype

boolean contains(String name);

Source Link

Document

Returns whether the named preference is known to this preference store.

Usage

From source file:org.dawb.workbench.ui.data.PlotDataComponent.java

License:Open Source License

private void readAxisSettings(String key, IAxis selectedAxis) {

    final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    if (store.getBoolean(EditorConstants.SAVE_LOG_FORMAT))
        if (store.contains(LOG_PREF + getExtension() + key)) {
            selectedAxis.setLog10(store.getBoolean(LOG_PREF + getExtension() + key));
        }//from   w w w  .  j  a  v  a2 s .c  om
    if (store.getBoolean(EditorConstants.SAVE_TIME_FORMAT))
        if (store.contains(TIME_PREF + getExtension() + key)) {
            selectedAxis.setDateFormatEnabled(store.getBoolean(TIME_PREF + getExtension() + key));
        }
    if (store.getBoolean(EditorConstants.SAVE_FORMAT_STRING))
        if (store.contains(FORMAT_PREF + getExtension() + key)) {
            selectedAxis.setFormatPattern(store.getString(FORMAT_PREF + getExtension() + key));
        }
}

From source file:org.dawb.workbench.ui.editors.PlotDataEditor.java

License:Open Source License

protected void getAxisSettings(String propertyStub, IAxis axis) {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean isDateTime = false;
    if (store.contains(propertyStub + "isDateTime")) {
        isDateTime = store.getBoolean(propertyStub + "isDateTime");
        axis.setDateFormatEnabled(isDateTime);
    }/*from  w  ww . ja v a  2s . c  o  m*/
    if (isDateTime && store.contains(propertyStub + "dateFormat")) {
        axis.setFormatPattern(store.getString(propertyStub + "dateFormat"));
    }
    if (store.contains(propertyStub + "log10")) {
        axis.setLog10(store.getBoolean(propertyStub + "log10"));
    }
}

From source file:org.eclipse.ajdt.internal.ui.lazystart.CompilationUnitFilter.java

License:Open Source License

public static void checkIfFileFilterEnabledAndAsk() {

    IPreferenceStore javaStore = JavaPlugin.getDefault().getPreferenceStore();

    //checks if the javaStore has been initialized
    if (isRelevant(javaStore)) {

        if (!javaStore.contains(CompilationUnitFilter.ID) || !javaStore.getBoolean(CompilationUnitFilter.ID)) {

            final IPreferenceStore store = AspectJUIPlugin.getDefault().getPreferenceStore();
            if (!store.contains(FILTER_DIALOG_ID) || !store.getBoolean(FILTER_DIALOG_ID)) {

                //wrap into low priority job so it does not get displayed before package explorer is loaded
                Job job = new Job(UIMessages.FileFilterDialog_JobTitle) {

                    public IStatus run(IProgressMonitor m) {
                        final Display display = AspectJUIPlugin.getDefault().getDisplay();

                        Runnable myRun = new Runnable() {
                            public void run() {
                                MessageDialogWithToggle md = MessageDialogWithToggle.openInformation(
                                        display.getActiveShell(), UIMessages.FileFilterDialog_Title,
                                        UIMessages.FileFilterDialog_Message,
                                        UIMessages.FileFilterDialog_CheckboxCaption, true, null, null);
                                store.setValue(FILTER_DIALOG_ID, md.getToggleState());
                            }//from   ww  w. j a  v a 2s . c  o  m
                        };
                        display.asyncExec(myRun);
                        return Status.OK_STATUS;
                    }
                };
                job.setPriority(Job.DECORATE);
                job.setRule(null);
                job.schedule();
            }
        }
    }
}

From source file:org.eclipse.ajdt.internal.ui.lazystart.CompilationUnitFilter.java

License:Open Source License

private static boolean isRelevant(IPreferenceStore javaStore) {
    //XXX: likely to be different in post 3.0 releases of eclipse!!
    return javaStore.contains("CustomFiltersActionGroup." + //$NON-NLS-1$
            JavaUI.ID_PACKAGES + ".TAG_DUMMY_TO_TEST_EXISTENCE"); //$NON-NLS-1$
}

From source file:org.eclipse.birt.report.designer.internal.ui.util.UIUtil.java

License:Open Source License

public static Color createColor(IPreferenceStore store, String key, Display display) {
    RGB rgb = null;/*w w w. ja v a 2s .  c om*/
    if (store.contains(key)) {
        if (store.isDefault(key)) {
            rgb = PreferenceConverter.getDefaultColor(store, key);
        } else {
            rgb = PreferenceConverter.getColor(store, key);
        }
        if (rgb != null) {
            return new Color(display, rgb);
        }
    }
    return null;
}

From source file:org.eclipse.cdt.codan.internal.ui.preferences.FieldEditorOverlayPage.java

License:Open Source License

/**
 * Creates and initializes a selection group with two choice buttons and one
 * push button.//from w w  w.  j  a v  a  2  s.  c  om
 * 
 * @param parent
 *        - the parent composite
 */
private void createSelectionGroup(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Composite radioGroup = new Composite(comp, SWT.NONE);
    radioGroup.setLayout(new GridLayout());
    radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    useWorkspaceSettingsButton = createRadioButton(radioGroup,
            CodanUIMessages.OverlayPage_Use_Workspace_Settings);
    useProjectSettingsButton = createRadioButton(radioGroup, CodanUIMessages.OverlayPage_Use_Project_Settings);
    configureButton = new Button(comp, SWT.PUSH);
    configureButton.setText(CodanUIMessages.OverlayPage_Configure_Workspace_Settings);
    configureButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            configureWorkspaceSettings();
        }
    });
    // Set workspace/project radio buttons
    try {
        IPreferenceStore preferences = getPreferenceStore();
        if (!preferences.contains(PreferenceConstants.P_USE_PARENT)
                || preferences.getBoolean(PreferenceConstants.P_USE_PARENT)) {
            useWorkspaceSettingsButton.setSelection(true);
        } else {
            useProjectSettingsButton.setSelection(true);
            configureButton.setEnabled(false);
        }
    } catch (Exception e) {
        useWorkspaceSettingsButton.setSelection(true);
    }
}

From source file:org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointPropertyPage.java

License:Open Source License

/**
 * Return string value of given property or null.
 */// www.  j  av a 2s .c o m
protected String getPropertyAsString(String property) {
    // currently only supports String and Integer
    IPreferenceStore store = getPreferenceStore();

    if (store.contains(property)) {
        String value = store.getString(property);
        return value;
    } else
        return null;
}

From source file:org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart.java

License:Open Source License

protected IVerticalRuler createVerticalRuler() {
    CompositeRuler ruler = createCompositeRuler();
    IPreferenceStore store = getPreferenceStore();
    if (ruler != null && store != null) {
        for (Iterator<?> iter = ruler.getDecoratorIterator(); iter.hasNext();) {
            IVerticalRulerColumn column = (IVerticalRulerColumn) iter.next();
            if (column instanceof AnnotationRulerColumn) {
                fAnnotationRulerColumn = (AnnotationRulerColumn) column;
                for (Iterator<?> iter2 = fAnnotationPreferences.getAnnotationPreferences().iterator(); iter2
                        .hasNext();) {/*from w  w w.  j  a  v a  2s .c o m*/
                    AnnotationPreference preference = (AnnotationPreference) iter2.next();
                    String key = preference.getVerticalRulerPreferenceKey();
                    boolean showAnnotation = true;
                    if (key != null && store.contains(key))
                        showAnnotation = store.getBoolean(key);
                    if (showAnnotation)
                        fAnnotationRulerColumn.addAnnotationType(preference.getAnnotationType());
                }
                fAnnotationRulerColumn.addAnnotationType(Annotation.TYPE_UNKNOWN);
                break;
            }
        }
    }
    return ruler;
}

From source file:org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart.java

License:Open Source License

/**
 * Initializes the given address ruler column from the preference store.
 *
 * @param rulerColumn the ruler column to be initialized
 *//* www.ja v  a 2s . c om*/
protected void initializeRulerColumn(DisassemblyRulerColumn rulerColumn, String colorPrefKey) {
    ISharedTextColors sharedColors = getSharedColors();
    IPreferenceStore store = getPreferenceStore();
    if (store != null) {

        RGB rgb = null;
        // foreground color
        if (store.contains(colorPrefKey)) {
            if (store.isDefault(colorPrefKey))
                rgb = PreferenceConverter.getDefaultColor(store, colorPrefKey);
            else
                rgb = PreferenceConverter.getColor(store, colorPrefKey);
        }
        if (rgb == null)
            rgb = new RGB(0, 0, 0);
        rulerColumn.setForeground(sharedColors.getColor(rgb));

        rgb = null;

        rulerColumn.redraw();
    }
}

From source file:org.eclipse.cdt.internal.ui.buildconsole.BuildConsoleManager.java

License:Open Source License

/**
 * Returns a background color instance based on data from a preference field.
 * This is a workaround for black console bug 320723.
 *//*from   www. j a  v  a 2s  .c  o m*/
private Color createBackgroundColor(Display display, String preference) {
    IPreferenceStore preferenceStore = CUIPlugin.getDefault().getPreferenceStore();
    RGB rgb;
    if (preferenceStore.contains(preference)) {
        rgb = PreferenceConverter.getColor(preferenceStore, preference);
    } else {
        rgb = new RGB(200, 200, 200); // gray background
    }
    return new Color(display, rgb);
}