Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 99b92aeeca0c6851bcf986be2e21f6dea04ae1d1 (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
86
87
88
89
90
91
/*******************************************************************************
 * Copyright (c) 2011 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.services.ISysMonitor;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
import org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;

/**
 * The property section to display the basic context information of a process.
 */
public class BasicContextSection extends BaseTitledSection {
	// The process context to be displayed.
	protected ISysMonitor.SysMonitorContext context;
	// The text field for the executable file.
	protected Text fileText;
	// The text field for the working directory.
	protected Text workDirText;
	// The text field for the root directory.
	protected Text rootText;
	// The state of the process.
	protected Text stateText;
	// The owner of the process.
	protected Text userText;
	// The owner group of the process.
	protected Text groupText;
	
	/*
	 * (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);
	    fileText = createWrapTextField(null, Messages.BasicContextSection_File);
		workDirText = createWrapTextField(fileText, Messages.BasicContextSection_WorkDir);
		rootText = createWrapTextField(workDirText, Messages.BasicContextSection_Root);
		stateText = createTextField(rootText, Messages.BasicContextSection_State);
		userText = createTextField(stateText, Messages.BasicContextSection_User);
		groupText = createTextField(userText, Messages.BasicContextSection_Group);
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
	 */
	@Override
    protected void updateInput(IPeerModelProvider input) {
        Assert.isTrue(input instanceof ProcessTreeNode);
        ProcessTreeNode node = (ProcessTreeNode) input;
        Assert.isNotNull(node.context);
        context = node.context;
    }

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
	 */
	@Override
    public void refresh() {
		fileText.setText(context.getFile() == null ? "" : context.getFile()); //$NON-NLS-1$
		workDirText.setText(context.getCurrentWorkingDirectory() == null ? "" : context.getCurrentWorkingDirectory()); //$NON-NLS-1$
		rootText.setText(context.getRoot() == null ? "" : context.getRoot()); //$NON-NLS-1$
		stateText.setText(context.getState() == null ? "" : context.getState()); //$NON-NLS-1$
		userText.setText(context.getUserName() == null ? "" : context.getUserName()); //$NON-NLS-1$
		groupText.setText(context.getGroupName() == null ? "" : context.getGroupName()); //$NON-NLS-1$
		super.refresh();
    }

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
	 */
	@Override
	protected String getText() {
		return Messages.BasicContextSection_Title; 
	}
}

Back to the top