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

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

Introduction

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

Prototype

void setValue(String name, boolean value);

Source Link

Document

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

Usage

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.CompatibilityAnalyserPreferences.java

License:Open Source License

/**
 * Fetches the default values from the preference store object.
 *//*from   www.  j a v  a  2 s .  co m*/
protected void performDefaults() {

    defaultcoreBtn.setSelection(true);

    localcoreBtn.setSelection(false);
    localCmb.setEnabled(false);
    browse1.setEnabled(false);

    webcoreBtn.setSelection(false);
    webLink.setEnabled(false);

    sdkcoreBtn.setSelection(false);
    sdkCmb.setEnabled(false);

    webLink.setText(CORETOOLS_WEBSERVER_URL); //$NON-NLS-1$
    knowniss_webLink.setText(KNOWNISSUES_WEBSERVER_URL); //$NON-NLS-1$
    baselineTxt.setText(BASELINES_WEBSERVER_URL);

    IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    store.setValue(CompatibilityAnalyserPreferencesConstants.DEFAULT_ISSUES, true);
    store.setValue(CompatibilityAnalyserPreferencesConstants.LATEST_ISSUES, false);
    store.setValue(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES, false);
    store.setValue(CompatibilityAnalyserPreferencesConstants.LOCAL_ISSUES, false);

    super.performDefaults();
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.CompatibilityAnalyserPreferences.java

License:Open Source License

/**
 * Stores the latest values to preference store object.
 *//*from w ww .j a va 2  s .  com*/
public boolean performOk() {
    IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    SavingUserData userData = new SavingUserData();

    String url2 = knowniss_webLink.getText();

    if (url2.length() != 0) {
        store.setValue(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL, url2);
    }
    /*else
    {
       MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.getString("CompatibilityAnalyserPreferences.25"), Messages.getString("CompatibilityAnalyserPreferences.26")); //$NON-NLS-1$ //$NON-NLS-2$
       return false;
    }*/
    if (localcoreBtn.getSelection() == true) {
        File checkbc = null;
        if (localCmb.getText().length() != 0) {
            checkbc = new File(FileMethods.appendPathSeparator(localCmb.getText())
                    + Messages.getString("CompatibilityAnalyserPreferences.27")); //$NON-NLS-1$
        } else {
            MessageDialog.openError(Display.getCurrent().getActiveShell(),
                    Messages.getString("CompatibilityAnalyserPreferences.28"), //$NON-NLS-1$
                    Messages.getString("CompatibilityAnalyserPreferences.29")); //$NON-NLS-1$
            return false;
        }

        //check whether the checkbc.py exists or not 
        if (checkbc.exists() && checkbc.isFile()) {
            try {
                String dv = CompatibilityAnalyserEngine
                        .getDataVersion(checkbc.getParentFile().getAbsolutePath());
                int num = Integer.parseInt(dv);
                if (num != CompatibilityAnalyserPlugin.DATA_VERSION) {
                    if (!checkbc.getParentFile().getAbsolutePath()
                            .equalsIgnoreCase(CompatibilityAnalyserPlugin.getDefaltCoretoolsPath()))
                        MessageDialog.openError(Display.getCurrent().getActiveShell(),
                                Messages.getString("CompatibilityAnalyserPreferences.42"),
                                "Invalid data version of coretools. Please check the coretools.\nPlease select the coretools of data version "
                                        + CompatibilityAnalyserPlugin.DATA_VERSION + ".");
                    return false;
                }
            } catch (NumberFormatException e) {
                MessageDialog.openError(Display.getCurrent().getActiveShell(),
                        Messages.getString("CompatibilityAnalyserPreferences.42"),
                        "Invalid data version of coretools. Please check the coretools.\nPlease select the coretools of data version "
                                + CompatibilityAnalyserPlugin.DATA_VERSION + ".");
                return false;
            } catch (Exception e) {
                MessageDialog.openError(Display.getCurrent().getActiveShell(),
                        Messages.getString("CompatibilityAnalyserPreferences.42"),
                        "Invalid data version of coretools. Please check the coretools.\nPlease select the coretools of data version "
                                + CompatibilityAnalyserPlugin.DATA_VERSION + ".");
                return false;
            }
            store.setValue(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH, localCmb.getText());
            userData.saveValue(SavingUserData.ValueTypes.CORE_PATH, localCmb.getText());
        } else {
            MessageDialog.openError(Display.getCurrent().getActiveShell(),
                    Messages.getString("CompatibilityAnalyserPreferences.30"), //$NON-NLS-1$
                    Messages.getString("CompatibilityAnalyserPreferences.31")); //$NON-NLS-1$ //$NON-NLS-3$
            return false;
        }
    }
    if (webcoreBtn.getSelection() == true) {
        String url1 = webLink.getText();
        if (url1.length() != 0) {
            if (isRefreshInvoked) {
                String prevFolder = store
                        .getString(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_ROOTDIR);

                FileMethods.deleteFolder(prevFolder);

                File currentFolder = new File(targetPath);
                currentFolder.renameTo(new File(CompatibilityAnalyserEngine.getWorkspacePath() + File.separator
                        + Messages.getString("CompatibilityAnalyserPreferences.WebServerContentsNew"))); //$NON-NLS-1$

                String corePath = CompatibilityAnalyserEngine.getWebServerToolsPath();

                if (corePath != null && corePath.equalsIgnoreCase(targetPath)) {
                    store.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH,
                            CompatibilityAnalyserEngine.getWorkspacePath() + File.separator + Messages
                                    .getString("CompatibilityAnalyserPreferences.WebServerContentsNew"));
                } else if (!corePath.equalsIgnoreCase(targetPath)) {
                    String coreRoot = CompatibilityAnalyserEngine.getWebServerToolsPath()
                            .substring(targetPath.length() + 1);
                    store.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH,
                            CompatibilityAnalyserEngine.getWorkspacePath() + File.separator
                                    + Messages
                                            .getString("CompatibilityAnalyserPreferences.WebServerContentsNew")
                                    + File.separator + coreRoot);
                }

                store.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_URL, url1);
                store.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_ROOTDIR,
                        CompatibilityAnalyserEngine.getWorkspacePath() + File.separator
                                + Messages.getString("CompatibilityAnalyserPreferences.WebServerContentsNew")); //$NON-NLS-1$

                isRefreshInvoked = false;

            }
            store.setValue(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL, url1);
        } else {
            MessageDialog.openError(Display.getCurrent().getActiveShell(),
                    Messages.getString("CompatibilityAnalyserPreferences.38"), //$NON-NLS-1$
                    Messages.getString("CompatibilityAnalyserPreferences.39")); //$NON-NLS-1$
            return false;
        }
    }
    if (sdkcoreBtn.getSelection() == true) {
        if (sdkCmb.getText().length() != 0) {
            store.setValue(CompatibilityAnalyserPreferencesConstants.SDK_NAME, sdkCmb.getText());
            ISymbianSDK selectedSdk = rndSdkList.elementAt(sdkCmb.getSelectionIndex());
            String bctoolsPath = FileMethods.appendPathSeparator(selectedSdk.getEPOCROOT())
                    + Messages.getString("CompatibilityAnalyserPreferences.40"); //$NON-NLS-1$
            File cbc = new File(
                    bctoolsPath + File.separator + Messages.getString("CompatibilityAnalyserPreferences.41")); //$NON-NLS-1$
            if (!cbc.exists()) {
                MessageDialog.openError(Display.getCurrent().getActiveShell(),
                        Messages.getString("CompatibilityAnalyserPreferences.42"), //$NON-NLS-1$
                        bctoolsPath + Messages.getString("CompatibilityAnalyserPreferences.43")); //$NON-NLS-1$
                return false;
            }

            try {
                String dv = CompatibilityAnalyserEngine.getDataVersion(bctoolsPath);
                int num = Integer.parseInt(dv);
                if (num != CompatibilityAnalyserPlugin.DATA_VERSION) {
                    if (!bctoolsPath.equalsIgnoreCase(CompatibilityAnalyserPlugin.getDefaltCoretoolsPath()))
                        MessageDialog.openError(Display.getCurrent().getActiveShell(),
                                Messages.getString("CompatibilityAnalyserPreferences.42"),
                                "Invalid data version of coretools. Please check the coretools.\nPlease select the coretools of data version "
                                        + CompatibilityAnalyserPlugin.DATA_VERSION + ".");
                    return false;
                }
            } catch (NumberFormatException e) {
                MessageDialog.openError(Display.getCurrent().getActiveShell(),
                        Messages.getString("CompatibilityAnalyserPreferences.42"),
                        "Invalid data version of coretools. Please check the coretools.\nPlease select the coretools of data version "
                                + CompatibilityAnalyserPlugin.DATA_VERSION + ".");
                return false;
            } catch (Exception e) {
                MessageDialog.openError(Display.getCurrent().getActiveShell(),
                        Messages.getString("CompatibilityAnalyserPreferences.42"),
                        "Invalid data version of coretools. Please check the coretools.\nPlease select the coretools of data version "
                                + CompatibilityAnalyserPlugin.DATA_VERSION + ".");
                return false;
            }

            store.setValue(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS_PATH, bctoolsPath);
        } else {
            MessageDialog.openError(Display.getCurrent().getActiveShell(),
                    Messages.getString("CompatibilityAnalyserPreferences.44"), //$NON-NLS-1$
                    "Please provide a R&D SDK for coretools"); //$NON-NLS-1$
            return false;
        }
    }

    store.setValue(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS, defaultcoreBtn.getSelection());
    store.setValue(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS, localcoreBtn.getSelection());
    store.setValue(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS, webcoreBtn.getSelection());
    store.setValue(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS, sdkcoreBtn.getSelection());

    store.setValue(CompatibilityAnalyserPreferencesConstants.BASELINES_URL, baselineTxt.getText());

    return super.performOk();
}

From source file:com.nokia.s60tools.compatibilityanalyser.utils.CompatibilityAnalyserUtils.java

License:Open Source License

/**
 * Starts the downloading core tools from web server with progress monitor.
 *///  ww  w  . j  ava  2s.  c  o  m
public static String initiateDownloadingCoreTools() {
    IRunnableWithProgress op = new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) {
            IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
            String urlInPref = prefStore.getString(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL);
            //If core tools were already downloaded from web server earlier, they will be deleted. 
            String previousContents = prefStore
                    .getString(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_ROOTDIR);
            if (previousContents != null && !previousContents.equals("")) //$NON-NLS-1$
            {
                File oldContents = new File(previousContents);
                if (oldContents.exists())
                    FileMethods.deleteFolder(previousContents);
            }
            String targetPath = FileMethods.appendPathSeparator(CompatibilityAnalyserEngine.getWorkspacePath())
                    + Messages.getString("HeaderAnalyserEngine.WebServerContentsNew"); //$NON-NLS-1$
            String coreToolsExtraction = CompatibilityAnalyserEngine
                    .readAndDownloadSupportedCoretools(urlInPref, targetPath, monitor);
            if (coreToolsExtraction == null) {
                temp = null;
                prefStore.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_URL,
                        urlInPref);
                prefStore.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH,
                        CompatibilityAnalyserEngine.getWebServerToolsPath());
                prefStore.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_ROOTDIR,
                        targetPath);
            } else
                temp = coreToolsExtraction;
        }
    };
    IWorkbench wb = PlatformUI.getWorkbench();
    IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
    Shell shell = win != null ? win.getShell() : null;
    try {
        new ProgressMonitorDialog(shell).run(true, true, op);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        return "Error!";
    } catch (InterruptedException e) {
        e.printStackTrace();
        return "Error!";
    }

    //If download not successful 
    if (temp != null)
        return temp;

    return null;
}

From source file:com.nokia.s60tools.crashanalyser.ui.preferences.CrashAnalyserPreferences.java

License:Open Source License

@Override
public boolean performOk() {
    IPreferenceStore store = CrashAnalyserPlugin.getCrashAnalyserPrefsStore();

    store.setValue(CrashAnalyserPreferenceConstants.TRACE_LISTENER, buttonListenTraceViewer.getSelection());
    store.setValue(CrashAnalyserPreferenceConstants.EPOCWIND_LISTENER, buttonEpocwind.getSelection());
    store.setValue(CrashAnalyserPreferenceConstants.SHOW_VISUALIZER, buttonShowVisualizer.getSelection());

    CrashAnalyserPlugin.startEmulatorListener();
    CrashAnalyserPlugin.startTraceListener();

    return super.performOk();
}

From source file:com.nokia.s60tools.creator.preferences.CreatorPreferencePage.java

License:Open Source License

/**
 * Save prefix seach order preferences//  w w w.  java  2s  .  c  om
 * @param store
 */
private void saveDefaultFolderPreferences(IPreferenceStore store) {
    String value = saveFolder.getText();
    store.setValue(CreatorPreferenceConstants.DEFAULT_DEVICE_SAVE_FOLDER, value);
}

From source file:com.nokia.s60tools.creator.preferences.CreatorPreferences.java

License:Open Source License

/**
 * Set "Don't ask again" value for replace files in device
 * @param isDontAskAgainChecked <code>true</code> if don't ask again is selected, <code>false</code> otherwise.
 *///from   w  w w .  j av  a 2s.com
public static void setDontAskFileReplaceInDevice(boolean isDontAskAgainChecked) {

    IPreferenceStore store = CreatorActivator.getPrefsStore();

    if (isDontAskAgainChecked) {
        store.setValue(CreatorPreferenceConstants.CREATOR_DONT_ASK_REPLACE, CreatorPreferenceConstants.TRUE);
    } else {
        store.setValue(CreatorPreferenceConstants.CREATOR_DONT_ASK_REPLACE, CreatorPreferenceConstants.FALSE);
    }
}

From source file:com.nokia.s60tools.creator.preferences.CreatorPreferences.java

License:Open Source License

/**
 * Set "Don't ask again" value for show information to follow execution in device
 * @param isDontAskAgainChecked <code>true</code> if don't ask again is selected, <code>false</code> otherwise.
 *///from   ww  w .  ja v a  2  s .co m
public static void setDontAskShowInformation(boolean isDontAskAgainChecked) {

    IPreferenceStore store = CreatorActivator.getPrefsStore();

    if (isDontAskAgainChecked) {
        store.setValue(CreatorPreferenceConstants.DONT_ASK_SHOW_INFORMATION, CreatorPreferenceConstants.TRUE);
    } else {
        store.setValue(CreatorPreferenceConstants.DONT_ASK_SHOW_INFORMATION, CreatorPreferenceConstants.FALSE);
    }
}

From source file:com.nokia.s60tools.creator.preferences.CreatorPreferences.java

License:Open Source License

/**
 * Set "Don't ask again" value for replace files in device
 * @param isDontAskAgainChecked <code>true</code> if don't ask again is selected, <code>false</code> otherwise.
 *///  w  ww . j a  v a2s .c om
public static void setDontAskShutdownCreator(boolean isDontAskAgainChecked) {

    IPreferenceStore store = CreatorActivator.getPrefsStore();

    if (isDontAskAgainChecked) {
        store.setValue(CreatorPreferenceConstants.CREATOR_DONT_ASK_SHUTDOWN, CreatorPreferenceConstants.TRUE);
    } else {
        store.setValue(CreatorPreferenceConstants.CREATOR_DONT_ASK_SHUTDOWN, CreatorPreferenceConstants.FALSE);
    }
}

From source file:com.nokia.s60tools.imaker.internal.preferences.ImageFlasherPreferencePage.java

License:Open Source License

private void storeValues() {
    IPreferenceStore store = doGetPreferenceStore();
    store.setValue(PreferenceConstants.PREFERENCES_DIRECTORY, textPreferencesDirectory.getText());
    store.setValue(PreferenceConstants.CONFML_SELECTION_DIALOG, checkConfml.getSelection());
}

From source file:com.nokia.s60tools.memspy.preferences.MemSpyPreferences.java

License:Open Source License

/**
 * Sets SWMT category settings for this session.
 * @param sessionSpecificSWMTCategorySetting SWMT category settings to set for this session
 *//*  w ww .  j a  v a  2 s . co  m*/
public static void setSWMTCategorySetting(int sessionSpecificSWMTCategorySetting, boolean isProfileSettings) {
    IPreferenceStore store = MemSpyPlugin.getPrefsStore();
    setProfileTrackedCategoriesSelected(isProfileSettings);
    if (isProfileSettings) {
        store.setValue(MemSpyPreferenceConstants.SWMT_CATEGORY_SETTING, sessionSpecificSWMTCategorySetting);
    } else {
        store.setValue(MemSpyPreferenceConstants.SWMT_CATEGORY_SETTINGS_CUSTOM,
                sessionSpecificSWMTCategorySetting);
    }
}