Source code: javax/ide/view/URISelectionDialog.java
1 package javax.ide.view;
2
3 import java.net.URI;
4 import javax.ide.command.Context;
5
6 /**
7 * This interface gives clients a portable interface to control basic file
8 * and directory selection dialogs.
9 */
10 public interface URISelectionDialog
11 {
12 /**
13 * Clients of the <code>URISelectionDialog</code> implement a
14 * <code>Validator</code> when they need to validate the selected URI(s)
15 * before the selection dialog is dismissed.
16 */
17 public interface Validator
18 {
19 /**
20 * Method called when the user presses the OK button of the
21 * <code>URISelectionDialog</code>.
22 * @param uri the {@link URI}s to validate.
23 * @param context the current {@link Context}.
24 * @return true if the selected URIs validated.
25 */
26 boolean validate( URI[] uri, Context context );
27 }
28
29 /**
30 * Shows the dialog.
31 *
32 * @return An integer value indicating whether the use pressed the OK, or
33 * Cancel button. The returned value can be checked against the constants:
34 * {@link IDEDialogs#OK_ID} and {@link IDEDialogs#CANCEL_ID}.
35 */
36 int show();
37
38 /**
39 * Shows the dialog.
40 * @param validator An implementation of the <code>Validator</code> interface
41 * that will be called to validate selected URIs.
42 * @return An integer value indicating whether the use pressed the OK, or
43 * Cancel button.
44 */
45 int show( Validator validator );
46
47 /**
48 * Gets any dialog result parameters as an array of objects.
49 * @return URI[] An array of result URIs or an empty array
50 */
51 URI[] getResults();
52 }
53