org.osgi.service.prefs.BackingStoreException Java Examples

The following examples show how to use org.osgi.service.prefs.BackingStoreException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CcConfiguration.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Updates the persistent configuration.
 * @param config The new configuration to be saved.
 */
@Override
public void update(Map<ConfigTypes, String> config) {
    ConfigLogger configLogger = new ConfigLogger("Updated Project configuration with the following:");
    for (Map.Entry<ConfigTypes, String> entry : config.entrySet())
    {    
        preferences.put(entry.getKey().toString(), entry.getValue());
        this.config.put(entry.getKey(), entry.getValue());
        configLogger.append(entry);
    }
    configLogger.log();
    try {
        preferences.flush();
    } catch (BackingStoreException e) {
        Logger.log(IStatus.ERROR, e.getMessage());
        e.printStackTrace();
    }
    notifyListeners(config);
}
 
Example #2
Source File: ProjectUtilities.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a populated project via the {@link IWebAppProjectCreator}.
 *
 * @throws FileNotFoundException
 * @throws UnsupportedEncodingException
 * @throws MalformedURLException
 * @throws BackingStoreException
 * @throws ClassNotFoundException
 * @throws SdkException
 * @throws CoreException
 * @throws IOException
 */
public static IProject createPopulatedProject(String projectName,
    IWebAppProjectCreator.Participant... creationParticipants) throws MalformedURLException,
    ClassNotFoundException, UnsupportedEncodingException, FileNotFoundException, CoreException,
    SdkException, BackingStoreException, IOException {

  IWebAppProjectCreator projectCreator = ProjectUtilities.createWebAppProjectCreator();
  projectCreator.setProjectName(projectName);
  projectCreator.setPackageName(projectName.toLowerCase());

  for (IWebAppProjectCreator.Participant participant : creationParticipants) {
    participant.updateWebAppProjectCreator(projectCreator);
  }

  projectCreator.create(new NullProgressMonitor());

  return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
}
 
Example #3
Source File: IssueInformationPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Invoked when the wizard is closed with the "Finish" button.
 *
 * @return {@code true} for closing the wizard; {@code false} for keeping it open.
 */
public boolean performFinish() {
	final IEclipsePreferences prefs = SARLEclipsePlugin.getDefault().getPreferences();
	final String login = this.trackerLogin.getText();
	if (Strings.isEmpty(login)) {
		prefs.remove(PREFERENCE_LOGIN);
	} else {
		prefs.put(PREFERENCE_LOGIN, login);
	}
	try {
		prefs.sync();
		return true;
	} catch (BackingStoreException e) {
		ErrorDialog.openError(getShell(), e.getLocalizedMessage(), e.getLocalizedMessage(),
				SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, e));
		return false;
	}
}
 
Example #4
Source File: UserAgentManager.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void clearPreferences(IProject project)
{
	if (project != null)
	{
		// Save to the project scope
		IEclipsePreferences preferences = new ProjectScope(project).getNode(CommonEditorPlugin.PLUGIN_ID);
		preferences.remove(IPreferenceConstants.USER_AGENT_PREFERENCE);
		try
		{
			preferences.flush();
		}
		catch (BackingStoreException e)
		{
			// ignore
		}
	}
}
 
Example #5
Source File: JavaCorePreferenceModifyListener.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public IEclipsePreferences preApply(IEclipsePreferences node) {
	// the node does not need to be the root of the hierarchy
	Preferences root = node.node("/"); //$NON-NLS-1$
	try {
		// we must not create empty preference nodes, so first check if the node exists
		if (root.nodeExists(InstanceScope.SCOPE)) {
			Preferences instance = root.node(InstanceScope.SCOPE);
			// we must not create empty preference nodes, so first check if the node exists
			if (instance.nodeExists(JavaCore.PLUGIN_ID)) {
				cleanJavaCore(instance.node(JavaCore.PLUGIN_ID));
			}
		}
	} catch (BackingStoreException e) {
		// do nothing
	}
	return super.preApply(node);
}
 
Example #6
Source File: CommonEditorPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method removes the spaces for tabs and tab width preferences from the default scope of the plugin preference
 * store.
 */
protected void removePluginDefaults()
{
	IEclipsePreferences store = getDefaultPluginPreferenceStore();
	if (store == null)
	{
		return;
	}

	store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
	store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
	try
	{
		store.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(CommonEditorPlugin.getDefault(), e);
	}
}
 
Example #7
Source File: LegacyGWTHostPageSelectionDialog.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public static String getStartupUrl(Shell shell, IProject project,
    Map<String, Set<String>> hostPagesByModule, boolean isExternal) {
  LegacyGWTHostPageSelectionDialog dialog = new LegacyGWTHostPageSelectionDialog(
      shell, project, hostPagesByModule, isExternal);

  if (dialog.open() == Window.OK) {
    try {
      WebAppProjectProperties.setLaunchConfigExternalUrlPrefix(project,
          dialog.getExternalUrlPrefix());
    } catch (BackingStoreException e) {
      GWTPluginLog.logError(e);
    }
    return dialog.getUrl();
  }

  // User clicked Cancel
  return null;
}
 
Example #8
Source File: MergeFileAssociationPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public boolean performOk() {
	MergeFileAssociation[] currentAssociations = getMergeFileAssociations();
	for (int i = 0; i < currentAssociations.length; i++) {
		currentAssociations[i].remove();
	}
	for (int i = 0; i < mergeFileAssociations.length; i++) {
		Preferences prefs = MergeFileAssociation.getParentPreferences().node(mergeFileAssociations[i].getFileType());
		if (mergeFileAssociations[i].getMergeProgram() == null) prefs.put("mergeProgram", ""); //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-2$
		else prefs.put("mergeProgram", mergeFileAssociations[i].getMergeProgram()); //$NON-NLS-1$
		if (mergeFileAssociations[i].getParameters() == null)prefs.put("parameters", ""); //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-2$ 
		else prefs.put("parameters", mergeFileAssociations[i].getParameters()); //$NON-NLS-1$
		prefs.putInt("type", mergeFileAssociations[i].getType()); //$NON-NLS-1$
		try {
			prefs.flush();
		} catch (BackingStoreException e) {}
	}
	return super.performOk();
}
 
Example #9
Source File: Ruleset.java    From CogniCrypt with Eclipse Public License 2.0 6 votes vote down vote up
public Ruleset(Preferences subPrefs) throws BackingStoreException {
	String[] keys = subPrefs.keys();
	for (String key : keys) {
		switch (key) {
			case "SelectedVersion":
				this.selectedVersion = subPrefs.get(key, "");
				break;
			case "CheckboxState":
				this.isChecked = subPrefs.getBoolean(key, false);
				break;
			case "FolderName":
				this.folderName = subPrefs.get(key, "");
				break;
			case "Url":
				this.url = subPrefs.get(key, "");
				break;
			default:
				break;
		}
	}
}
 
Example #10
Source File: EclipseUtil.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Migrate the existing preferences from instance scope to configuration scope and then remove the preference key
 * from the instance scope.
 */
public static void migratePreference(String pluginId, String preferenceKey)
{
	IEclipsePreferences configNode = EclipseUtil.configurationScope().getNode(pluginId);
	if (StringUtil.isEmpty(configNode.get(preferenceKey, null))) // no value in config scope
	{
		IEclipsePreferences instanceNode = EclipseUtil.instanceScope().getNode(pluginId);
		String instancePrefValue = instanceNode.get(preferenceKey, null);
		if (!StringUtil.isEmpty(instancePrefValue))
		{
			// only migrate if there is a value!
			configNode.put(preferenceKey, instancePrefValue);
			instanceNode.remove(preferenceKey);
			try
			{
				configNode.flush();
				instanceNode.flush();
			}
			catch (BackingStoreException e)
			{
				IdeLog.logWarning(CorePlugin.getDefault(), e.getMessage(), e);
			}
		}
	}
}
 
Example #11
Source File: ThemeManager.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Set the FG, BG, selection and current line colors on our editors.
 * 
 * @param theme
 */
private void setAptanaEditorColorsToMatchTheme(Theme theme)
{
	IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode("com.aptana.editor.common"); //$NON-NLS-1$
	prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, false);
	prefs.put(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND, toString(theme.getForeground()));

	prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, false);
	prefs.put(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, toString(theme.getBackground()));

	prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, false);
	prefs.put(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, toString(theme.getForeground()));

	prefs.put(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR,
			toString(theme.getLineHighlightAgainstBG()));
	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(ThemePlugin.getDefault(), e);
	}
}
 
Example #12
Source File: JavaProject.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void updatePreferences(IEclipsePreferences preferences) {

	 	IEclipsePreferences oldPreferences = loadPreferences();
	 	if (oldPreferences != null) {
			try {
		 		String[] propertyNames = oldPreferences.childrenNames();
				for (int i = 0; i < propertyNames.length; i++){
					String propertyName = propertyNames[i];
				    String propertyValue = oldPreferences.get(propertyName, ""); //$NON-NLS-1$
				    if (!"".equals(propertyValue)) { //$NON-NLS-1$
					    preferences.put(propertyName, propertyValue);
				    }
				}
				// save immediately new preferences
				preferences.flush();
			} catch (BackingStoreException e) {
				// fails silently
			}
		}
	 }
 
Example #13
Source File: BazelClasspathContainer.java    From eclipse with Apache License 2.0 6 votes vote down vote up
private boolean isSourcePath(String path) throws JavaModelException, BackingStoreException {
  Path pp = new File(instance.getWorkspaceRoot().toString() + File.separator + path).toPath();
  IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
  for (IClasspathEntry entry : project.getRawClasspath()) {
    if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
      IResource res = root.findMember(entry.getPath());
      if (res != null) {
        String file = res.getLocation().toOSString();
        if (!file.isEmpty() && pp.startsWith(file)) {
          IPath[] inclusionPatterns = entry.getInclusionPatterns();
          if (!matchPatterns(pp, entry.getExclusionPatterns()) && (inclusionPatterns == null
              || inclusionPatterns.length == 0 || matchPatterns(pp, inclusionPatterns))) {
            return true;
          }
        }
      }
    }
  }
  return false;
}
 
Example #14
Source File: GWTProjectProperties.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public static void setFileNamesCopiedToWebInfLib(IProject project,
    List<String> fileNamesCopiedToWebInfLib) throws BackingStoreException {
  IEclipsePreferences prefs = getProjectProperties(project);
  StringBuilder sb = new StringBuilder();
  boolean addPipe = false;
  for (String fileNameCopiedToWebInfLib : fileNamesCopiedToWebInfLib) {
    if (addPipe) {
      sb.append("|");
    } else {
      addPipe = true;
    }

    sb.append(fileNameCopiedToWebInfLib);
  }

  prefs.put(FILES_COPIED_TO_WEB_INF_LIB, sb.toString());
  prefs.flush();
}
 
Example #15
Source File: CcConfiguration.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Loads project level preferences from disk.
 */
@Override
public void load() {
    validate();
    config = new HashMap<>();
    try {
        for (String configKey : preferences.keys()) {
            ConfigTypes ct = ConfigTypes.getFromString(configKey);
            if (ct != null) {
                if (ConfigTypes.COMMON_TYPE.contains(ct)) {
                    config.put((ConfigTypes)ct, preferences.get(configKey, STR_EMPTY));
                }
            }
        }
    } catch (BackingStoreException e) {
        e.printStackTrace();
    }
}
 
Example #16
Source File: SaveProjectPreferencesJob.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
	if (monitor.isCanceled()) {
		return Status.CANCEL_STATUS;
	}
	monitor.beginTask(NLS.bind(TypeScriptCoreMessages.SaveProjectPreferencesJob_taskName, project.getName()), 1);

	try {
		preferences.flush();
	} catch (BackingStoreException e) {
		IStatus status = new Status(Status.ERROR, TypeScriptCorePlugin.PLUGIN_ID,
				"Error while saving  project preferences", e);
		throw new CoreException(status);
	}

	monitor.worked(1);
	monitor.done();

	return Status.OK_STATUS;
}
 
Example #17
Source File: UIPlugin.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void updateInitialPerspectiveVersion()
{
	// updates the initial stored version so that user won't get a prompt on a new workspace
	boolean hasStartedBefore = Platform.getPreferencesService().getBoolean(PLUGIN_ID,
			IPreferenceConstants.IDE_HAS_LAUNCHED_BEFORE, false, null);
	if (!hasStartedBefore)
	{
		IEclipsePreferences prefs = (EclipseUtil.instanceScope()).getNode(PLUGIN_ID);
		prefs.putInt(IPreferenceConstants.PERSPECTIVE_VERSION, WebPerspectiveFactory.VERSION);
		prefs.putBoolean(IPreferenceConstants.IDE_HAS_LAUNCHED_BEFORE, true);
		try
		{
			prefs.flush();
		}
		catch (BackingStoreException e)
		{
			IdeLog.logError(getDefault(), Messages.UIPlugin_ERR_FailToSetPref, e);
		}
	}
}
 
Example #18
Source File: AbstractProfileManager.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param uiPrefs
 * @param allOptions
 */
private void addAll(IEclipsePreferences uiPrefs, Map allOptions) {
	try {
		String[] keys = uiPrefs.keys();
		for (int i = 0; i < keys.length; i++) {
			String key = keys[i];
			String val = uiPrefs.get(key, null);
			if (val != null) {
				allOptions.put(key, val);
			}
		}
	} catch (BackingStoreException e) {
		// ignore
	}

}
 
Example #19
Source File: CommonEditorPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void performDefaults()
{
	IEclipsePreferences store = getPluginPreferenceStore();

	store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
	store.remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);

	setPluginDefaults();
	setTabSpaceCombo();
	super.performDefaults();
	try
	{
		store.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(CommonEditorPlugin.getDefault(), e);
	}
}
 
Example #20
Source File: Activator.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
public void resetPlatform(String platformHome) {
	
	try {
		Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
		preferences.put("platform_home", platformHome);
		preferences.flush();
	}
	catch (BackingStoreException e) {
		logError("Failed to persist platform_home", e);
	}
	
	getTypeSystemExporter().setPlatformHome(null);
	getTypeSystemExporter().nullifySystemConfig();
	getTypeSystemExporter().nullifyPlatformConfig();
	getTypeSystemExporter().nullifyTypeSystem();
	getTypeSystemExporter().nullifyAllTypes();
	getTypeSystemExporter().nullifyAllTypeNames();
}
 
Example #21
Source File: ThemeManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * laziliy init the set of theme names.
 */
public synchronized Set<String> getThemeNames()
{
	if (fThemeNames == null)
	{
		fThemeNames = new HashSet<String>();
		// Add names of themes from builtins...
		fThemeNames.addAll(getBuiltinThemeNames());

		// Look in prefs to see what user themes are stored there, garb their names
		IScopeContext[] scopes = new IScopeContext[] { EclipseUtil.instanceScope(), EclipseUtil.defaultScope() };
		for (IScopeContext scope : scopes)
		{
			IEclipsePreferences prefs = scope.getNode(ThemePlugin.PLUGIN_ID);
			Preferences preferences = prefs.node(ThemeManager.THEMES_NODE);
			try
			{
				String[] themeNames = preferences.keys();
				fThemeNames.addAll(Arrays.asList(themeNames));
			}
			catch (BackingStoreException e)
			{
				IdeLog.logError(ThemePlugin.getDefault(), e);
			}
		}
	}
	return fThemeNames;
}
 
Example #22
Source File: FlexExistingArtifactDeployCommandHandlerTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetStagingDelegate_absoluteJarPathDoesNotExist() throws BackingStoreException {
  try {
    setUpDeployPreferences(false /* asRelativePath */);
    createFileInProject("app.yaml");

    handler.getStagingDelegate(projectCreator.getProject());
    fail();
  } catch (CoreException e) {
    assertThat(e.getMessage(), endsWith("my-app.jar does not exist."));
  }
}
 
Example #23
Source File: FlexExistingArtifactDeployCommandHandlerTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetStagingDelegate_absoluteAppYamlPathDoesNotExist()
    throws BackingStoreException {
  try {
    setUpDeployPreferences(false /* asRelativePath */);
    handler.getStagingDelegate(projectCreator.getProject());
    fail();
  } catch (CoreException e) {
    assertThat(e.getMessage(), endsWith("app.yaml does not exist."));
  }
}
 
Example #24
Source File: GwtFacetUninstallDelegate.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private void removeFacet(IProject project) throws CoreException {
  GWTProjectPropertyPage projectProperty = new GWTProjectPropertyPage();
  try {
    projectProperty.removeGWTSdkForFacet(project);
  } catch (BackingStoreException e) {
    GwtWtpPlugin.logError("Could not uinstall the GWT facet.", e);
  }
}
 
Example #25
Source File: GWTProjectProperties.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public static void setEntryPointModules(IProject project, List<String> modules)
    throws BackingStoreException {
  IEclipsePreferences prefs = getProjectProperties(project);
  String rawPropVal = PropertiesUtilities.serializeStrings(modules);
  prefs.put(ENTRY_POINT_MODULES, rawPropVal);
  prefs.flush();
}
 
Example #26
Source File: DeployPreferences.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
public void save() throws BackingStoreException {
  preferenceStore.put(PREF_ACCOUNT_EMAIL, Strings.nullToEmpty(accountEmail));
  preferenceStore.put(PREF_PROJECT_ID, Strings.nullToEmpty(projectId));
  preferenceStore.put(PREF_CUSTOM_VERSION, Strings.nullToEmpty(version));
  preferenceStore.putBoolean(PREF_ENABLE_AUTO_PROMOTE, autoPromote);
  preferenceStore.putBoolean(
      PREF_INCLUDE_OPTIONAL_CONFIGURATION_FILES, includeOptionalConfigurationFiles);
  preferenceStore.put(PREF_CUSTOM_BUCKET, Strings.nullToEmpty(bucket));
  preferenceStore.putBoolean(PREF_STOP_PREVIOUS_VERSION, stopPreviousVersion);
  preferenceStore.flush();
}
 
Example #27
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void flushPreferences() {
	try {
		internalGetPreferences().flush();
	} catch (BackingStoreException e) {
		SVNProviderPlugin.log(SVNException.wrapException(e));
	}
}
 
Example #28
Source File: EclipsePreferenceStore.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public void save() {
  try {
    preferences.flush();
  } catch (BackingStoreException e) {
    DataflowCorePlugin.logError(e, "Failed to flush Dataflow preferences");
  }
}
 
Example #29
Source File: TypeScriptCorePreferenceInitializer.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Fix the embedded TypeScript runtime ande node.js preference if needed.
 * 
 * @param preferences
 * @see https://github.com/angelozerr/typescript.java/issues/121
 */
public static void fixEmbeddedPreference(IEclipsePreferences preferences) {
	boolean refresh = false;
	// Fix embedded TypeScript runtime if needed
	String embeddedTypeScriptId = preferences.get(TypeScriptCorePreferenceConstants.EMBEDDED_TYPESCRIPT_ID, null);
	if (embeddedTypeScriptId != null
			&& TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepository(embeddedTypeScriptId) == null) {
		preferences.put(TypeScriptCorePreferenceConstants.EMBEDDED_TYPESCRIPT_ID,
				TypeScriptCorePlugin.getTypeScriptRepositoryManager().getDefaultRepository().getName());
		refresh = true;
	}
	// Fix embedded node.js if needed
	String embeddedNode = preferences.get(TypeScriptCorePreferenceConstants.NODEJS_EMBEDDED_ID, null);
	if (embeddedNode != null
			&& TypeScriptCorePlugin.getNodejsInstallManager().findNodejsInstall(embeddedNode) == null) {
		if (useBundledNodeJsEmbedded(preferences)) {
			refresh = true;
		}
	}
	if (refresh) {
		try {
			preferences.flush();
		} catch (BackingStoreException e) {
			Trace.trace(Trace.SEVERE, "Error while fixing embedded TypeScript runtime and node.js preference", e);
		}
	}
}
 
Example #30
Source File: FlexExistingArtifactDeployCommandHandlerTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void setUpDeployPreferences(boolean asRelativePath) throws BackingStoreException {
  IPath workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation();
  IPath appYaml = projectCreator.getProject().getFile("app.yaml").getLocation();
  IPath jar = projectCreator.getProject().getFile("my-app.jar").getLocation();

  if (asRelativePath) {
    appYaml = appYaml.makeRelativeTo(workspace);
    jar = jar.makeRelativeTo(workspace);
  }

  preferences.setAppYamlPath(appYaml.toString());
  preferences.setDeployArtifactPath(jar.toString());
  preferences.save();
}