List of usage examples for org.eclipse.jface.commands PersistentState shouldPersist
public boolean shouldPersist()
From source file:org.eclipse.ui.internal.commands.CommandService.java
License:Open Source License
public final void dispose() { commandPersistence.dispose();/*from ww w . j a va 2 s . c o m*/ /* * All state on all commands neeeds to be disposed. This is so that the * state has a chance to persist any changes. */ final Command[] commands = commandManager.getAllCommands(); for (int i = 0; i < commands.length; i++) { final Command command = commands[i]; final String[] stateIds = command.getStateIds(); for (int j = 0; j < stateIds.length; j++) { final String stateId = stateIds[j]; final State state = command.getState(stateId); if (state instanceof PersistentState) { final PersistentState persistentState = (PersistentState) state; if (persistentState.shouldPersist()) { persistentState.save(PrefUtil.getInternalPreferenceStore(), createPreferenceKey(command, stateId)); } } } } commandCallbacks = null; }
From source file:org.eclipse.ui.internal.commands.CommandStateProxy.java
License:Open Source License
public final void dispose() { if (state != null) { state.dispose();//w w w. j a va2 s . co m if (state instanceof PersistentState) { final PersistentState persistableState = (PersistentState) state; if (persistableState.shouldPersist() && preferenceStore != null && preferenceKey != null) { persistableState.save(preferenceStore, preferenceKey); } } } }
From source file:org.eclipse.ui.internal.commands.CommandStateProxy.java
License:Open Source License
public final void load(final IPreferenceStore store, final String preferenceKey) { if (loadState() && state instanceof PersistentState) { final PersistentState persistableState = (PersistentState) state; if (persistableState.shouldPersist() && preferenceStore != null && preferenceKey != null) { persistableState.load(preferenceStore, preferenceKey); }/*from w ww .j av a 2s . co m*/ } }