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.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
 *///from  w  w w.  jav a 2  s  . c o  m
public static void setProfileTrackedCategoriesSelected(boolean isAllCategoriesSelected) {
    IPreferenceStore store = MemSpyPlugin.getPrefsStore();
    store.setValue(MemSpyPreferenceConstants.SWMT_CATEGORY_SETTING_PROFILE_SELECTED, isAllCategoriesSelected);
}

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

License:Open Source License

/**
 * Sets the SWMT Heap Dump selection on/off
 * @param selection/*from   w  w  w  . j a  v a 2 s  .com*/
 */
public static void setSWMTHeapDumpSelected(boolean selection) {
    IPreferenceStore store = MemSpyPlugin.getPrefsStore();
    store.setValue(MemSpyPreferenceConstants.SWMT_HEAP_DUMP_SELECTED, selection);
}

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

License:Open Source License

/**
 * Sets SWMT HeapNameFilter setting for this session.
 * @param heapNameFilter SWMT HeapNameFilter settings to set for this session.
 *///from w w w  . j  a  v a2  s  .c  o m
public static void setSWMTHeapNameFilter(String heapNameFilter) {
    IPreferenceStore store = MemSpyPlugin.getPrefsStore();
    store.setValue(MemSpyPreferenceConstants.SWMT_HEAPFILTER_SETTING, heapNameFilter);
}

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

License:Open Source License

/**
 * Sets the user selection if S60 device is closed between cycles
 * @param selection/* www  .j a v a  2  s  . c  o m*/
 */
public static void setCloseSymbianAgentBetweenCycles(boolean selection) {
    IPreferenceStore store = MemSpyPlugin.getPrefsStore();
    store.setValue(MemSpyPreferenceConstants.CLOSE_BETWEEN_CYCLES, selection);
}

From source file:com.nokia.s60tools.remotecontrol.ftp.ui.view.PathHistory.java

License:Open Source License

/**
 * Store path history to preference store. Only store first <PATH_HISTORY_SIZE>+2 paths.
 */// w  w w  . ja v  a2 s .  c  o m
private void storePathHistory() {
    IPreferenceStore prefStore = RemoteControlActivator.getPrefsStore();
    // Form data into a string separated with commas.
    String storeString = "";
    for (int i = 0; (i < getPathHistory().size()) && (i < PATH_HISTORY_SIZE + 2); i++) {
        storeString += getPathHistory().get(i).toString() + ",";
    }
    // Remove last comma.
    storeString = storeString.substring(0, storeString.length() - 1);
    // Store string.
    prefStore.setValue(CACHE_NAME, storeString);
}

From source file:com.nokia.s60tools.symbianfoundationtemplates.actions.OpenWizardAction.java

License:Open Source License

public void run(final IAction action) {
    IWorkbenchWindow window = SymbianFoundationTemplates.getDefault().getWorkbench().getActiveWorkbenchWindow();
    ISelection selection = (ISelection) window.getSelectionService().getSelection();
    IProject prj = CarbideBuilderPlugin.getProjectInContext();
    ICarbideBuildManager mngr = CarbideBuilderPlugin.getBuildManager();
    prjInfo = mngr.getProjectInfo(prj);/*from www .  ja v  a  2 s  .c om*/
    List<java.io.File> userinc = new ArrayList<java.io.File>();
    List<java.io.File> sysinc = new ArrayList<java.io.File>();

    if (selection instanceof TreeSelection) {
        IStructuredSelection treeSelection = (IStructuredSelection) selection;
        IPath mmp = new Path(treeSelection.getFirstElement().toString());
        EpocEnginePathHelper pathHelper = new EpocEnginePathHelper(prjInfo.getProject());
        //EpocEngineHelper.getMMPIncludePaths(prjInfo.getProject(),fl.getProjectRelativePath(),prjInfo.getDefaultConfiguration(), userinc, sysinc);

        //gets USERINCLUDE paths from the MMP file
        //Treeselection object is different for different views
        //(i.e. for Sysmbian Project Navigator  and Project Explorer)
        IPath mmpPath = null;
        if (treeSelection.getFirstElement() instanceof IResource) {
            mmpPath = ((IResource) treeSelection.getFirstElement()).getLocation();
            EpocEngineHelper.getMMPIncludePaths(prjInfo.getProject(),
                    ((IFile) treeSelection.getFirstElement()).getProjectRelativePath(),
                    prjInfo.getDefaultConfiguration(), userinc, sysinc);
        } else {
            IFile fl = ResourcesPlugin.getWorkspace().getRoot().getFile(mmp);
            mmpPath = fl.getLocation();
            EpocEngineHelper.getMMPIncludePaths(prjInfo.getProject(), fl.getProjectRelativePath(),
                    prjInfo.getDefaultConfiguration(), userinc, sysinc);
        }
        //gets SOURCEPATH paths from the MMP file  
        List<IPath> sourceFiles = EpocEngineHelper
                .getSourceFilesForConfiguration(prjInfo.getDefaultConfiguration(), mmpPath);//mmppath.makeAbsolute());
        Iterator<IPath> srsFilesItr = sourceFiles.iterator();
        List<String> srcDirs = new ArrayList<String>();
        while (srsFilesItr.hasNext()) {
            //IFile inc=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(test.next().toFile().getParent()));
            IPath mmppath = srsFilesItr.next();
            String str = (pathHelper.convertFilesystemToWorkspace(mmppath)).toFile().getParent().replace('\\',
                    '/');
            if (!srcDirs.contains(str)) {
                srcDirs.add(str);
            }
        }

        MMPSourceUserIncPaths prevPaths = new MMPSourceUserIncPaths();

        //Convert all user include paths to project-relative
        List<String> userIncPaths = new ArrayList<String>();
        Iterator<File> incItr = userinc.iterator();
        while (incItr.hasNext()) {
            //IFile inc=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(inci.next().getAbsolutePath()));
            IPath incpath = new Path(incItr.next().getAbsolutePath());
            String str = (pathHelper.convertFilesystemToWorkspace(incpath)).toString().replace('\\', '/');
            userIncPaths.add(str);
        }

        prevPaths.saveValues(MMPSourceUserIncPaths.ValueTypes.SRC_DIRS, srcDirs.toArray(new String[0]));
        prevPaths.saveValues(MMPSourceUserIncPaths.ValueTypes.USERINC_DIRS,
                userIncPaths.toArray(new String[0]));

    }
    //set boolean true when open from the project view 
    IPreferenceStore preferenceStore = SymbianFoundationTemplates.getDefault().getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.OPENED_FROM_VIEW, true);
    Runnable showWizardRunnable = new Runnable() {
        public void run() {
            WizardDialog wizDialog;
            if (action.getText().equalsIgnoreCase("C Class")) {
                wiz = new CClassWizard();
                wiz.setWindowTitle(Messages.getString("CClassWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("M Class")) {
                wiz = new MClassWizard();
                wiz.setWindowTitle(Messages.getString("MClassWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("R Class")) {
                wiz = new RClassWizard();
                wiz.setWindowTitle(Messages.getString("RClassWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("T Class")) {
                wiz = new TClassWizard();
                wiz.setWindowTitle(Messages.getString("TClassWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("C Class Header")) {
                wiz = new CHeaderWizard();
                wiz.setWindowTitle(Messages.getString("CHeaderWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("M Class Header")) {
                wiz = new MHeaderWizard();
                wiz.setWindowTitle(Messages.getString("MHeaderWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("R Class Header")) {
                wiz = new RHeaderWizard();
                wiz.setWindowTitle(Messages.getString("RHeaderWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("T Class Header")) {
                wiz = new THeaderWizard();
                wiz.setWindowTitle(Messages.getString("THeaderWizardTitle"));
            } else if (action.getText().equalsIgnoreCase("Source File")) {
                wiz = new SourceWizard();
                wiz.setWindowTitle(Messages.getString("SourceWizardTitle"));
            }
            wizDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
            wizDialog.create();
            wizDialog.getShell().setSize(550, 620);
            try {
                wizDialog.setBlockOnOpen(true);
                wizDialog.open();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    Display.getDefault().syncExec(showWizardRunnable);

    clearAllPreviousValues();

}

From source file:com.nokia.s60tools.symbianfoundationtemplates.actions.OpenWizardAction.java

License:Open Source License

/**
 * Clear all the values before the wizard is opened next time.
 *
 *//*from   w ww. j  a  va2s  .  com*/
private void clearAllPreviousValues() {
    IPreferenceStore preferenceStore = SymbianFoundationTemplates.getDefault().getPreferenceStore();
    MMPSourceUserIncPaths toClearPaths = new MMPSourceUserIncPaths();
    toClearPaths.saveValues(MMPSourceUserIncPaths.ValueTypes.SRC_DIRS, null);
    toClearPaths.saveValues(MMPSourceUserIncPaths.ValueTypes.USERINC_DIRS, null);
    preferenceStore.setValue(PreferenceConstants.OPENED_FROM_VIEW, false);
}

From source file:com.nokia.s60tools.testdrop.ui.preferences.TestDropPreferences.java

License:Open Source License

/**
 * Called when user saves preferences or changes the preference page to
 * another//  www  .j av a2s.c o  m
 */
public boolean performOk() {
    if (isPasswordSame(passwordText.getText(), confirmPasswordText.getText())) {
        IPreferenceStore prefStore = TestDropPlugin.getPrefStore();
        if (testDropImportButton.getSelection()) {
            prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_IMPORT, true);
        } else {
            prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_IMPORT, false);
            try {
                if (testDropPathText.getText().length() > 0) {
                    Path path = new Path(testDropPathText.getText());
                    if (StartUp.getConnectionProperties() != null) {
                        StartUp.getConnectionProperties().setDropPath(path);
                    }
                    prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_PATH, path.toString());
                } else {
                    throw new Exception();
                }
            } catch (Exception ex) {
                LogExceptionHandler.showErrorDialog(
                        Messages.getString("TestDropPreferences.testDropPathIsNotValidNotify"));
                return false;
            }
        }

        prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_ENABLE_HARDWARE,
                enableHardwareTestDropCheck.getSelection());

        if (enableHardwareTestDropCheck.getSelection()) {
            if (hostText.getText().length() == 0 || portText.getText().length() == 0
                    || usernameText.getText().length() == 0 || passwordText.getText().length() == 0
                    || confirmPasswordText.getText().length() == 0) {
                LogExceptionHandler
                        .showNotifyDialog(Messages.getString("StartUp.ConnectionSettingsFailException"));
                return false;
            } else {
                prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_CONNECTION_HOST, hostText.getText());
                prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_CONNECTION_PORT,
                        Integer.valueOf(portText.getText()));
                prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_CONNECTION_USERNAME,
                        usernameText.getText());
                prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_CONNECTION_PASSWORD,
                        passwordText.getText());
            }
        }

        prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_SHOW_TEST_RESULT,
                testResultViewCombo.getItem(testResultViewCombo.getSelectionIndex()));

        if (testResultPathText.getText().length() > 0) {
            try {
                Path path = new Path(testResultPathText.getText());
                prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_TEST_RESULT_PATH, path.toString());
            } catch (Exception ex) {
                LogExceptionHandler
                        .showErrorDialog(Messages.getString("TestDropPreferences.testResultPathIsNotValid"));
                return false;
            }
        } else {
            prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_TEST_RESULT_PATH, "");
        }
        if (alwaysButton.getSelection()) {
            prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_TARGET_DEVICE_CACHE,
                    targetDeviceListCacheCombo.getItem(targetDeviceListCacheCombo.getSelectionIndex()));
            prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_DIALOG_SHOW_MODE, DIALOG_SHOW_MODE_ALWAYS);
        } else {
            int index = targetDeviceListCombo.getSelectionIndex();
            if (index == -1) {
                LogExceptionHandler.showNotifyDialog(SELECT_ONE_TARGET_MSG);
                return false;
            } else {
                prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_DIALOG_SHOW_MODE,
                        DIALOG_SHOW_MODE_DEFAULT);
                prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_SELECTED_TARGET_DEVICE,
                        targetDeviceListCombo.getItem(targetDeviceListCombo.getSelectionIndex()));
                dialogModel.setSelectedMasterDeviceIndex(index);
                if (!targetDeviceListCombo.getItem(targetDeviceListCombo.getSelectionIndex()) // this block will be run 
                        .contains("emulator")) { // only when hardware device
                    dialogModel.getSelectedMasterDevice().setRank( // is chosen as default
                            StartUp.RANK_MASTER); // Those settings are not
                    List<File> images = dialogModel // needed for emulator
                            .getSelectedMasterDevice().getImages();
                    String imageList = "";
                    if (images != null && images.size() > 0) {
                        Iterator<File> iterator = images.iterator();
                        while (iterator.hasNext()) {
                            File file = iterator.next();
                            imageList += file.getPath() + ";";
                        }
                        imageList = imageList.substring(0, (imageList.length() - 1));
                    }
                    prefStore.setValue(TestDropPreferenceConstants.TEST_DROP_TARGET_DEVICE_FLASH_IMAGE_LIST,
                            imageList);
                }
                StartUp.setDialogModel(dialogModel);
            }
        }

    } else {
        LogExceptionHandler.showErrorDialog(PASSWORD_DISMATCH);
        return false;
    }
    return super.performOk();
}

From source file:com.nokia.sdt.sourcegen.SourceGenUtils.java

License:Open Source License

public static void setAuthorPreference(String value) {
    if (Platform.isRunning()) {
        TemplateWizardPlugin.getDefault().getDialogSettings().put(AUTHOR_PREFERENCE, value);
    } else {//w w  w  .j  av a 2s.  c  o m
        IPreferenceStore preferenceStore = getPreferenceStore();
        if (preferenceStore == null)
            return;
        preferenceStore.setValue(AUTHOR_PREFERENCE, value);
    }
}

From source file:com.nokia.sdt.sourcegen.SourceGenUtils.java

License:Open Source License

public static void setCopyrightPreference(String value) {
    if (Platform.isRunning()) {
        TemplateWizardPlugin.getDefault().getDialogSettings().put(COPYRIGHT_PREFERENCE, value);
    } else {/*  www .jav a2 s .c  om*/
        IPreferenceStore preferenceStore = getPreferenceStore();
        if (preferenceStore == null)
            return;
        preferenceStore.setValue(COPYRIGHT_PREFERENCE, value);
    }
}