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

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

Introduction

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

Prototype

String FALSE

To view the source code for org.eclipse.jface.preference IPreferenceStore FALSE.

Click Source Link

Document

The string representation used for false ("false").

Usage

From source file:org.jboss.tools.browsersim.eclipse.launcher.BrowserSimLauncher.java

License:Open Source License

public static IVMInstall getSelectedVM() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    IVMInstall jvm = null;/*w w w  .  j av  a 2s  . c o  m*/
    if (IPreferenceStore.FALSE
            .equals(store.getString(BrowserSimPreferencesPage.BROWSERSIM_JVM_AUTOMATICALLY))) {
        // path to browserSim jvm is located in preferences
        String jvmId = store.getString(BrowserSimPreferencesPage.BROWSERSIM_JVM_ID);
        jvm = PreferencesUtil.getJVM(jvmId);
    } else {
        // detect jvm automatically
        List<IVMInstall> jvms = PreferencesUtil.getSuitableJvms(1);
        if (!jvms.isEmpty()) {
            jvm = jvms.get(0);
        }
    }
    return jvm;
}

From source file:org.jboss.tools.browsersim.eclipse.preferences.BrowserSimPreferencesInitializer.java

License:Open Source License

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    store.setDefault(BrowserSimPreferencesPage.BROWSERSIM_JVM_AUTOMATICALLY, IPreferenceStore.TRUE);
    store.setDefault(BrowserSimPreferencesPage.BROWSERSIM_GTK_2,
            PreferencesUtil.requiresGTK3() ? IPreferenceStore.FALSE : IPreferenceStore.TRUE);
}

From source file:org.jboss.tools.browsersim.eclipse.preferences.BrowserSimPreferencesPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//from   w  w w . j  a v a 2  s . co m
    int nColumns = 2;

    Composite result = new Composite(parent, SWT.NONE);
    result.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginWidth = 0;
    layout.numColumns = nColumns;
    result.setLayout(layout);

    PreferenceLinkArea contentTypeArea = new PreferenceLinkArea(result, SWT.NONE,
            "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage", //$NON-NLS-1$
            Messages.BrowserSimPreferencesPage_JRE_LINK, (IWorkbenchPreferenceContainer) getContainer(), null);
    GridData data = new GridData();
    data.horizontalSpan = 2;
    contentTypeArea.getControl().setLayoutData(data);
    contentTypeArea.getControl().setFont(parent.getFont());

    Group jreGroup = new Group(result, SWT.NONE);

    GridLayout jreGroupLayout = new GridLayout();
    jreGroupLayout.numColumns = 3;
    jreGroup.setLayout(jreGroupLayout);

    GridData jreGroupLayoutData = new GridData(GridData.FILL_HORIZONTAL);
    jreGroupLayoutData.horizontalSpan = 2;
    jreGroup.setLayoutData(jreGroupLayoutData);

    jreGroup.setText(Messages.BrowserSimPreferencesPage_SELECT_JRE);

    radioListener = new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            controlChanged(e.widget);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };

    automatically = addRadioButton(jreGroup, Messages.BrowserSimPreferencesPage_DETECT_AUTOMATICALLY,
            BROWSERSIM_JVM_AUTOMATICALLY, IPreferenceStore.TRUE, 0);
    automatically.addSelectionListener(radioListener);
    select = addRadioButton(jreGroup, Messages.BrowserSimPreferencesPage_SELECT, BROWSERSIM_JVM_AUTOMATICALLY,
            IPreferenceStore.FALSE, 0);
    select.addSelectionListener(radioListener);

    combo = new Combo(jreGroup, SWT.READ_ONLY);
    for (int i = 0; i < jvms.size(); i++) {
        combo.add(jvms.get(i).getName(), i);
    }
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fillValues();

    if (PlatformUtil.OS_LINUX.equals(PlatformUtil.getOs())) {
        addGtkGroup(result);
    }

    Dialog.applyDialogFont(result);
    return result;
}

From source file:org.jboss.tools.browsersim.eclipse.preferences.BrowserSimPreferencesPage.java

License:Open Source License

private void addGtkGroup(Composite result) {
    Group gtkGroup = new Group(result, SWT.NONE);

    GridLayout gtkGroupLayout = new GridLayout();
    gtkGroupLayout.numColumns = 2;// w  w  w . ja  v a  2s.c  o  m
    gtkGroup.setLayout(gtkGroupLayout);

    GridData gtkGridData = new GridData(GridData.FILL_HORIZONTAL);
    gtkGroup.setLayoutData(gtkGridData);

    gtkGroup.setText(Messages.BrowserSimPreferencesPage_SELECT_GTK);

    gtk2 = addRadioButton(gtkGroup, Messages.BrowserSimPreferencesPage_GTK_2, BROWSERSIM_GTK_2,
            IPreferenceStore.TRUE, 0);
    gtk3 = addRadioButton(gtkGroup, Messages.BrowserSimPreferencesPage_GTK_3, BROWSERSIM_GTK_2,
            IPreferenceStore.FALSE, 0);

    setGtkValues();
}

From source file:org.jboss.tools.browsersim.eclipse.preferences.BrowserSimPreferencesPage.java

License:Open Source License

private void fillValues() {
    if (jvms.isEmpty()) {
        /*/*w  w  w .j  a v  a 2 s.c  om*/
         * browserSim can be executed only on 32bit jvm on windows, that's why jvm list can be empty.
         * @see https://issues.jboss.org/browse/JBIDE-13988
         */
        String message;
        boolean is32bitEclipse = PlatformUtil.ARCH_X86.equals(PlatformUtil.getArch());
        message = MessageFormat.format(Messages.BrowserSimPreferencesPage_REQUIREMENTS,
                is32bitEclipse ? "32-bit" : "64-bit"); //$NON-NLS-1$ //$NON-NLS-2$
        setMessage(message, IMessageProvider.ERROR);
        automatically.setSelection(true);
        select.setEnabled(false);
        combo.setEnabled(false);
    } else {
        int selectionIndex = -1;
        if (IPreferenceStore.FALSE.equals(getPreferenceStore().getString(BROWSERSIM_JVM_AUTOMATICALLY))) {
            String selectedID = getPreferenceStore().getString(BROWSERSIM_JVM_ID);
            for (int i = 0; i < jvms.size(); i++) {
                if (selectedID.equals(jvms.get(i).getId())) {
                    selectionIndex = i;
                    break;
                }
            }
            select.setSelection(true);
            controlChanged(select);
        } else {
            automatically.setSelection(true);
            controlChanged(automatically);
        }

        automatically.setText(automatically.getText() + " (" + jvms.get(0).getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
        combo.select(selectionIndex);
    }
}

From source file:org.jboss.tools.browsersim.eclipse.preferences.BrowserSimPreferencesPage.java

License:Open Source License

@Override
public boolean performOk() {
    IPreferenceStore store = getPreferenceStore();

    if (PlatformUtil.OS_LINUX.equals(PlatformUtil.getOs())) {
        if (gtk2.getSelection()) {
            store.setValue(BROWSERSIM_GTK_2, IPreferenceStore.TRUE);
        } else {// w w  w .  ja v a 2  s.  c o m
            store.setValue(BROWSERSIM_GTK_2, IPreferenceStore.FALSE);
        }
    }

    if (automatically.getSelection()) {
        store.setValue(BROWSERSIM_JVM_AUTOMATICALLY, IPreferenceStore.TRUE);
    } else {
        store.setValue(BROWSERSIM_JVM_AUTOMATICALLY, IPreferenceStore.FALSE);
        String value = jvms.get(combo.getSelectionIndex()).getId();

        // check that this jvm was not deleted from Installed JRE's page before saving
        boolean exists = false;
        for (IVMInstall vm : PreferencesUtil.getSuitableJvms()) {
            if (value.equals(vm.getId())) {
                exists = true;
                break;
            }
        }

        if (exists) {
            store.setValue(BROWSERSIM_JVM_ID, value);
        } else {
            // if selected jvm is deleted from Installed JRE's page, any suitable jvm will use
            store.setValue(BROWSERSIM_JVM_AUTOMATICALLY, IPreferenceStore.TRUE);
        }
    }
    return true;
}

From source file:org.jboss.tools.vpe.browsersim.eclipse.launcher.BrowserSimLauncher.java

License:Open Source License

public static void launchBrowserSim(String initialUrl) {
    List<String> parameters = new ArrayList<String>();

    parameters.add(NOT_STANDALONE);//from  w  w w  .j ava2s  .  c om
    if (initialUrl != null) {
        parameters.add(initialUrl);
    }

    IVMInstall jvm = getSelectedVM();
    if (jvm == null) {// no suitable vm
        ExternalProcessLauncher.showErrorDialog(Messages.BrowserSim);
    } else {
        String jvmPath = jvm.getInstallLocation().getAbsolutePath();
        String jrePath = jvm.getInstallLocation().getAbsolutePath() + File.separator + "jre"; //$NON-NLS-1$

        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
        List<String> bundles = getBundles();

        if (IPreferenceStore.FALSE.equals(store.getString(BrowserSimPreferencesPage.BROWSERSIM_GTK_2))
                || (!BrowserSimUtil.isJavaFxAvailable(jvmPath) && !BrowserSimUtil.isJavaFxAvailable(jrePath))) {
            bundles.add("org.jboss.tools.vpe.browsersim.javafx.mock"); //$NON-NLS-1$
        }

        ExternalProcessLauncher.launchAsExternalProcess(bundles, RESOURCES_BUNDLES, BROWSERSIM_CALLBACKS,
                BROWSERSIM_CLASS_NAME, parameters, Messages.BrowserSim, jvm);
    }
}

From source file:org.jboss.tools.vpe.browsersim.eclipse.preferences.BrowserSimPreferencesPage.java

License:Open Source License

private void fillValues() {
    if (jvms.isEmpty()) {
        /*/*www  .  j  a  va  2 s  .  c  o  m*/
         * browserSim can be executed only on 32bit jvm on windows, that's why jvm list can be empty.
         * @see https://issues.jboss.org/browse/JBIDE-13988
         */
        String message;
        String os = Platform.getOS();
        boolean is32bitEclipse = PlatformUtil.ARCH_X86.equals(PlatformUtil.getArch());
        if (Platform.OS_WIN32.equals(os)) {
            message = Messages.BrowserSimPreferencesPage_REQUIREMENTS_WINDOWS;
        } else if (PlatformUtil.OS_MACOSX.equals(os) && is32bitEclipse) {
            message = Messages.BrowserSimPreferencesPage_REQUIREMENTS_MAC32;
        } else {// Linux, 64-bit Mac
            message = MessageFormat.format(Messages.BrowserSimPreferencesPage_REQUIREMENTS,
                    is32bitEclipse ? "32-bit" : "64-bit"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        setMessage(message, IMessageProvider.ERROR);
        automatically.setSelection(true);
        select.setEnabled(false);
        combo.setEnabled(false);
    } else {
        int selectionIndex = -1;
        if (IPreferenceStore.FALSE.equals(getPreferenceStore().getString(BROWSERSIM_JVM_AUTOMATICALLY))) {
            String selectedID = getPreferenceStore().getString(BROWSERSIM_JVM_ID);
            for (int i = 0; i < jvms.size(); i++) {
                if (selectedID.equals(jvms.get(i).getId())) {
                    selectionIndex = i;
                    break;
                }
            }
            select.setSelection(true);
            controlChanged(select);
        } else {
            automatically.setSelection(true);
            controlChanged(automatically);
        }

        automatically.setText(automatically.getText() + " (" + jvms.get(0).getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
        combo.select(selectionIndex);
    }
}

From source file:org.locationtech.udig.catalog.RemotePreferenceStore.java

License:Open Source License

/**
 * Had to add this method as the Property object was being unreliable in returning its contents
 * using the getProperty method. We also want null to be null, rather than not "null".
 *///ww w.  ja v  a 2 s  .c  o m
private String toString(Object object) {
    if (object == null)
        return null;
    if (object instanceof Boolean) {
        if (((Boolean) object).booleanValue()) {
            return IPreferenceStore.TRUE;
        } else {
            return IPreferenceStore.FALSE;
        }
    }
    return String.valueOf(object);
}

From source file:org.mailster.gui.prefs.store.MailsterPrefStore.java

License:Open Source License

/**
 * Helper method: sets the value for a given name.
 * @param p//from  w  ww.ja  v a  2  s.  c  om
 * @param name
 * @param value
 */
private void setValue(Properties p, String name, boolean value) {
    p.put(name, value == true ? IPreferenceStore.TRUE : IPreferenceStore.FALSE);
}