use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup in project tdi-studio-se by Talend.
the class ConfigChartAction method run.
/*
* @see Action#run()
*/
@Override
public void run() {
IActiveJvm jvm = runtimeComposite.getJvm();
if (jvm == null) {
return;
}
String title = chart.getSection().getText();
IMonitoredMXBeanGroup group = chart.getAttributeGroup();
AxisUnit unit = group.getAxisUnit();
List<MBeanAttribute> attributes = getAttributes();
ConfigureChartDialog dialog = new ConfigureChartDialog(chart.getShell(), title, unit, attributes, jvm, true);
if (dialog.open() == Window.OK) {
performConfiguration(dialog.getChartTitle(), dialog.getAxisUnit(), dialog.getAttributes(), dialog.getRemovedAttributes());
}
}
use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup in project tdi-studio-se by Talend.
the class ConfigChartAction method performConfiguration.
/**
* Performs the configuration.
*
* @param chartTitle The chart title
* @param axisUnit The axis unit
* @param attributes The attributes
* @param removedAttributes The removed attributes
*/
private void performConfiguration(String chartTitle, AxisUnit axisUnit, List<MBeanAttribute> attributes, List<MBeanAttribute> removedAttributes) {
IMonitoredMXBeanGroup group = chart.getAttributeGroup();
group.setName(chartTitle);
group.setAxisUnit(axisUnit);
for (MBeanAttribute attribute : attributes) {
ObjectName objectName = attribute.getObjectName();
String attributeName = attribute.getAttributeName();
IMonitoredMXBeanAttribute monitoredAttribute = group.getAttribute(objectName, attributeName);
RGB rgb = attribute.getRgb();
if (monitoredAttribute == null) {
try {
group.addAttribute(objectName.getCanonicalName(), attributeName, new int[] { rgb.red, rgb.green, rgb.blue });
} catch (JvmCoreException e) {
Activator.log(Messages.addAttributeFailedMsg, e);
}
} else {
monitoredAttribute.setRGB(rgb.red, rgb.green, rgb.blue);
}
}
for (MBeanAttribute removedAttribute : removedAttributes) {
group.removeAttribute(removedAttribute.getObjectName().getCanonicalName(), removedAttribute.getAttributeName());
}
chart.refresh();
}
use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup in project tdi-studio-se by Talend.
the class ConfigureChartAction method run.
/*
* @see Action#run()
*/
@Override
public void run() {
IActiveJvm jvm = section.getJvm();
if (jvm == null) {
return;
}
String title = chart.getSection().getText();
IMonitoredMXBeanGroup group = chart.getAttributeGroup();
AxisUnit unit = group.getAxisUnit();
List<MBeanAttribute> attributes = getAttributes();
ConfigureChartDialog dialog = new ConfigureChartDialog(chart.getShell(), title, unit, attributes, jvm, true);
if (dialog.open() == Window.OK) {
performConfiguration(dialog.getChartTitle(), dialog.getAxisUnit(), dialog.getAttributes(), dialog.getRemovedAttributes());
}
}
use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup in project tdi-studio-se by Talend.
the class ConfigureChartDialog method validate.
/**
* Validates the entered title name.
*
* @param text The entered text
*/
void validate(String text) {
//$NON-NLS-1$
String errorMessage = "";
for (IMonitoredMXBeanGroup group : jvm.getMBeanServer().getMonitoredAttributeGroups()) {
if (group.getName().equals(text) && !originalChartTitle.equals(text)) {
errorMessage = Messages.chartTitleDuplicatedMsg;
break;
}
}
if (text.isEmpty()) {
errorMessage = Messages.chartTitleEmptyMsg;
}
errorImageLabel.setVisible(!errorMessage.isEmpty());
errorMessageLabel.setText(errorMessage);
setOkButtonVisible(errorMessage.isEmpty());
}
use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup in project tdi-studio-se by Talend.
the class LoadChartSetAction method loadChartSet.
/**
* Loads the given memento of chart set.
*
* @param memento The memento
* @throws JvmCoreException
*/
private void loadChartSet(IMemento memento) throws JvmCoreException {
IMBeanServer server = section.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()));
}
}
Aggregations