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

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

Introduction

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

Prototype

boolean getBoolean(String name);

Source Link

Document

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

Usage

From source file:com.ggasoftware.indigo.knime.plugin.IndigoPlugin.java

License:Open Source License

@Override
public void start(final BundleContext context) throws Exception {
    super.start(context);
    final IPreferenceStore pStore = getDefault().getPreferenceStore();

    pStore.addPropertyChangeListener(new IPropertyChangeListener() {
        public void propertyChange(final PropertyChangeEvent event) {
            if (event.getProperty().equals(PREF_BOND_LENGTH))
                _bondLength = pStore.getInt(PREF_BOND_LENGTH);
            else if (event.getProperty().equals(PREF_SHOW_IMPLICIT_HYDROGENS))
                _showImplicitHydrogens = pStore.getBoolean(PREF_SHOW_IMPLICIT_HYDROGENS);
            else if (event.getProperty().equals(PREF_COLORING))
                _coloring = pStore.getBoolean(PREF_COLORING);
            else if (event.getProperty().equals(PREF_MOL_IMAGE_WIDTH))
                _molImageWidth = pStore.getInt(PREF_MOL_IMAGE_WIDTH);
            else if (event.getProperty().equals(PREF_MOL_IMAGE_HEIGHT))
                _molImageHeight = pStore.getInt(PREF_MOL_IMAGE_HEIGHT);
            else if (event.getProperty().equals(PREF_ENABLE_RENDERER))
                _enableRendering = pStore.getBoolean(PREF_ENABLE_RENDERER);
        }/*from  w  w  w.  j  av  a  2  s.  c  o  m*/
    });

    _enableRendering = pStore.getBoolean(PREF_ENABLE_RENDERER);
    _bondLength = pStore.getInt(PREF_BOND_LENGTH);
    _showImplicitHydrogens = pStore.getBoolean(PREF_SHOW_IMPLICIT_HYDROGENS);
    _coloring = pStore.getBoolean(PREF_COLORING);
    _molImageWidth = pStore.getInt(PREF_MOL_IMAGE_WIDTH);
    _molImageHeight = pStore.getInt(PREF_MOL_IMAGE_HEIGHT);

    MolValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false);
    SdfValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false);
    SmilesValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false);
    SmartsValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false);
    RxnValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false);
    CMLValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false);
}

From source file:com.github.elucash.lambda4jdt.FoldingStructureProvider.java

License:Open Source License

private void initializePreferences() {
    IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
    fCollapseInnerTypes = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_INNERTYPES);
    fCollapseImportContainer = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_IMPORTS);
    fCollapseJavadoc = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_JAVADOC);
    fCollapseMembers = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_METHODS);
    fCollapseHeaderComments = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_HEADERS);
}

From source file:com.github.picologger.eclipse.syslogcat.preference.PreferenceInitializer.java

License:Apache License

/**
 * Initializes the preferences of ddmlib and ddmuilib with values from the eclipse store.
 *///  ww  w  .j  ava2  s.  c  o  m
public synchronized static void setupPreferences() {
    IPreferenceStore store = DdmsPlugin.getDefault().getPreferenceStore();

    DdmPreferences.setDebugPortBase(store.getInt(ATTR_DEBUG_PORT_BASE));
    DdmPreferences.setSelectedDebugPort(store.getInt(ATTR_SELECTED_DEBUG_PORT));
    DdmPreferences.setLogLevel(store.getString(ATTR_LOG_LEVEL));
    DdmPreferences.setInitialThreadUpdate(store.getBoolean(ATTR_DEFAULT_THREAD_UPDATE));
    DdmPreferences.setInitialHeapUpdate(store.getBoolean(ATTR_DEFAULT_HEAP_UPDATE));
    DdmUiPreferences.setThreadRefreshInterval(store.getInt(ATTR_THREAD_INTERVAL));
    DdmPreferences.setTimeOut(store.getInt(ATTR_TIME_OUT));
}

From source file:com.google.dart.tools.debug.ui.internal.client.DartJsLaunchConfigurationDelegate.java

License:Open Source License

/**
 * Run the specified Dart web client/*  w  w w  .java 2s  . co m*/
 * 
 * @param file the web page or Dart application
 * @param external <code>true</code> if the launch session should use an external browser or false
 *          if the web client should be displayed in a browser embedded in Eclipse.
 */
private void runWebClient(IFile file, final boolean external) throws CoreException {
    final IFile webpage = getWebPage(file);
    final IWorkbench workbench = PlatformUI.getWorkbench();
    workbench.getDisplay().asyncExec(new Runnable() {

        @Override
        public void run() {
            try {
                openBrowser(webpage, external);
            } catch (Exception e) {
                DartUtil.logError(e);
            }
        }

        private void openBrowser(final IFile file, final boolean external) throws Exception {
            IWorkbenchBrowserSupport browserSupport = workbench.getBrowserSupport();
            IWebBrowser browser;
            if (external) {
                try {
                    browser = browserSupport.getExternalBrowser();
                } catch (PartInitException e) {
                    DebugErrorHandler.errorDialog(null, "Launch Failed", e.getMessage(), e);
                    throw e;
                }
            } else {
                if (!browserSupport.isInternalWebBrowserAvailable()) {
                    warnExternalBrowserNA(workbench);
                }
                browser = browserSupport.createBrowser(null);
            }
            browser.openURL(file.getLocationURI().toURL());
        }

        private void warnExternalBrowserNA(final IWorkbench workbench) {
            Shell shell = workbench.getActiveWorkbenchWindow().getShell();
            IPreferenceStore prefs = DartDebugUIPlugin.getDefault().getPreferenceStore();
            if (prefs.getBoolean(EMBEDDED_BROWSER_NA)) {
                return;
            }
            MessageDialogWithToggle.openInformation(shell, "Embedded Browser", "Embedded Browser not available",
                    "Don't show this again", false, prefs, EMBEDDED_BROWSER_NA);
        }
    });
}

From source file:com.google.dart.tools.deploy.ApplicationWorkbenchAdvisor.java

License:Open Source License

private void refreshFromLocal() {
    String[] commandLineArgs = Platform.getCommandLineArgs();
    IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();
    boolean refresh = store.getBoolean(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP);
    if (!refresh) {
        return;//www.  j  av a2  s.  com
    }

    // Do not refresh if it was already done by core on startup.
    for (int i = 0; i < commandLineArgs.length; i++) {
        if (commandLineArgs[i].equalsIgnoreCase("-refresh")) { //$NON-NLS-1$
            return;
        }
    }

    final IContainer root = ResourcesPlugin.getWorkspace().getRoot();
    Job job = new WorkspaceJob(IDEWorkbenchMessages.Workspace_refreshing) {
        @Override
        public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
            refreshResources((IWorkspaceRoot) root, monitor);
            return Status.OK_STATUS;
        }
    };
    job.setRule(root);
    job.schedule();
}

From source file:com.google.dart.tools.search.internal.ui.SearchPreferencePage.java

License:Open Source License

public static boolean arePotentialMatchesEmphasized() {
    IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore();
    return store.getBoolean(EMPHASIZE_POTENTIAL_MATCHES);
}

From source file:com.google.dart.tools.search.internal.ui.SearchPreferencePage.java

License:Open Source License

public static boolean arePotentialMatchesIgnored() {
    IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore();
    return store.getBoolean(IGNORE_POTENTIAL_MATCHES);
}

From source file:com.google.dart.tools.search.internal.ui.SearchPreferencePage.java

License:Open Source License

public static boolean isEditorReused() {
    IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore();
    return store.getBoolean(REUSE_EDITOR);
}

From source file:com.google.dart.tools.search.internal.ui.SearchPreferencePage.java

License:Open Source License

public static boolean isViewBroughtToFront() {
    IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore();
    return store.getBoolean(BRING_VIEW_TO_FRONT);
}

From source file:com.google.dart.tools.ui.actions.MemberFilterActionGroup.java

License:Open Source License

/**
 * Creates a new <code>MemberFilterActionGroup</code>.
 * /*from www. j a va2 s.  c o  m*/
 * @param viewer the viewer to be filtered
 * @param viewerId a unique id of the viewer. Used as a key to to store the last used filter
 *          settings in the preference store
 * @param inViewMenu if <code>true</code> the actions are added to the view menu. If
 *          <code>false</code> they are added to the toolbar.
 * @param availableFilters Specifies which filter action should be contained.
 *          <code>FILTER_FIELDS</code> and <code>FILTER_LOCALTYPES</code> or a combination of
 *          these constants are possible values. Use <code>ALL_FILTERS</code> to select all
 *          available filters.
 */
public MemberFilterActionGroup(StructuredViewer viewer, String viewerId, boolean inViewMenu,
        int availableFilters) {

    fViewer = viewer;
    fViewerId = viewerId;
    fInViewMenu = inViewMenu;

    IPreferenceStore store = PreferenceConstants.getPreferenceStore();
    fFilter = new MemberFilter();

    String title, helpContext;
    ArrayList<MemberFilterAction> actions = new ArrayList<MemberFilterAction>(4);

    // fields
    int filterProperty = FILTER_FIELDS;
    if (isSet(filterProperty, availableFilters)) {
        boolean filterEnabled = store.getBoolean(getPreferenceKey(filterProperty));
        if (filterEnabled) {
            fFilter.addFilter(filterProperty);
        }
        title = ActionMessages.MemberFilterActionGroup_hide_fields_label;
        helpContext = DartHelpContextIds.FILTER_FIELDS_ACTION;
        MemberFilterAction hideFields = new MemberFilterAction(this, title, filterProperty, helpContext,
                filterEnabled);
        hideFields.setDescription(ActionMessages.MemberFilterActionGroup_hide_fields_description);
        hideFields.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_fields_tooltip);
        DartPluginImages.setLocalImageDescriptors(hideFields, "fields_co.gif"); //$NON-NLS-1$
        actions.add(hideFields);
    }

    // static
    filterProperty = FILTER_STATIC;
    if (isSet(filterProperty, availableFilters)) {
        boolean filterEnabled = store.getBoolean(getPreferenceKey(filterProperty));
        if (filterEnabled) {
            fFilter.addFilter(filterProperty);
        }
        title = ActionMessages.MemberFilterActionGroup_hide_static_label;
        helpContext = DartHelpContextIds.FILTER_STATIC_ACTION;
        MemberFilterAction hideStatic = new MemberFilterAction(this, title, FILTER_STATIC, helpContext,
                filterEnabled);
        hideStatic.setDescription(ActionMessages.MemberFilterActionGroup_hide_static_description);
        hideStatic.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_static_tooltip);
        DartPluginImages.setLocalImageDescriptors(hideStatic, "static_co.gif"); //$NON-NLS-1$
        actions.add(hideStatic);
    }

    // local types
    //    filterProperty = FILTER_LOCALTYPES;
    //    if (isSet(filterProperty, availableFilters)) {
    //      boolean filterEnabled = store.getBoolean(getPreferenceKey(filterProperty));
    //      if (filterEnabled) {
    //        fFilter.addFilter(filterProperty);
    //      }
    //      title = ActionMessages.MemberFilterActionGroup_hide_localtypes_label;
    //      helpContext = DartHelpContextIds.FILTER_LOCALTYPES_ACTION;
    //      MemberFilterAction hideLocalTypes = new MemberFilterAction(this, title,
    //          filterProperty, helpContext, filterEnabled);
    //      hideLocalTypes.setDescription(ActionMessages.MemberFilterActionGroup_hide_localtypes_description);
    //      hideLocalTypes.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_localtypes_tooltip);
    //      JavaPluginImages.setLocalImageDescriptors(hideLocalTypes,
    //          "localtypes_co.gif"); //$NON-NLS-1$
    //      actions.add(hideLocalTypes);
    //    }

    // order corresponds to order in toolbar
    fFilterActions = actions.toArray(new MemberFilterAction[actions.size()]);

    fViewer.addFilter(fFilter);
}