blob: b58ffacb3fc01f4feab146ec48cb260785f40b00 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*******************************************************************************
* Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.ISysMonitor;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
/**
* The property section to display the memory usage of a process.
*/
public class MemorySection extends BaseTitledSection {
// The context of the process selected.
/* default */ ISysMonitor.SysMonitorContext context;
// The text field for the virtual memory size in bytes.
private Text vsizeText;
// The text field for the virtual memory pages.
private Text psizeText;
// The number of memory pages in process resident set.
private Text rssText;
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
*/
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
vsizeText = createTextField(null, Messages.MemorySection_VSize);
psizeText = createTextField(vsizeText, Messages.MemorySection_PSize);
rssText = createTextField(psizeText, Messages.MemorySection_RSS);
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
*/
@Override
protected String getText() {
return Messages.MemorySection_Title;
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
*/
@Override
protected void updateInput(IPeerNodeProvider input) {
Assert.isTrue(input instanceof IProcessContextNode);
final IProcessContextNode node = (IProcessContextNode) input;
Runnable runnable = new Runnable() {
@Override
public void run() {
context = node.getSysMonitorContext();
}
};
Assert.isTrue(!Protocol.isDispatchThread());
Protocol.invokeAndWait(runnable);
}
/* (non-Javadoc)
* @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
*/
@Override
public void refresh() {
SWTControlUtil.setText(vsizeText, context == null ? "" : context.getVSize() >= 0 ? "" + context.getVSize() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
SWTControlUtil.setText(psizeText, context == null ? "" : context.getPSize() >= 0 ? "" + context.getPSize() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
SWTControlUtil.setText(rssText, context == null ? "" : context.getRSS() >= 0 ? "" + context.getRSS() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
super.refresh();
}
}
|