summaryrefslogtreecommitdiffstats
path: root/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java')
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java104
1 files changed, 104 insertions, 0 deletions
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java
new file mode 100644
index 0000000..9fd7876
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java
@@ -0,0 +1,104 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.yocto.sdk.remotetools.Activator;
14import org.yocto.sdk.remotetools.Messages;
15import org.eclipse.jface.dialogs.IDialogConstants;
16import org.eclipse.swt.SWT;
17import org.eclipse.swt.events.ModifyEvent;
18import org.eclipse.swt.events.ModifyListener;
19
20import org.eclipse.swt.layout.GridData;
21import org.eclipse.swt.layout.GridLayout;
22import org.eclipse.swt.widgets.Button;
23
24import org.eclipse.swt.widgets.Composite;
25
26import org.eclipse.swt.widgets.Label;
27import org.eclipse.swt.widgets.Shell;
28import org.eclipse.swt.widgets.Text;
29
30
31public class Ust2SettingDialog extends UstSettingDialogBase {
32
33 static protected String TITLE="Lttng2.0 User Tracing Import";
34
35 protected String trace;
36 protected Text traceText;
37
38 protected Ust2SettingDialog(Shell parentShell, String title, String conn) {
39 super(parentShell,title,conn);
40 }
41
42 public Ust2SettingDialog(Shell parentShell) {
43 this(parentShell,
44 TITLE,
45 Activator.getDefault().getDialogSettings().get(IBaseConstants.CONNECTION_NAME_UST)
46 );
47 }
48
49 public String getTrace() {
50 return trace;
51 }
52
53 @Override
54 protected void okPressed() {
55
56 trace=traceText.getText();
57
58 super.okPressed();
59 }
60
61 protected void createArgument(Composite parent)
62 {
63 Composite projComp = new Composite(parent, SWT.NONE);
64 GridLayout projLayout = new GridLayout();
65 projLayout.numColumns = 4;
66 projLayout.marginHeight = 0;
67 projLayout.marginWidth = 0;
68 projComp.setLayout(projLayout);
69 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
70 projComp.setLayoutData(gd);
71
72 Label label = new Label(projComp, SWT.NONE);
73 label.setText(Messages.Usttrace_Trace_Loc_Text);
74 gd = new GridData();
75 gd.horizontalSpan = 4;
76 label.setLayoutData(gd);
77
78 traceText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
79 traceText.addModifyListener(new ModifyListener() {
80 public void modifyText(ModifyEvent e) {
81 updateOkButton();
82 }
83 });
84 if(trace!=null)
85 traceText.setText(trace);
86 gd = new GridData(GridData.FILL_HORIZONTAL);
87 gd.horizontalSpan = 1;
88 traceText.setLayoutData(gd);
89 }
90
91 @Override
92 protected boolean updateOkButton() {
93 boolean ret=super.updateOkButton();
94 if(ret==true) {
95 if(traceText.getText().isEmpty() || !traceText.getText().endsWith("/ust")) {
96 Button button=getButton(IDialogConstants.OK_ID);
97 if(button!=null)
98 button.setEnabled(false);
99 ret=false;
100 }
101 }
102 return ret;
103 }
104}