KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > lifl > eclipse > plugin > project > OpenCCM > utils > CVSsrcFSChooser


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2003 USTL - LIFL - GOAL
5 Contact: openccm-team@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Offroy.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 /*
27  * Created on 23 mai 2003 by jerome OFFROY (offroy@lifl.fr)
28  *
29  */

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 /**
50  * @author Jerome Offroy offroy@lifl.fr
51  *
52  */

53 public class CVSsrcFSChooser {
54
55     private String JavaDoc _CVSsrcFSPathValue;
56     private String JavaDoc _CVSsrcFSPathLabel;
57     private String JavaDoc _CVFsrcFSGroupLabel;
58     private Text CVSsrcFSTextPath;
59
60     private DirectoryDialog fd1;
61     private CheckGroup checkGroup;
62     /**
63      * @param pageNumber
64      * @param elem
65      */

66     public CVSsrcFSChooser(IConfigurationElement elem) {
67         _CVSsrcFSPathValue =
68             AttributeManager.getAttribute(elem, "CVSsrcFSPathValue");
69         _CVSsrcFSPathLabel =
70             AttributeManager.getAttribute(elem, "CVSsrcFSPathLabel");
71         _CVFsrcFSGroupLabel = "";
72     }
73
74     /**
75      * @param composite
76      */

77     public void viewToSetCVSsrcFS(Composite composite) {
78         String JavaDoc 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                 //TODO add verification for the OpenCCM source folder
94
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 JavaDoc buffer = fd1.open();
106                 if (buffer != null)
107                     configCVSsrcFS(buffer);
108             }
109         });
110     }
111
112     /**
113      * @param buffer
114      */

115     protected void configCVSsrcFS(String JavaDoc buffer) {
116         set_CVSsrcFSPathValue(buffer);
117         CVSsrcFSTextPath.setText(buffer);
118     }
119
120     /**
121      * @param string
122      */

123     public void set_CVSsrcFSPathValue(String JavaDoc string) {
124         _CVSsrcFSPathValue = string;
125     }
126
127     /**
128      * @return
129      */

130     public String JavaDoc get_CVSsrcFSPathValue() {
131         return _CVSsrcFSPathValue;
132     }
133
134     /**
135      * @return
136      */

137     public CheckGroup getCheckGroup() {
138         return checkGroup;
139     }
140
141     /**
142      * @param group
143      */

144     public void setCheckGroup(CheckGroup group) {
145         checkGroup = group;
146     }
147
148 }
149
Popular Tags