Search in sources :

Example 16 with IMemento

use of org.eclipse.ui.IMemento in project tdi-studio-se by Talend.

the class SaveChartSetAsAction method addNewChartSet.

/**
     * Adds the new chart set to the given memento.
     * 
     * @param memento The memento
     * @param chartSet The new chart set
     */
private void addNewChartSet(XMLMemento memento, String chartSet) {
    IMemento chartSetMemento = memento.createChild(CHART_SET, chartSet);
    for (IMonitoredMXBeanGroup group : section.getJvm().getMBeanServer().getMonitoredAttributeGroups()) {
        IMemento groupMemento = chartSetMemento.createChild(GROUP, group.getName());
        groupMemento.putString(UNIT, group.getAxisUnit().name());
        for (IMonitoredMXBeanAttribute attribute : group.getAttributes()) {
            IMemento attributeMemento = groupMemento.createChild(ATTRIBUTE, attribute.getAttributeName());
            attributeMemento.putString(OBJECT_NAME, attribute.getObjectName().getCanonicalName());
            attributeMemento.putString(COLOR, getRGBString(attribute.getRGB()));
        }
    }
}
Also used : IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) IMonitoredMXBeanAttribute(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute) IMemento(org.eclipse.ui.IMemento)

Example 17 with IMemento

use of org.eclipse.ui.IMemento in project tdi-studio-se by Talend.

the class AbstractChartAction method getChartSets.

/**
     * Gets the chart sets stored as chart sets memento.
     * 
     * @return The chart sets
     * @throws WorkbenchException
     * @throws IOException
     */
List<String> getChartSets() throws WorkbenchException, IOException {
    List<String> elements = new ArrayList<String>();
    IMemento chartSetsMemento = getChartSetsMemento();
    if (chartSetsMemento == null) {
        return elements;
    }
    for (IMemento element : chartSetsMemento.getChildren(CHART_SET)) {
        elements.add(element.getID());
    }
    Collections.sort(elements);
    return elements;
}
Also used : ArrayList(java.util.ArrayList) IMemento(org.eclipse.ui.IMemento)

Example 18 with IMemento

use of org.eclipse.ui.IMemento in project tdi-studio-se by Talend.

the class AbstractChartSetAction method getChartSets.

/**
     * Gets the chart sets stored as chart sets memento.
     * 
     * @return The chart sets
     * @throws WorkbenchException
     * @throws IOException
     */
List<String> getChartSets() throws WorkbenchException, IOException {
    List<String> elements = new ArrayList<String>();
    IMemento chartSetsMemento = getChartSetsMemento();
    if (chartSetsMemento == null) {
        return elements;
    }
    for (IMemento element : chartSetsMemento.getChildren(CHART_SET)) {
        elements.add(element.getID());
    }
    Collections.sort(elements);
    return elements;
}
Also used : ArrayList(java.util.ArrayList) IMemento(org.eclipse.ui.IMemento)

Example 19 with IMemento

use of org.eclipse.ui.IMemento in project tdi-studio-se by Talend.

the class LoadChartAction method loadChartSet.

/**
     * Loads the given memento of chart set.
     * 
     * @param memento The memento
     * @throws JvmCoreException
     */
private void loadChartSet(IMemento memento) throws JvmCoreException {
    IMBeanServer server = graphComposite.getJvm().getMBeanServer();
    server.getMonitoredAttributeGroups().clear();
    StringBuffer buffer = new StringBuffer();
    for (IMemento groupMemento : memento.getChildren(GROUP)) {
        IMonitoredMXBeanGroup group = server.addMonitoredAttributeGroup(groupMemento.getID(), AxisUnit.valueOf(groupMemento.getString(UNIT)));
        for (IMemento attributeMemento : groupMemento.getChildren(ATTRIBUTE)) {
            String objectName = attributeMemento.getString(OBJECT_NAME);
            String attributeName = attributeMemento.getID();
            if (attributeExist(objectName, attributeName)) {
                group.addAttribute(objectName, attributeName, getRGB(attributeMemento.getString(COLOR)));
            } else {
                buffer.append('\n');
                buffer.append(objectName + ':' + attributeName);
            }
        }
    }
    if (buffer.length() > 0) {
        MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.errorDialogTitle, NLS.bind(Messages.attributeNotSupportedMsg, buffer.toString()));
    }
}
Also used : IMBeanServer(org.talend.designer.runtime.visualization.MBean.IMBeanServer) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) IMemento(org.eclipse.ui.IMemento)

Example 20 with IMemento

use of org.eclipse.ui.IMemento in project bndtools by bndtools.

the class AdvancedSearchDialog method saveState.

@Override
public void saveState(IMemento memento) {
    memento.putInteger("tabIndex", activeTabIndex);
    for (Entry<String, SearchPanel> panelEntry : panelMap.entrySet()) {
        IMemento childMemento = memento.createChild("tab", panelEntry.getKey());
        SearchPanel panel = panelEntry.getValue();
        panel.saveState(childMemento);
    }
}
Also used : 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