Search in sources :

Example 46 with IActiveJvm

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

the class AbstractRuntimeGraphcsComposite method setInput.

public void setInput(ISelection selection) {
    if (!(selection instanceof StructuredSelection)) {
        return;
    }
    StructuredSelection structuredSelection = (StructuredSelection) selection;
    Object firstElement = structuredSelection.getFirstElement();
    IActiveJvm oldJvm = jvm;
    IActiveJvm newJvm = (IActiveJvm) firstElement;
    jvm = newJvm;
    if (oldJvm != newJvm || newJvm.isConnected()) {
        updatePage();
    }
    if (newJvm.isConnected()) {
        updatePage();
    }
    setInput(selection, newJvm, oldJvm);
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 47 with IActiveJvm

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

the class JvmTreeViewer method updateStatusLine.

/**
     * Updates the status line.
     * 
     * @param selection the selection
     */
void updateStatusLine(final IStructuredSelection selection) {
    RefreshJob refreshJob = new RefreshJob(Messages.refreshStatusLineJobLabel, JvmTreeViewer.class.getName()) {

        private ProfilerState state;

        private Object element;

        @Override
        protected void refreshModel(IProgressMonitor monitor) {
            element = selection.getFirstElement();
            if (element instanceof IActiveJvm) {
                IActiveJvm activeJvm = (IActiveJvm) element;
                state = activeJvm.getCpuProfiler().getState();
            }
        }

        @Override
        protected void refreshUI() {
            StringBuffer text = new StringBuffer();
            StringBuffer errorText = new StringBuffer();
            errorImage = null;
            if (element instanceof IActiveJvm) {
                IActiveJvm activeJvm = (IActiveJvm) element;
                if (activeJvm.isConnected()) {
                    text.append(Messages.connectedMsg);
                    if (state == ProfilerState.RUNNING) {
                        //$NON-NLS-1$
                        text.append(" ").append(Messages.cpuProfilerRunningMsg);
                    }
                } else if (!activeJvm.isConnectionSupported()) {
                    String errorMessage = activeJvm.getErrorStateMessage();
                    if (errorMessage != null) {
                        errorText.append(errorMessage);
                    }
                } else {
                    text.append(Messages.disconnectedMsg);
                }
            } else if (element instanceof IHost) {
                IHost host = (IHost) element;
                if (host.getName().equals(IHost.LOCALHOST)) {
                    if (!JvmModel.getInstance().hasValidJdk()) {
                        errorText.append(Messages.invalidJdkLocationMsg);
                        errorImage = getErrorImage();
                    } else if (host.getActiveJvms().isEmpty()) {
                        errorText.append(Messages.cannnotDetectJvmMsg);
                        errorImage = getErrorImage();
                    }
                }
            }
            statusLineManager.setErrorMessage(errorImage, errorText.toString());
            statusLineItem.setText(text.toString());
        }
    };
    refreshJob.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) IHost(org.talend.designer.runtime.visualization.IHost) ProfilerState(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerState)

Example 48 with IActiveJvm

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

the class TimelineSection method refresh.

/*
     * @see AbstractPropertySection#refresh()
     */
@Override
public void refresh() {
    refreshConnectionIndicator();
    refreshReportField();
    IActiveJvm jvm = getJvm();
    if (jvm == null || !jvm.isConnected() || isRefreshSuspended() || chartsPage.isDisposed()) {
        return;
    }
    for (TimelineChart chart : charts) {
        if (!chart.isDisposed() && chart.isVisible()) {
            chart.refresh();
        }
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm)

Example 49 with IActiveJvm

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

the class TimelineSection method refreshConnectionIndicator.

/**
     * Refreshes the connection indicator.
     */
private void refreshConnectionIndicator() {
    IActiveJvm jvm = getJvm();
    boolean isConnected = jvm != null && jvm.isConnected();
    refreshBackground(chartsPage, isConnected);
    for (TimelineChart chart : charts) {
        refreshBackground(chart, isConnected);
        refreshBackground(chart.getPlotArea(), isConnected);
        refreshBackground(chart.getSection(), isConnected);
    }
    refreshBackground(messagePage, isConnected);
    clearAction.setEnabled(isConnected);
    refreshAction.setEnabled(isConnected);
    newChartAction.setEnabled(isConnected);
    loadChartSetAction.setEnabled(isConnected);
    garbageCollectorAction.setEnabled(isConnected);
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm)

Example 50 with IActiveJvm

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

the class TimelineSection method createControls.

/*
     * @see AbstractJvmPropertySection#createControls(Composite)
     */
@Override
protected void createControls(Composite parent) {
    timelinePageBook = new PageBook(parent, SWT.NONE);
    chartsPage = new Composite(timelinePageBook, SWT.NONE);
    messagePage = createMessagePage();
    parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    GridLayout layout = new GridLayout(2, true);
    layout.horizontalSpacing = 15;
    chartsPage.setLayout(layout);
    timelinePageBook.showPage(chartsPage);
    mBeanServerChangeListener = new IMBeanServerChangeListener() {

        @Override
        public void serverChanged(MBeanServerEvent event) {
            new RefreshJob(Messages.reconstructChartJobLabel, toString()) {

                @Override
                protected void refreshUI() {
                    IActiveJvm jvm = getJvm();
                    if (jvm != null) {
                        reconstructCharts(jvm, false);
                    }
                }
            }.schedule();
        }
    };
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.TIMELINE_PAGE);
}
Also used : RefreshJob(org.talend.designer.runtime.visualization.internal.ui.RefreshJob) IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) GridLayout(org.eclipse.swt.layout.GridLayout) PageBook(org.eclipse.ui.part.PageBook) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) IMBeanServerChangeListener(org.talend.designer.runtime.visualization.MBean.IMBeanServerChangeListener) MBeanServerEvent(org.talend.designer.runtime.visualization.MBean.MBeanServerEvent)

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