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()));
}
}
}
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;
}
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;
}
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()));
}
}
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);
}
}
Aggregations