use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class ActiveJvm method refreshPid.
/**
* Refreshes the PID.
*
* @throws JvmCoreException
*/
private void refreshPid() throws JvmCoreException {
//$NON-NLS-1$
String[] elements = mBeanServer.getRuntimeName().split("@");
if (elements == null || elements.length != 2) {
throw new JvmCoreException(IStatus.ERROR, Messages.getPidFailedMsg, new Exception());
}
setPid(Integer.valueOf(elements[0]));
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method reconstructCharts.
void reconstructCharts(IActiveJvm activeJvm, boolean connected) {
if (chartsPage.isDisposed()) {
return;
}
if (connected) {
try {
loadOverviewChartSet(activeJvm);
} catch (JvmCoreException e) {
Activator.log(Messages.configureMonitoredAttributesFailedMsg, e);
}
}
List<IMonitoredMXBeanGroup> groups = activeJvm.getMBeanServer().getMonitoredAttributeGroups();
if (groups.size() == 0) {
return;
}
for (TimelineChart chart : charts) {
chart.dispose();
}
charts.clear();
if (chartComposite != null && !chartComposite.isDisposed()) {
chartComposite.dispose();
}
chartComposite = new Composite(chartsPage, SWT.NONE);
FormLayout chartLayout = new FormLayout();
chartLayout.marginHeight = 0;
chartLayout.marginWidth = 0;
chartComposite.setLayout(chartLayout);
FormData chartComData = new FormData();
chartComData.top = new FormAttachment(0, 0);
chartComData.bottom = new FormAttachment(100, 0);
chartComData.left = new FormAttachment(0, 0);
chartComData.right = new FormAttachment(100, 0);
chartComposite.setLayoutData(chartComData);
for (IMonitoredMXBeanGroup group : groups) {
createSection(chartComposite, group);
}
createReportField(chartComposite);
// createInfoField(chartComposite);
chartsPage.layout();
chartsPage.setVisible(true);
refresh();
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createMessagePage.
private Composite createMessagePage(Composite parent) {
messagePage = new Composite(parent, SWT.NONE);
FormLayout messageLayout = new FormLayout();
messageLayout.marginHeight = 0;
messageLayout.marginWidth = 0;
messagePage.setLayout(messageLayout);
messagePage.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
FormToolkit toolkit = new FormToolkit(Display.getDefault());
Hyperlink hyperlink = toolkit.createHyperlink(messagePage, Messages.loadDefaultChartSetLabel, SWT.NONE);
hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent event) {
try {
new LoadChartAction(RuntimeGraphcsComposite.this).loadDefaultChartSet();
} catch (JvmCoreException e) {
Activator.log(Messages.loadChartSetFailedMsg, e);
}
}
});
return messagePage;
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class NewJvmConnectionWizard method addActiveJvm.
/**
* Adds the active JVM.
*
* @return The active JVM
*/
private IActiveJvm addActiveJvm() {
final boolean isHostAndPortSelected = page.isHostAndPortSelected();
final String hostName = page.getRemoteHost();
final int port = page.getPort();
final String userName = page.getUserName();
final String password = page.getPassword();
final String jmxUrl = page.getJmxUrl();
try {
final IActiveJvm[] result = new IActiveJvm[1];
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
int period = Activator.getDefault().getPreferenceStore().getInt(IConstants.UPDATE_PERIOD);
if (isHostAndPortSelected) {
IHost host = JvmModel.getInstance().addHost(hostName);
result[0] = host.addRemoteActiveJvm(port, userName, password, period);
} else {
result[0] = JvmModel.getInstance().addHostAndJvm(jmxUrl, userName, password, period);
}
} catch (JvmCoreException e) {
throw new InvocationTargetException(e);
}
}
};
new ProgressMonitorDialog(getShell()).run(true, true, op);
return result[0];
} catch (InvocationTargetException e) {
openErrorDialog(e);
return null;
} catch (InterruptedException e) {
return null;
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class NewJvmConnectionWizard method performFinish.
/*
* @see Wizard#performFinish()
*/
@Override
public boolean performFinish() {
// add active JVM
IActiveJvm jvm = addActiveJvm();
if (jvm == null) {
return false;
}
// select item on JVM explorer
viewer.refresh();
viewer.setSelection(new StructuredSelection(jvm));
// connect to JVM
try {
int period = Activator.getDefault().getPreferenceStore().getInt(IConstants.UPDATE_PERIOD);
jvm.connect(period);
} catch (JvmCoreException e) {
Activator.log(NLS.bind(Messages.connectJvmFailedMsg, jvm.getPid()), e);
}
page.storeDialogSettings();
return true;
}
Aggregations