protected void savePreferences() { try { if (preferenceStore instanceof IPersistentPreferenceStore) { ((IPersistentPreferenceStore) preferenceStore).save(); } } catch (IOException e) { IStatus status = new Status(IStatus.ERROR, uiPlugin.getBundle().getSymbolicName(), "Unexpected internal error: ", e); //$NON-NLS-1$ uiPlugin.getLog().log(status); } }
public void run() { store.setValue(prefName, isChecked()); if (store.needsSaving()) try { store.save(); } catch (IOException e) { Activator.handleError(e.getMessage(), e, false); } }
protected void toggle() { boolean newState = !isPropertySet(); IPreferenceStore store = preferenceStoreAccess.getWritablePreferenceStore(); store.setValue(getPreferenceKey(), newState); if (store instanceof IPersistentPreferenceStore) try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { // log and ignore logger.debug(e.getMessage(), e); } stateChanged(newState); }
/** * Saves the templates to the preferences. * * @throws IOException if the templates cannot be written */ public void save() throws IOException { ArrayList<TemplatePersistenceData> custom= new ArrayList<>(); for (Iterator<TemplatePersistenceData> it= fTemplates.iterator(); it.hasNext();) { TemplatePersistenceData data= it.next(); if (data.isCustom() && !(data.isUserAdded() && data.isDeleted())) // don't save deleted user-added templates custom.add(data); } StringWriter output= new StringWriter(); TemplateReaderWriter writer= new TemplateReaderWriter(); writer.save(custom.toArray(new TemplatePersistenceData[custom.size()]), output); fIgnorePreferenceStoreChanges= true; try { fPreferenceStore.setValue(fKey, output.toString()); if (fPreferenceStore instanceof IPersistentPreferenceStore) ((IPersistentPreferenceStore)fPreferenceStore).save(); } finally { fIgnorePreferenceStoreChanges= false; } }
public void run() { historyPage.store.setValue(prefName, isChecked()); if (historyPage.store.needsSaving()) try { historyPage.store.save(); } catch (IOException e) { Activator.handleError(e.getMessage(), e, false); } }
public void save() { if (store.needsSaving() && store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore)store).save(); } catch (IOException e) { Activator.logError(Activator.getResourceString("easyshell.message.error.store.save"), e); } } }
public void run() { historyPage.store.setValue( UIPreferences.RESOURCEHISTORY_SHOW_FINDTOOLBAR, isChecked()); if (historyPage.store.needsSaving()) try { historyPage.store.save(); } catch (IOException e) { Activator.handleError(e.getMessage(), e, false); } historyPage.layout(); } };
public void widgetSelected(SelectionEvent e) { store.setValue(UIPreferences.FINDTOOLBAR_IGNORE_CASE, caseItem.getSelection()); if (store.needsSaving()){ try { store.save(); } catch (IOException e1) { Activator.handleError(e1.getMessage(), e1, false); } } clear(); } });
/** * Saves the templates to the preferences. * * @throws IOException if the templates cannot be written */ @Override public void save() throws IOException { ArrayList<TemplatePersistenceData> custom= new ArrayList<>(); for (TemplatePersistenceData data : internalGetTemplates()) { if (data.isCustom() && !(data.isUserAdded() && data.isDeleted())) // don't save deleted user-added templates custom.add(data); } StringWriter output= new StringWriter(); TemplateReaderWriter writer= new TemplateReaderWriter(); writer.save(custom.toArray(new TemplatePersistenceData[custom.size()]), output); fIgnorePreferenceStoreChanges= true; try { fPreferenceStore.setValue(getKey(), output.toString()); if (fPreferenceStore instanceof IPersistentPreferenceStore) ((IPersistentPreferenceStore)fPreferenceStore).save(); } finally { fIgnorePreferenceStoreChanges= false; } }
public void widgetDisposed(DisposeEvent e) { final int[] w = sf.getWeights(); store.putValue(key, UIPreferences.intArrayToString(w)); if (store.needsSaving()) try { store.save(); } catch (IOException e1) { Activator.handleError(e1.getMessage(), e1, false); } } });
/** * Save the values specified in the pages. * <p> * 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() { // Save now in case tbe workbench does not shutdown cleanly for (int i = 0; i < pages.length; i++) { PreferencePage page = pages[i]; IPreferenceStore store = page.getPreferenceStore(); if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { Utils.handle(e); } } } }
@Override public boolean performOk() { boolean retVal = super.performOk(); if (retVal && isPropertyPage()) { try { currentProject().setPersistentProperty(new QualifiedName(qualifiedName(), USE_PROJECT_SETTINGS), String.valueOf(useProjectSettingsButton.getSelection())); ((IPersistentPreferenceStore) getPreferenceStore()).save(); } catch (Exception e) { log.error("Error", e); //$NON-NLS-1$ retVal = false; } } return retVal; } }
@Override public boolean performOk() { if (idePreferenceStore != null && idePreferenceStore.needsSaving() && idePreferenceStore instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) idePreferenceStore).save(); } catch (IOException e) { String message = JFaceResources.format("PreferenceDialog.saveErrorMessage", getTitle(), //$NON-NLS-1$ e.getMessage()); Policy.getStatusHandler().show(new Status(IStatus.ERROR, Policy.JFACE, message, e), JFaceResources.getString("PreferenceDialog.saveErrorTitle")); //$NON-NLS-1$ } } return super.performOk(); }
/** * Save the values specified in the pages. * <p> * 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() { // Save now in case tbe workbench does not shutdown cleanly for (int i = 0; i < pages.length; i++) { PreferencePage page = pages[i]; IPreferenceStore store = page.getPreferenceStore(); if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { Utils.handle(e); } } } }
&& store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { String message = JFaceResources.format("PreferenceDialog.saveErrorMessage", page.getTitle(), //$NON-NLS-1$
&& store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { String message = JFaceResources.format("PreferenceDialog.saveErrorMessage", page.getTitle(), //$NON-NLS-1$
&& store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { String message =JFaceResources.format(
/** * OK was clicked. Store the preferences to the plugin store * * @return whether it is okay to close the preference page */ 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; }
@Override public void run() { IPreferenceStore preferences = getCompareConfiguration().getPreferenceStore(); preferences.setValue(ComparePreferencePage.SWAPPED, !getCompareConfiguration().isMirrored()); if (preferences instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) preferences).save(); } catch (IOException e) { CompareUIPlugin.log(e); } } } };
private void prefsItemChanged(int findin, MenuItem item) { store.setValue(UIPreferences.FINDTOOLBAR_FIND_IN, findin); if (store.needsSaving()){ try { store.save(); } catch (IOException e) { Activator.handleError(e.getMessage(), e, false); } } commitIdItem.setSelection(false); commentsItem.setSelection(false); authorItem.setSelection(false); committerItem.setSelection(false); item.setSelection(true); clear(); }