use of org.eclipse.ui.IMemento in project bndtools by bndtools.
the class AdvancedSearchDialog method restoreState.
public void restoreState(IMemento memento) {
activeTabIndex = memento.getInteger("tabIndex");
IMemento[] children = memento.getChildren("tab");
for (IMemento childMemento : children) {
String key = childMemento.getID();
SearchPanel panel = panelMap.get(key);
if (panel != null)
panel.restoreState(childMemento);
}
}
use of org.eclipse.ui.IMemento in project eclipse.platform.text by eclipse.
the class SortDropDownAction method saveState.
private void saveState(IMemento memento, Map<String, SorterDescriptor> map, String mapName) {
Iterator<Entry<String, SorterDescriptor>> iter = map.entrySet().iterator();
memento = memento.createChild(mapName);
while (iter.hasNext()) {
IMemento mementoElement = memento.createChild(TAG_ELEMENT);
Entry<String, SorterDescriptor> entry = iter.next();
mementoElement.putString(TAG_PAGE_ID, entry.getKey());
mementoElement.putString(TAG_SORTER_ID, entry.getValue().getId());
}
}
use of org.eclipse.ui.IMemento in project eclipse.platform.text by eclipse.
the class SortDropDownAction method restoreState.
private void restoreState(IMemento memento, Map<String, SorterDescriptor> map, String mapName) {
memento = memento.getChild(mapName);
if (memento == null)
return;
IMemento[] mementoElements = memento.getChildren(TAG_ELEMENT);
for (IMemento mementoElement : mementoElements) {
String pageId = mementoElement.getString(TAG_PAGE_ID);
String sorterId = mementoElement.getString(TAG_SORTER_ID);
SorterDescriptor sorterDesc = getSorter(sorterId);
if (sorterDesc != null)
map.put(pageId, sorterDesc);
}
}
use of org.eclipse.ui.IMemento in project eclipse.platform.text by eclipse.
the class SearchView method restorePageFromMemento.
private void restorePageFromMemento() {
if (fPageState != null) {
int bestActivation = -1;
IMemento restorePageMemento = null;
IMemento[] children = fPageState.getChildren(MEMENTO_TYPE);
for (IMemento pageMemento : children) {
if (pageMemento.getString(MEMENTO_KEY_RESTORE) != null) {
Integer lastActivation = pageMemento.getInteger(MEMENTO_KEY_LAST_ACTIVATION);
if (lastActivation != null && lastActivation.intValue() > bestActivation) {
bestActivation = lastActivation.intValue();
restorePageMemento = pageMemento;
}
}
}
if (restorePageMemento != null) {
showEmptySearchPage(restorePageMemento.getID());
String pinned = fPageState.getString(MEMENTO_KEY_IS_PINNED);
if (String.valueOf(true).equals(pinned)) {
setPinned(true);
fPinSearchViewAction.update();
}
}
}
}
use of org.eclipse.ui.IMemento in project eclipse.platform.text by eclipse.
the class SearchView method initPage.
@Override
protected void initPage(IPageBookViewPage page) {
super.initPage(page);
IActionBars actionBars = page.getSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fSearchAgainAction);
actionBars.updateActionBars();
fUndoRedoActionGroup.fillActionBars(actionBars);
ISearchResultPage srPage = (ISearchResultPage) page;
IMemento memento = null;
if (fPageState != null) {
IMemento[] mementos = fPageState.getChildren(MEMENTO_TYPE);
for (IMemento memento2 : mementos) {
if (memento2.getID().equals(srPage.getID())) {
memento = memento2;
break;
}
}
}
srPage.restoreState(memento);
}
Aggregations