use of org.eclipse.e4.ui.di.PersistState in project aero.minova.rcp by minova-afis.
the class SearchCriteriaLoadHandler method createMenuItem.
private MHandledMenuItem createMenuItem(EModelService service, String criteriaTableName) {
MHandledMenuItem mi = service.createModelElement(MHandledMenuItem.class);
// Name aus dem Eintrag suchen!
// vWorkingTime.erlanger Heute.table
// vWorkingTime.erlanger Heute
// erlanger Heute
String displayName = criteriaTableName.replace(".table", "");
displayName = displayName.substring(displayName.lastIndexOf(".") + 1, displayName.length());
mi.setLabel(displayName);
final MCommand cmd = MCommandsFactory.INSTANCE.createCommand();
cmd.setElementId("aero.minova.rcp.rcp.command.searchCriteria");
mi.setCommand(cmd);
// action
MParameter param = MCommandsFactory.INSTANCE.createParameter();
param.setName("aero.minova.rcp.rcp.commandparameter.criteriaaction");
param.setValue("LOAD");
mi.getParameters().add(param);
// Name
param = MCommandsFactory.INSTANCE.createParameter();
param.setName("aero.minova.rcp.rcp.commandparameter.criterianame");
param.setValue(displayName);
mi.getParameters().add(param);
// Handler der aufgerufen werden soll, wenn wir auf den Button drücken
mi.getPersistedState().put("persistState", "false");
return mi;
}
use of org.eclipse.e4.ui.di.PersistState in project gda-core by openGDA.
the class MappingExperimentView method saveState.
@PersistState
public void saveState(MPart part) {
// serialize the json bean and save it in the preferences
final IMarshallerService marshaller = injectionContext.get(IMarshallerService.class);
try {
logger.trace("Saving the current state of the mapping view.");
final String json = marshaller.marshal(mappingBeanProvider.getMappingExperimentBean());
part.getPersistedState().put(STATE_KEY_MAPPING_BEAN_JSON, json);
} catch (Exception e) {
logger.error("Could not save current the state of the mapping view.", e);
}
// Now save any other persistent data that is outside the mapping bean
for (IMappingSection section : sections.values()) {
section.saveState(part.getPersistedState());
}
}
use of org.eclipse.e4.ui.di.PersistState in project gda-core by openGDA.
the class TimeSeriesScanView method saveState.
@PersistState
public void saveState(MPart part) {
try {
final Map<String, String> state = part.getPersistedState();
state.put(STATE_KEY_MALCOLM_DEVICE_NAME, getSelectedMalcolmDeviceName());
state.put(STATE_KEY_NUM_STEPS, numStepsSpinner.getText());
final IMarshallerService marshaller = eclipseContext.get(IMarshallerService.class);
final String outerScannablesJson = marshaller.marshal(outerScannablesBlock.getOuterScannables());
state.put(STATE_KEY_OUTER_SCANNABLES, outerScannablesJson);
} catch (Exception e) {
logger.error("Could not save the current state of the Time Series Scan view", e);
}
}
Aggregations