Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f0351d7b94bdee43ec95fcb4c746f90ae2e72883 (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
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;


import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.PropertyPage;

public class ProcessPropertyPage extends PropertyPage {

	/**
	 * Constructor for ProcessPropertyPage
	 */
	public ProcessPropertyPage() {
		super();
	}

	/**
	 * @see PreferencePage#createContents(Composite)
	 */
	protected Control createContents(Composite ancestor) {
		Font font = ancestor.getFont();
		noDefaultAndApplyButton();
		
		Composite parent= new Composite(ancestor, SWT.NULL);
		GridLayout layout= new GridLayout();
		layout.numColumns= 2;
		parent.setLayout(layout);
		
		Label l1= new Label(parent, SWT.NULL);
		l1.setText(DebugPreferencesMessages.getString("ProcessPropertyPage.Command_Line__1")); //$NON-NLS-1$
		
		GridData gd= new GridData();
		gd.verticalAlignment= GridData.BEGINNING;
		l1.setLayoutData(gd);
		l1.setFont(font);
		Text l2= new Text(parent, SWT.WRAP | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
		gd= new GridData(GridData.FILL_HORIZONTAL);
		gd.widthHint= convertWidthInCharsToPixels(80);
		gd.heightHint= convertHeightInCharsToPixels(15);
		l2.setLayoutData(gd);
		l2.setFont(font);
		initCommandLineLabel(l2);
		
		return parent;
	}
	
	private void initCommandLineLabel(Text l) {
		Object o= getElement();
		if (o instanceof IDebugTarget)
			o= ((IDebugTarget)o).getProcess();
		if (o instanceof IProcess) {
			IProcess process= (IProcess)o;
			String cmdLine= process.getAttribute(IProcess.ATTR_CMDLINE);
			if (cmdLine != null)
				l.setText(cmdLine);
		}
	}
}

Back to the top