Search in sources :

Example 21 with IMemento

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);
    }
}
Also used : IMemento(org.eclipse.ui.IMemento)

Example 22 with IMemento

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());
    }
}
Also used : Entry(java.util.Map.Entry) IMemento(org.eclipse.ui.IMemento)

Example 23 with IMemento

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);
    }
}
Also used : IMemento(org.eclipse.ui.IMemento)

Example 24 with IMemento

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();
            }
        }
    }
}
Also used : IMemento(org.eclipse.ui.IMemento)

Example 25 with IMemento

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);
}
Also used : ISearchResultPage(org.eclipse.search.ui.ISearchResultPage) IActionBars(org.eclipse.ui.IActionBars) IMemento(org.eclipse.ui.IMemento)

Aggregations

IMemento (org.eclipse.ui.IMemento)29 NodeTemplate (org.knime.workbench.repository.model.NodeTemplate)4 IOException (java.io.IOException)3 StringWriter (java.io.StringWriter)3 WorkbenchException (org.eclipse.ui.WorkbenchException)3 XMLMemento (org.eclipse.ui.XMLMemento)3 IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)3 ArrayList (java.util.ArrayList)2 TreeDefinitionNode (org.eclipse.linuxtools.systemtap.structures.TreeDefinitionNode)2 ISearchResultPage (org.eclipse.search.ui.ISearchResultPage)2 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)2 IMBeanServer (org.talend.designer.runtime.visualization.MBean.IMBeanServer)2 FileReader (java.io.FileReader)1 Entry (java.util.Map.Entry)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 MPlaceholder (org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder)1 TreeNode (org.eclipse.linuxtools.systemtap.structures.TreeNode)1 IActionBars (org.eclipse.ui.IActionBars)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IElementFactory (org.eclipse.ui.IElementFactory)1