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.buildml.eclipse.ImportSubEditor.java

License:Open Source License

@Override
public void updateOptionsFromPreferenceStore() {
    IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();

    setOption(EditorOptions.OPT_COALESCE_DIRS, prefStore.getBoolean(PreferenceConstants.PREF_COALESCE_DIRS));

    /*/*from  w  w  w  .  j  a va2s. c o m*/
     * Determine where the BuildML binaries and libraries are kept. By default we get
     * them from within the plugin jar file, although the user is permitted
     * to override that path. If they do, however, they should be warned.
     */
    String buildMlPath = null;
    URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path("/files"), null);
    if (url != null) {
        try {
            URL filesDirUrl = FileLocator.toFileURL(url);
            buildMlPath = filesDirUrl.getPath();
        } catch (IOException e) {
            /* nothing - buildMlPath stays null, which indicates an error */
        }
    }

    /*
     * If we can't locate the /files directory within the plugin, that's likely because we're
     * running this plugin within the eclipse PDE (as opposed to the plugin being installed
     * and executed in the normal way). If this is the case, then buildMlPath == null.
     * 
     * In any situation, the user is welcome to override the value of buildMlPath with their
     * own setting. However, if they're not using the plugin jar's copy of the files, we
     * should warn them.
     */
    String prefBuildMlPath = prefStore.getString(PreferenceConstants.PREF_BUILDML_HOME);
    if (!prefBuildMlPath.isEmpty() && !warnedAboutPathOverride) {
        if (buildMlPath != null) {
            AlertDialog.displayWarningDialog("Overriding BUILDML_HOME setting",
                    "Although the bin and lib directories have been found in the plugin jar file, "
                            + "you have chosen to override the path. Please go into the BuildML preferences "
                            + "if you wish to remove this override.");
            warnedAboutPathOverride = true;
        }
        buildMlPath = prefBuildMlPath;
    }

    /*
     * Check that the BUILDML_HOME preference is set, is a directory, and contains subdirectories
     * "lib" and "bin".
     */
    if ((buildMlPath == null) || buildMlPath.isEmpty()) {
        AlertDialog.displayErrorDialog("Missing Preference Setting",
                "The preference setting: \"Directory containing BuildML's bin and lib directories\" "
                        + "is not defined. Please go into the BuildML preferences and set a suitable value.");
    } else {
        File buildMlPathFile = new File(buildMlPath);
        if (!(buildMlPathFile.isDirectory()) || (!new File(buildMlPathFile, "bin").isDirectory())
                || (!new File(buildMlPathFile, "lib").isDirectory())) {
            AlertDialog.displayErrorDialog("Invalid Preference Setting",
                    "The preference setting: \"Directory containing BuildML's bin and lib directories\" "
                            + "does not refer to a valid directory.");
        }
        /* 
         * Else, the path is good. The only additional requirement is that the 'cfs' command
         * be executable. This won't be the case if the /files directory has just been
         * extracted into the Eclipse configuration directory for the first time. Note that
         * chmod can fail if the files aren't owned by the current user, but that's not a
         * problem for us.
         */
        else {
            System.setProperty("BUILDML_HOME", buildMlPath);
            SystemUtils.chmod(buildMlPath + "/bin/cfs", 0755);
        }
    }
}

From source file:com.centurylink.mdw.plugin.designer.dialogs.ExportAsDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.getShell().setText("Export Process");

    GridLayout gl = new GridLayout();
    gl.numColumns = 2;/*  w w  w . j a v  a 2  s  . c om*/
    composite.setLayout(gl);

    Label msgLabel = new Label(composite, SWT.NONE);
    msgLabel.setText("Save process '" + processVersion.getName() + "' as image.");
    GridData gd = new GridData(GridData.BEGINNING);
    gd.horizontalSpan = 2;
    msgLabel.setLayoutData(gd);

    Group exportFormatGroup = new Group(composite, SWT.NONE);
    exportFormatGroup.setText("Format to Export");
    gl = new GridLayout();
    exportFormatGroup.setLayout(gl);
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    exportFormatGroup.setLayoutData(gd);
    bpmnButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT);
    bpmnButton.setText(BPMN2);
    htmlButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT);
    htmlButton.setText(HTML);
    docxButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT);
    docxButton.setText(MS_WORD);
    jpegButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT);
    jpegButton.setText("JPEG");
    jpegButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            boolean sel = jpegButton.getSelection();

            if (sel) {
                docButton.setSelection(false);
                attrsButton.setSelection(false);
                varsButton.setSelection(false);
            }

            docButton.setEnabled(!sel);
            attrsButton.setEnabled(!sel);
            varsButton.setEnabled(!sel);
        }
    });
    pngButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT);
    pngButton.setText(PNG);
    pngButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            boolean sel = pngButton.getSelection();

            if (sel) {
                docButton.setSelection(false);
                attrsButton.setSelection(false);
                varsButton.setSelection(false);
            }

            docButton.setEnabled(!sel);
            attrsButton.setEnabled(!sel);
            varsButton.setEnabled(!sel);
        }
    });
    rtfButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT);
    rtfButton.setText(RTF);
    pdfButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT);
    pdfButton.setText(PDF);

    IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore();
    String format = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_EXPORT_FORMAT);
    if (FORMATS.get(HTML).equals(format) || format == null)
        htmlButton.setSelection(true);
    else if (FORMATS.get(MS_WORD).equals(format))
        docxButton.setSelection(true);
    else if (FORMATS.get(JPG).equals(format))
        jpegButton.setSelection(true);
    else if (FORMATS.get(PNG).equals(format))
        pngButton.setSelection(true);
    else if (FORMATS.get(BPMN2).equals(format))
        bpmnButton.setSelection(true);
    else if (FORMATS.get(RTF).equals(format))
        rtfButton.setSelection(true);
    else if (FORMATS.get(PDF).equals(format))
        pdfButton.setSelection(true);

    Composite comp2 = new Composite(composite, SWT.NONE);
    gl = new GridLayout();
    gl.marginTop = -5;
    comp2.setLayout(gl);

    // inclusion options
    Group optionsGroup = new Group(comp2, SWT.NONE);
    optionsGroup.setText("Include");
    gl = new GridLayout();
    optionsGroup.setLayout(gl);
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    optionsGroup.setLayoutData(gd);
    docButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
    docButton.setText("Documentation");
    attrsButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
    attrsButton.setText("Attributes");
    varsButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
    varsButton.setText("Variables");

    docButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_DOCUMENTATION));
    attrsButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_ATTRIBUTES));
    varsButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_VARIABLES));

    // activity order
    Group activityOrderGroup = new Group(comp2, SWT.NONE);
    activityOrderGroup.setText("Element Order");
    activityOrderGroup.setLayout(new GridLayout());
    activityOrderGroup
            .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
    sequenceIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT);
    sequenceIdButton.setText("Sequence Number");
    referenceIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT);
    referenceIdButton.setText("Reference ID");
    logicalIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT);
    logicalIdButton.setText("Logical ID");

    String sort = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_EXPORT_ELEMENT_ORDER);
    if (Node.ID_REFERENCE.equals(sort))
        referenceIdButton.setSelection(true);
    else if (Node.ID_LOGICAL.equals(sort))
        logicalIdButton.setSelection(true);
    else
        sequenceIdButton.setSelection(true);

    filepathText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    gd.widthHint = 250;
    filepathText.setLayoutData(gd);
    filepathText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            filepath = filepathText.getText().trim();
            getButton(IDialogConstants.OK_ID).setEnabled(filepath.length() > 0);
        }
    });

    browseButton = new Button(composite, SWT.PUSH);
    browseButton.setText("Browse...");
    browseButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            FileSaveDialog dlg = new FileSaveDialog(getShell());
            dlg.setFilterExtensions(new String[] { "*." + getFileExtension() });
            dlg.setFileName(getFileName());
            String filepath = dlg.open();
            if (filepath != null)
                filepathText.setText(filepath);
        }
    });

    return composite;
}

From source file:com.centurylink.mdw.plugin.designer.dialogs.ProcessSaveDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.getShell().setText("Save Process");

    String msg = "'" + process.getName() + "'";
    if (respondingToClose)
        msg += " has been modified.  Save changes?";
    new Label(composite, SWT.NONE).setText(msg);

    String oldEmbedded = getProcess().getAttribute("process_old_embedded"); // MDW3

    Group radioGroup = new Group(composite, SWT.NONE);
    radioGroup.setText("Process Version to Save");
    GridLayout gl = new GridLayout();
    radioGroup.setLayout(gl);//ww  w  .ja v  a 2 s .co m
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    radioGroup.setLayoutData(gd);
    overwriteButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT);
    if (oldEmbedded != null || !allowForceUpdate)
        overwriteButton.setEnabled(false);
    overwriteButton.setText("Overwrite current version: " + process.getVersionString());
    overwriteButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            versionButtonSelected(e);
        }
    });
    newMinorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT);
    newMinorButton.setText("Save as new minor version: " + process.getNewVersionString(false));
    newMinorButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            versionButtonSelected(e);
        }
    });
    newMajorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT);
    newMajorButton.setText("Save as new major version: " + process.getNewVersionString(true));
    newMajorButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            versionButtonSelected(e);
        }
    });

    if (oldEmbedded != null)
        new Label(composite, SWT.NONE)
                .setText("This process contains MDW 3.* subprocesses.\nYou must save it as a new version.");

    IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore();

    String prefsIncrement = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_SAVE_INCREMENT);
    boolean rememberSelection = !prefsIncrement.isEmpty();
    if (prefsIncrement.isEmpty())
        prefsIncrement = Increment.Minor.toString();
    Increment increment = Increment.valueOf(prefsIncrement);
    if (increment == Increment.Overwrite)
        overwriteButton.setSelection(true);
    else if (increment == Increment.Major)
        newMajorButton.setSelection(true);
    else
        newMinorButton.setSelection(true);

    rememberSelectionCheckbox = new Button(composite, SWT.CHECK);
    rememberSelectionCheckbox.setText("Remember this selection for future saves");
    rememberSelectionCheckbox.setSelection(rememberSelection);

    enforceValidationCheckbox = new Button(composite, SWT.CHECK);
    enforceValidationCheckbox.setText("Enforce process validation rules");
    enforceValidationCheckbox
            .setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_ENFORCE_PROCESS_VALIDATION_RULES));

    if (process.getProject().isFilePersist()) {
        boolean overwrite = overwriteButton.getSelection();
        // override attributes
        carryOverrideAttributesCheckbox = new Button(composite, SWT.CHECK);
        carryOverrideAttributesCheckbox.setText("Carry forward override attributes");
        boolean enabled = process.overrideAttributesApplied() && !overwrite;
        boolean checked = overwrite ? true : process.overrideAttributesApplied();
        enableCarryOverrideAttrs(enabled, checked);
        carryOverrideAttributesCheckbox.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                if (carryOverrideAttributesCheckbox.getSelection()) {
                    WarningTray tray = getWarningTray();
                    if (tray.getMessage().startsWith("Any override attributes")) {
                        tray.close();
                        getButton(Dialog.OK).setText(respondingToClose ? "Save" : "OK");
                    }
                }
            }
        });
    } else {
        keepLockedCheckbox = new Button(composite, SWT.CHECK);
        keepLockedCheckbox.setText("Keep process locked after saving");
        keepLockedCheckbox.setSelection(
                prefsStore.getBoolean(PreferenceConstants.PREFS_KEEP_PROCESSES_LOCKED_WHEN_SAVING));
    }

    return composite;
}

From source file:com.centurylink.mdw.plugin.designer.dialogs.TemplateRunDialog.java

License:Apache License

public TemplateRunDialog(Shell shell, Template template) {
    super(shell);
    this.template = template;

    // initial output location
    IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore();
    inputFilePath = prefsStore.getString(PreferenceConstants.PREFS_TEMPLATE_INPUT_FILE);
    if (inputFilePath.length() == 0)
        inputFilePath = null;/*w  w  w.ja va  2s .co  m*/
    inputDirPath = prefsStore.getString(PreferenceConstants.PREFS_TEMPLATE_INPUT_LOCATION);
    if (inputDirPath.length() == 0)
        inputDirPath = null;
    outputDirPath = prefsStore.getString(PreferenceConstants.PREFS_TEMPLATE_OUTPUT_LOCATION);
    velocityPropFilePath = prefsStore.getString(PreferenceConstants.PREFS_VELOCITY_PROPERTY_FILE_LOCATION);
    velocityToolsFilePath = prefsStore.getString(PreferenceConstants.PREFS_VELOCITY_TOOLBOX_FILE_LOCATION);
}

From source file:com.centurylink.mdw.plugin.designer.dialogs.VersionableSaveDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.getShell().setText("Save " + versionable.getTitle());

    Group radioGroup = new Group(composite, SWT.NONE);
    radioGroup.setText("Version to Save");
    GridLayout gl = new GridLayout();
    radioGroup.setLayout(gl);//from  ww w.  j ava 2s. c om
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    radioGroup.setLayoutData(gd);
    overwriteButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT);
    overwriteButton.setText("Overwrite current version: " + versionable.getVersionString());
    overwriteButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            versionButtonSelected(e);
        }
    });
    newMinorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT);
    newMinorButton.setText(
            "Save as new minor version: " + versionable.formatVersion(versionable.getNextMinorVersion()));
    newMinorButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            versionButtonSelected(e);
        }
    });
    newMajorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT);
    newMajorButton.setText(
            "Save as new major version: " + versionable.formatVersion(versionable.getNextMajorVersion()));
    newMajorButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            versionButtonSelected(e);
        }
    });

    boolean prod = versionable.getProject().isProduction();
    if (prod)
        overwriteButton.setEnabled(false);

    IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore();

    String prefsIncrement = prefsStore.getString(PreferenceConstants.PREFS_ASSET_SAVE_INCREMENT);
    boolean rememberSelection = !prefsIncrement.isEmpty();
    if (prefsIncrement.isEmpty())
        prefsIncrement = Increment.Minor.toString();
    versionIncrement = Increment.valueOf(prefsIncrement);
    if (prod && versionIncrement == Increment.Overwrite)
        versionIncrement = Increment.Minor;

    if (versionIncrement == Increment.Overwrite)
        overwriteButton.setSelection(true);
    else if (versionIncrement == Increment.Major)
        newMajorButton.setSelection(true);
    else
        newMinorButton.setSelection(true);

    rememberSelectionCheckbox = new Button(composite, SWT.CHECK);
    rememberSelectionCheckbox.setText("Remember this selection for future saves");
    rememberSelectionCheckbox.setSelection(rememberSelection);

    enforceValidationCheckbox = new Button(composite, SWT.CHECK);
    enforceValidationCheckbox.setText("Enforce asset validation rules");
    enforceValidationCheckbox
            .setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_ENFORCE_ASSET_VALIDATION_RULES));

    if (isVcsRemote) {
        saveButton.setEnabled(false);
    } else {
        keepLockedCheckbox = new Button(composite, SWT.CHECK);
        keepLockedCheckbox.setText("Keep " + versionable.getTitle() + " locked after saving");
        keepLockedCheckbox.setSelection(
                prefsStore.getBoolean(PreferenceConstants.PREFS_KEEP_RESOURCES_LOCKED_WHEN_SAVING));
    }

    return composite;
}

From source file:com.centurylink.mdw.plugin.designer.ProcessCanvasWrapper.java

License:Apache License

/**
 * Creates the wrapped Swing component.//ww w  .j  a va  2s . com
 *
 * @param parent
 *            the parent SWT part
 * @return the SWT composite with the embedded Swing component
 */
public EmbeddedSwingComposite createEmbeddedSwingComposite(Composite parent) {
    return new EmbeddedSwingComposite(parent, SWT.NONE) {
        @Override
        protected JComponent createSwingComponent() {
            CanvasCommon canvas = null;

            if (isInstance()) {
                getFrame().setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
                canvas = getDesignerProxy().loadProcessInstance(getProcess(), getProcessInstancePage());
                getProcess().setReadOnly(getProject().getPersistType() == WorkflowProject.PersistType.Database);
                getFrame().setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
            } else {
                canvas = getDesignerProxy().loadProcess(getProcess(), getFlowchartPage());
            }

            // initialize canvas settings from preferences
            IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore();
            String nodeIdType = prefsStore.getString(PreferenceConstants.PREFS_DESIGNER_CANVAS_NODE_ID_TYPE);
            if (!isInstance() && !nodeIdType.isEmpty() && !getNodeIdType().equals(nodeIdType))
                setNodeIdType(nodeIdType);
            FlowchartPage.showtip = !prefsStore
                    .getBoolean(PreferenceConstants.PREFS_DESIGNER_SUPPRESS_TOOLTIPS);

            JScrollPane scrollPane = new JScrollPane(canvas);
            scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
            return scrollPane;
        }
    };
}

From source file:com.centurylink.mdw.plugin.MdwPlugin.java

License:Apache License

public static String getStringPref(String name) {
    IPreferenceStore prefsStore = getDefault().getPreferenceStore();
    return prefsStore.getString(name);
}

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

License:Apache License

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

    int reportingLevel = store.getInt(PREFS_MDW_REPORTING_LEVEL);
    mdwReportingLevelCombo// w w w . j  a va  2 s . com
            .setText(reportingLevel + " - " + PluginMessages.MESSAGE_LEVELS.get(new Integer(reportingLevel)));
    logTimingsCheckbox.setSelection(store.getBoolean(PREFS_LOG_TIMINGS));
    logConnectErrorsCheckbox.setSelection(store.getBoolean(PREFS_LOG_CONNECT_ERRORS));
    copyrightNoticeTextArea.setText(store.getString(PREFS_COPYRIGHT_NOTICE));
    jdbcFetchSizeText.setText(String.valueOf(store.getInt(PREFS_JDBC_FETCH_SIZE)));
    eventManagerCheckbox.setSelection(store.getBoolean(PREFS_SWING_LAUNCH_EVENT_MANAGER));
    threadPoolManagerCheckbox.setSelection(store.getBoolean(PREFS_SWING_LAUNCH_THREAD_POOL_MANAGER));
    useDiscoveredVcsCredsCheckbox.setSelection(store.getBoolean(PREFS_USE_DISCOVERED_VCS_CREDS));
}

From source file:com.centurylink.mdw.plugin.preferences.model.MdwSettings.java

License:Apache License

public void initialize() {
    setDefaultValues();/*  w  ww .  ja v a2s.  co  m*/

    IPreferenceStore store = MdwPlugin.getDefault().getPreferenceStore();

    String relUrl = store.getString(PREFS_MDW_RELEASES_URL);
    if (relUrl.endsWith("/"))
        relUrl = relUrl.substring(0, relUrl.length() - 1);
    setMdwReleasesUrl(relUrl);
    if (getMdwReleasesUrl().length() == 0)
        setMdwReleasesUrl(store.getDefaultString(PREFS_MDW_RELEASES_URL));
    setWorkspaceSetupUrl(store.getString(PREFS_WORKSPACE_SETUP_URL));
    if (getWorkspaceSetupUrl().length() == 0)
        setWorkspaceSetupUrl(store.getDefaultString(PREFS_WORKSPACE_SETUP_URL));
    setDiscoveryUrl(store.getString(PREFS_DISCOVERY_URL));
    if (getDiscoveryUrl().length() == 0)
        setDiscoveryUrl(store.getDefaultString(PREFS_DISCOVERY_URL));
    setIncludePreviewBuilds(store.getBoolean(PREFS_INCLUDE_PREVIEW_BUILDS));
    setJdbcFetchSize(store.getInt(PREFS_JDBC_FETCH_SIZE));
    if (getJdbcFetchSize() == 0)
        setJdbcFetchSize(store.getDefaultInt(PREFS_JDBC_FETCH_SIZE));
    setCopyrightNotice(store.getString(PREFS_COPYRIGHT_NOTICE));
    if (getCopyrightNotice().length() == 0)
        setCopyrightNotice(store.getDefaultString(PREFS_COPYRIGHT_NOTICE));
    setInPlaceLabelEditing(store.getBoolean(PREFS_IN_PLACE_LABEL_EDITING));
    setCompareConflictingAssetsDuringImport(store.getBoolean(PREFS_COMPARE_CONFLICTING_ASSETS));
    setAllowDeleteArchivedProcesses(store.getBoolean(PREFS_ALLOW_DELETE_ARCHIVED_PROCESSES));
    setAllowAssetNamesWithoutExtensions(store.getBoolean(PREFS_ALLOW_ASSETS_WITHOUT_EXTENSIONS));
    setUseEmbeddedEditorForExcelAssets(store.getBoolean(PREFS_EMBEDDED_EDITOR_FOR_EXCEL));
    setDoubleClickOpensSubprocessesAndScripts(
            store.getBoolean(PREFS_DOUBLE_CLICK_OPENS_SUBPROCESSES_AND_SCRIPTS));
    setInferSmartSubprocVersionSpec(store.getBoolean(PREFS_INFER_SMART_SUBPROC_VERSION_SPEC));
    setMdwReportingLevel(store.getInt(PREFS_MDW_REPORTING_LEVEL));
    int red = store.getInt(PREFS_READONLY_BG_RED);
    int green = store.getInt(PREFS_READONLY_BG_GREEN);
    int blue = store.getInt(PREFS_READONLY_BG_BLUE);
    setReadOnlyBackground(new RGB(red, green, blue));
    setTempResourceLocation(store.getString(PREFS_TEMP_RESOURCE_DIRECTORY));
    if (getTempResourceLocation().length() == 0)
        setTempResourceLocation(store.getDefaultString(PREFS_TEMP_RESOURCE_DIRECTORY));
    setTempFilesToKeep(store.getInt(PREFS_PREVIOUS_TEMP_FILE_VERSIONS_TO_KEEP));
    if (getTempFilesToKeep() == 0)
        setTempFilesToKeep(store.getDefaultInt(PREFS_PREVIOUS_TEMP_FILE_VERSIONS_TO_KEEP));
    setLoadScriptLibsOnEdit(store.getBoolean(PREFS_LOAD_SCRIPT_LIBS_ON_EDIT));
    setWarnOverrideAttrsNotCarriedForward(store.getBoolean(PREFS_WARN_OVERRIDE_ATTRS_NOT_CARRIED_FORWARD));

    logTimings = store.getBoolean(PREFS_LOG_TIMINGS);
    logConnectErrors = store.getBoolean(PREFS_LOG_CONNECT_ERRORS);

    swingLaunchEventManager = store.getBoolean(PREFS_SWING_LAUNCH_EVENT_MANAGER);
    swingLaunchThreadPoolManager = store.getBoolean(PREFS_SWING_LAUNCH_THREAD_POOL_MANAGER);

    useDiscoveredVcsCredentials = store.getBoolean(PREFS_USE_DISCOVERED_VCS_CREDS);

    setHttpConnectTimeout(store.getInt(PREFS_HTTP_CONNECT_TIMEOUT_MS));
    setHttpReadTimeout(store.getInt(PREFS_HTTP_READ_TIMEOUT_MS));
    setSmtpHost(store.getString(PREFS_SMTP_HOST));
    setSmtpPort(store.getInt(PREFS_SMTP_PORT));
}

From source file:com.centurylink.mdw.plugin.preferences.model.ServerConsoleSettings.java

License:Apache License

/**
 * initialize attribute values from preferences
 *///from   w w  w.  j  a  v  a  2 s . co m
public void initialize() {
    setDefaultValues();

    IPreferenceStore store = MdwPlugin.getDefault().getPreferenceStore();
    bufferSize = store.getInt(PREFS_SERVER_CONSOLE_BUFFER_SIZE);
    if (bufferSize == 0)
        bufferSize = store.getDefaultInt(PREFS_SERVER_CONSOLE_BUFFER_SIZE);

    FontData fd = new FontData(store.getString(PREFS_SERVER_CONSOLE_FONT));
    if (fd.equals(new FontData("Courier New", 10, SWT.NORMAL)))
        fd = new FontData(store.getDefaultString(PREFS_SERVER_CONSOLE_FONT));
    setFontData(fd);
    int red = store.getInt(PREFS_SERVER_CONSOLE_FONT_RED);
    if (red == 0)
        red = store.getDefaultInt(PREFS_SERVER_CONSOLE_FONT_RED);
    int green = store.getInt(PREFS_SERVER_CONSOLE_FONT_GREEN);
    if (green == 0)
        green = store.getDefaultInt(PREFS_SERVER_CONSOLE_FONT_GREEN);
    int blue = store.getInt(PREFS_SERVER_CONSOLE_FONT_BLUE);
    if (blue == 0)
        blue = store.getDefaultInt(PREFS_SERVER_CONSOLE_FONT_BLUE);
    setFontRgb(new RGB(red, green, blue));
    red = store.getInt(PREFS_SERVER_CONSOLE_BG_RED);
    if (red == 255)
        red = store.getDefaultInt(PREFS_SERVER_CONSOLE_BG_RED);
    green = store.getInt(PREFS_SERVER_CONSOLE_BG_GREEN);
    if (green == 255)
        green = store.getDefaultInt(PREFS_SERVER_CONSOLE_BG_GREEN);
    blue = store.getInt(PREFS_SERVER_CONSOLE_BG_BLUE);
    if (blue == 255)
        blue = store.getDefaultInt(PREFS_SERVER_CONSOLE_BG_BLUE);
    setBackgroundRgb(new RGB(red, green, blue));

    String clientShell = store.getString(PREFS_SERVER_CLIENT_SHELL);
    if (clientShell == null || clientShell.isEmpty())
        clientShell = store.getDefaultString(PREFS_SERVER_CLIENT_SHELL);
    setClientShell(ClientShell.valueOf(clientShell));

    String clientShellExePath = store.getString(PREFS_SERVER_CLIENT_SHELL_EXE_PATH);
    if (clientShellExePath != null && !clientShellExePath.isEmpty())
        setClientShellExe(new File(clientShellExePath));
    else
        setClientShellExe(null);
}