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.guvnor.tools.preferences.GuvnorPreferencePage.java

License:Apache License

public static boolean shouldSavePasswords() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean res = true;
    if (!store.contains(IGuvnorPreferenceConstants.SAVE_PASSWORDS_PREF)) {
        store.putValue(IGuvnorPreferenceConstants.SAVE_PASSWORDS_PREF, String.valueOf(true));
    } else {/*from   ww  w .j  ava2  s. c o m*/
        res = store.getBoolean(IGuvnorPreferenceConstants.SAVE_PASSWORDS_PREF);
    }
    return res;
}

From source file:org.guvnor.tools.preferences.GuvnorPreferencePage.java

License:Apache License

public static int getOverlayLocationPref() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    int res = 0;//from ww w.j  a  va  2s .c  om
    if (!store.contains(IGuvnorPreferenceConstants.OVERLAY_LOCATION_PREF)) {
        store.putValue(IGuvnorPreferenceConstants.OVERLAY_LOCATION_PREF,
                String.valueOf(IGuvnorPreferenceConstants.OVERLAY_LOCATION_DEFAULT));
        res = IGuvnorPreferenceConstants.OVERLAY_LOCATION_DEFAULT;
    } else {
        res = store.getInt(IGuvnorPreferenceConstants.OVERLAY_LOCATION_PREF);
    }
    return res;
}

From source file:org.guvnor.tools.preferences.GuvnorPreferencePage.java

License:Apache License

public static boolean shouldShowChangeIndicator() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean res = true;
    if (!store.contains(IGuvnorPreferenceConstants.SHOW_CHANGE_INDICATOR_PREF)) {
        store.putValue(IGuvnorPreferenceConstants.SHOW_CHANGE_INDICATOR_PREF, String.valueOf(true));
    } else {//from  w w  w  .j  av  a2  s  .c o m
        res = store.getBoolean(IGuvnorPreferenceConstants.SHOW_CHANGE_INDICATOR_PREF);
    }
    return res;
}

From source file:org.guvnor.tools.preferences.GuvnorPreferencePage.java

License:Apache License

public static boolean shouldShowRevision() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean res = true;
    if (!store.contains(IGuvnorPreferenceConstants.SHOW_REVISION_PREF)) {
        store.putValue(IGuvnorPreferenceConstants.SHOW_REVISION_PREF, String.valueOf(true));
    } else {/*from  ww  w  . j a  v a  2s. c  om*/
        res = store.getBoolean(IGuvnorPreferenceConstants.SHOW_REVISION_PREF);
    }
    return res;
}

From source file:org.guvnor.tools.preferences.GuvnorPreferencePage.java

License:Apache License

public static boolean shouldShowTimeDateStamp() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean res = true;
    if (!store.contains(IGuvnorPreferenceConstants.SHOW_DATETIME_PREF)) {
        store.putValue(IGuvnorPreferenceConstants.SHOW_DATETIME_PREF, String.valueOf(true));
    } else {//from  w  ww.j ava2s. c om
        res = store.getBoolean(IGuvnorPreferenceConstants.SHOW_DATETIME_PREF);
    }
    return res;
}

From source file:org.jboss.tools.asciidoc.texteditor.internal.document.partition.AbstractPartitionScanner.java

License:Open Source License

private static int getBoldStyle(final IPreferenceStore store, final String key, final int defaultValue) {
    if (store.contains(key)) {
        return store.getBoolean(key) ? SWT.BOLD : SWT.NORMAL;
    }/*from w w w .j  a  va 2s. c om*/
    return defaultValue;
}

From source file:org.jboss.tools.asciidoc.texteditor.internal.document.partition.AbstractPartitionScanner.java

License:Open Source License

private static int getItalicStyle(final IPreferenceStore store, final String key, final int defaultValue) {
    if (store.contains(key)) {
        return store.getBoolean(key) ? SWT.ITALIC : SWT.NORMAL;
    }// w  w  w .ja v a2s . c o m
    return defaultValue;

}

From source file:org.jboss.tools.windup.ui.internal.views.WindupReportView.java

License:Open Source License

@Inject
public void createPartControl(Composite composite) {
    this.composite = composite;
    //this.composite = new Composite(parent, SWT.NONE);
    //        GridLayout layout = new GridLayout(1, false);
    //        this.composite.setLayout(layout);
    GridLayoutFactory.fillDefaults().margins(0, 0).applyTo(composite);
    ;//from  www  . j  av  a  2 s. c  o m
    GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);

    // create the message label
    this.message = new StyledText(this.composite, SWT.WRAP);
    this.message.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    this.message.setVisible(false);

    this.browser = new Browser(this.composite, SWT.NONE);
    this.browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // react to selection changes
    this.selectionChangedListener = new ISelectionListener() {
        @Override
        public void selectionChanged(MPart part, Object selection) {
            /*
                 * if update on selection and the current selection is not the same as the containing workbench part
                 */
            if (WindupReportView.this.syncronizeViewWithCurrentSelection
                    && part != WindupReportView.this.part) {
                /*
                 * if editor selection else if some other sort of selection
                 */
                if (part instanceof IEditorPart) {
                    IEditorInput input = ((IEditorPart) part).getEditorInput();
                    if (input instanceof IFileEditorInput) {
                        updateSelection(new StructuredSelection(((IFileEditorInput) input).getFile()));
                    }
                } else {
                    if (!(selection instanceof ISelection)) {
                        selection = new StructuredSelection(selection);
                    } else {
                        updateSelection((ISelection) selection);
                    }
                }
            }
        }
    };
    selectionService.addPostSelectionListener(selectionChangedListener);

    // react to Windup report generations
    this.reportListener = new IWindupListener() {
        @Override
        public void graphGenerated(IProject project) {
            /*
             * if the current selection is in the project that just had a report generated, refresh the view
             */
            if (WindupReportView.this.currentSelection != null
                    && WindupReportView.this.currentSelection.getProject().equals(project)) {

                // refresh has to take place in the display thread
                Display.getDefault().syncExec(new Runnable() {
                    public void run() {
                        WindupReportView.this.refresh();
                    }
                });
            }
        }
    };
    windupService.addWindupListener(reportListener);

    // store view preferences
    IPreferenceStore preferenceStore = getPreferenceStore();
    if (preferenceStore.contains(Preferences.REPORTVIEW_SYNC_SELECTION)) {
        this.syncronizeViewWithCurrentSelection = preferenceStore
                .getBoolean(Preferences.REPORTVIEW_SYNC_SELECTION);
    } else {
        preferenceStore.setDefault(Preferences.REPORTVIEW_SYNC_SELECTION,
                this.syncronizeViewWithCurrentSelection);
    }
}

From source file:org.knime.ext.textprocessing.preferences.SearchEnginePreferenceInitializer.java

License:Open Source License

/**
 * @return {@code true} if search engine settings exist, otherwise {@code false}.
 *///from   w w  w . j  a v  a  2s .c  o  m
public static boolean existsSearchEnginesSettings() {
    final IPreferenceStore pStore = TextprocessingCorePlugin.getDefault().getPreferenceStore();
    return pStore.contains(PREF_SEARCHENGINES);
}

From source file:org.knime.ext.textprocessing.preferences.StoragePreferenceInitializer.java

License:Open Source License

/**
 * @return The specified number of documents to store in a single file store file.
 *//*from   w  ww.  ja  v  a 2s.  com*/
public static final int fileStoreChunkSize() {
    final IPreferenceStore pStore = TextprocessingCorePlugin.getDefault().getPreferenceStore();
    if (!pStore.contains(PREF_FILESTORE_CHUNKSIZE)) {
        return DEFAULT_FILESTORE_CHUNKSIZE;
    }
    if (pStore.getInt(PREF_FILESTORE_CHUNKSIZE) <= 0) {
        return 1;
    }
    return pStore.getInt(PREF_FILESTORE_CHUNKSIZE);
}