Methods Summary |
---|
public java.lang.String | getNamespace()Returns the namespace for the project. The namespace contains a standard part + the
application package.
if (mNamespace == null) {
IFile manifestFile = AndroidManifestParser.getManifest(mProject);
try {
AndroidManifestParser data = AndroidManifestParser.parseForData(manifestFile);
String javaPackage = data.getPackage();
mNamespace = String.format(AndroidConstants.NS_CUSTOM_RESOURCES, javaPackage);
} catch (CoreException e) {
}
}
return mNamespace;
|
public java.lang.Integer | getResourceValue(java.lang.String type, java.lang.String name)
if (mProjectRes != null) {
return mProjectRes.getResourceValue(type, name);
}
return null;
|
private java.lang.Object | instantiateClass(java.lang.Class clazz, java.lang.Class[] constructorSignature, java.lang.Object[] constructorParameters)Instantiate a class object, using a specific constructor and parameters.
Constructor<?> constructor = clazz.getConstructor(constructorSignature);
constructor.setAccessible(true);
return constructor.newInstance(constructorParameters);
|
boolean | isUsed()Returns whether the loader has received requests to load custom views.
This allows to efficiently only recreate when needed upon code change in the project.
return mUsed;
|
public java.lang.Object | loadView(java.lang.String className, java.lang.Class[] constructorSignature, java.lang.Object[] constructorParameters){@inheritDoc}
This implementation goes through the output directory of the Eclipse project and loads the
.class file directly.
// look for a cached version
Class<?> clazz = mLoadedClasses.get(className);
if (clazz != null) {
return instantiateClass(clazz, constructorSignature, constructorParameters);
}
// load the class.
ProjectClassLoader loader = new ProjectClassLoader(mParentClassLoader, mProject);
try {
clazz = loader.loadClass(className);
if (clazz != null) {
mUsed = true;
mLoadedClasses.put(className, clazz);
return instantiateClass(clazz, constructorSignature, constructorParameters);
}
} catch (Error e) {
// Log this error with the class name we're trying to load and abort.
AdtPlugin.log(e, "ProjectCallback.loadView failed to find class %1$s", className); //$NON-NLS-1$
}
return null;
|
public java.lang.String[] | resolveResourceValue(int id)
if (mProjectRes != null) {
return mProjectRes.resolveResourceValue(id);
}
return null;
|
public java.lang.String | resolveResourceValue(int[] id)
if (mProjectRes != null) {
return mProjectRes.resolveResourceValue(id);
}
return null;
|