1 26 30 31 package org.omg.lifl.eclipse.plugin.project.OpenCCM.utils; 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.RowLayout; 38 import org.eclipse.swt.widgets.Button; 39 import org.eclipse.swt.widgets.Composite; 40 import org.eclipse.swt.widgets.DirectoryDialog; 41 import org.eclipse.swt.widgets.Event; 42 import org.eclipse.swt.widgets.Group; 43 import org.eclipse.swt.widgets.Label; 44 import org.eclipse.swt.widgets.Listener; 45 import org.eclipse.swt.widgets.Text; 46 import org.omg.lifl.eclipse.plugin.project.utils.AttributeManager; 47 import org.omg.lifl.eclipse.plugin.project.utils.SWT.CheckGroup; 48 49 53 public class CVSsrcFSChooser { 54 55 private String _CVSsrcFSPathValue; 56 private String _CVSsrcFSPathLabel; 57 private String _CVFsrcFSGroupLabel; 58 private Text CVSsrcFSTextPath; 59 60 private DirectoryDialog fd1; 61 private CheckGroup checkGroup; 62 66 public CVSsrcFSChooser(IConfigurationElement elem) { 67 _CVSsrcFSPathValue = 68 AttributeManager.getAttribute(elem, "CVSsrcFSPathValue"); 69 _CVSsrcFSPathLabel = 70 AttributeManager.getAttribute(elem, "CVSsrcFSPathLabel"); 71 _CVFsrcFSGroupLabel = ""; 72 } 73 74 77 public void viewToSetCVSsrcFS(Composite composite) { 78 String buttonTittle = ProjectMessages.getString("DirectoryChooser.BrowseButtonLabel"); 79 checkGroup = new CheckGroup(composite, "Source Import Config"); 80 81 Group group_1 = new Group(checkGroup.getGroup(), SWT.NONE); 82 checkGroup.setSubGroup(group_1); 83 84 group_1.setLayout(new RowLayout()); 85 group_1.setText(_CVFsrcFSGroupLabel); 86 87 Label label2 = new Label(group_1, SWT.LEFT); 88 label2.setText(_CVSsrcFSPathLabel); 89 CVSsrcFSTextPath = new Text(group_1, SWT.SINGLE | SWT.BORDER); 90 CVSsrcFSTextPath.setText(_CVSsrcFSPathValue); 91 CVSsrcFSTextPath.addModifyListener(new ModifyListener() { 92 public void modifyText(ModifyEvent e) { 93 set_CVSsrcFSPathValue(CVSsrcFSTextPath.getText()); 95 } 96 }); 97 fd1 = new DirectoryDialog(composite.getShell()); 98 fd1.setFilterPath(get_CVSsrcFSPathValue()); 99 Button btn = new Button(group_1, SWT.NONE); 100 btn.setText(buttonTittle); 101 102 btn.addListener(SWT.Selection, new Listener() { 103 104 public void handleEvent(Event e) { 105 String buffer = fd1.open(); 106 if (buffer != null) 107 configCVSsrcFS(buffer); 108 } 109 }); 110 } 111 112 115 protected void configCVSsrcFS(String buffer) { 116 set_CVSsrcFSPathValue(buffer); 117 CVSsrcFSTextPath.setText(buffer); 118 } 119 120 123 public void set_CVSsrcFSPathValue(String string) { 124 _CVSsrcFSPathValue = string; 125 } 126 127 130 public String get_CVSsrcFSPathValue() { 131 return _CVSsrcFSPathValue; 132 } 133 134 137 public CheckGroup getCheckGroup() { 138 return checkGroup; 139 } 140 141 144 public void setCheckGroup(CheckGroup group) { 145 checkGroup = group; 146 } 147 148 } 149 | Popular Tags |