Search in sources :

Example 1 with ICpuModelChangeListener

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModelChangeListener in project tdi-studio-se by Talend.

the class CpuDumpEditor method addListeners.

/**
     * Adds the listeners.
     */
private void addListeners() {
    cpuModel.addModelChangeListener(new ICpuModelChangeListener() {

        @Override
        public void modelChanged(CpuModelEvent e) {
            Display.getDefault().asyncExec(new Runnable() {

                @Override
                public void run() {
                    refresh();
                }
            });
        }
    });
    addPageChangedListener(new IPageChangedListener() {

        @Override
        public void pageChanged(PageChangedEvent event) {
            pageSelectionChanged();
        }
    });
}
Also used : IPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) ICpuModelChangeListener(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModelChangeListener) PageChangedEvent(org.eclipse.jface.dialogs.PageChangedEvent) CpuModelEvent(org.talend.designer.runtime.visualization.internal.core.cpu.CpuModelEvent)

Example 2 with ICpuModelChangeListener

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModelChangeListener in project tdi-studio-se by Talend.

the class CpuDumpEditor method init.

/*
     * @see MultiPageEditorPart#init(IEditorSite, IEditorInput)
     */
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    cpuModel = new CpuModelFactory().createCpuModel();
    cpuModel.addModelChangeListener(new ICpuModelChangeListener() {

        @Override
        public void modelChanged(CpuModelEvent event) {
            if (event.state == CpuModelState.CallersCalleesTargetChanged) {
                refresh();
                if (cpuModel.getCallersCalleesTarget() != null) {
                    showCallerCalleeTab();
                }
            }
        }
    });
    setPartName(input.getName());
    if (input instanceof IFileEditorInput) {
        String filePath = ((IFileEditorInput) input).getFile().getRawLocation().toOSString();
        loadDumpFile(filePath);
    } else if (input instanceof FileStoreEditorInput) {
        String filePath = ((FileStoreEditorInput) input).getURI().getPath();
        loadDumpFile(filePath);
    }
}
Also used : ICpuModelChangeListener(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModelChangeListener) IFileEditorInput(org.eclipse.ui.IFileEditorInput) CpuModelFactory(org.talend.designer.runtime.visualization.internal.core.cpu.CpuModelFactory) CpuModelEvent(org.talend.designer.runtime.visualization.internal.core.cpu.CpuModelEvent) FileStoreEditorInput(org.eclipse.ui.ide.FileStoreEditorInput)

Aggregations

CpuModelEvent (org.talend.designer.runtime.visualization.internal.core.cpu.CpuModelEvent)2 ICpuModelChangeListener (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModelChangeListener)2 IPageChangedListener (org.eclipse.jface.dialogs.IPageChangedListener)1 PageChangedEvent (org.eclipse.jface.dialogs.PageChangedEvent)1 IFileEditorInput (org.eclipse.ui.IFileEditorInput)1 FileStoreEditorInput (org.eclipse.ui.ide.FileStoreEditorInput)1 CpuModelFactory (org.talend.designer.runtime.visualization.internal.core.cpu.CpuModelFactory)1