Created a separated 'externaltools' plugin: initial check-in
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / variable / IVariableComponent.java
1 package net.sourceforge.phpdt.externaltools.variable;
2
3 /**********************************************************************
4 Copyright (c) 2002 IBM Corp. and others. All rights reserved.
5 This file is made available under the terms of the Common Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/cpl-v10.html
8  
9 Contributors:
10 **********************************************************************/
11
12 import net.sourceforge.phpdt.externaltools.group.IGroupDialogPage;
13
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.swt.widgets.Control;
16
17 /**
18  * Represents the API for a client extending one of the
19  * variable extension points to provide visual editing
20  * of the variable.
21  * <p>
22  * This interface is not to be extended by clients. Clients
23  * may implement this interface.
24  * </p>
25  */
26 public interface IVariableComponent {
27         /**
28          * Returns the control to edit the variable
29          * value, otherwise <code>null</code> if no editing
30          * supported or if <code>createContents</code> has
31          * not been called yet
32          * 
33          * @return the main control for the variable component
34          *              or <code>null</code> if none
35          */
36         public Control getControl();
37         
38         /**
39          * Creates the control to edit the variable. Does nothing
40          * if no editing supported.
41          * 
42          * @param parent the composite to parent all controls to
43          * @param varTag the variable tag name to create the controls for
44          * @param page the dialog page this visual component will be part of
45          */
46         public void createContents(Composite parent, String varTag, IGroupDialogPage page);
47
48         /**
49          * Returns the variable value as specified by
50          * the user thru the visual component.
51          * 
52          * @return the variable value as indicated by the visual component
53          */
54         public String getVariableValue();
55
56         /**
57          * Returns whether the variable's visual component has an
58          * acceptable value.
59          * 
60          * @return <code>true</code> if all value acceptable, or <code>false</code> otherwise
61          */
62         public boolean isValid();
63
64         /**
65          * Sets the visual component to represent the
66          * given variable value.
67          * 
68          * @param varValue the variable value the visual component should indicate
69          */
70         public void setVariableValue(String varValue);
71
72         /**
73          * Validates visual component current values entered by the
74          * user and updates it's valid state if needed
75          */
76         public void validate();
77 }