blob: a17af018395bbdb1cf139afede1f1d677f691f87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.eclipse.org/org/documents/epl-v10.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.ide.common.api;
import com.android.sdklib.annotations.Nullable;
/**
* A Client Rules Engine is a set of methods that {@link IViewRule}s can use to
* access the client public API of the Rules Engine. Rules can access it via
* the property "_rules_engine" which is dynamically added to {@link IViewRule}
* instances on creation.
* <p>
* <b>NOTE: This is not a public or final API; if you rely on this be prepared
* to adjust your code for the next tools release.</b>
* </p>
*/
public interface IClientRulesEngine {
/**
* Returns the FQCN for which the rule was loaded.
*/
String getFqcn();
/**
* Prints a debug line in the Eclipse console using the ADT formatter.
*
* @param msg A String format message.
* @param params Optional parameters for the message.
*/
void debugPrintf(String msg, Object...params);
/**
* Loads and returns an {@link IViewRule} for the given FQCN.
*
* @param fqcn A non-null, non-empty FQCN for the rule to load.
* @return The rule that best matches the given FQCN according to the
* inheritance chain. Rules are cached and requesting the same FQCN twice
* is fast and will return the same rule instance.
*/
IViewRule loadRule(String fqcn);
/**
* Returns the metadata associated with the given fully qualified class name.
*
* @param fqcn a fully qualified class name for an Android view class
* @return the metadata associated with the given fully qualified class name.
*/
IViewMetadata getMetadata(String fqcn);
/**
* Displays the given message string in an alert dialog with an "OK" button.
*/
void displayAlert(String message);
/**
* Displays a simple input alert dialog with an OK and Cancel buttons.
*
* @param message The message to display in the alert dialog.
* @param value The initial value to display in the input field. Can be null.
* @param filter An optional filter to validate the input. Specify null (or
* a validator which always returns true) if you do not want
* input validation.
* @return Null if canceled by the user. Otherwise the possibly-empty input string.
* @null Return value is null if dialog was canceled by the user.
*/
@Nullable
String displayInput(String message, @Nullable String value, @Nullable IValidator filter);
}
|