Example usage for org.eclipse.jface.menus TextState load

List of usage examples for org.eclipse.jface.menus TextState load

Introduction

In this page you can find the example usage for org.eclipse.jface.menus TextState load.

Prototype

@Override
    public final void load(final IPreferenceStore store, final String preferenceKey) 

Source Link

Usage

From source file:org.eclipse.ui.tests.commands.StateTest.java

License:Open Source License

public final void testTextPreference() {
    final ICommandService commandService = (ICommandService) fWorkbench.getService(ICommandService.class);
    final Command command = commandService.getCommand(COMMAND_ID);
    State state = command.getState(TEXT_STATE_ID);
    state.setValue(TEXT_HELLO);//  w ww  .  j av a 2  s  .com
    assertTrue(state instanceof PersistentState);
    PersistentState pstate = (PersistentState) state;
    IPreferenceStore preferenceStore = TestPlugin.getDefault().getPreferenceStore();
    pstate.save(preferenceStore, COMMAND_ID + "." + TEXT_STATE_ID);
    TextState nstate = new TextState();
    assertNull(nstate.getValue());
    nstate.load(preferenceStore, COMMAND_ID + "." + TEXT_STATE_ID);
    assertEquals(TEXT_HELLO, nstate.getValue());
}