KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > ui > SootOptionsLauncherDialog


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20
21 package ca.mcgill.sable.soot.ui;
22
23 import org.eclipse.jface.dialogs.Dialog;
24 import org.eclipse.jface.dialogs.*;
25 import org.eclipse.core.runtime.*;
26 import org.eclipse.swt.widgets.*;
27 import org.eclipse.swt.*;
28 import ca.mcgill.sable.soot.*;
29
30
31
32
33 public class SootOptionsLauncherDialog extends Dialog {
34     protected IAdaptable input;
35     private Text text_input;
36     private Label text_label;
37
38     public SootOptionsLauncherDialog(Shell parentShell, IAdaptable input) {
39         super(parentShell);
40         this.input = input;
41     }
42
43     protected Control createDialogArea(Composite parent) {
44         Composite composite = (Composite)super.createDialogArea(parent);
45     
46         text_label = new Label(composite, SWT.LEFT);
47         text_label.setText("Set Soot Command Line:");
48     
49         text_input = new Text(composite, SWT.CENTER);
50         IDialogSettings settings = null;
51         try {
52             settings = SootPlugin.getDefault().getDialogSettings();
53         }
54         catch (Exception JavaDoc e1) {
55             System.out.println(e1.getMessage());
56         }
57         if (settings != null) {
58             String JavaDoc input = settings.get("text_input");
59             if (input != null) {
60                 text_input.setText(input);
61             }
62         }
63         text_input.setSize(200,20);
64                 
65         return composite;
66         
67     }
68     
69     protected void okPressed() {
70         IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
71         settings.put("text_input", text_input.getText());
72         super.okPressed();
73             
74     }
75     
76     
77 }
78
Popular Tags