Search in sources :

Example 1 with RefreshJob

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

the class RuntimeGraphcsComposite method createControls.

@Override
protected void createControls(Composite parent) {
    chartsPage = new Composite(parent, SWT.NULL);
    parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    chartsPage.setBackground(parent.getBackground());
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = 0;
    formLayout.marginHeight = 0;
    chartsPage.setLayout(formLayout);
    FormData pageData = new FormData();
    pageData.top = new FormAttachment(0, 0);
    pageData.bottom = new FormAttachment(100, 0);
    pageData.left = new FormAttachment(0, 0);
    pageData.right = new FormAttachment(100, 0);
    chartsPage.setLayoutData(pageData);
    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 : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) RefreshJob(org.talend.designer.runtime.visualization.internal.ui.RefreshJob) IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) IMBeanServerChangeListener(org.talend.designer.runtime.visualization.MBean.IMBeanServerChangeListener) MBeanServerEvent(org.talend.designer.runtime.visualization.MBean.MBeanServerEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 2 with RefreshJob

use of org.talend.designer.runtime.visualization.internal.ui.RefreshJob 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 3 with RefreshJob

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

the class TimelineChart method refresh.

/**
     * Refreshes the chart.
     */
public void refresh() {
    refreshJob = new RefreshJob(NLS.bind(Messages.refreshChartJobLabel, attributeGroup.getName()), sectionId + attributeGroup.getName()) {

        @Override
        protected void refreshModel(IProgressMonitor monitor) {
        // do nothing
        }

        @Override
        protected void refreshUI() {
            refreshChartWidget();
        }
    };
    refreshJob.schedule();
}
Also used : RefreshJob(org.talend.designer.runtime.visualization.internal.ui.RefreshJob) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)

Example 4 with RefreshJob

use of org.talend.designer.runtime.visualization.internal.ui.RefreshJob 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)

Example 5 with RefreshJob

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

the class StopMonitoringAction method run.

/*
     * @see Action#run()
     */
@Override
public void run() {
    RefreshJob refreshJob = new RefreshJob(Messages.stopMonitoringJobLabel, UUID.randomUUID().toString()) {

        @Override
        protected void refreshModel(IProgressMonitor monitor) {
            for (IActiveJvm jvm : jvms) {
                jvm.disconnect();
            }
        }

        @Override
        protected void refreshUI() {
            if (!treeViewer.getControl().isDisposed()) {
                treeViewer.refresh();
            }
        }
    };
    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)

Aggregations

RefreshJob (org.talend.designer.runtime.visualization.internal.ui.RefreshJob)7 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)5 Composite (org.eclipse.swt.widgets.Composite)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)2 IMBeanServerChangeListener (org.talend.designer.runtime.visualization.MBean.IMBeanServerChangeListener)2 MBeanServerEvent (org.talend.designer.runtime.visualization.MBean.MBeanServerEvent)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 PageBook (org.eclipse.ui.part.PageBook)1 IHost (org.talend.designer.runtime.visualization.IHost)1 ProfilerState (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerState)1