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.nokia.s60tools.testdrop.util.StartUp.java

License:Open Source License

/**
 * Runs a new RunTestModuleJob. This is a test run for emulator
 *
 *//*from   w w w . j a  v a  2 s.  co  m*/
public static void runTestDrop() {
    if (RunTestModuleJob.getIsTestRunInProgress()) {
        LogExceptionHandler.showErrorDialog(Messages.getString("TestDropTargetDialog.testRunIsInProgress"));
        return;
    }
    IPreferenceStore prefStore = TestDropPlugin.getPrefStore();
    String selectedDevice = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_SELECTED_TARGET_DEVICE);
    String chosenDeviceName = selectedDevice.substring(0,
            selectedDevice.indexOf(DialogContentFactory.EMULATOR_DEVICE_POSTFIX));

    TestRun testRun = null;
    if (dialogModel.getSelectedProject() != null) {
        testRun = new TestRun(dialogModel.getSelectedProject(), chosenDeviceName);
    } else if (dialogModel.getSelectedCfgFiles() != null) {
        boolean isComponentsGroupEnabled = false;
        TestCombinerInputDialog combinerInputDialog = new TestCombinerInputDialog(
                Display.getCurrent().getActiveShell(), null, isComponentsGroupEnabled);
        combinerInputDialog.open();
        if (combinerInputDialog.getReturnCode() != org.eclipse.jface.window.Window.OK) {
            return;
        }
        boolean debugVariantActive = combinerInputDialog.getIfDebugVariantChosen();
        testRun = new TestRun(dialogModel.getSelectedCfgFiles(), chosenDeviceName, debugVariantActive);
    }

    ValidationResult validationResult = TestRunValidator.validateTestRun(testRun);
    if (validationResult.getValidationProblem() != ValidationProblem.NO_PROBLEM) {
        MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell());
        messageBox.setText(Messages.getString("TestDropTargetDialog.fileNotFoundMessage"));
        messageBox.setMessage(validationResult.getMessage());
        messageBox.open();
        return;
    }

    RunTestModuleJob runJob = new RunTestModuleJob(testRun);
    runJob.setPriority(Job.SHORT);
    runJob.schedule();
    StartUp.addListenerToEmulatorJob(runJob);
}

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

License:Open Source License

public static String getAuthorPreference() {
    if (Platform.isRunning()) {
        return TemplateWizardPlugin.getDefault().getDialogSettings().get(AUTHOR_PREFERENCE);
    } else {//from w  w  w  . j a v  a 2s. co  m
        IPreferenceStore preferenceStore = getPreferenceStore();
        if (preferenceStore == null)
            return null;
        return preferenceStore.getString(AUTHOR_PREFERENCE);
    }
}

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

License:Open Source License

public static String getCopyrightPreference() {
    if (Platform.isRunning()) {
        return TemplateWizardPlugin.getDefault().getDialogSettings().get(COPYRIGHT_PREFERENCE);
    } else {//from w w  w .  j a va2  s.c  o  m
        IPreferenceStore preferenceStore = getPreferenceStore();
        if (preferenceStore == null)
            return null;
        return preferenceStore.getString(COPYRIGHT_PREFERENCE);
    }
}

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

License:Open Source License

public static File getSourceFileHeaderTemplate() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    if (preferenceStore == null)
        return null;
    String filePath = preferenceStore.getString(PreferenceConstants.P_FILE_HEADER_TEMPLATE_LOCATION);
    if ((filePath == null) || (filePath.length() == 0))
        return null;
    return new File(filePath);
}

From source file:com.nokia.testfw.codegen.ui.wizard.PropertyPage.java

License:Open Source License

protected void initDefaults() {
    IPreferenceStore preferenceStore = CodegenUIPlugin.getDefault().getPreferenceStore();
    setUID3Random();//from   ww  w  . j a  v a2  s.c  om
    iAutherNameEdit.setText(iAutherName = preferenceStore.getString(PreferenceConstants.AUTHER));
}

From source file:com.nokia.tools.s60.editor.ScreenModelMediator.java

License:Open Source License

/**
 * Updates the preferences when user adds/removes gallery screens.
 * //w  ww  .  j a v  a2 s  .  co m
 * @param newScreen the new screen to be added. 
 */
protected void updateGalleryPreferences(IGalleryScreen screenEffected, boolean isDelete) {
    if (!isGalleryPersistable()) {
        return;
    }

    IPreferenceStore store = S60WorkspacePlugin.getDefault().getPreferenceStore();
    String prefName = IS60IDEConstants.PREF_GALLERY_SCREENS + "."
            + screenEffected.getData().getRoot().getType();
    String screens = store.getString(prefName);
    StringBuffer sb = new StringBuffer();
    if (screens != null) {
        String[] strs = screens.split(",");
        for (String str : strs) {
            if (isDelete && screenEffected != null && str.equals(screenEffected.getName())) {
                continue;
            }
            sb.append(str + ",");
        }
    }
    if (!isDelete && screenEffected != null) {
        sb.append(screenEffected.getName() + ",");
    }
    if (sb.length() > 0) {
        // removes the trailing ","
        sb.deleteCharAt(sb.length() - 1);
    }
    synchronized (this) {
        suppressPreferenceChangeEvents = true;
        try {
            store.setValue(prefName, sb.toString());
            if (store.needsSaving() && store instanceof IPersistentPreferenceStore) {
                try {
                    ((IPersistentPreferenceStore) store).save();
                } catch (IOException e) {
                    S60WorkspacePlugin.error(e);
                }
            }
        } finally {
            suppressPreferenceChangeEvents = false;
        }
    }
}

From source file:com.nokia.tools.s60.preferences.ExternalToolsPreferencePage.java

License:Open Source License

/**
 * Initializes states of the controls from the preference store.
 *//*w ww  .  ja v  a  2s .  c  o m*/
private void initializeValues() {
    IPreferenceStore store = getPreferenceStore();
    bitmapEditorTextField.setText(store.getString(IMediaConstants.PREF_BITMAP_EDITOR));
    soundEditorTextField.setText(store.getString(IMediaConstants.PREF_SOUND_EDITOR));
    vectorEditorTextField.setText(store.getString(IMediaConstants.PREF_VECTOR_EDITOR));

    audioPlayerTextField.setText(store.getString(IMediaConstants.PREF_AUDIO_PLAYER));
    videoPlayerTextField.setText(store.getString(IMediaConstants.PREF_VIDEO_PLAYER));

    store = UiPlugin.getDefault().getPreferenceStore();
}

From source file:com.nokia.tools.s60.preferences.S60UICustomizationGeneralPreferencePage.java

License:Open Source License

/**
 * Initializes states of the controls from the preference store.
 *//*www .  j av a2s . c o  m*/
private void initializeValues() {
    IPreferenceStore store = getPreferenceStore();
    svgConversionCheckbox.setSelection(store.getBoolean(IMediaConstants.PREF_SILENT_SVG_CONVERSION));
    silent9PieceReplaceCheck.setSelection(store.getBoolean(IMediaConstants.PREF_NINE_PIECE_2SINGLE_ASK));
    silentSinglePieceReplaceCheck.setSelection(store.getBoolean(IMediaConstants.PREF_SINGLE_PIECE_2NINE_ASK));

    store = S60WorkspacePlugin.getDefault().getPreferenceStore();
    hidePreviewNotAvailableCheck
            .setSelection(store.getBoolean(IS60IDEConstants.PREF_NO_PREVIEW_HIDE_MESSAGEBOX));
    showFloatingToolbarCheck.setSelection(store.getBoolean(IS60IDEConstants.PREF_SHOW_EDITOR_TOOLTIP));

    for (IContent content : contents) {
        String val = store.getString(IS60IDEConstants.PREF_GALLERY_SCREENS + "." + content.getType());
        updateGalleryCheckboxes(content, val);
    }

    store = UiPlugin.getDefault().getPreferenceStore();
    autoSaveBeforePackagingCheck
            .setSelection(store.getBoolean(IScreenConstants.PREF_SAVE_BEFORE_PACKAGING_ASK));
    zoomGlobalRadio.setSelection(store.getBoolean(IScreenConstants.PREF_ZOOMING_GLOBAL));
    zoomIndividualRadio.setSelection(!zoomGlobalRadio.getSelection());
    showScreenAnimationCheck.setSelection(!store.getBoolean(IScreenConstants.PREF_AUTO_ANIMATION_DISABLED));
}

From source file:com.nokia.tools.screen.ui.dialogs.PathHandlingConfig.java

License:Open Source License

public static PathHandlingConfig load() {

    IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore();
    PathHandlingConfig cfg = new PathHandlingConfig();

    // Defaults//from  ww w . ja  va  2  s. c  o  m
    iPreferenceStore.setDefault(PREF_USE_PREDEFINED, false);
    iPreferenceStore.setDefault(PREF_RECENT_COUNT, 5);

    cfg.usePredefined = iPreferenceStore.getBoolean(PREF_USE_PREDEFINED);
    cfg.recentCount = iPreferenceStore.getInt(PREF_RECENT_COUNT);

    int defCount = iPreferenceStore.getInt(PREF_PREDEFINED_COUNT);
    int recCount = iPreferenceStore.getInt(PREF_RECENT_COUNT);

    cfg.predefinedPathList = new ArrayList<String>();

    for (int i = 0; i < defCount; i++) {
        String path = iPreferenceStore.getString(PREF_ADD_PREDEFINED + (i));
        if (path.length() > 0 && new File(path).exists()) {
            cfg.predefinedPathList.add(path);
        }
    }

    cfg.recentPathList = new ArrayList<String>();

    for (int i = 0; i < recCount; i++) {
        String path = iPreferenceStore.getString(PREF_ADD_RECENTLY + (i));
        if (path.length() > 0 && new File(path).exists()) {
            cfg.recentPathList.add(path);
        }
    }
    return cfg;
}

From source file:com.nokia.tools.screen.ui.wizards.ExportWizardPage1.java

License:Open Source License

protected void setDefaultDestination() {

    String destinationDir = null;
    String defaultDestDir = ResourcesPlugin.getWorkspace().getRoot().getLocation().makeAbsolute().toOSString();

    // try to recall last one
    IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore();
    destinationDir = iPreferenceStore.getString(PREF_LAST_EXPORT_LOCATION);

    if (!StringUtils.isEmpty(destinationDir)) {
        File destFile = new File(destinationDir);
        if (destFile.isAbsolute() && destFile.isDirectory()) {
            // ok
        } else {//from ww  w .  ja  v  a2s .  com
            destinationDir = defaultDestDir;
        }
    }

    if (StringUtils.isEmpty(destinationDir)) {
        destinationDir = defaultDestDir;
    }

    // create default destination
    if (strSelProjects != null) {
        destinationDir += File.separator + strSelProjects[0] + getExtension();
    }

    this.destination = destinationDir;

    destText.setText(this.destination);
    updatePageCompletion();
}