2 * Copyright 2016 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.Combo;
26 import org.eclipse.swt.widgets.Composite;
27 import org.eclipse.swt.widgets.Control;
28 import org.eclipse.swt.widgets.Label;
29 import org.eclipse.swt.widgets.Shell;
31 import java.util.List;
34 * This class shows a dialog for filtering logs based on severity levels.
36 public class AddInterfaceTypeDialog extends TrayDialog {
38 private Combo ifTypesCmb;
40 private List<String> ifTypes;
42 public AddInterfaceTypeDialog(Shell shell, List<String> ifTypes) {
44 this.ifTypes = ifTypes;
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("Add Interface Type");
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);
64 lbl.setText("Select Interface Type");
66 ifTypesCmb = new Combo(content, SWT.NULL);
67 gd = new GridData(SWT.FILL, SWT.FILL, true, true);
68 ifTypesCmb.setLayoutData(gd);
70 ifTypesCmb.addModifyListener(new ModifyListener() {
72 public void modifyText(ModifyEvent e) {
73 value = ifTypesCmb.getText();
82 private void initList() {
83 if (null != ifTypesCmb && null != ifTypes && !ifTypes.isEmpty()) {
84 ifTypesCmb.setItems(ifTypes.toArray(new String[1]));
89 public boolean isHelpAvailable() {
93 public String getValue() {