2 * Copyright 2015 Samsung Electronics All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package oic.simulator.serviceprovider.view.dialogs;
19 import org.eclipse.jface.dialogs.TrayDialog;
20 import org.eclipse.swt.SWT;
21 import org.eclipse.swt.events.ModifyEvent;
22 import org.eclipse.swt.events.ModifyListener;
23 import org.eclipse.swt.layout.GridData;
24 import org.eclipse.swt.layout.GridLayout;
25 import org.eclipse.swt.widgets.Composite;
26 import org.eclipse.swt.widgets.Control;
27 import org.eclipse.swt.widgets.Label;
28 import org.eclipse.swt.widgets.Shell;
29 import org.eclipse.swt.widgets.Text;
32 * This class shows a dialog for filtering logs based on severity levels.
34 public class SingleTextInputDialog extends TrayDialog {
38 private String lblTxt;
39 private String shellTitle;
41 public SingleTextInputDialog(Shell shell, String title, String lblTxt) {
48 protected void configureShell(Shell shell) {
49 super.configureShell(shell);
53 protected Control createDialogArea(Composite parent) {
54 Composite composite = (Composite) super.createDialogArea(parent);
55 getShell().setText(shellTitle);
57 Composite content = new Composite(parent, SWT.NULL);
58 GridLayout gridLayout = new GridLayout();
59 content.setLayout(gridLayout);
60 GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
61 content.setLayoutData(gd);
63 Label lbl = new Label(content, SWT.NONE);
66 txt = new Text(content, SWT.BORDER);
67 gd = new GridData(SWT.FILL, SWT.FILL, true, true);
68 txt.setLayoutData(gd);
69 txt.addModifyListener(new ModifyListener() {
72 public void modifyText(ModifyEvent e) {
73 value = txt.getText();
81 protected void okPressed() {
84 if (value.length() > 0) {
93 public boolean isHelpAvailable() {
97 public String getValue() {