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

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

Introduction

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

Prototype

TextState

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);//from  w  w w  .ja  va2s .c  o m
    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());
}