• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.eclipse.org/org/documents/epl-v10.php
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.ide.eclipse.adt;
18 
19 import com.android.sdklib.SdkConstants;
20 
21 import java.io.File;
22 import java.util.regex.Pattern;
23 
24 /**
25  * Constant definition class.<br>
26  * <br>
27  * Most constants have a prefix defining the content.
28  * <ul>
29  * <li><code>WS_</code> Workspace path constant. Those are absolute paths,
30  * from the project root.</li>
31  * <li><code>OS_</code> OS path constant. These paths are different depending on the platform.</li>
32  * <li><code>FN_</code> File name constant.</li>
33  * <li><code>FD_</code> Folder name constant.</li>
34  * <li><code>MARKER_</code> Resource Marker Ids constant.</li>
35  * <li><code>EXT_</code> File extension constant. This does NOT include a dot.</li>
36  * <li><code>DOT_</code> File extension constant. This start with a dot.</li>
37  * <li><code>RE_</code> Regexp constant.</li>
38  * <li><code>NS_</code> Namespace constant.</li>
39  * <li><code>CLASS_</code> Fully qualified class name.</li>
40  * </ul>
41  *
42  */
43 public class AndroidConstants {
44     /**
45      * The old Editors Plugin ID. It is still used in some places for compatibility.
46      * Please do not use for new features.
47      */
48     public static final String EDITORS_NAMESPACE = "com.android.ide.eclipse.editors"; // $NON-NLS-1$
49 
50     /** Nature of android projects */
51     public final static String NATURE = "com.android.ide.eclipse.adt.AndroidNature"; //$NON-NLS-1$
52 
53     /** Separator for workspace path, i.e. "/". */
54     public final static String WS_SEP = "/"; //$NON-NLS-1$
55     /** Separator character for workspace path, i.e. '/'. */
56     public final static char WS_SEP_CHAR = '/';
57 
58     /** Extension of the Application package Files, i.e. "apk". */
59     public final static String EXT_ANDROID_PACKAGE = "apk"; //$NON-NLS-1$
60     /** Extension of java files, i.e. "java" */
61     public final static String EXT_JAVA = "java"; //$NON-NLS-1$
62     /** Extension of compiled java files, i.e. "class" */
63     public final static String EXT_CLASS = "class"; //$NON-NLS-1$
64     /** Extension of xml files, i.e. "xml" */
65     public final static String EXT_XML = "xml"; //$NON-NLS-1$
66     /** Extension of jar files, i.e. "jar" */
67     public final static String EXT_JAR = "jar"; //$NON-NLS-1$
68     /** Extension of aidl files, i.e. "aidl" */
69     public final static String EXT_AIDL = "aidl"; //$NON-NLS-1$
70     /** Extension of native libraries, i.e. "so" */
71     public final static String EXT_NATIVE_LIB = "so"; //$NON-NLS-1$
72 
73     private final static String DOT = "."; //$NON-NLS-1$
74 
75     /** Dot-Extension of the Application package Files, i.e. ".apk". */
76     public final static String DOT_ANDROID_PACKAGE = DOT + EXT_ANDROID_PACKAGE;
77     /** Dot-Extension of java files, i.e. ".java" */
78     public final static String DOT_JAVA = DOT + EXT_JAVA;
79     /** Dot-Extension of compiled java files, i.e. ".class" */
80     public final static String DOT_CLASS = DOT + EXT_CLASS;
81     /** Dot-Extension of xml files, i.e. ".xml" */
82     public final static String DOT_XML = DOT + EXT_XML;
83     /** Dot-Extension of jar files, i.e. ".jar" */
84     public final static String DOT_JAR = DOT + EXT_JAR;
85     /** Dot-Extension of aidl files, i.e. ".aidl" */
86     public final static String DOT_AIDL = DOT + EXT_AIDL;
87 
88     /** Name of the manifest file, i.e. "AndroidManifest.xml". */
89     public static final String FN_ANDROID_MANIFEST = "AndroidManifest.xml"; //$NON-NLS-1$
90 
91     /** Name of the android sources directory */
92     public static final String FD_ANDROID_SOURCES = "sources"; //$NON-NLS-1$
93 
94     /** Resource java class  filename, i.e. "R.java" */
95     public final static String FN_RESOURCE_CLASS = "R.java"; //$NON-NLS-1$
96     /** Resource class file  filename, i.e. "R.class" */
97     public final static String FN_COMPILED_RESOURCE_CLASS = "R.class"; //$NON-NLS-1$
98     /** Manifest java class filename, i.e. "Manifest.java" */
99     public final static String FN_MANIFEST_CLASS = "Manifest.java"; //$NON-NLS-1$
100     /** Dex conversion output filname, i.e. "classes.dex" */
101     public final static String FN_CLASSES_DEX = "classes.dex"; //$NON-NLS-1$
102     /** Temporary packaged resources file name, i.e. "resources.ap_" */
103     public final static String FN_RESOURCES_AP_ = "resources.ap_"; //$NON-NLS-1$
104     /** Temporary packaged resources file name for a specific set of configuration */
105     public final static String FN_RESOURCES_S_AP_ = "resources-%s.ap_"; //$NON-NLS-1$
106     public final static Pattern PATTERN_RESOURCES_S_AP_ =
107         Pattern.compile("resources-.*\\.ap_", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
108 
109     public final static String FN_TRACEVIEW =
110         (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) ?
111             "traceview.exe" : "traceview"; //$NON-NLS-1$ //$NON-NLS-2$
112 
113     /** Absolute path of the workspace root, i.e. "/" */
114     public final static String WS_ROOT = WS_SEP;
115 
116     /** Absolute path of the resource folder, eg "/res".<br> This is a workspace path. */
117     public final static String WS_RESOURCES = WS_SEP + SdkConstants.FD_RESOURCES;
118 
119     /** Absolute path of the resource folder, eg "/assets".<br> This is a workspace path. */
120     public final static String WS_ASSETS = WS_SEP + SdkConstants.FD_ASSETS;
121 
122     /** Leaf of the javaDoc folder. Does not start with a separator. */
123     public final static String WS_JAVADOC_FOLDER_LEAF = SdkConstants.FD_DOCS + "/" + //$NON-NLS-1$
124             SdkConstants.FD_DOCS_REFERENCE;
125 
126     /** Path of the samples directory relative to the sdk folder.
127      *  This is an OS path, ending with a separator.
128      *  FIXME: remove once the NPW is fixed. */
129     public final static String OS_SDK_SAMPLES_FOLDER = SdkConstants.FD_SAMPLES + File.separator;
130 
131     public final static String RE_DOT = "\\."; //$NON-NLS-1$
132     /** Regexp for java extension, i.e. "\.java$" */
133     public final static String RE_JAVA_EXT = "\\.java$"; //$NON-NLS-1$
134     /** Regexp for aidl extension, i.e. "\.aidl$" */
135     public final static String RE_AIDL_EXT = "\\.aidl$"; //$NON-NLS-1$
136 
137     /** Namespace pattern for the custom resource XML, i.e. "http://schemas.android.com/apk/res/%s" */
138     public final static String NS_CUSTOM_RESOURCES = "http://schemas.android.com/apk/res/%1$s"; //$NON-NLS-1$
139 
140     /** The old common plug-in ID. Please do not use for new features. */
141     public static final String COMMON_PLUGIN_ID = "com.android.ide.eclipse.common"; //$NON-NLS-1$
142 
143     /** aapt marker error when running the compile command */
144     public final static String MARKER_AAPT_COMPILE = COMMON_PLUGIN_ID + ".aaptProblem"; //$NON-NLS-1$
145 
146     /** aapt marker error when running the package command */
147     public final static String MARKER_AAPT_PACKAGE = COMMON_PLUGIN_ID + ".aapt2Problem"; //$NON-NLS-1$
148 
149     /** XML marker error. */
150     public final static String MARKER_XML = COMMON_PLUGIN_ID + ".xmlProblem"; //$NON-NLS-1$
151 
152     /** aidl marker error. */
153     public final static String MARKER_AIDL = COMMON_PLUGIN_ID + ".aidlProblem"; //$NON-NLS-1$
154 
155     /** android marker error */
156     public final static String MARKER_ANDROID = COMMON_PLUGIN_ID + ".androidProblem"; //$NON-NLS-1$
157 
158     /** Name for the "type" marker attribute */
159     public final static String MARKER_ATTR_TYPE = "android.type"; //$NON-NLS-1$
160     /** Name for the "class" marker attribute */
161     public final static String MARKER_ATTR_CLASS = "android.class"; //$NON-NLS-1$
162     /** activity value for marker attribute "type" */
163     public final static String MARKER_ATTR_TYPE_ACTIVITY = "activity"; //$NON-NLS-1$
164     /** service value for marker attribute "type" */
165     public final static String MARKER_ATTR_TYPE_SERVICE = "service"; //$NON-NLS-1$
166     /** receiver value for marker attribute "type" */
167     public final static String MARKER_ATTR_TYPE_RECEIVER = "receiver"; //$NON-NLS-1$
168     /** provider value for marker attribute "type" */
169     public final static String MARKER_ATTR_TYPE_PROVIDER = "provider"; //$NON-NLS-1$
170 
171     public final static String CLASS_ACTIVITY = "android.app.Activity"; //$NON-NLS-1$
172     public final static String CLASS_SERVICE = "android.app.Service"; //$NON-NLS-1$
173     public final static String CLASS_BROADCASTRECEIVER = "android.content.BroadcastReceiver"; //$NON-NLS-1$
174     public final static String CLASS_CONTENTPROVIDER = "android.content.ContentProvider"; //$NON-NLS-1$
175     public final static String CLASS_INSTRUMENTATION = "android.app.Instrumentation"; //$NON-NLS-1$
176     public final static String CLASS_INSTRUMENTATION_RUNNER =
177         "android.test.InstrumentationTestRunner"; //$NON-NLS-1$
178     public final static String CLASS_BUNDLE = "android.os.Bundle"; //$NON-NLS-1$
179     public final static String CLASS_R = "android.R"; //$NON-NLS-1$
180     public final static String CLASS_MANIFEST_PERMISSION = "android.Manifest$permission"; //$NON-NLS-1$
181     public final static String CLASS_INTENT = "android.content.Intent"; //$NON-NLS-1$
182     public final static String CLASS_CONTEXT = "android.content.Context"; //$NON-NLS-1$
183     public final static String CLASS_VIEW = "android.view.View"; //$NON-NLS-1$
184     public final static String CLASS_VIEWGROUP = "android.view.ViewGroup"; //$NON-NLS-1$
185     public final static String CLASS_NAME_LAYOUTPARAMS = "LayoutParams"; //$NON-NLS-1$
186     public final static String CLASS_VIEWGROUP_LAYOUTPARAMS =
187         CLASS_VIEWGROUP + "$" + CLASS_NAME_LAYOUTPARAMS; //$NON-NLS-1$
188     public final static String CLASS_NAME_FRAMELAYOUT = "FrameLayout"; //$NON-NLS-1$
189     public final static String CLASS_FRAMELAYOUT =
190         "android.widget." + CLASS_NAME_FRAMELAYOUT; //$NON-NLS-1$
191     public final static String CLASS_PREFERENCE = "android.preference.Preference"; //$NON-NLS-1$
192     public final static String CLASS_NAME_PREFERENCE_SCREEN = "PreferenceScreen"; //$NON-NLS-1$
193     public final static String CLASS_PREFERENCES =
194         "android.preference." + CLASS_NAME_PREFERENCE_SCREEN; //$NON-NLS-1$
195     public final static String CLASS_PREFERENCEGROUP = "android.preference.PreferenceGroup"; //$NON-NLS-1$
196     public final static String CLASS_PARCELABLE = "android.os.Parcelable"; //$NON-NLS-1$
197 
198     public final static String CLASS_BRIDGE = "com.android.layoutlib.bridge.Bridge"; //$NON-NLS-1$
199 
200     /**
201      * Prefered compiler level, i.e. "1.5".
202      */
203     public final static String COMPILER_COMPLIANCE_PREFERRED = "1.5"; //$NON-NLS-1$
204     /**
205      * List of valid compiler level, i.e. "1.5" and "1.6"
206      */
207     public final static String[] COMPILER_COMPLIANCE = {
208         "1.5", //$NON-NLS-1$
209         "1.6", //$NON-NLS-1$
210     };
211 
212     /** The base URL where to find the Android class & manifest documentation */
213     public static final String CODESITE_BASE_URL = "http://code.google.com/android";  //$NON-NLS-1$
214 
215     public static final String LIBRARY_TEST_RUNNER = "android.test.runner"; // $NON-NLS-1$
216 }
217