01: /*
02: * Copyright (c) 2004-2006, Jean-François Brazeau. All rights reserved.
03: *
04: * Redistribution and use in source and binary forms, with or without
05: * modification, are permitted provided that the following conditions are met:
06: *
07: * 1. Redistributions of source code must retain the above copyright notice,
08: * this list of conditions and the following disclaimer.
09: *
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * 3. The name of the author may not be used to endorse or promote products
15: * derived from this software without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18: * IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22: * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23: * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25: * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26: * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27: */
28: package jfb.tools.activitymgr.ui.dialogs;
29:
30: import org.eclipse.swt.SWT;
31: import org.eclipse.swt.layout.GridData;
32: import org.eclipse.swt.layout.GridLayout;
33: import org.eclipse.swt.widgets.Button;
34: import org.eclipse.swt.widgets.Composite;
35: import org.eclipse.swt.widgets.Text;
36:
37: /**
38: * Control utilisé pour gérer les entrées de type fichier.
39: */
40: public class FileEditor {
41:
42: /** Champ texte */
43: private Text fileText;
44:
45: /** Bouton de commande */
46: private Button browseButton;
47:
48: /**
49: * Constructeur par défaut.
50: * @param parent composant parent.
51: * @param title le titre de l'éditeur.
52: */
53: public FileEditor(Composite parent, String title) {
54: // Création du paneau
55: Composite panel = new Composite(parent, SWT.NONE);
56: GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
57: panel.setLayoutData(gridData);
58: GridLayout gridLayout = new GridLayout(2, false);
59: gridLayout.marginHeight = 0;
60: gridLayout.marginWidth = 0;
61: gridLayout.verticalSpacing = 0;
62: panel.setLayout(gridLayout);
63: fileText = new Text(panel, SWT.BORDER);
64: fileText.setText(title);
65: browseButton = new Button(panel, SWT.NONE);
66: browseButton.setText("...");
67: }
68:
69: }
|