Search in sources :

Example 51 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class HeapHistogramPage method refresh.

/**
     * Refreshes the appearance.
     */
public void refresh() {
    // for dump editor
    if (section == null || isDisposed()) {
        return;
    }
    final boolean isVisible = isVisible();
    new RefreshJob(NLS.bind(Messages.refreshMemorySectionJobLabel, section.getJvm().getPid()), getId()) {

        @Override
        protected void refreshModel(IProgressMonitor monitor) {
            if (!isSupported() || !isVisible) {
                return;
            }
            try {
                IActiveJvm jvm = section.getJvm();
                if (jvm != null && jvm.isConnected() && !jvm.isRemote() && !section.isRefreshSuspended()) {
                    jvm.getMBeanServer().refreshHeapCache();
                }
            } catch (JvmCoreException e) {
                Activator.log(Messages.refreshHeapDataFailedMsg, e);
            }
        }

        @Override
        protected void refreshUI() {
            IActiveJvm jvm = section.getJvm();
            boolean isConnected = jvm != null && jvm.isConnected();
            boolean isRemote = jvm != null && jvm.isRemote();
            boolean isSupported = isSupported();
            if (!heapViewer.getControl().isDisposed() && heapViewer.getControl().isVisible() && isSupported) {
                heapViewer.refresh();
            }
            if (!isDisposed()) {
                refreshBackground();
            }
            dumpHprofAction.setEnabled(isConnected);
            dumpHeapAction.setEnabled(!section.hasErrorMessage() && !isRemote && isSupported);
            refreshAction.setEnabled(isConnected && !isRemote && isSupported);
            garbageCollectorAction.setEnabled(isConnected);
            clearHeapDeltaAction.setEnabled(isConnected && !isRemote && isSupported);
        }
    }.schedule();
}
Also used : RefreshJob(org.talend.designer.runtime.visualization.internal.ui.RefreshJob) IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 52 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class ResumeCpuProfilingAction method performRun.

/*
     * @see AbstractJobAction#performRun(IProgressMonitor)
     */
@Override
protected IStatus performRun(IProgressMonitor monitor) {
    IActiveJvm jvm = section.getJvm();
    if (jvm == null) {
        return Status.CANCEL_STATUS;
    }
    if (jvm.getCpuProfiler().getProfilerType() == ProfilerType.BCI) {
        try {
            jvm.getCpuProfiler().transformClasses(monitor);
        } catch (JvmCoreException e) {
            Activator.log(Messages.resumeCpuProfilingFailedMsg, e);
        } catch (InterruptedException e) {
            return Status.CANCEL_STATUS;
        }
    }
    try {
        jvm.getCpuProfiler().resume();
    } catch (JvmCoreException e) {
        Activator.log(Messages.resumeCpuProfilingFailedMsg, e);
    }
    suspendAction.setEnabled(true);
    return Status.OK_STATUS;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 53 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class DumpCpuProfilingDataAction method performRun.

/*
     * @see AbstractJobAction#performRun(IProgressMonitor)
     */
@Override
protected IStatus performRun(IProgressMonitor monitor) {
    IActiveJvm jvm = section.getJvm();
    if (jvm == null) {
        return Status.CANCEL_STATUS;
    }
    IFileStore fileStore = null;
    try {
        fileStore = jvm.getCpuProfiler().dump();
    } catch (JvmCoreException e) {
        Activator.log(Messages.dumpCpuProfileDataFailedMsg, e);
        return Status.CANCEL_STATUS;
    }
    section.setPinned(true);
    OpenSnapshotAction.openEditor(fileStore);
    return Status.OK_STATUS;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IFileStore(org.eclipse.core.filesystem.IFileStore) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 54 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class AbstractJvmPropertySection method setInput.

/*
     * @see AbstractPropertySection#setInput(IWorkbenchPart, ISelection)
     */
@Override
public final void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    if (!(selection instanceof StructuredSelection)) {
        return;
    }
    StructuredSelection structuredSelection = (StructuredSelection) selection;
    Object firstElement = structuredSelection.getFirstElement();
    if (!(firstElement instanceof IActiveJvm)) {
        super.setInput(part, null);
        return;
    }
    IActiveJvm oldJvm = jvm;
    IActiveJvm newJvm = (IActiveJvm) firstElement;
    jvm = newJvm;
    if (oldJvm != newJvm || newJvm.isConnected()) {
        updatePage();
    }
    addToolBarActions();
    addLocalMenus();
    if (newJvm.isConnected()) {
        activateSection();
    }
    setInput(part, selection, newJvm, oldJvm);
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Aggregations

IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)54 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)14 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)7 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)6 RefreshJob (org.talend.designer.runtime.visualization.internal.ui.RefreshJob)6 IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)5 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 ObjectName (javax.management.ObjectName)2 Job (org.eclipse.core.runtime.jobs.Job)2 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Composite (org.eclipse.swt.widgets.Composite)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 IHost (org.talend.designer.runtime.visualization.IHost)2 JvmModelEvent (org.talend.designer.runtime.visualization.JvmModelEvent)2 IMBeanServerChangeListener (org.talend.designer.runtime.visualization.MBean.IMBeanServerChangeListener)2 IMonitoredMXBeanAttribute (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute)2 AxisUnit (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit)2 MBeanServerEvent (org.talend.designer.runtime.visualization.MBean.MBeanServerEvent)2