KickJava   Java API By Example, From Geeks To Geeks.

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


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 3 juin 2003 by jerome OFFROY (offroy@lifl.fr)
28  *
29  */

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 /**
46  * @author offroy
47  *
48  */

49 public class ProjectChooser {
50     private String JavaDoc _NameLabel;
51     private String JavaDoc _ProjectName;
52     private Text fTextControl;
53     private ValidatorProject page;
54     
55     /**
56      * Constructor
57      */

58     public ProjectChooser(IConfigurationElement elem) {
59         _NameLabel = AttributeManager.getAttribute(elem, "label");
60         _ProjectName = AttributeManager.getAttribute(elem, "name");
61     }
62     
63     /**
64      * @param composite
65      */

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     /**
93      * @return
94      */

95     public String JavaDoc get_NameLabel() {
96         return _NameLabel;
97     }
98
99     /**
100      * @param string
101      */

102     public void set_NameLabel(String JavaDoc string) {
103         _NameLabel = string;
104     }
105
106     /**
107      * @return
108      */

109     public String JavaDoc get_ProjectName() {
110         return _ProjectName;
111     }
112
113     /**
114      * @param string
115      */

116     public void set_ProjectName(String JavaDoc string) {
117         _ProjectName = string;
118     }
119
120     /**
121      * @return
122      */

123     public Text getFTextControl() {
124         return fTextControl;
125     }
126
127     /**
128      * @param text
129      */

130     public void setFTextControl(Text text) {
131         fTextControl = text;
132     }
133
134 }
135
Popular Tags