List of usage examples for org.eclipse.jface.preference IPreferenceStore needsSaving
boolean needsSaving();
From source file:com.bmw.spdxeditor.SPDXPreferencesPage.java
License:Apache License
protected void performApply() { System.out.println("performApply"); IPreferenceStore store = getPreferenceStore(); if (creatorText.getText().equalsIgnoreCase("noassertion")) { store.setValue(DEFAULT_FILE_CREATOR, "NOASSERTION"); } else if (StringUtils.isEmpty(creatorTypes.getText())) { MessageDialog.openError(getShell(), "Error", "Select value in dropdown box first."); } else if (StringUtils.isEmpty(creatorText.getText())) { MessageDialog.openError(getShell(), "Error", "Enter value for creator name."); } else {//from www . ja v a 2 s.c om String defaultCreator = creatorTypes.getText() + ":" + creatorText.getText(); logger.info("Default creator set to: {}", defaultCreator); store.setValue(DEFAULT_FILE_CREATOR, defaultCreator); MessageDialog.openInformation(getShell(), "Creator set", "Default SPDX file creator has been set."); } System.out.println("storeNeedsSaving: " + store.needsSaving()); }
From source file:com.elphel.vdt.core.options.OptionsCore.java
License:Open Source License
private static void finalizeDoStore(IPreferenceStore store) { if (store instanceof ScopedPreferenceStore) { try {/*from w w w . j a va 2 s. co m*/ if (store.needsSaving()) ((ScopedPreferenceStore) store).save(); } catch (IOException e) { // Nothing do do, we don't need to bother the user } } }
From source file:com.google.dart.tools.ui.internal.preferences.DartBasePreferencePage.java
License:Open Source License
private void handleSave(IPreferenceStore store) { if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) { try {/*from ww w . java2 s . c om*/ ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { DartToolsPlugin.log(e); } } }
From source file:com.google.gdt.eclipse.gph.subclipse.SubclipseProduct.java
License:Open Source License
public static void configureSVNKit() throws IOException { IPreferenceStore store = getPreferenceStore(); store.setValue(ISVNUIConstants.PREF_SVNINTERFACE, SVNKIT_CLIENT_INTERFACE); if (store.needsSaving() && store instanceof IPersistentPreferenceStore) { ((IPersistentPreferenceStore) store).save(); }//w w w . ja v a2 s . c o m }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
/** * Save the values specified in the pages. * <p>//w ww . ja v a2 s. c o m * The default implementation of this framework method saves all pages of * type <code>PreferencePage</code> (if their store needs saving and is a * <code>PreferenceStore</code>). * </p> * <p> * Subclasses may override. * </p> */ protected void handleSave() { Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator(); while (nodes.hasNext()) { IPreferenceNode node = (IPreferenceNode) nodes.next(); IPreferencePage page = node.getPage(); if (page instanceof PreferencePage) { // Save now in case tbe workbench does not shutdown cleanly IPreferenceStore store = ((PreferencePage) page).getPreferenceStore(); if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { MessageDialog.openError(getShell(), JFaceResources.getString("PreferenceDialog.saveErrorTitle"), //$NON-NLS-1$ JFaceResources.format("PreferenceDialog.saveErrorMessage", //$NON-NLS-1$ new Object[] { page.getTitle(), e.getMessage() })); } } } } }
From source file:com.nokia.tools.s60.editor.ScreenModelMediator.java
License:Open Source License
/** * Updates the preferences when user adds/removes gallery screens. * /*w w w. j a v a 2s. c o 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:org.eclipse.ant.internal.ui.preferences.AntEditorPreferencePage.java
License:Open Source License
@Override public boolean performOk() { Iterator<String> iter = fWorkingValues.keySet().iterator(); IPreferenceStore store = getPreferenceStore(); while (iter.hasNext()) { String key = iter.next(); store.putValue(key, fWorkingValues.get(key)); }/*from w ww . j av a 2 s . c o m*/ if (store.needsSaving()) { // any AntModels listen for changes to the "PROBLEM" pref // this is so that the models do not update for each and every pref modification store.putValue(AntEditorPreferenceConstants.PROBLEM, "changed"); //$NON-NLS-1$ // ensure to clear as there may not be any models open currently store.setToDefault(AntEditorPreferenceConstants.PROBLEM); } return super.performOk(); }
From source file:org.eclipse.contribution.xref.internal.ui.preference.XReferencePreferencePage.java
License:Open Source License
private void reset() { // called after perform ok has updated providerDefinitions IPreferenceStore store = XReferenceUIPlugin.getDefault().getPreferenceStore(); if (store.needsSaving()) { XReferenceUIPlugin.getDefault().savePluginPreferences(); }//from w w w . j a v a 2s . c o m }
From source file:org.eclipse.egit.ui.internal.preferences.DoublePreferencesPreferencePage.java
License:Open Source License
private void saveSecondaryPreferenceStore() { IPreferenceStore store = getSecondaryPreferenceStore(); if (store != null && store.needsSaving() && (store instanceof IPersistentPreferenceStore)) { try {/* w w w . j av a2 s. c o m*/ ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { String message = JFaceResources.format("PreferenceDialog.saveErrorMessage", //$NON-NLS-1$ new Object[] { getTitle(), e.getMessage() }); Policy.getStatusHandler().show(new Status(IStatus.ERROR, Activator.getPluginId(), message, e), JFaceResources.getString("PreferenceDialog.saveErrorTitle")); //$NON-NLS-1$ } } }
From source file:org.eclipse.egit.ui.internal.preferences.GitDecoratorPreferencePage.java
License:Open Source License
/** * OK was clicked. Store the preferences to the plugin store * * @return whether it is okay to close the preference page */// ww w .jav a 2 s . c o m public boolean performOk() { IPreferenceStore store = getPreferenceStore(); final boolean okToClose = performOk(store); if (store.needsSaving()) { try { ((IPersistentPreferenceStore) store).save(); Activator.broadcastPropertyChange( new PropertyChangeEvent(this, Activator.DECORATORS_CHANGED, null, null)); } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } } return okToClose; }