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

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

Introduction

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

Prototype

String getString(String name);

Source Link

Document

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

Usage

From source file:com.centurylink.mdw.plugin.preferences.ProcessDesignPreferencePage.java

License:Apache License

protected void initializeValues() {
    IPreferenceStore store = getPreferenceStore();
    allowAssetNamesWithoutExtensionsCheckbox
            .setSelection(store.getBoolean(PREFS_ALLOW_ASSETS_WITHOUT_EXTENSIONS));
    inPlaceLabelEditingCheckbox.setSelection(store.getBoolean(PREFS_IN_PLACE_LABEL_EDITING));
    compareConflictingAssetsCheckbox.setSelection(store.getBoolean(PREFS_COMPARE_CONFLICTING_ASSETS));
    allowDeleteArchivedProcessesCheckbox.setSelection(store.getBoolean(PREFS_ALLOW_DELETE_ARCHIVED_PROCESSES));
    doubleClickOpensSubprocsAndScriptsCheckbox
            .setSelection(store.getBoolean(PREFS_DOUBLE_CLICK_OPENS_SUBPROCESSES_AND_SCRIPTS));
    inferSmartSubprocVersionSpecCheckbox.setSelection(store.getBoolean(PREFS_INFER_SMART_SUBPROC_VERSION_SPEC));
    showBamEventDataFieldCheckbox.setSelection(store.getBoolean(PREFS_SHOW_BAM_EVENT_DATA_INPUT_FIELD));
    warnOverrideAttrsNotCarriedForwardCheckbox
            .setSelection(store.getBoolean(PREFS_WARN_OVERRIDE_ATTRS_NOT_CARRIED_FORWARD));
    embeddedEditorForExcelCheckbox.setSelection(store.getBoolean(PREFS_EMBEDDED_EDITOR_FOR_EXCEL));
    int red = store.getInt(PREFS_READONLY_BG_RED);
    int green = store.getInt(PREFS_READONLY_BG_GREEN);
    int blue = store.getInt(PREFS_READONLY_BG_BLUE);
    readOnlyBackgroundRgb = new RGB(red, green, blue);
    colorDialog.setRGB(readOnlyBackgroundRgb);
    tempResourceLocationText.setText(store.getString(PREFS_TEMP_RESOURCE_DIRECTORY));
    previousTempFileVersionsSpinner.setSelection(store.getInt(PREFS_PREVIOUS_TEMP_FILE_VERSIONS_TO_KEEP));
    loadScriptLibsOnEditCheckbox.setSelection(store.getBoolean(PREFS_LOAD_SCRIPT_LIBS_ON_EDIT));
}

From source file:com.centurylink.mdw.plugin.preferences.ServerConsolePreferencePage.java

License:Apache License

@Override
protected void initializeValues() {
    IPreferenceStore store = getPreferenceStore();
    bufferSize = store.getInt(PREFS_SERVER_CONSOLE_BUFFER_SIZE);
    bufferSizeText.setText(String.valueOf(bufferSize));
    String font = store.getString(PREFS_SERVER_CONSOLE_FONT);
    fontData = new FontData(font);
    fontDialog.setFontList(new FontData[] { fontData });
    int red = store.getInt(PREFS_SERVER_CONSOLE_FONT_RED);
    int green = store.getInt(PREFS_SERVER_CONSOLE_FONT_GREEN);
    int blue = store.getInt(PREFS_SERVER_CONSOLE_FONT_BLUE);
    fontRgb = new RGB(red, green, blue);
    fontDialog.setRGB(fontRgb);/*  w w  w.j a va 2  s  .  c  o m*/
    red = store.getInt(PREFS_SERVER_CONSOLE_BG_RED);
    green = store.getInt(PREFS_SERVER_CONSOLE_BG_GREEN);
    blue = store.getInt(PREFS_SERVER_CONSOLE_BG_BLUE);
    backgroundRgb = new RGB(red, green, blue);
    colorDialog.setRGB(backgroundRgb);

    String csPref = store.getString(PREFS_SERVER_CLIENT_SHELL);
    if (ClientShell.Putty.toString().equals(csPref))
        clientShell = ClientShell.Putty;
    else
        clientShell = ClientShell.Karaf;
    if (clientShell == ClientShell.Putty) {
        puttyClientRadio.setSelection(true);
        puttyExeText.setText(store.getString(PREFS_SERVER_CLIENT_SHELL_EXE_PATH));
    } else {
        karafClientRadio.setSelection(true);
        puttyExeText.setEnabled(false);
    }
}

From source file:com.centurylink.mdw.plugin.preferences.ServerConsolePreferencePage.java

License:Apache License

@Override
protected void initializeFromDefaults() {
    IPreferenceStore store = getPreferenceStore();
    bufferSize = store.getDefaultInt(PREFS_SERVER_CONSOLE_BUFFER_SIZE);

    String font = store.getDefaultString(PREFS_SERVER_CONSOLE_FONT);
    fontData = new FontData(font);
    fontDialog.setFontList(new FontData[] { fontData });
    int red = store.getDefaultInt(PREFS_SERVER_CONSOLE_FONT_RED);
    int green = store.getDefaultInt(PREFS_SERVER_CONSOLE_FONT_GREEN);
    int blue = store.getDefaultInt(PREFS_SERVER_CONSOLE_FONT_BLUE);
    fontRgb = new RGB(red, green, blue);
    fontDialog.setRGB(fontRgb);/*w  w w.j  a  va 2  s. co m*/
    red = store.getDefaultInt(PREFS_SERVER_CONSOLE_BG_RED);
    green = store.getDefaultInt(PREFS_SERVER_CONSOLE_BG_GREEN);
    blue = store.getDefaultInt(PREFS_SERVER_CONSOLE_BG_BLUE);
    backgroundRgb = new RGB(red, green, blue);
    colorDialog.setRGB(backgroundRgb);

    String csPref = store.getString(PREFS_SERVER_CLIENT_SHELL);
    if (ClientShell.Putty.toString().equals(csPref))
        clientShell = ClientShell.Putty;
    else
        clientShell = ClientShell.Karaf;
    if (clientShell == ClientShell.Putty) {
        puttyClientRadio.setSelection(true);
        puttyExeText.setText(store.getString(PREFS_SERVER_CLIENT_SHELL_EXE_PATH));
    } else {
        karafClientRadio.setSelection(true);
        puttyExeText.setEnabled(false);
    }
}

From source file:com.centurylink.mdw.plugin.preferences.UrlsPreferencePage.java

License:Apache License

protected void initializeValues() {
    IPreferenceStore store = getPreferenceStore();

    mdwReleasesUrlTextField.setText(store.getString(PREFS_MDW_RELEASES_URL));
    includePreviewReleasesCheckbox.setSelection(store.getBoolean(PREFS_INCLUDE_PREVIEW_BUILDS));
    workspaceSetupUrlTextField.setText(store.getString(PREFS_WORKSPACE_SETUP_URL));
    discoveryUrlTextField.setText(store.getString(PREFS_DISCOVERY_URL));
    httpConnectTimeoutText.setText(String.valueOf(store.getInt(PREFS_HTTP_CONNECT_TIMEOUT_MS)));
    httpReadTimeoutText.setText(String.valueOf(store.getInt(PREFS_HTTP_READ_TIMEOUT_MS)));
    smtpHostTextField.setText(store.getString(PREFS_SMTP_HOST));
    smtpPortTextField.setText(String.valueOf(store.getInt(PREFS_SMTP_PORT)));
}

From source file:com.centurylink.mdw.plugin.workspace.WorkspaceConfig.java

License:Apache License

public WorkspaceConfig(MdwSettings mdwSettings) {
    this.mdwSettings = mdwSettings;
    IPreferenceStore store = MdwPlugin.getDefault().getPreferenceStore();
    String currentTemplates = store.getString(PREFS_CURRENT_CODE_TEMPLATES);
    if (currentTemplates != null && currentTemplates.trim().length() != 0)
        this.codeTemplates = currentTemplates;
    String currentFormatter = store.getString(PREFS_CURRENT_CODE_FORMATTER);
    if (currentFormatter != null && currentFormatter.trim().length() != 0)
        this.codeFormatter = currentFormatter;
}

From source file:com.cisco.yangide.ui.preferences.OverlayPreferenceStore.java

License:Open Source License

private void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {

    if (orgin.isDefault(key.fKey)) {
        if (!target.isDefault(key.fKey)) {
            target.setToDefault(key.fKey);
        }/* w  w w. ja  v a  2s. c  o  m*/
        return;
    }

    TypeDescriptor d = key.fDescriptor;
    if (BOOLEAN == d) {

        boolean originValue = orgin.getBoolean(key.fKey);
        boolean targetValue = target.getBoolean(key.fKey);
        if (targetValue != originValue) {
            target.setValue(key.fKey, originValue);
        }

    } else if (DOUBLE == d) {

        double originValue = orgin.getDouble(key.fKey);
        double targetValue = target.getDouble(key.fKey);
        if (targetValue != originValue) {
            target.setValue(key.fKey, originValue);
        }

    } else if (FLOAT == d) {

        float originValue = orgin.getFloat(key.fKey);
        float targetValue = target.getFloat(key.fKey);
        if (targetValue != originValue) {
            target.setValue(key.fKey, originValue);
        }

    } else if (INT == d) {

        int originValue = orgin.getInt(key.fKey);
        int targetValue = target.getInt(key.fKey);
        if (targetValue != originValue) {
            target.setValue(key.fKey, originValue);
        }

    } else if (LONG == d) {

        long originValue = orgin.getLong(key.fKey);
        long targetValue = target.getLong(key.fKey);
        if (targetValue != originValue) {
            target.setValue(key.fKey, originValue);
        }

    } else if (STRING == d) {

        String originValue = orgin.getString(key.fKey);
        String targetValue = target.getString(key.fKey);
        if (targetValue != null && originValue != null && !targetValue.equals(originValue)) {
            target.setValue(key.fKey, originValue);
        }

    }
}

From source file:com.cisco.yangide.ui.preferences.OverlayPreferenceStore.java

License:Open Source License

private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target,
        boolean forceInitialization) {
    TypeDescriptor d = key.fDescriptor;/*from ww  w. ja v  a 2s .  c o m*/
    if (BOOLEAN == d) {

        if (forceInitialization) {
            target.setValue(key.fKey, true);
        }
        target.setValue(key.fKey, orgin.getBoolean(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));

    } else if (DOUBLE == d) {

        if (forceInitialization) {
            target.setValue(key.fKey, 1.0D);
        }
        target.setValue(key.fKey, orgin.getDouble(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));

    } else if (FLOAT == d) {

        if (forceInitialization) {
            target.setValue(key.fKey, 1.0F);
        }
        target.setValue(key.fKey, orgin.getFloat(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));

    } else if (INT == d) {

        if (forceInitialization) {
            target.setValue(key.fKey, 1);
        }
        target.setValue(key.fKey, orgin.getInt(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));

    } else if (LONG == d) {

        if (forceInitialization) {
            target.setValue(key.fKey, 1L);
        }
        target.setValue(key.fKey, orgin.getLong(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));

    } else if (STRING == d) {

        if (forceInitialization) {
            target.setValue(key.fKey, "1"); //$NON-NLS-1$
        }
        target.setValue(key.fKey, orgin.getString(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));

    }
}

From source file:com.cloudbees.eclipse.ui.CloudBeesUIPlugin.java

License:Open Source License

public List<JenkinsInstance> loadManualJenkinsInstances() {
    IPreferenceStore store = CloudBeesUIPlugin.getDefault().getPreferenceStore();
    String instances = store.getString(PreferenceConstants.P_JENKINS_INSTANCES);
    List<JenkinsInstance> list = JenkinsInstance.decode(instances);

    if (list != null) {
        for (JenkinsInstance inst : list) {
            lookupJenkinsService(inst);//from ww  w. j  a va 2  s  .com
        }
    }

    return list;
}

From source file:com.cloudbees.eclipse.ui.CloudBeesUIPlugin.java

License:Open Source License

synchronized public List<ForgeInstance> getForgeRepos(final IProgressMonitor monitor)
        throws CloudBeesException {
    List<ForgeInstance> cloudRepos = CloudBeesCorePlugin.getDefault().getGrandCentralService()
            .getForgeRepos(monitor);/*from   w ww .j  a  v a  2s.co  m*/

    if (this.forgeRegistry == null) {
        IPreferenceStore store = CloudBeesUIPlugin.getDefault().getPreferenceStore();
        String instances = store.getString(PreferenceConstants.P_FORGE_INSTANCES);
        this.forgeRegistry = new ArrayList<ForgeInstance>(ForgeInstance.decode(instances));
    }

    for (ForgeInstance forge : cloudRepos) {
        int pos = this.forgeRegistry.indexOf(forge);
        if (pos >= 0) {
            ForgeInstance old = this.forgeRegistry.get(pos);
            forge.status = old.status;
        }
    }

    Collections.sort(cloudRepos);

    this.forgeRegistry.clear();
    this.forgeRegistry.addAll(cloudRepos);

    return cloudRepos;
}

From source file:com.clustercontrol.accesscontrol.dialog.LoginDialog.java

License:Open Source License

/**
* ????//from w  w w .  ja va  2 s  .  co m
* 
* @param parent ?
*/
@Override
protected Control createDialogArea(Composite parent) {
    // Configure scrolled composite
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, true));
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);

    scrolledComposite.setLayout(new GridLayout());
    // Add content to scrolled composite
    Composite scrolledContent = new Composite(scrolledComposite, SWT.NONE);
    scrolledContent.setLayout(new GridLayout(4, false));

    if (inputList.isEmpty()) {
        if (0 < EndpointManager.sizeOfAll()) {
            // 1. Load manager from EndpointManager
            List<EndpointUnit> endpointUnitList = EndpointManager.getAllManagerList();
            int connectedLen = endpointUnitList.size();
            for (int i = 0; i < connectedLen; i++) {
                EndpointUnit endpointUnit = endpointUnitList.get(i);
                inputList.add(new LoginInput(endpointUnit.getUserId(), endpointUnit.getPassword(),
                        endpointUnit.getUrlListStr(), endpointUnit.getManagerName(), endpointUnit.getStatus()));
            }
        } else if (paramMap.size() > 0) {
            // 2. Load manager from GET query
            String[] urls = new String[] {};
            String[] users = new String[] {};
            String[] managerNames = new String[] {};

            if (paramMap.containsKey(LoginManager.KEY_URL_LOGIN_URL)) {
                urls = paramMap.get(LoginManager.KEY_URL_LOGIN_URL).split(";");
            }
            if (paramMap.containsKey(LoginManager.KEY_URL_UID)) {
                users = paramMap.get(LoginManager.KEY_URL_UID).split(";");
            }
            if (paramMap.containsKey(LoginManager.KEY_URL_MANAGER_NAME)) {
                managerNames = paramMap.get(LoginManager.KEY_URL_MANAGER_NAME).split(";");
            }

            for (int cnt = 0; cnt < maxConnectManager; ++cnt) {
                if (urls.length > cnt) {
                    // URL?????
                    String url = urls[cnt];
                    String userId = LoginManager.VALUE_UID;
                    String managerName = null;

                    if (users.length > cnt) {
                        userId = users[cnt];
                    }

                    if (managerNames.length > cnt) {
                        managerName = managerNames[cnt];
                    }

                    inputList.add(new LoginInput(userId, "", url, managerName));
                } else {
                    // URL???????
                    break;
                }
            }
        } else {
            // 3. Load record(s) from history
            IPreferenceStore store = ClusterControlPlugin.getDefault().getPreferenceStore();
            int historyNum = store.getInt(LoginManager.KEY_LOGIN_STATUS_NUM);
            if (historyNum > maxConnectManager) {
                // ????
                historyNum = maxConnectManager;
            }
            if (0 < historyNum) {
                // 1. Try to reload from history
                for (int i = 0; i < historyNum; i++) {
                    String userId = store.getString(LoginManager.KEY_LOGIN_STATUS_UID + "_" + i);
                    String password = "";
                    String url = store.getString(LoginManager.KEY_LOGIN_STATUS_URL + "_" + i);
                    String managerName = store.getString(LoginManager.KEY_LOGIN_STATUS_MANAGERNAME + "_" + i);

                    // Use ENV setting at first when existed
                    if (0 == i) {
                        // ??
                        String envUserId = System.getenv(LoginManager.ENV_HINEMOS_MANAGER_USER);
                        if (null != envUserId && 0 != envUserId.length()) {
                            userId = envUserId;
                        }
                        String envPassword = System.getenv(LoginManager.ENV_HINEMOS_MANAGER_PASS);
                        if (null != envPassword && 0 != envPassword.length()) {
                            password = envPassword;
                        }
                        String envUrl = System.getenv(LoginManager.ENV_HINEMOS_MANAGER_URL);
                        if (null != envUrl && 0 != envUrl.length()) {
                            url = envUrl;
                        }
                    }
                    inputList.add(new LoginInput(userId, password, url, managerName));
                }
            }
        }
    }

    int unconnected = 0;
    if (inputList.isEmpty()) {
        // Create a default blank one
        LoginInput loginInput = new LoginInput();
        loginInput.render(scrolledContent, true);
        // ?????????????.
        loginInput.setFocus();
        inputList.add(loginInput);
        unconnected++;
    } else {
        // Show inputList
        int newLen = inputList.size();
        for (int i = 0; i < newLen; i++) {
            LoginInput input = inputList.get(i);
            input.render(scrolledContent, 0 == i);

            if (input.getAccount().getStatus() == LoginAccount.STATUS_UNCONNECTED) {
                unconnected++;
            }
            if (newLen - 1 == i) {
                //?????????????. Always focus on the last one
                input.setFocus();
            }
        }
        disableLoginButton = unconnected == 0;
    }

    Label separatorLabel = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    separatorLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    m_log.debug("unconnected=" + unconnected + ", inputList.size=" + inputList.size());
    if (1 < inputList.size()) {
        Button useSameIDChkBox = new Button(parent, SWT.CHECK);
        WidgetTestUtil.setTestId(this, "usesameid", useSameIDChkBox);
        useSameIDChkBox.setText(Messages.getString("checkbox.usesameaccount"));

        if (useSameID) {
            autoIDInput(useSameID);
        }
        useSameIDChkBox.setSelection(useSameID);
        useSameIDChkBox.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                autoIDInput(((Button) e.widget).getSelection());
            }
        });
    }

    scrolledComposite.setContent(scrolledContent);
    scrolledComposite.setMinSize(scrolledContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    return scrolledComposite;
}