1 19 20 package ca.mcgill.sable.soot.ui; 21 22 import java.util.ArrayList ; 23 24 import org.eclipse.swt.widgets.*; 25 import org.eclipse.swt.layout.*; 26 import org.eclipse.swt.*; 27 import ca.mcgill.sable.soot.ui.*; 28 29 public class StringOptionWidget implements ISootOptionWidget { 30 31 private Text text; 32 private Label label; 33 private String alias; 34 35 36 37 42 public StringOptionWidget(Composite parent, int style, 43 OptionData data) { 44 45 setAlias(data.getRealAlias()); 46 47 Group path = new Group(parent, SWT.NONE); 48 GridLayout gl = new GridLayout(); 49 gl.numColumns = 2; 50 path.setLayout(gl); 51 GridData gridData2 = new GridData(GridData.FILL_HORIZONTAL); 53 path.setLayoutData(gridData2); 54 55 56 57 setLabel(new Label(path, SWT.NONE)); 58 setLabelText(data.getText()); 59 setText(new Text(path, SWT.SINGLE | SWT.BORDER)); 60 61 getText().setText(data.getInitText()); 62 getText().setToolTipText(data.getTooltip().trim()); 63 getText().setSize(300, 20); 64 65 GridData gridData = new GridData(GridData.FILL_HORIZONTAL); 67 gridData.horizontalSpan = 1; 68 getText().setLayoutData(gridData); 69 70 71 } 72 public ArrayList getControls(){ 73 ArrayList controls = new ArrayList (); 74 controls.add(getText()); 75 return controls; 76 } 77 78 public String getId(){ 79 return getAlias(); 80 } 81 82 public void setLabelText(String text) { 83 getLabel().setText(text); 84 } 85 86 90 public Label getLabel() { 91 return label; 92 } 93 94 98 public Text getText() { 99 return text; 100 } 101 102 106 public void setLabel(Label label) { 107 this.label = label; 108 } 109 110 114 public void setText(Text text) { 115 this.text = text; 116 } 117 118 122 public String getAlias() { 123 return alias; 124 } 125 126 130 public void setAlias(String alias) { 131 this.alias = alias; 132 } 133 134 } 135 | Popular Tags |