use of org.talend.designer.runtime.visualization.internal.ui.properties.timeline.MBeanAttribute in project tdi-studio-se by Talend.
the class ShowInTimelineAction method selectionChanged.
/*
* @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
IActiveJvm jvm = section.getJvm();
if (!(event.getSelection() instanceof StructuredSelection) || jvm == null || !jvm.isConnected()) {
setEnabled(false);
return;
}
Object[] elements = ((StructuredSelection) event.getSelection()).toArray();
if (elements.length == 0) {
setEnabled(false);
return;
}
boolean enabled = true;
selections.clear();
for (Object element : elements) {
MBeanAttribute attribute = getMBeanAttribute(element);
if (attribute != null) {
selections.add(attribute);
}
if (!getEnabled(element)) {
enabled = false;
}
}
setEnabled(enabled);
}
use of org.talend.designer.runtime.visualization.internal.ui.properties.timeline.MBeanAttribute in project tdi-studio-se by Talend.
the class ShowInTimelineAction method performShowInTimeline.
/**
* Performs showing a new chart with attributes in Timeline tab.
*
* @param chartTitle The chart title
* @param axisUnit The axis unit
* @param attributes The attributes
*/
private void performShowInTimeline(String chartTitle, AxisUnit axisUnit, List<MBeanAttribute> attributes) {
IActiveJvm jvm = section.getJvm();
if (jvm == null) {
return;
}
IMonitoredMXBeanGroup group = jvm.getMBeanServer().addMonitoredAttributeGroup(chartTitle, axisUnit);
for (MBeanAttribute attribute : attributes) {
ObjectName objectName = attribute.getObjectName();
String attributeName = attribute.getAttributeName();
RGB rgb = attribute.getRgb();
try {
group.addAttribute(objectName.getCanonicalName(), attributeName, new int[] { rgb.red, rgb.green, rgb.blue });
} catch (JvmCoreException e) {
Activator.log(NLS.bind(Messages.addAttributeFailedMsg, attributeName), e);
}
}
}
Aggregations