1 26 30 31 package org.omg.lifl.eclipse.plugin.project.OpenCCM; 32 33 import org.eclipse.core.runtime.IConfigurationElement; 34 import org.eclipse.swt.SWT; 35 import org.eclipse.swt.events.ModifyEvent; 36 import org.eclipse.swt.events.ModifyListener; 37 import org.eclipse.swt.layout.GridData; 38 import org.eclipse.swt.layout.GridLayout; 39 import org.eclipse.swt.widgets.Composite; 40 import org.eclipse.swt.widgets.Label; 41 import org.eclipse.swt.widgets.Text; 42 import org.omg.lifl.eclipse.plugin.project.OpenCCM.utils.ValidatorProject; 43 import org.omg.lifl.eclipse.plugin.project.utils.AttributeManager; 44 45 49 public class ProjectChooser { 50 private String _NameLabel; 51 private String _ProjectName; 52 private Text fTextControl; 53 private ValidatorProject page; 54 55 58 public ProjectChooser(IConfigurationElement elem) { 59 _NameLabel = AttributeManager.getAttribute(elem, "label"); 60 _ProjectName = AttributeManager.getAttribute(elem, "name"); 61 } 62 63 66 public void viewToSetOpenCCMProjectName(Composite composite, ValidatorProject validator) { 67 this.page = validator; 68 Composite internal = new Composite(composite, SWT.NONE); 69 GridLayout gd = new GridLayout(); 70 gd.numColumns = 2; 71 72 GridLayout gd2 = new GridLayout(); 73 gd2.numColumns = 2; 74 75 internal.setLayout(gd); 76 Label label = new Label(internal, SWT.LEFT); 77 label.setText(_NameLabel); 78 label.setLayoutData(new GridData()); 79 fTextControl = new Text(internal, SWT.SINGLE | SWT.BORDER); 80 81 fTextControl.setText(_ProjectName); 82 fTextControl.addModifyListener(new ModifyListener() { 83 public void modifyText(ModifyEvent e) { 84 if (!fTextControl.isDisposed() && page != null) { 85 page.validateTextProjectName(fTextControl.getText()); 86 } 87 } 88 }); 89 fTextControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 90 } 91 92 95 public String get_NameLabel() { 96 return _NameLabel; 97 } 98 99 102 public void set_NameLabel(String string) { 103 _NameLabel = string; 104 } 105 106 109 public String get_ProjectName() { 110 return _ProjectName; 111 } 112 113 116 public void set_ProjectName(String string) { 117 _ProjectName = string; 118 } 119 120 123 public Text getFTextControl() { 124 return fTextControl; 125 } 126 127 130 public void setFTextControl(Text text) { 131 fTextControl = text; 132 } 133 134 } 135 | Popular Tags |