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

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

Introduction

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

Prototype

@Override
    public void setValue(String name, boolean value) 

Source Link

Usage

From source file:org.osate.ui.wizards.AadlProjectWizard.java

License:Open Source License

/**
 * Do the work after everything is specified. <!-- begin-user-doc --> <!--
 * end-user-doc -->/*from   w  w  w .ja  v  a2s.c om*/
 * 
 * @generated NOT
 */
public boolean performFinish() {
    createNewProject();
    if (newProject == null)
        return false;
    updatePerspective();
    selectAndReveal(newProject);
    final IProject p = getNewProject();
    final IFolder defModDir = p.getFolder(WorkspacePlugin.DEFAULT_MODEL_DIR);
    final IFolder xmlPack = defModDir.getFolder(WorkspacePlugin.AADL_PACKAGES_DIR);
    final IFolder xmlPSet = defModDir.getFolder(WorkspacePlugin.PROPERTY_SETS_DIR);
    final IFolder defSrcDir = p.getFolder(WorkspacePlugin.DEFAULT_SOURCE_DIR);
    final IFolder srcPack = defSrcDir.getFolder(WorkspacePlugin.AADL_PACKAGES_DIR);
    final IFolder srcPSet = defSrcDir.getFolder(WorkspacePlugin.PROPERTY_SETS_DIR);

    try {
        CoreUtility.createFolder(xmlPack, true, true, null);
        CoreUtility.createFolder(xmlPSet, true, true, null);
        CoreUtility.createFolder(srcPack, true, true, null);
        CoreUtility.createFolder(srcPSet, true, true, null);
    } catch (CoreException e) {
        MessageDialog.openError(getShell(), "Creation Problems",
                MessageFormat.format("Problem creating folder", e.getStackTrace().toString()));
    }
    String filepath = p.getFile(WorkspacePlugin.AADLPATH_FILENAME).getRawLocation().toString();

    PreferenceStore ps = new PreferenceStore(filepath);
    ps.setValue(WorkspacePlugin.PROJECT_SOURCE_DIR, WorkspacePlugin.DEFAULT_SOURCE_DIR);
    ps.setValue(WorkspacePlugin.PROJECT_MODEL_DIR, WorkspacePlugin.DEFAULT_MODEL_DIR);
    try {
        ps.save();
    } catch (IOException e1) {
        MessageDialog.openError(getShell(), "Save Problem", //$NON-NLS-1$
                MessageFormat.format("Problem saving Preference Store", e1.getStackTrace().toString()));
    }
    try {
        p.refreshLocal(1, null);
    } catch (CoreException e2) {
        MessageDialog.openError(getShell(), "Refresh Problems Problems", //$NON-NLS-1$
                MessageFormat.format(
                        "Resource changes are disallowed during certain types of resource change event notification",
                        e2.getStackTrace().toString()));
    }
    try {
        if (!p.hasNature(XtextProjectHelper.NATURE_ID)) {
            IProjectDescription desc = p.getDescription();
            String[] oldNatures = desc.getNatureIds();
            String[] newNatures = new String[oldNatures.length + 1];
            System.arraycopy(oldNatures, 0, newNatures, 0, oldNatures.length);
            newNatures[oldNatures.length] = XtextProjectHelper.NATURE_ID;
            desc.setNatureIds(newNatures);
            p.setDescription(desc, null);
        }
    } catch (CoreException e) {
        OsateCorePlugin.log(e);
    }
    AadlNature.addNature(p, null);
    return true;
}

From source file:org.python.pydev.ui.interpreters.InterpreterManagerTest.java

License:Open Source License

public void testInterpreterManager() throws Exception {
    Collection<String> pythonpath = new ArrayList<String>();
    pythonpath.add(TestDependent.PYTHON_LIB);
    pythonpath.add(TestDependent.PYTHON_SITE_PACKAGES);

    PreferenceStore prefs = new PreferenceStore();
    String interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON_EXE, pythonpath).toString();
    prefs.setValue(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);
    PythonInterpreterManager manager = new PythonInterpreterManager(prefs);
    checkSameInterpreterInfo(manager);//from  ww w  .java 2s.  co  m

    manager.clearCaches();
    InterpreterInfo info = checkSameInterpreterInfo(manager);

    pythonpath = new ArrayList<String>();
    pythonpath.add(TestDependent.PYTHON_LIB);
    pythonpath.add(TestDependent.PYTHON_SITE_PACKAGES);
    pythonpath.add(additionalPythonpathEntry.toString());
    interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON_EXE, pythonpath).toString();
    prefs.setValue(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);

    info = checkSameInterpreterInfo(manager);
}