These are constants specific to ADT.
There'll be an AndroidConstants class in common.jar with
more generic android constant values.
Change-Id: I8368920f92c28cbfb87098087bf01f2d2cdee095
* </ul>
*
*/
-public class AndroidConstants {
+public class AdtConstants {
/**
* The old Editors Plugin ID. It is still used in some places for compatibility.
* Please do not use for new features.
/** Returns the absolute traceview path */
public static String getOsAbsoluteTraceview() {
return getOsSdkFolder() + SdkConstants.OS_SDK_TOOLS_FOLDER +
- AndroidConstants.FN_TRACEVIEW;
+ AdtConstants.FN_TRACEVIEW;
}
/** Returns the absolute emulator path */
public static String getOsAbsoluteHprofConv() {
return getOsSdkFolder() + SdkConstants.OS_SDK_TOOLS_FOLDER +
- AndroidConstants.FN_HPROF_CONV;
+ AdtConstants.FN_HPROF_CONV;
}
/** Returns the absolute proguard path */
*/
public static String getUrlDoc() {
return ProjectHelper.getJavaDocPath(
- getOsSdkFolder() + AndroidConstants.WS_JAVADOC_FOLDER_LEAF);
+ getOsSdkFolder() + AdtConstants.WS_JAVADOC_FOLDER_LEAF);
}
/**
public static InputStream readEmbeddedFileAsStream(String filepath) {
// attempt to read an embedded file
try {
- URL url = getEmbeddedFileUrl(AndroidConstants.WS_SEP + filepath);
+ URL url = getEmbeddedFileUrl(AdtConstants.WS_SEP + filepath);
if (url != null) {
return url.openStream();
}
// attempt to get a file to one of the template.
String path = filepath;
- if (!path.startsWith(AndroidConstants.WS_SEP)) {
- path = AndroidConstants.WS_SEP + path;
+ if (!path.startsWith(AdtConstants.WS_SEP)) {
+ path = AdtConstants.WS_SEP + path;
}
URL url = bundle.getEntry(path);
* @see IFileListener#fileChanged
*/
public void fileChanged(IFile file, IMarkerDelta[] markerDeltas, int kind) {
- if (AndroidConstants.EXT_XML.equals(file.getFileExtension())) {
+ if (AdtConstants.EXT_XML.equals(file.getFileExtension())) {
// The resources files must have a file path similar to
// project/res/.../*.xml
// There is no support for sub folders, so the segment count must be 4
// as the default editor.
IEditorDescriptor desc = IDE.getDefaultEditor(file);
String editorId = desc.getId();
- if (editorId.startsWith(AndroidConstants.EDITORS_NAMESPACE)) {
+ if (editorId.startsWith(AdtConstants.EDITORS_NAMESPACE)) {
// reset the default editor.
IDE.setDefaultEditor(file, null);
}
package com.android.ide.eclipse.adt.internal.actions;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
import org.eclipse.core.resources.IProject;
// check if the project already has the android nature.
for (int i = 0; i < natures.length; ++i) {
- if (AndroidConstants.NATURE_DEFAULT.equals(natures[i])) {
+ if (AdtConstants.NATURE_DEFAULT.equals(natures[i])) {
// we shouldn't be here as the visibility of the item
// is dependent on the project.
return new Status(Status.WARNING, AdtPlugin.PLUGIN_ID,
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 1, natures.length);
- newNatures[0] = AndroidConstants.NATURE_DEFAULT;
+ newNatures[0] = AdtConstants.NATURE_DEFAULT;
// set the new nature list in the project
description.setNatureIds(newNatures);
package com.android.ide.eclipse.adt.internal.build;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
import org.eclipse.core.resources.IMarker;
// check the values and attempt to mark the file.
if (checkAndMark(location, lineStr, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
continue;
// display the error
if (checkAndMark(location, null, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
// check the values and attempt to mark the file.
if (checkAndMark(location, lineStr, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
continue;
// check the values and attempt to mark the file.
if (checkAndMark(location, lineStr, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
// check the values and attempt to mark the file.
if (checkAndMark(location, lineStr, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
// check the values and attempt to mark the file.
if (checkAndMark(location, lineStr, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_WARNING) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_WARNING) == false) {
return true;
}
// check the values and attempt to mark the file.
if (checkAndMark(location, lineStr, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
// check the values and attempt to mark the file.
if (checkAndMark(location, null, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_COMPILE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
// check the values and attempt to mark the file.
if (checkAndMark(null /*location*/, null, msg, osRoot, project,
- AndroidConstants.MARKER_AAPT_PACKAGE, IMarker.SEVERITY_ERROR) == false) {
+ AdtConstants.MARKER_AAPT_PACKAGE, IMarker.SEVERITY_ERROR) == false) {
return true;
}
package com.android.ide.eclipse.adt.internal.build;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.builders.BaseBuilder;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity;
@Override
protected String getExtension() {
- return AndroidConstants.EXT_AIDL;
+ return AdtConstants.EXT_AIDL;
}
@Override
boolean verbose = AdtPrefs.getPrefs().getBuildVerbosity() == BuildVerbosity.VERBOSE;
// remove the generic marker from the project
- builder.removeMarkersFromResource(project, AndroidConstants.MARKER_AIDL);
+ builder.removeMarkersFromResource(project, AdtConstants.MARKER_AIDL);
// loop until we've compile them all
for (IFile sourceFile : sources) {
}
// Remove the AIDL error markers from the aidl file
- builder.removeMarkersFromResource(sourceFile, AndroidConstants.MARKER_AIDL);
+ builder.removeMarkersFromResource(sourceFile, AdtConstants.MARKER_AIDL);
// get the path of the source file.
IPath sourcePath = sourceFile.getLocation();
AdtPlugin.printErrorToConsole(project, results.toArray());
// mark the project
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_AIDL,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_AIDL,
Messages.Unparsed_AIDL_Errors, IMarker.SEVERITY_ERROR);
} else {
AdtPlugin.printToConsole(project, results.toArray());
} catch (IOException e) {
// mark the project and exit
String msg = String.format(Messages.AIDL_Exec_Error, command[0]);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_AIDL, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_AIDL, msg,
IMarker.SEVERITY_ERROR);
return false;
} catch (InterruptedException e) {
// mark the project and exit
String msg = String.format(Messages.AIDL_Exec_Error, command[0]);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_AIDL, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_AIDL, msg,
IMarker.SEVERITY_ERROR);
return false;
}
}
// mark the file
- BaseProjectHelper.markResource(file, AndroidConstants.MARKER_AIDL, msg, line,
+ BaseProjectHelper.markResource(file, AdtConstants.MARKER_AIDL, msg, line,
IMarker.SEVERITY_ERROR);
// success, go to the next line
// Build the Java file name from the aidl name.
String javaName = sourceFile.getName().replaceAll(
- AndroidConstants.RE_AIDL_EXT, AndroidConstants.DOT_JAVA);
+ AdtConstants.RE_AIDL_EXT, AdtConstants.DOT_JAVA);
// get the resource for the java file.
IFile javaFile = destinationFolder.getFile(javaName);
package com.android.ide.eclipse.adt.internal.build;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.AndroidPrintStream;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity;
// need to figure out some path before we can execute aapt;
// get the resource folder
- IFolder resFolder = mProject.getFolder(AndroidConstants.WS_RESOURCES);
+ IFolder resFolder = mProject.getFolder(AdtConstants.WS_RESOURCES);
// and the assets folder
- IFolder assetsFolder = mProject.getFolder(AndroidConstants.WS_ASSETS);
+ IFolder assetsFolder = mProject.getFolder(AdtConstants.WS_ASSETS);
// we need to make sure this one exists.
if (assetsFolder.exists() == false) {
// (This is to handle the case of reference Android projects in the context of
// instrumentation projects that need to reference the projects to be tested).
if (referencedJavaProject.getProject().hasNature(
- AndroidConstants.NATURE_DEFAULT) == false) {
+ AdtConstants.NATURE_DEFAULT) == false) {
writeStandardProjectResources(apkBuilder, referencedJavaProject, wsRoot, list);
}
}
IResource resource = wsRoot.findMember(path);
// case of a jar file (which could be relative to the workspace or a full path)
- if (AndroidConstants.EXT_JAR.equalsIgnoreCase(path.getFileExtension())) {
+ if (AdtConstants.EXT_JAR.equalsIgnoreCase(path.getFileExtension())) {
if (resource != null && resource.exists() &&
resource.getType() == IResource.FILE) {
oslibraryList.add(resource.getLocation().toOSString());
// only include output from non android referenced project
// (This is to handle the case of reference Android projects in the context of
// instrumentation projects that need to reference the projects to be tested).
- if (javaProject.getProject().hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (javaProject.getProject().hasNature(AdtConstants.NATURE_DEFAULT) == false) {
// get the output folder
IPath path = null;
try {
package com.android.ide.eclipse.adt.internal.build;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.builders.BaseBuilder;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity;
boolean r = super.handleGeneratedFile(file, kind);
if (r == false &&
kind == IResourceDelta.REMOVED &&
- AndroidConstants.EXT_DEP.equalsIgnoreCase(file.getFileExtension())) {
+ AdtConstants.EXT_DEP.equalsIgnoreCase(file.getFileExtension())) {
// This looks to be an extension file.
// For futureproofness let's make sure this dependency file was generated by
// this processor even if it's the only processor using them for now.
// remove the file name segment
relative = relative.removeLastSegments(1);
// add the file name of a Renderscript file.
- relative = relative.append(file.getName().replaceAll(AndroidConstants.RE_DEP_EXT,
- AndroidConstants.DOT_RS));
+ relative = relative.append(file.getName().replaceAll(AdtConstants.RE_DEP_EXT,
+ AdtConstants.DOT_RS));
// now look for a match in the source folders.
List<IPath> sourceFolders = BaseProjectHelper.getSourceClasspaths(
@Override
protected String getExtension() {
- return AndroidConstants.EXT_RS;
+ return AdtConstants.EXT_RS;
}
@Override
boolean someSuccess = false;
// remove the generic marker from the project
- builder.removeMarkersFromResource(project, AndroidConstants.MARKER_RENDERSCRIPT);
+ builder.removeMarkersFromResource(project, AdtConstants.MARKER_RENDERSCRIPT);
// loop until we've compile them all
for (IFile sourceFile : sources) {
}
// Remove the RS error markers from the source file and the dependencies
- builder.removeMarkersFromResource(sourceFile, AndroidConstants.MARKER_RENDERSCRIPT);
+ builder.removeMarkersFromResource(sourceFile, AdtConstants.MARKER_RENDERSCRIPT);
SourceFileData data = getFileData(sourceFile);
if (data != null) {
for (IFile dep : data.getDependencyFiles()) {
- builder.removeMarkersFromResource(dep, AndroidConstants.MARKER_RENDERSCRIPT);
+ builder.removeMarkersFromResource(dep, AdtConstants.MARKER_RENDERSCRIPT);
}
}
// mark the project
BaseProjectHelper.markResource(project,
- AndroidConstants.MARKER_RENDERSCRIPT,
+ AdtConstants.MARKER_RENDERSCRIPT,
"Unparsed Renderscript error! Check the console for output.",
IMarker.SEVERITY_ERROR);
} else {
String msg = String.format(
"Error executing Renderscript. Please check llvm-rs-cc is present at %1$s",
command[0]);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_RENDERSCRIPT, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_RENDERSCRIPT, msg,
IMarker.SEVERITY_ERROR);
return false;
} catch (InterruptedException e) {
String msg = String.format(
"Error executing Renderscript. Please check llvm-rs-cc is present at %1$s",
command[0]);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_RENDERSCRIPT, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_RENDERSCRIPT, msg,
IMarker.SEVERITY_ERROR);
return false;
}
}
// mark the file
- BaseProjectHelper.markResource(f, AndroidConstants.MARKER_RENDERSCRIPT, msg, line,
+ BaseProjectHelper.markResource(f, AdtConstants.MARKER_RENDERSCRIPT, msg, line,
IMarker.SEVERITY_ERROR);
// success, go to the next line
private IFile getDependencyFileFor(IFile sourceFile) {
IFolder depFolder = getDependencyFolder(sourceFile);
- return depFolder.getFile(sourceFile.getName().replaceAll(AndroidConstants.RE_RS_EXT,
- AndroidConstants.DOT_DEP));
+ return depFolder.getFile(sourceFile.getName().replaceAll(AdtConstants.RE_RS_EXT,
+ AdtConstants.DOT_DEP));
}
/**
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.BuildHelper;
import com.android.ide.eclipse.adt.internal.build.Messages;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
IFile file = (IFile)resource;
// remove previous markers
- removeMarkersFromResource(file, AndroidConstants.MARKER_XML);
+ removeMarkersFromResource(file, AdtConstants.MARKER_XML);
// create the error handler
XmlErrorHandler reporter = new XmlErrorHandler(file, visitor);
}
// abort if there are TARGET or ADT type markers
- stopOnMarker(iProject, AndroidConstants.MARKER_TARGET, IResource.DEPTH_ZERO,
+ stopOnMarker(iProject, AdtConstants.MARKER_TARGET, IResource.DEPTH_ZERO,
false /*checkSeverity*/);
- stopOnMarker(iProject, AndroidConstants.MARKER_ADT, IResource.DEPTH_ZERO,
+ stopOnMarker(iProject, AdtConstants.MARKER_ADT, IResource.DEPTH_ZERO,
false /*checkSeverity*/);
}
package com.android.ide.eclipse.adt.internal.build.builders;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.AndroidPrintStream;
import com.android.ide.eclipse.adt.internal.build.AaptExecException;
import com.android.ide.eclipse.adt.internal.build.AaptParser;
int type = resource.getType();
if (type == IResource.FILE) {
String ext = resource.getFileExtension();
- if (AndroidConstants.EXT_CLASS.equals(ext)) {
+ if (AdtConstants.EXT_CLASS.equals(ext)) {
mConvertToDex = true;
}
}
private ResourceMarker mResourceMarker = new ResourceMarker() {
public void setWarning(IResource resource, String message) {
- BaseProjectHelper.markResource(resource, AndroidConstants.MARKER_PACKAGING,
+ BaseProjectHelper.markResource(resource, AdtConstants.MARKER_PACKAGING,
message, IMarker.SEVERITY_WARNING);
}
};
IProject project = getProject();
// Clear the project of the generic markers
- removeMarkersFromContainer(project, AndroidConstants.MARKER_AAPT_PACKAGE);
- removeMarkersFromContainer(project, AndroidConstants.MARKER_PACKAGING);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_AAPT_PACKAGE);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_PACKAGING);
}
// build() returns a list of project from which this project depends for future compilation.
}
// remove older packaging markers.
- removeMarkersFromContainer(javaProject.getProject(), AndroidConstants.MARKER_PACKAGING);
+ removeMarkersFromContainer(javaProject.getProject(), AdtConstants.MARKER_PACKAGING);
if (outputFolder == null) {
// mark project and exit
- markProject(AndroidConstants.MARKER_PACKAGING, Messages.Failed_To_Get_Output,
+ markProject(AdtConstants.MARKER_PACKAGING, Messages.Failed_To_Get_Output,
IMarker.SEVERITY_ERROR);
return allRefProjects;
}
if (mPackageResources == false) {
// check the full resource package
- tmp = outputFolder.findMember(AndroidConstants.FN_RESOURCES_AP_);
+ tmp = outputFolder.findMember(AdtConstants.FN_RESOURCES_AP_);
if (tmp == null || tmp.exists() == false) {
mPackageResources = true;
mBuildFinalPackage = true;
// mark project and exit
String msg = String.format(Messages.s_File_Missing,
SdkConstants.FN_ANDROID_MANIFEST_XML);
- markProject(AndroidConstants.MARKER_PACKAGING, msg, IMarker.SEVERITY_ERROR);
+ markProject(AdtConstants.MARKER_PACKAGING, msg, IMarker.SEVERITY_ERROR);
return allRefProjects;
}
IPath binLocation = outputFolder.getLocation();
if (binLocation == null) {
- markProject(AndroidConstants.MARKER_PACKAGING, Messages.Output_Missing,
+ markProject(AdtConstants.MARKER_PACKAGING, Messages.Output_Missing,
IMarker.SEVERITY_ERROR);
return allRefProjects;
}
// first we check if we need to package the resources.
if (mPackageResources) {
// remove some aapt_package only markers.
- removeMarkersFromContainer(project, AndroidConstants.MARKER_AAPT_PACKAGE);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_AAPT_PACKAGE);
try {
helper.packageResources(manifestFile, libProjects, null /*resfilter*/,
0 /*versionCode */, osBinPath,
- AndroidConstants.FN_RESOURCES_AP_);
+ AdtConstants.FN_RESOURCES_AP_);
} catch (AaptExecException e) {
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING,
e.getMessage(), IMarker.SEVERITY_ERROR);
return allRefProjects;
} catch (AaptResultException e) {
// therefore not all files that should have been marked, were marked),
// we put a generic marker on the project and abort.
BaseProjectHelper.markResource(project,
- AndroidConstants.MARKER_PACKAGING,
+ AdtConstants.MARKER_PACKAGING,
Messages.Unparsed_AAPT_Errors,
IMarker.SEVERITY_ERROR);
}
String message = e.getMessage();
AdtPlugin.printErrorToConsole(project, message);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING,
message, IMarker.SEVERITY_ERROR);
Throwable cause = e.getCause();
SdkConstants.FN_APK_CLASSES_DEX;
try {
helper.finalDebugPackage(
- osBinPath + File.separator + AndroidConstants.FN_RESOURCES_AP_,
+ osBinPath + File.separator + AdtConstants.FN_RESOURCES_AP_,
classesDexPath, osFinalPackagePath,
javaProject, libProjects, referencedJavaProjects, mResourceMarker);
} catch (KeytoolException e) {
// mark the project with the standard message
String msg = String.format(Messages.Final_Archive_Error_s, eMessage);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING, msg,
IMarker.SEVERITY_ERROR);
// output more info in the console
// mark the project with the standard message
String msg = String.format(Messages.Final_Archive_Error_s, eMessage);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING, msg,
IMarker.SEVERITY_ERROR);
} catch (AndroidLocationException e) {
String eMessage = e.getMessage();
// mark the project with the standard message
String msg = String.format(Messages.Final_Archive_Error_s, eMessage);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING, msg,
IMarker.SEVERITY_ERROR);
} catch (NativeLibInJarException e) {
String msg = e.getMessage();
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING,
msg, IMarker.SEVERITY_ERROR);
AdtPlugin.printErrorToConsole(project, (Object[]) e.getAdditionalInfo());
// mark project and return
String msg = String.format(Messages.Final_Archive_Error_s, e.getMessage());
AdtPlugin.printErrorToConsole(project, msg);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING, msg,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING, msg,
IMarker.SEVERITY_ERROR);
} catch (DuplicateFileException e) {
String msg1 = String.format(
e.getArchivePath(), e.getFile1(), e.getFile2());
String msg2 = String.format(Messages.Final_Archive_Error_s, msg1);
AdtPlugin.printErrorToConsole(project, msg2);
- BaseProjectHelper.markResource(project, AndroidConstants.MARKER_PACKAGING, msg2,
+ BaseProjectHelper.markResource(project, AdtConstants.MARKER_PACKAGING, msg2,
IMarker.SEVERITY_ERROR);
}
msg = String.format("Unknown error: %1$s", msg);
AdtPlugin.logAndPrintError(exception, project.getName(), msg);
- markProject(AndroidConstants.MARKER_PACKAGING, msg, IMarker.SEVERITY_ERROR);
+ markProject(AdtConstants.MARKER_PACKAGING, msg, IMarker.SEVERITY_ERROR);
}
return allRefProjects;
// do a (hopefully quick) search for Precompiler type markers. Those are always only
// errors.
- stopOnMarker(iProject, AndroidConstants.MARKER_AAPT_COMPILE, IResource.DEPTH_INFINITE,
+ stopOnMarker(iProject, AdtConstants.MARKER_AAPT_COMPILE, IResource.DEPTH_INFINITE,
false /*checkSeverity*/);
- stopOnMarker(iProject, AndroidConstants.MARKER_AIDL, IResource.DEPTH_INFINITE,
+ stopOnMarker(iProject, AdtConstants.MARKER_AIDL, IResource.DEPTH_INFINITE,
false /*checkSeverity*/);
- stopOnMarker(iProject, AndroidConstants.MARKER_RENDERSCRIPT, IResource.DEPTH_INFINITE,
+ stopOnMarker(iProject, AdtConstants.MARKER_RENDERSCRIPT, IResource.DEPTH_INFINITE,
false /*checkSeverity*/);
- stopOnMarker(iProject, AndroidConstants.MARKER_ANDROID, IResource.DEPTH_ZERO,
+ stopOnMarker(iProject, AdtConstants.MARKER_ANDROID, IResource.DEPTH_ZERO,
false /*checkSeverity*/);
// do a search for JDT markers. Those can be errors or warnings
package com.android.ide.eclipse.adt.internal.build.builders;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.BuildHelper;
import com.android.ide.eclipse.adt.internal.build.builders.BaseBuilder.BaseDeltaVisitor;
import com.android.sdklib.SdkConstants;
// just check this is a .class file. Any modification will
// trigger a change in the classes.dex file
String ext = resource.getFileExtension();
- if (AndroidConstants.EXT_CLASS.equalsIgnoreCase(ext)) {
+ if (AdtConstants.EXT_CLASS.equalsIgnoreCase(ext)) {
mConvertToDex = true;
mMakeFinalPackage = true;
mConvertToDex = true;
mMakeFinalPackage = true;
} else if (resourceName.equalsIgnoreCase(
- AndroidConstants.FN_RESOURCES_AP_) ||
- AndroidConstants.PATTERN_RESOURCES_S_AP_.matcher(
+ AdtConstants.FN_RESOURCES_AP_) ||
+ AdtConstants.PATTERN_RESOURCES_S_AP_.matcher(
resourceName).matches()) {
// or if the default resources.ap_ or a configured version
// (resources-###.ap_) was removed.
} else if (mLibFolder != null && mLibFolder.isPrefixOf(path)) {
// inside the native library folder. Test if the changed resource is a .so file.
if (type == IResource.FILE &&
- (AndroidConstants.EXT_NATIVE_LIB.equalsIgnoreCase(path.getFileExtension())
+ (AdtConstants.EXT_NATIVE_LIB.equalsIgnoreCase(path.getFileExtension())
|| SdkConstants.FN_GDBSERVER.equals(resource.getName()))) {
mMakeFinalPackage = true;
return false; // return false for file.
package com.android.ide.eclipse.adt.internal.build.builders;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.AaptParser;
import com.android.ide.eclipse.adt.internal.build.AidlProcessor;
import com.android.ide.eclipse.adt.internal.build.SourceProcessor;
String msg = String.format(Messages.s_File_Missing,
SdkConstants.FN_ANDROID_MANIFEST_XML);
AdtPlugin.printErrorToConsole(project, msg);
- markProject(AndroidConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
+ markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
return result;
AndroidVersion projectVersion = projectTarget.getVersion();
// remove earlier marker from the manifest
- removeMarkersFromResource(manifestFile, AndroidConstants.MARKER_ADT);
+ removeMarkersFromResource(manifestFile, AdtConstants.MARKER_ADT);
if (minSdkValue != -1) {
String codename = projectVersion.getCodename();
"Platform %1$s is a preview and requires application manifest to set %2$s to '%1$s'",
codename, AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION);
AdtPlugin.printErrorToConsole(project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT,
msg, IMarker.SEVERITY_ERROR);
return result;
} else if (minSdkValue < projectVersion.getApiLevel()) {
AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
minSdkValue, projectVersion.getApiLevel());
AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT,
msg, IMarker.SEVERITY_WARNING);
} else if (minSdkValue > projectVersion.getApiLevel()) {
// integer minSdk is too high for the target => warning
AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
minSdkValue, projectVersion.getApiLevel());
AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT,
msg, IMarker.SEVERITY_WARNING);
}
} else {
"Manifest attribute '%1$s' is set to '%2$s'. Integer is expected.",
AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION, minSdkVersion);
AdtPlugin.printErrorToConsole(project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT,
msg, IMarker.SEVERITY_ERROR);
return result;
} else if (codename.equals(minSdkVersion) == false) {
"Value of manifest attribute '%1$s' does not match platform codename '%2$s'",
AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION, codename);
AdtPlugin.printErrorToConsole(project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT,
msg, IMarker.SEVERITY_ERROR);
return result;
}
"Platform %1$s is a preview and requires application manifests to set %2$s to '%1$s'",
codename, AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION);
AdtPlugin.printErrorToConsole(project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT, msg,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT, msg,
IMarker.SEVERITY_ERROR);
return result;
}
String msg = String.format(Messages.s_Doesnt_Declare_Package_Error,
SdkConstants.FN_ANDROID_MANIFEST_XML);
AdtPlugin.printErrorToConsole(project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT,
msg, IMarker.SEVERITY_ERROR);
return result;
"Application package '%1$s' must have a minimum of 2 segments.",
SdkConstants.FN_ANDROID_MANIFEST_XML);
AdtPlugin.printErrorToConsole(project, msg);
- BaseProjectHelper.markResource(manifestFile, AndroidConstants.MARKER_ADT,
+ BaseProjectHelper.markResource(manifestFile, AdtConstants.MARKER_ADT,
msg, IMarker.SEVERITY_ERROR);
return result;
}
// Clear the project of the generic markers
- removeMarkersFromContainer(project, AndroidConstants.MARKER_AAPT_COMPILE);
- removeMarkersFromContainer(project, AndroidConstants.MARKER_XML);
- removeMarkersFromContainer(project, AndroidConstants.MARKER_AIDL);
- removeMarkersFromContainer(project, AndroidConstants.MARKER_RENDERSCRIPT);
- removeMarkersFromContainer(project, AndroidConstants.MARKER_ANDROID);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_AAPT_COMPILE);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_XML);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_AIDL);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_RENDERSCRIPT);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_ANDROID);
}
@Override
private void handleResources(IProject project, String javaPackage, IAndroidTarget projectTarget,
IFile manifest, List<IProject> libProjects) throws CoreException, AbortBuildException {
// get the resource folder
- IFolder resFolder = project.getFolder(AndroidConstants.WS_RESOURCES);
+ IFolder resFolder = project.getFolder(AdtConstants.WS_RESOURCES);
// get the file system path
IPath outputLocation = mGenFolder.getLocation();
String osManifestPath = manifestLocation.toOSString();
// remove the aapt markers
- removeMarkersFromResource(manifest, AndroidConstants.MARKER_AAPT_COMPILE);
- removeMarkersFromContainer(resFolder, AndroidConstants.MARKER_AAPT_COMPILE);
+ removeMarkersFromResource(manifest, AdtConstants.MARKER_AAPT_COMPILE);
+ removeMarkersFromContainer(resFolder, AdtConstants.MARKER_AAPT_COMPILE);
AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, project,
Messages.Preparing_Generated_Files);
// We actually need to delete the manifest.java as it may become empty and
// in this case aapt doesn't generate an empty one, but instead doesn't
// touch it.
- IFile manifestJavaFile = packageFolder.getFile(AndroidConstants.FN_MANIFEST_CLASS);
+ IFile manifestJavaFile = packageFolder.getFile(AdtConstants.FN_MANIFEST_CLASS);
manifestJavaFile.getLocation().toFile().delete();
// launch aapt: create the command line
// (and therefore not all files that should have been marked,
// were marked), we put a generic marker on the project and abort.
if (parsingError) {
- markProject(AndroidConstants.MARKER_ADT,
+ markProject(AdtConstants.MARKER_ADT,
Messages.Unparsed_AAPT_Errors, IMarker.SEVERITY_ERROR);
}
// something happen while executing the process,
// mark the project and exit
String msg = String.format(Messages.AAPT_Exec_Error, array.get(0));
- markProject(AndroidConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
+ markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
// This interrupts the build.
throw new AbortBuildException();
// we got interrupted waiting for the process to end...
// mark the project and exit
String msg = String.format(Messages.AAPT_Exec_Error, array.get(0));
- markProject(AndroidConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
+ markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
// This interrupts the build.
throw new AbortBuildException();
*/
private IPath getJavaPackagePath(String javaPackageName) {
// convert the java package into path
- String[] segments = javaPackageName.split(AndroidConstants.RE_DOT);
+ String[] segments = javaPackageName.split(AdtConstants.RE_DOT);
StringBuilder path = new StringBuilder();
for (String s : segments) {
- path.append(AndroidConstants.WS_SEP_CHAR);
+ path.append(AdtConstants.WS_SEP_CHAR);
path.append(s);
}
package com.android.ide.eclipse.adt.internal.build.builders;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.SourceChangeHandler;
import com.android.ide.eclipse.adt.internal.build.SourceProcessor;
import com.android.ide.eclipse.adt.internal.build.Messages;
IFile manifestFile = (IFile)resource;
if (manifestFile.exists()) {
- manifestFile.deleteMarkers(AndroidConstants.MARKER_XML, true,
+ manifestFile.deleteMarkers(AdtConstants.MARKER_XML, true,
IResource.DEPTH_ZERO);
- manifestFile.deleteMarkers(AndroidConstants.MARKER_ANDROID, true,
+ manifestFile.deleteMarkers(AdtConstants.MARKER_ANDROID, true,
IResource.DEPTH_ZERO);
}
String fileName = resource.getName();
// Special case of R.java/Manifest.java.
- if (AndroidConstants.FN_RESOURCE_CLASS.equals(fileName) ||
- AndroidConstants.FN_MANIFEST_CLASS.equals(fileName)) {
+ if (AdtConstants.FN_RESOURCE_CLASS.equals(fileName) ||
+ AdtConstants.FN_MANIFEST_CLASS.equals(fileName)) {
// if it was removed, there's a possibility that it was removed due to a
// package change, or an aidl that was removed, but the only thing
// that will happen is that we'll have an extra build. Not much of a problem.
case IResourceDelta.CHANGED:
// display verbose message
message = String.format(Messages.s_Modified_Recreating_s, p,
- AndroidConstants.FN_RESOURCE_CLASS);
+ AdtConstants.FN_RESOURCE_CLASS);
break;
case IResourceDelta.ADDED:
// display verbose message
message = String.format(Messages.Added_s_s_Needs_Updating, p,
- AndroidConstants.FN_RESOURCE_CLASS);
+ AdtConstants.FN_RESOURCE_CLASS);
break;
case IResourceDelta.REMOVED:
// display verbose message
message = String.format(Messages.s_Removed_s_Needs_Updating, p,
- AndroidConstants.FN_RESOURCE_CLASS);
+ AdtConstants.FN_RESOURCE_CLASS);
break;
}
if (message != null) {
handler.handleResourceFile((IFile)resource, kind);
}
- if (AndroidConstants.EXT_XML.equalsIgnoreCase(ext)) {
+ if (AdtConstants.EXT_XML.equalsIgnoreCase(ext)) {
if (kind != IResourceDelta.REMOVED) {
// check xml Validity
mBuilder.checkXML(resource, this);
package com.android.ide.eclipse.adt.internal.build.builders;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.Messages;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity;
IProject project = getProject();
// Clear the project of the generic markers
- removeMarkersFromContainer(project, AndroidConstants.MARKER_ADT);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_ADT);
}
// build() returns a list of project from which this project depends for future compilation.
IJavaProject javaProject = JavaCore.create(project);
// Clear the project of the generic markers
- removeMarkersFromContainer(project, AndroidConstants.MARKER_ADT);
+ removeMarkersFromContainer(project, AdtConstants.MARKER_ADT);
// check for existing target marker, in which case we abort.
// (this means: no SDK, no target, or unresolvable target.)
}
if (errorMessage != null) {
- markProject(AndroidConstants.MARKER_ADT, errorMessage, IMarker.SEVERITY_ERROR);
+ markProject(AdtConstants.MARKER_ADT, errorMessage, IMarker.SEVERITY_ERROR);
AdtPlugin.printErrorToConsole(project, errorMessage);
return null;
if (osSdkFolder == null || osSdkFolder.length() == 0) {
AdtPlugin.printErrorToConsole(project, Messages.No_SDK_Setup_Error);
- markProject(AndroidConstants.MARKER_ADT, Messages.No_SDK_Setup_Error,
+ markProject(AdtConstants.MARKER_ADT, Messages.No_SDK_Setup_Error,
IMarker.SEVERITY_ERROR);
return null;
}
AdtPlugin.printErrorToConsole(project, message);
- markProject(AndroidConstants.MARKER_ADT, message, IMarker.SEVERITY_ERROR);
+ markProject(AdtConstants.MARKER_ADT, message, IMarker.SEVERITY_ERROR);
return null;
} else if (hasGenSrcFolder == false || genFolderPresent == false) {
AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, project, Messages.Refreshing_Res);
// refresh the res folder.
- IFolder resFolder = project.getFolder(AndroidConstants.WS_RESOURCES);
+ IFolder resFolder = project.getFolder(AdtConstants.WS_RESOURCES);
resFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
// Also refresh the assets folder to make sure the ApkBuilder
// will now it's changed and will force a new resource packaging.
- IFolder assetsFolder = project.getFolder(AndroidConstants.WS_ASSETS);
+ IFolder assetsFolder = project.getFolder(AdtConstants.WS_ASSETS);
assetsFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
import com.android.ide.common.api.IAttributeInfo.Format;
import com.android.ide.common.resources.platform.AttributeInfo;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.resources.ResourceType;
* The path in the online documentation for the manifest description.
* <p/>
* This is NOT a complete URL. To be used, it needs to be appended
- * to {@link AndroidConstants#CODESITE_BASE_URL} or to the local SDK
+ * to {@link AdtConstants#CODESITE_BASE_URL} or to the local SDK
* documentation.
*/
public static final String MANIFEST_SDK_URL = "/reference/android/R.styleable.html#"; //$NON-NLS-1$
package com.android.ide.eclipse.adt.internal.editors.export;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidTextEditor;
import org.eclipse.core.resources.IFile;
*/
public class ExportEditor extends AndroidTextEditor {
- public static final String ID = AndroidConstants.EDITORS_NAMESPACE + ".text.ExportEditor"; //$NON-NLS-1$
+ public static final String ID = AdtConstants.EDITORS_NAMESPACE + ".text.ExportEditor"; //$NON-NLS-1$
private ExportPropertiesPage mExportPropsPage;
package com.android.ide.eclipse.adt.internal.editors.layout;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DocumentDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
*/
public class LayoutEditor extends AndroidXmlEditor implements IShowEditorInput, IPartListener {
- public static final String ID = AndroidConstants.EDITORS_NAMESPACE + ".layout.LayoutEditor"; //$NON-NLS-1$
+ public static final String ID = AdtConstants.EDITORS_NAMESPACE + ".layout.LayoutEditor"; //$NON-NLS-1$
/** Root node of the UI element hierarchy */
private UiDocumentNode mUiRootNode;
package com.android.ide.eclipse.adt.internal.editors.layout;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.resources.manager.GlobalProjectMonitor;
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFile;
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolder;
boolean hasAndroidNature = false;
try {
- hasAndroidNature = project.hasNature(AndroidConstants.NATURE_DEFAULT);
+ hasAndroidNature = project.hasNature(AdtConstants.NATURE_DEFAULT);
} catch (CoreException e) {
// do nothing if the nature cannot be queried.
return;
for (IProject p : referencingProjects) {
try {
- hasAndroidNature = p.hasNature(AndroidConstants.NATURE_DEFAULT);
+ hasAndroidNature = p.hasNature(AdtConstants.NATURE_DEFAULT);
} catch (CoreException e) {
// do nothing if the nature cannot be queried.
continue;
// here we only care about code change (so change for .class files).
// Resource changes is handled by the IResourceListener.
- if (AndroidConstants.EXT_CLASS.equals(file.getFileExtension())) {
+ if (AdtConstants.EXT_CLASS.equals(file.getFileExtension())) {
if (file.getName().matches("R[\\$\\.](.*)")) {
// this is a R change!
if (changeFlags == null) {
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.ide.common.rendering.legacy.LegacyCallback;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
ManifestData manifestData = AndroidManifestHelper.parseForData(mProject);
if (manifestData != null) {
String javaPackage = manifestData.getPackage();
- mNamespace = String.format(AndroidConstants.NS_CUSTOM_RESOURCES, javaPackage);
+ mNamespace = String.format(AdtConstants.NS_CUSTOM_RESOURCES, javaPackage);
}
}
package com.android.ide.eclipse.adt.internal.editors.layout;
import com.android.ide.common.rendering.api.ILayoutPullParser;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
import com.android.sdklib.SdkConstants;
public WidgetPullParser(ViewElementDescriptor descriptor) {
mDescriptor = descriptor;
- String[] segments = mDescriptor.getFullClassName().split(AndroidConstants.RE_DOT);
+ String[] segments = mDescriptor.getFullClassName().split(AdtConstants.RE_DOT);
mAttributes[0][1] = segments[segments.length-1];
}
import static com.android.ide.common.layout.LayoutConstants.ANDROID_STRING_PREFIX;
import static com.android.ide.common.layout.LayoutConstants.SCROLL_VIEW;
import static com.android.ide.common.layout.LayoutConstants.STRING_PREFIX;
-import static com.android.ide.eclipse.adt.AndroidConstants.ANDROID_PKG;
+import static com.android.ide.eclipse.adt.AdtConstants.ANDROID_PKG;
import com.android.ide.common.rendering.LayoutLibrary;
import com.android.ide.common.rendering.StaticRenderSession;
import com.android.ide.common.resources.ResourceResolver;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.IPageImageProvider;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.editors.layout.ContextPullParser;
if (severity == IMarker.SEVERITY_ERROR) {
hasJavaErrors = true;
}
- } else if (markerType.equals(AndroidConstants.MARKER_AAPT_COMPILE)) {
+ } else if (markerType.equals(AdtConstants.MARKER_AAPT_COMPILE)) {
int severity = marker.getAttribute(IMarker.SEVERITY, -1);
if (severity == IMarker.SEVERITY_ERROR) {
hasAaptErrors = true;
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
-import static com.android.ide.eclipse.adt.AndroidConstants.EXT_XML;
-import static com.android.ide.eclipse.adt.AndroidConstants.WS_LAYOUTS;
-import static com.android.ide.eclipse.adt.AndroidConstants.WS_SEP;
+import static com.android.ide.eclipse.adt.AdtConstants.EXT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.WS_LAYOUTS;
+import static com.android.ide.eclipse.adt.AdtConstants.WS_SEP;
import static com.android.sdklib.SdkConstants.FD_LAYOUT;
import static org.eclipse.core.resources.IResourceDelta.ADDED;
*/
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
-import static com.android.ide.eclipse.adt.AndroidConstants.WS_SEP;
+import static com.android.ide.eclipse.adt.AdtConstants.WS_SEP;
import static com.android.sdklib.SdkConstants.FD_ANIMATOR;
import static com.android.sdklib.SdkConstants.FD_RESOURCES;
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import static com.android.ide.common.layout.LayoutConstants.ANDROID_URI;
-import static com.android.ide.eclipse.adt.AndroidConstants.DOT_PNG;
-import static com.android.ide.eclipse.adt.AndroidConstants.DOT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.DOT_PNG;
+import static com.android.ide.eclipse.adt.AdtConstants.DOT_XML;
import com.android.ide.common.rendering.LayoutLibrary;
import com.android.ide.common.rendering.api.Capability;
import static com.android.ide.common.layout.LayoutConstants.TABLE_ROW;
import static com.android.ide.common.layout.LayoutConstants.VALUE_FALSE;
import static com.android.ide.common.layout.LayoutConstants.VALUE_VERTICAL;
-import static com.android.ide.eclipse.adt.AndroidConstants.EXT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.EXT_XML;
import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor;
import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
import static com.android.ide.common.layout.LayoutConstants.ID_PREFIX;
import static com.android.ide.common.layout.LayoutConstants.NEW_ID_PREFIX;
import static com.android.ide.common.layout.LayoutConstants.VALUE_WRAP_CONTENT;
-import static com.android.ide.eclipse.adt.AndroidConstants.DOT_XML;
-import static com.android.ide.eclipse.adt.AndroidConstants.EXT_XML;
-import static com.android.ide.eclipse.adt.AndroidConstants.WS_SEP;
+import static com.android.ide.eclipse.adt.AdtConstants.DOT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.EXT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.WS_SEP;
import static com.android.ide.eclipse.adt.internal.editors.descriptors.XmlnsAttributeDescriptor.XMLNS;
import static com.android.ide.eclipse.adt.internal.editors.descriptors.XmlnsAttributeDescriptor.XMLNS_COLON;
import static com.android.resources.ResourceType.LAYOUT;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.CanvasViewInfo;
IPath parentPath = parent.getProjectRelativePath();
final IFile file = project.getFile(new Path(parentPath + WS_SEP + newFileName));
TextFileChange addFile = new TextFileChange("Create new separate layout", file);
- addFile.setTextType(AndroidConstants.EXT_XML);
+ addFile.setTextType(AdtConstants.EXT_XML);
changes.add(addFile);
addFile.setEdit(new InsertEdit(0, sb.toString()));
package com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.CanvasViewInfo;
if (file.exists()) {
IProject proj = file.getProject();
try {
- if (proj != null && proj.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (proj != null && proj.hasNature(AdtConstants.NATURE_DEFAULT)) {
return file;
}
} catch (CoreException e) {
import static com.android.ide.common.layout.LayoutConstants.VALUE_FILL_PARENT;
import static com.android.ide.common.layout.LayoutConstants.VALUE_MATCH_PARENT;
import static com.android.ide.common.layout.LayoutConstants.VALUE_WRAP_CONTENT;
-import static com.android.ide.eclipse.adt.AndroidConstants.EXT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.EXT_XML;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
package com.android.ide.eclipse.adt.internal.editors.manifest;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.manifest.descriptors.AndroidManifestDescriptors;
*/
public final class ManifestEditor extends AndroidXmlEditor {
- public static final String ID = AndroidConstants.EDITORS_NAMESPACE + ".manifest.ManifestEditor"; //$NON-NLS-1$
+ public static final String ID = AdtConstants.EDITORS_NAMESPACE + ".manifest.ManifestEditor"; //$NON-NLS-1$
private final static String EMPTY = ""; //$NON-NLS-1$
try {
// get the markers for the file
IMarker[] markers = inputFile.findMarkers(
- AndroidConstants.MARKER_ANDROID, true, IResource.DEPTH_ZERO);
+ AdtConstants.MARKER_ANDROID, true, IResource.DEPTH_ZERO);
AndroidManifestDescriptors desc = getManifestDescriptors();
if (desc != null) {
*/
private void processMarker(IMarker marker, List<UiElementNode> nodeList, int kind) {
// get the data from the marker
- String nodeType = marker.getAttribute(AndroidConstants.MARKER_ATTR_TYPE, EMPTY);
+ String nodeType = marker.getAttribute(AdtConstants.MARKER_ATTR_TYPE, EMPTY);
if (nodeType == EMPTY) {
return;
}
- String className = marker.getAttribute(AndroidConstants.MARKER_ATTR_CLASS, EMPTY);
+ String className = marker.getAttribute(AdtConstants.MARKER_ATTR_CLASS, EMPTY);
if (className == EMPTY) {
return;
}
package com.android.ide.eclipse.adt.internal.editors.manifest.model;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.TextAttributeDescriptor;
if (className.startsWith(".")) { //$NON-NLS-1$
fullClassName = packageName + className;
} else {
- String[] segments = className.split(AndroidConstants.RE_DOT);
+ String[] segments = className.split(AdtConstants.RE_DOT);
if (segments.length == 1) {
fullClassName = packageName + "." + className; //$NON-NLS-1$
}
// look for how many segments we have left.
// if one, just write it that way.
// if more than one, write it with a leading dot.
- String[] packages = name.split(AndroidConstants.RE_DOT);
+ String[] packages = name.split(AdtConstants.RE_DOT);
if (packages.length == 1) {
text.setText(name);
} else {
package com.android.ide.eclipse.adt.internal.editors.menu;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor.Mandatory;
*/
public class MenuEditor extends AndroidXmlEditor {
- public static final String ID = AndroidConstants.EDITORS_NAMESPACE + ".menu.MenuEditor"; //$NON-NLS-1$
+ public static final String ID = AdtConstants.EDITORS_NAMESPACE + ".menu.MenuEditor"; //$NON-NLS-1$
/** Root node of the UI element hierarchy */
private UiElementNode mUiRootNode;
package com.android.ide.eclipse.adt.internal.editors.resources;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.resources.descriptors.ResourcesDescriptors;
*/
public class ResourcesEditor extends AndroidXmlEditor {
- public static final String ID = AndroidConstants.EDITORS_NAMESPACE + ".resources.ResourcesEditor"; //$NON-NLS-1$
+ public static final String ID = AdtConstants.EDITORS_NAMESPACE + ".resources.ResourcesEditor"; //$NON-NLS-1$
/** Root node of the UI element hierarchy */
private UiElementNode mUiResourcesNode;
import static com.android.ide.common.layout.LayoutConstants.ATTR_ON_CLICK;
import static com.android.ide.common.layout.LayoutConstants.NEW_ID_PREFIX;
import static com.android.ide.common.layout.LayoutConstants.VIEW;
-import static com.android.ide.eclipse.adt.AndroidConstants.ANDROID_PKG;
-import static com.android.ide.eclipse.adt.AndroidConstants.EXT_XML;
-import static com.android.ide.eclipse.adt.AndroidConstants.FN_RESOURCE_BASE;
-import static com.android.ide.eclipse.adt.AndroidConstants.FN_RESOURCE_CLASS;
+import static com.android.ide.eclipse.adt.AdtConstants.ANDROID_PKG;
+import static com.android.ide.eclipse.adt.AdtConstants.EXT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.FN_RESOURCE_BASE;
+import static com.android.ide.eclipse.adt.AdtConstants.FN_RESOURCE_CLASS;
import static com.android.ide.eclipse.adt.internal.editors.resources.descriptors.ResourcesDescriptors.NAME_ATTR;
import static com.android.ide.eclipse.adt.internal.editors.resources.descriptors.ResourcesDescriptors.ROOT_ELEMENT;
import static com.android.sdklib.SdkConstants.FD_DOCS;
package com.android.ide.eclipse.adt.internal.editors.xml;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.FirstElementParser;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DocumentDescriptor;
*/
public class XmlEditor extends AndroidXmlEditor {
- public static final String ID = AndroidConstants.EDITORS_NAMESPACE + ".xml.XmlEditor"; //$NON-NLS-1$
+ public static final String ID = AdtConstants.EDITORS_NAMESPACE + ".xml.XmlEditor"; //$NON-NLS-1$
/** Root node of the UI element hierarchy */
private UiDocumentNode mUiRootNode;
package com.android.ide.eclipse.adt.internal.launch;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.sdklib.SdkConstants;
import org.eclipse.core.runtime.CoreException;
if (bundle == null) {
throw new IOException("Cannot find org.junit bundle");
}
- URL jarUrl = bundle.getEntry(AndroidConstants.WS_SEP + JUNIT_JAR);
+ URL jarUrl = bundle.getEntry(AdtConstants.WS_SEP + JUNIT_JAR);
return FileLocator.resolve(jarUrl).getFile();
}
}
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.launch.AndroidLaunchConfiguration.TargetMode;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
return false;
}
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
String msg = String.format("%1$s is not an Android project!", project.getName());
AdtPlugin.displayError("Android Launch", msg);
return false;
package com.android.ide.eclipse.adt.internal.launch.junit;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.launch.AndroidLaunch;
import com.android.ide.eclipse.adt.internal.launch.AndroidLaunchConfiguration;
import com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController;
LaunchMessages.AndroidJUnitDelegate_NoRunnerConsoleMsg_4s,
project.getName(),
SdkConstants.CLASS_INSTRUMENTATION_RUNNER,
- AndroidConstants.LIBRARY_TEST_RUNNER,
+ AdtConstants.LIBRARY_TEST_RUNNER,
SdkConstants.FN_ANDROID_MANIFEST_XML));
return null;
} catch (CoreException e) {
package com.android.ide.eclipse.adt.internal.launch.junit;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.launch.LaunchMessages;
import com.android.ide.eclipse.adt.internal.launch.MainLaunchConfigTab;
validateJavaProject(javaProject);
try {
- if (!project.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (!project.hasNature(AdtConstants.NATURE_DEFAULT)) {
setErrorMessage(
LaunchMessages.NonAndroidProjectError);
return;
*/
package com.android.ide.eclipse.adt.internal.launch.junit;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.launch.LaunchMessages;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
*/
private boolean hasTestRunnerLibrary(ManifestData manifestData) {
for (UsesLibrary lib : manifestData.getUsesLibraries()) {
- if (AndroidConstants.LIBRARY_TEST_RUNNER.equals(lib.getName())) {
+ if (AdtConstants.LIBRARY_TEST_RUNNER.equals(lib.getName())) {
return true;
}
}
String validateInstrumentationRunner(String instrumentation) {
if (!mHasRunnerLibrary) {
return String.format(LaunchMessages.InstrValidator_NoTestLibMsg_s,
- AndroidConstants.LIBRARY_TEST_RUNNER);
+ AdtConstants.LIBRARY_TEST_RUNNER);
}
// check if this instrumentation is the standard test runner
if (!instrumentation.equals(SdkConstants.CLASS_INSTRUMENTATION_RUNNER)) {
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.sdk.ProjectState;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.sdklib.AndroidVersion;
}
try {
- BaseProjectHelper.markProject(iProject, AndroidConstants.MARKER_TARGET,
+ BaseProjectHelper.markProject(iProject, AdtConstants.MARKER_TARGET,
markerMessage, IMarker.SEVERITY_ERROR, IMarker.PRIORITY_HIGH);
} catch (CoreException e) {
// In some cases, the workspace may be locked for modification when we
protected IStatus run(IProgressMonitor monitor) {
try {
BaseProjectHelper.markProject(iProject,
- AndroidConstants.MARKER_TARGET,
+ AdtConstants.MARKER_TARGET,
fmessage, IMarker.SEVERITY_ERROR,
IMarker.PRIORITY_HIGH);
} catch (CoreException e2) {
// no error, remove potential MARKER_TARGETs.
try {
if (iProject.exists()) {
- iProject.deleteMarkers(AndroidConstants.MARKER_TARGET, true,
+ iProject.deleteMarkers(AdtConstants.MARKER_TARGET, true,
IResource.DEPTH_INFINITE);
}
} catch (CoreException ce) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- iProject.deleteMarkers(AndroidConstants.MARKER_TARGET, true,
+ iProject.deleteMarkers(AdtConstants.MARKER_TARGET, true,
IResource.DEPTH_INFINITE);
} catch (CoreException e2) {
return e2.getStatus();
package com.android.ide.eclipse.adt.internal.project;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder;
import com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder;
import com.android.ide.eclipse.adt.internal.build.builders.ResourceManagerBuilder;
// Adding the java nature after the android one, would place the java builder before the
// android builders.
addNatureToProjectDescription(project, JavaCore.NATURE_ID, monitor);
- addNatureToProjectDescription(project, AndroidConstants.NATURE_DEFAULT, monitor);
+ addNatureToProjectDescription(project, AdtConstants.NATURE_DEFAULT, monitor);
}
/**
String[] newNatures = new String[natures.length + 1];
// Android natures always come first.
- if (natureId.equals(AndroidConstants.NATURE_DEFAULT)) {
+ if (natureId.equals(AdtConstants.NATURE_DEFAULT)) {
System.arraycopy(natures, 0, newNatures, 1, natures.length);
newNatures[0] = natureId;
} else {
package com.android.ide.eclipse.adt.internal.project;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
// check if it's an android project based on its nature
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT)) {
if (filter == null || filter.accept(project)) {
androidProjectList.add(javaProject);
}
package com.android.ide.eclipse.adt.internal.project;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.AndroidPrintStream;
import com.android.ide.eclipse.adt.internal.build.BuildHelper;
import com.android.ide.eclipse.adt.internal.build.DexException;
// tmp file for the packaged resource file. To not disturb the incremental builders
// output, all intermediary files are created in tmp files.
- File resourceFile = File.createTempFile(TEMP_PREFIX, AndroidConstants.DOT_RES);
+ File resourceFile = File.createTempFile(TEMP_PREFIX, AdtConstants.DOT_RES);
resourceFile.deleteOnExit();
// package the resources.
// Step 2. Convert the byte code to Dalvik bytecode
// tmp file for the packaged resource file.
- File dexFile = File.createTempFile(TEMP_PREFIX, AndroidConstants.DOT_DEX);
+ File dexFile = File.createTempFile(TEMP_PREFIX, AdtConstants.DOT_DEX);
dexFile.deleteOnExit();
ProjectState state = Sdk.getProjectState(project);
String[] projectOutputs = helper.getProjectOutputs();
// create a jar from the output of these projects
- File inputJar = File.createTempFile(TEMP_PREFIX, AndroidConstants.DOT_JAR);
+ File inputJar = File.createTempFile(TEMP_PREFIX, AdtConstants.DOT_JAR);
inputJar.deleteOnExit();
JarOutputStream jos = new JarOutputStream(new FileOutputStream(inputJar));
null /*resourceMarker*/);
// destination file for proguard
- File obfuscatedJar = File.createTempFile(TEMP_PREFIX, AndroidConstants.DOT_JAR);
+ File obfuscatedJar = File.createTempFile(TEMP_PREFIX, AdtConstants.DOT_JAR);
obfuscatedJar.deleteOnExit();
// run proguard
IPath binLocation = outputFolder.getLocation();
// make the full path to the package
- String fileName = project.getName() + AndroidConstants.DOT_ANDROID_PACKAGE;
+ String fileName = project.getName() + AdtConstants.DOT_ANDROID_PACKAGE;
File file = new File(binLocation.toOSString() + File.separator + fileName);
} else if (file.isFile()) {
// check the extension
String name = file.getName();
- if (name.toLowerCase().endsWith(AndroidConstants.DOT_CLASS) == false) {
+ if (name.toLowerCase().endsWith(AdtConstants.DOT_CLASS) == false) {
return;
}
package com.android.ide.eclipse.adt.internal.project;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.sdklib.SdkConstants;
}
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT)) {
// check the folder is directly under the project.
if (folder.getParent().getType() == IResource.PROJECT) {
String name = folder.getName();
package com.android.ide.eclipse.adt.internal.project;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.xml.ManifestData;
public static String getJavaDocPath(String javaDocOSLocation) {
// first thing we do is convert the \ into /
String javaDoc = javaDocOSLocation.replaceAll("\\\\", //$NON-NLS-1$
- AndroidConstants.WS_SEP);
+ AdtConstants.WS_SEP);
// then we add file: at the beginning for unix path, and file:/ for non
// unix path
- if (javaDoc.startsWith(AndroidConstants.WS_SEP)) {
+ if (javaDoc.startsWith(AdtConstants.WS_SEP)) {
return "file:" + javaDoc; //$NON-NLS-1$
}
if (checkCompilerCompliance(javaProject) != COMPILER_COMPLIANCE_OK) {
// setup the preferred compiler compliance level.
javaProject.setOption(JavaCore.COMPILER_COMPLIANCE,
- AndroidConstants.COMPILER_COMPLIANCE_PREFERRED);
+ AdtConstants.COMPILER_COMPLIANCE_PREFERRED);
javaProject.setOption(JavaCore.COMPILER_SOURCE,
- AndroidConstants.COMPILER_COMPLIANCE_PREFERRED);
+ AdtConstants.COMPILER_COMPLIANCE_PREFERRED);
javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM,
- AndroidConstants.COMPILER_COMPLIANCE_PREFERRED);
+ AdtConstants.COMPILER_COMPLIANCE_PREFERRED);
// clean the project to make sure we recompile
try {
for (IProject p : projects) {
if (p.isOpen()) {
try {
- if (p.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (p.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
// ignore non android projects
continue;
}
String[] natures = description.getNatureIds();
// if the android nature is not the first one, we reorder them
- if (AndroidConstants.NATURE_DEFAULT.equals(natures[0]) == false) {
+ if (AdtConstants.NATURE_DEFAULT.equals(natures[0]) == false) {
// look for the index
for (int i = 0 ; i < natures.length ; i++) {
- if (AndroidConstants.NATURE_DEFAULT.equals(natures[i])) {
+ if (AdtConstants.NATURE_DEFAULT.equals(natures[i])) {
// if we try to just reorder the array in one pass, this doesn't do
// anything. I guess JDT check that we are actually adding/removing nature.
// So, first we'll remove the android nature, and then add it back.
// remove the android nature
- removeNature(project, AndroidConstants.NATURE_DEFAULT);
+ removeNature(project, AdtConstants.NATURE_DEFAULT);
// now add it back at the first index.
description = project.getDescription();
String[] newNatures = new String[natures.length + 1];
// first one is android
- newNatures[0] = AndroidConstants.NATURE_DEFAULT;
+ newNatures[0] = AdtConstants.NATURE_DEFAULT;
// next the rest that was before the android nature
System.arraycopy(natures, 0, newNatures, 1, natures.length);
* @return true if the option value is supproted.
*/
private static boolean checkCompliance(String optionValue) {
- for (String s : AndroidConstants.COMPILER_COMPLIANCE) {
+ for (String s : AdtConstants.COMPILER_COMPLIANCE) {
if (s != null && s.equals(optionValue)) {
return true;
}
*/
public static String getApkFilename(IProject project, String config) {
if (config != null) {
- return project.getName() + "-" + config + AndroidConstants.DOT_ANDROID_PACKAGE; //$NON-NLS-1$
+ return project.getName() + "-" + config + AdtConstants.DOT_ANDROID_PACKAGE; //$NON-NLS-1$
}
- return project.getName() + AndroidConstants.DOT_ANDROID_PACKAGE;
+ return project.getName() + AdtConstants.DOT_ANDROID_PACKAGE;
}
/**
//Verify that the project has also the Android Nature
try {
- if (!androidJavaProject.getProject().hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (!androidJavaProject.getProject().hasNature(AdtConstants.NATURE_DEFAULT)) {
continue;
}
} catch (CoreException e) {
// get the package path
- String packageName = project.getName() + AndroidConstants.DOT_ANDROID_PACKAGE;
+ String packageName = project.getName() + AdtConstants.DOT_ANDROID_PACKAGE;
IResource r = outputLocation.findMember(packageName);
// check the package is present
* is missing.
*/
public static IFile getManifest(IProject project) {
- IResource r = project.findMember(AndroidConstants.WS_SEP
+ IResource r = project.findMember(AdtConstants.WS_SEP
+ SdkConstants.FN_ANDROID_MANIFEST_XML);
if (r == null || r.exists() == false || (r instanceof IFile) == false) {
package com.android.ide.eclipse.adt.internal.project;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.sdklib.xml.AndroidManifestParser.ManifestErrorHandler;
import org.eclipse.core.resources.IFile;
public void warning(SAXParseException exception) throws SAXException {
if (mFile != null) {
BaseProjectHelper.markResource(mFile,
- AndroidConstants.MARKER_XML,
+ AdtConstants.MARKER_XML,
exception.getMessage(),
exception.getLineNumber(),
IMarker.SEVERITY_WARNING);
if (mFile != null) {
BaseProjectHelper.markResource(mFile,
- AndroidConstants.MARKER_XML,
+ AdtConstants.MARKER_XML,
message,
lineNumber,
IMarker.SEVERITY_ERROR);
// mark the file
IMarker marker = BaseProjectHelper.markResource(getFile(),
- AndroidConstants.MARKER_ANDROID, result, line, IMarker.SEVERITY_ERROR);
+ AdtConstants.MARKER_ANDROID, result, line, IMarker.SEVERITY_ERROR);
// add custom attributes to be used by the manifest editor.
if (marker != null) {
try {
- marker.setAttribute(AndroidConstants.MARKER_ATTR_TYPE,
- AndroidConstants.MARKER_ATTR_TYPE_ACTIVITY);
- marker.setAttribute(AndroidConstants.MARKER_ATTR_CLASS, className);
+ marker.setAttribute(AdtConstants.MARKER_ATTR_TYPE,
+ AdtConstants.MARKER_ATTR_TYPE_ACTIVITY);
+ marker.setAttribute(AdtConstants.MARKER_ATTR_CLASS, className);
} catch (CoreException e) {
}
}
package com.android.ide.eclipse.adt.internal.refactoring.core;\r
\r
import com.android.ide.common.layout.LayoutConstants;\r
-import com.android.ide.eclipse.adt.AndroidConstants;\r
+import com.android.ide.eclipse.adt.AdtConstants;\r
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;\r
import com.android.ide.eclipse.adt.internal.refactoring.changes.AndroidLayoutChange;\r
import com.android.ide.eclipse.adt.internal.refactoring.changes.AndroidLayoutChangeDescription;\r
IJavaProject javaProject = (IJavaProject) mPackageFragment\r
.getAncestor(IJavaElement.JAVA_PROJECT);\r
IProject project = javaProject.getProject();\r
- IResource manifestResource = project.findMember(AndroidConstants.WS_SEP\r
+ IResource manifestResource = project.findMember(AdtConstants.WS_SEP\r
+ SdkConstants.FN_ANDROID_MANIFEST_XML);\r
\r
if (manifestResource == null || !manifestResource.exists()\r
package com.android.ide.eclipse.adt.internal.refactoring.core;\r
\r
import com.android.ide.common.layout.LayoutConstants;\r
-import com.android.ide.eclipse.adt.AndroidConstants;\r
+import com.android.ide.eclipse.adt.AdtConstants;\r
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;\r
import com.android.ide.eclipse.adt.internal.refactoring.changes.AndroidLayoutChange;\r
import com.android.ide.eclipse.adt.internal.refactoring.changes.AndroidLayoutChangeDescription;\r
IType type = (IType) element;\r
IJavaProject javaProject = (IJavaProject) type.getAncestor(IJavaElement.JAVA_PROJECT);\r
IProject project = javaProject.getProject();\r
- IResource manifestResource = project.findMember(AndroidConstants.WS_SEP\r
+ IResource manifestResource = project.findMember(AdtConstants.WS_SEP\r
+ SdkConstants.FN_ANDROID_MANIFEST_XML);\r
\r
if (manifestResource == null || !manifestResource.exists()\r
package com.android.ide.eclipse.adt.internal.refactoring.core;\r
\r
import com.android.ide.common.layout.LayoutConstants;\r
-import com.android.ide.eclipse.adt.AndroidConstants;\r
+import com.android.ide.eclipse.adt.AdtConstants;\r
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;\r
import com.android.ide.eclipse.adt.internal.refactoring.changes.AndroidLayoutChange;\r
import com.android.ide.eclipse.adt.internal.refactoring.changes.AndroidLayoutChangeDescription;\r
IType type = (IType) element;\r
IJavaProject javaProject = (IJavaProject) type.getAncestor(IJavaElement.JAVA_PROJECT);\r
IProject project = javaProject.getProject();\r
- IResource manifestResource = project.findMember(AndroidConstants.WS_SEP\r
+ IResource manifestResource = project.findMember(AdtConstants.WS_SEP\r
+ SdkConstants.FN_ANDROID_MANIFEST_XML);\r
\r
if (manifestResource == null || !manifestResource.exists()\r
package com.android.ide.eclipse.adt.internal.refactorings.extractstring;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
if (file.exists()) {
IProject proj = file.getProject();
try {
- if (proj != null && proj.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (proj != null && proj.hasNature(AdtConstants.NATURE_DEFAULT)) {
return file;
}
} catch (CoreException e) {
package com.android.ide.eclipse.adt.internal.refactorings.extractstring;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolderType;
import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector;
"/res/[a-z][a-zA-Z0-9_-]+/[^.]+\\.xml"); //$NON-NLS-1$
/** Absolute destination folder root, e.g. "/res/" */
private static final String RES_FOLDER_ABS =
- AndroidConstants.WS_RESOURCES + AndroidConstants.WS_SEP;
+ AdtConstants.WS_RESOURCES + AdtConstants.WS_SEP;
/** Relative destination folder root, e.g. "res/" */
private static final String RES_FOLDER_REL =
- SdkConstants.FD_RESOURCES + AndroidConstants.WS_SEP;
+ SdkConstants.FD_RESOURCES + AdtConstants.WS_SEP;
private static final String DEFAULT_RES_FILE_PATH = "/res/values/strings.xml"; //$NON-NLS-1$
mConfigSelector.getConfiguration(mTempConfig);
StringBuffer sb = new StringBuffer(RES_FOLDER_ABS);
sb.append(mTempConfig.getFolderName(ResourceFolderType.VALUES));
- sb.append(AndroidConstants.WS_SEP);
+ sb.append(AdtConstants.WS_SEP);
String newPath = sb.toString();
if (wsFolderPath.startsWith(RES_FOLDER_ABS)) {
wsFolderPath = wsFolderPath.substring(RES_FOLDER_ABS.length());
- int pos = wsFolderPath.indexOf(AndroidConstants.WS_SEP_CHAR);
+ int pos = wsFolderPath.indexOf(AdtConstants.WS_SEP_CHAR);
if (pos >= 0) {
wsFolderPath = wsFolderPath.substring(0, pos);
}
import static com.android.ide.common.layout.LayoutConstants.STRING_PREFIX;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ReferenceAttributeDescriptor;
}
// Check this a Layout XML file and get the selection and its context.
- if (mFile != null && AndroidConstants.EXT_XML.equals(mFile.getFileExtension())) {
+ if (mFile != null && AdtConstants.EXT_XML.equals(mFile.getFileExtension())) {
// Currently we only support Android resource XML files, so they must have a path
// similar to
// Add all /res folders (technically we don't need to process /res/values
// XML files that contain resources/string elements, but it's easier to
// not filter them out.)
- IFolder f = mProject.getFolder(AndroidConstants.WS_RESOURCES);
+ IFolder f = mProject.getFolder(AdtConstants.WS_RESOURCES);
if (f.exists()) {
try {
mFolders.addAll(
if (res.exists() && !res.isDerived() && res instanceof IFile) {
IFile file = (IFile) res;
// Must have an XML extension
- if (AndroidConstants.EXT_XML.equals(file.getFileExtension())) {
+ if (AdtConstants.EXT_XML.equals(file.getFileExtension())) {
IPath p = file.getFullPath();
// And not be either paths we want to filter out
if ((mFilterPath1 != null && mFilterPath1.equals(p)) ||
SubMonitor monitor) {
TextFileChange xmlChange = new TextFileChange(getName(), targetXml);
- xmlChange.setTextType(AndroidConstants.EXT_XML);
+ xmlChange.setTextType(AdtConstants.EXT_XML);
String error = ""; //$NON-NLS-1$
TextEdit edit = null;
HashSet<IFile> files = new HashSet<IFile>();
files.add(sourceFile);
- if (allConfigurations && AndroidConstants.EXT_XML.equals(sourceFile.getFileExtension())) {
+ if (allConfigurations && AdtConstants.EXT_XML.equals(sourceFile.getFileExtension())) {
IPath path = sourceFile.getFullPath();
if (path.segmentCount() == 4 && path.segment(1).equals(SdkConstants.FD_RESOURCES)) {
IProject project = sourceFile.getProject();
package com.android.ide.eclipse.adt.internal.refactorings.renamepackage;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.descriptors.XmlnsAttributeDescriptor;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.xml.AndroidManifest;
ImportRewrite irw = ImportRewrite.create(cu, true);
irw.addImport(mNewPackageName.getFullyQualifiedName() + '.'
- + AndroidConstants.FN_RESOURCE_BASE);
+ + AdtConstants.FN_RESOURCE_BASE);
try {
rewrittenImports.addChild( irw.rewriteImports(null) );
}
TextFileChange xmlChange = new TextFileChange("XML resource file edit", file);
- xmlChange.setTextType(AndroidConstants.EXT_XML);
+ xmlChange.setTextType(AdtConstants.EXT_XML);
MultiTextEdit multiEdit = new MultiTextEdit();
ArrayList<TextEditGroup> editGroups = new ArrayList<TextEditGroup>();
- final String oldAppNamespaceString = String.format(AndroidConstants.NS_CUSTOM_RESOURCES,
+ final String oldAppNamespaceString = String.format(AdtConstants.NS_CUSTOM_RESOURCES,
mOldPackageName.getFullyQualifiedName());
- final String newAppNamespaceString = String.format(AndroidConstants.NS_CUSTOM_RESOURCES,
+ final String newAppNamespaceString = String.format(AdtConstants.NS_CUSTOM_RESOURCES,
mNewPackageName.getFullyQualifiedName());
// Prepare the change set
}
TextFileChange xmlChange = new TextFileChange("Make Manifest edits", file);
- xmlChange.setTextType(AndroidConstants.EXT_XML);
+ xmlChange.setTextType(AdtConstants.EXT_XML);
MultiTextEdit multiEdit = new MultiTextEdit();
ArrayList<TextEditGroup> editGroups = new ArrayList<TextEditGroup>();
public boolean visit(IResource resource) throws CoreException {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
- if (AndroidConstants.EXT_JAVA.equals(file.getFileExtension())) {
+ if (AdtConstants.EXT_JAVA.equals(file.getFileExtension())) {
ICompilationUnit icu = JavaCore.createCompilationUnitFrom(file);
edit.addChild(text_edit);
TextFileChange text_file_change = new TextFileChange(file.getName(), file);
- text_file_change.setTextType(AndroidConstants.EXT_JAVA);
+ text_file_change.setTextType(AdtConstants.EXT_JAVA);
text_file_change.setEdit(edit);
mChanges.add(text_file_change);
}
// XXX Partially taken from ExtractStringRefactoring.java
// Check this a Layout XML file and get the selection and
// its context.
- } else if (AndroidConstants.EXT_XML.equals(file.getFileExtension())) {
+ } else if (AdtConstants.EXT_XML.equals(file.getFileExtension())) {
if (SdkConstants.FN_ANDROID_MANIFEST_XML.equals(file.getName())) {
QualifiedName qualifiedImportName = (QualifiedName) importName;
if (qualifiedImportName.getName().getIdentifier()
- .equals(AndroidConstants.FN_RESOURCE_BASE)) {
+ .equals(AdtConstants.FN_RESOURCE_BASE)) {
mRewriter.replace(qualifiedImportName.getQualifier(), mNewPackageName,
null);
}
package com.android.ide.eclipse.adt.internal.resources;
-import static com.android.ide.eclipse.adt.AndroidConstants.DOT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.DOT_XML;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.resources.manager.FolderTypeRelationship;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResourceItem;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
newText = newText.substring(0, newText.length() - DOT_XML.length());
}
- if (newText.indexOf('.') != -1 && !newText.endsWith(AndroidConstants.DOT_XML)) {
+ if (newText.indexOf('.') != -1 && !newText.endsWith(AdtConstants.DOT_XML)) {
return String.format("The filename must end with %1$s.", DOT_XML);
}
package com.android.ide.eclipse.adt.internal.resources.manager;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
import com.android.ide.eclipse.adt.internal.resources.manager.GlobalProjectMonitor.IFileListener;
* @see IFileListener#fileChanged
*/
public void fileChanged(IFile file, IMarkerDelta[] markerDeltas, int kind) {
- if (file.getName().equals(AndroidConstants.FN_COMPILED_RESOURCE_CLASS)) {
+ if (file.getName().equals(AdtConstants.FN_COMPILED_RESOURCE_CLASS)) {
loadAndParseRClass(file.getProject());
}
}
public void projectOpenedWithWorkspace(IProject project) {
try {
// check this is an android project
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT)) {
loadAndParseRClass(project);
}
} catch (CoreException e) {
package com.android.ide.eclipse.adt.internal.resources.manager;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.BuildHelper;
import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
IPath path = e.getPath();
// check the name ends with .jar
- if (AndroidConstants.EXT_JAR.equalsIgnoreCase(path.getFileExtension())) {
+ if (AdtConstants.EXT_JAR.equalsIgnoreCase(path.getFileExtension())) {
boolean local = false;
IResource resource = wsRoot.findMember(path);
if (resource != null && resource.exists() &&
package com.android.ide.eclipse.adt.internal.resources.manager;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
import com.android.ide.eclipse.adt.internal.resources.manager.GlobalProjectMonitor.IFileListener;
final IProject project = folder.getProject();
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
return;
}
} catch (CoreException e) {
final IProject project = file.getProject();
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
return;
}
} catch (CoreException e) {
private void createProject(IProject project) {
if (project.isOpen()) {
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
return;
}
} catch (CoreException e1) {
package com.android.ide.eclipse.adt.internal.sdk;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
// get the name of the entry.
String entryPath = entry.getName();
- if (!entryPath.endsWith(AndroidConstants.DOT_CLASS)) {
+ if (!entryPath.endsWith(AdtConstants.DOT_CLASS)) {
// only accept class files
continue;
}
while ((entry = zis.getNextEntry()) != null) {
// get the name of the entry and convert to a class binary name
String entryPath = entry.getName();
- if (!entryPath.endsWith(AndroidConstants.DOT_CLASS)) {
+ if (!entryPath.endsWith(AdtConstants.DOT_CLASS)) {
// only accept class files
continue;
}
// The name is a binary name. Something like "android.R", or "android.R$id".
// Make a path out of it.
- String entryName = className.replaceAll("\\.", "/") + AndroidConstants.DOT_CLASS; //$NON-NLS-1$ //$NON-NLS-2$
+ String entryName = className.replaceAll("\\.", "/") + AdtConstants.DOT_CLASS; //$NON-NLS-1$ //$NON-NLS-2$
// create streams to read the intermediary archive
FileInputStream fis = new FileInputStream(mOsFrameworkLocation);
import com.android.ide.common.rendering.LayoutLibrary;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.build.DexWrapper;
import com.android.ide.eclipse.adt.internal.project.AndroidClasspathContainerInitializer;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
private void onProjectRemoved(IProject project, boolean deleted) {
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
return;
}
} catch (CoreException e) {
private void onProjectOpened(final IProject openedProject) {
try {
- if (openedProject.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (openedProject.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
return;
}
} catch (CoreException e) {
public void projectRenamed(IProject project, IPath from) {
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
return;
}
} catch (CoreException e) {
// the target.
IProject iProject = file.getProject();
- if (iProject.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (iProject.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
return;
}
package com.android.ide.eclipse.adt.internal.ui;
-import static com.android.ide.eclipse.adt.AndroidConstants.EXT_XML;
-import static com.android.ide.eclipse.adt.AndroidConstants.WS_SEP;
+import static com.android.ide.eclipse.adt.AdtConstants.EXT_XML;
+import static com.android.ide.eclipse.adt.AdtConstants.WS_SEP;
import static com.android.ide.eclipse.adt.internal.editors.resources.descriptors.ResourcesDescriptors.NAME_ATTR;
import static com.android.sdklib.SdkConstants.FD_RESOURCES;
import static com.android.sdklib.SdkConstants.FD_VALUES;
package com.android.ide.eclipse.adt.internal.ui;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResourceItem;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFile;
// Note: keep using the obsolete AndroidConstants.EDITORS_NAMESPACE (which used
// to be the Editors Plugin ID) to keep existing preferences functional.
private final static String PREFS_COLUMN_RES =
- AndroidConstants.EDITORS_NAMESPACE + "ResourceExplorer.Col1"; //$NON-NLS-1$
+ AdtConstants.EDITORS_NAMESPACE + "ResourceExplorer.Col1"; //$NON-NLS-1$
private final static String PREFS_COLUMN_2 =
- AndroidConstants.EDITORS_NAMESPACE + "ResourceExplorer.Col2"; //$NON-NLS-1$
+ AdtConstants.EDITORS_NAMESPACE + "ResourceExplorer.Col2"; //$NON-NLS-1$
private Tree mTree;
private TreeViewer mTreeViewer;
try {
// if it's an android project, then we get its resources, and feed them
// to the tree viewer.
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT)) {
if (mCurrentProject != project) {
ProjectResources projRes = ResourceManager.getInstance().getProjectResources(
project);
package com.android.ide.eclipse.adt.internal.wizards.export;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
mHasMessage = true;
} else {
try {
- if (project.hasNature(AndroidConstants.NATURE_DEFAULT) == false) {
+ if (project.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
addError(mErrorComposite, "Project is not an Android project.");
} else {
// check for errors
if (outputIFolder != null) {
String outputOsPath = outputIFolder.getLocation().toOSString();
String apkFilePath = outputOsPath + File.separator + project.getName() +
- AndroidConstants.DOT_ANDROID_PACKAGE;
+ AdtConstants.DOT_ANDROID_PACKAGE;
File f = new File(apkFilePath);
if (f.isFile() == false) {
String.format("%1$s/%2$s/%1$s%3$s does not exists!",
project.getName(),
outputIFolder.getName(),
- AndroidConstants.DOT_ANDROID_PACKAGE));
+ AdtConstants.DOT_ANDROID_PACKAGE));
}
} else {
addError(mErrorComposite,
package com.android.ide.eclipse.adt.internal.wizards.newproject;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.internal.sdk.Sdk.ITargetChangeListener;
// name as a default. If the activity name has dots, it's a part of a
// package specification and only the last identifier must be used.
if (activityName.indexOf('.') != -1) {
- String[] ids = activityName.split(AndroidConstants.RE_DOT);
+ String[] ids = activityName.split(AdtConstants.RE_DOT);
activityName = ids[ids.length - 1];
}
if (mProjectNameField.getText().length() == 0 || !mProjectNameModifiedByUser) {
} else if (osTarget.indexOf('.') == 0) {
osTarget = mInfo.getPackageName() + osTarget;
}
- osTarget = osTarget.replace('.', File.separatorChar) + AndroidConstants.DOT_JAVA;
+ osTarget = osTarget.replace('.', File.separatorChar) + AdtConstants.DOT_JAVA;
String projectPath = getProjectLocation();
File projectDir = new File(projectPath);
import com.android.ide.common.layout.LayoutConstants;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.project.AndroidNature;
import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
private static final String PH_TEST_INSTRUMENTATION = "TEST-INSTRUMENTATION"; //$NON-NLS-1$
private static final String BIN_DIRECTORY =
- SdkConstants.FD_OUTPUT + AndroidConstants.WS_SEP;
+ SdkConstants.FD_OUTPUT + AdtConstants.WS_SEP;
private static final String RES_DIRECTORY =
- SdkConstants.FD_RESOURCES + AndroidConstants.WS_SEP;
+ SdkConstants.FD_RESOURCES + AdtConstants.WS_SEP;
private static final String ASSETS_DIRECTORY =
- SdkConstants.FD_ASSETS + AndroidConstants.WS_SEP;
+ SdkConstants.FD_ASSETS + AdtConstants.WS_SEP;
private static final String DRAWABLE_DIRECTORY =
- SdkConstants.FD_DRAWABLE + AndroidConstants.WS_SEP;
+ SdkConstants.FD_DRAWABLE + AdtConstants.WS_SEP;
private static final String DRAWABLE_HDPI_DIRECTORY =
- SdkConstants.FD_DRAWABLE + "-" + Density.HIGH.getResourceValue() + AndroidConstants.WS_SEP; //$NON-NLS-1$
+ SdkConstants.FD_DRAWABLE + "-" + Density.HIGH.getResourceValue() + AdtConstants.WS_SEP; //$NON-NLS-1$
private static final String DRAWABLE_MDPI_DIRECTORY =
- SdkConstants.FD_DRAWABLE + "-" + Density.MEDIUM.getResourceValue() + AndroidConstants.WS_SEP; //$NON-NLS-1$
+ SdkConstants.FD_DRAWABLE + "-" + Density.MEDIUM.getResourceValue() + AdtConstants.WS_SEP; //$NON-NLS-1$
private static final String DRAWABLE_LDPI_DIRECTORY =
- SdkConstants.FD_DRAWABLE + "-" + Density.LOW.getResourceValue() + AndroidConstants.WS_SEP; //$NON-NLS-1$
+ SdkConstants.FD_DRAWABLE + "-" + Density.LOW.getResourceValue() + AdtConstants.WS_SEP; //$NON-NLS-1$
private static final String LAYOUT_DIRECTORY =
- SdkConstants.FD_LAYOUT + AndroidConstants.WS_SEP;
+ SdkConstants.FD_LAYOUT + AdtConstants.WS_SEP;
private static final String VALUES_DIRECTORY =
- SdkConstants.FD_VALUES + AndroidConstants.WS_SEP;
+ SdkConstants.FD_VALUES + AdtConstants.WS_SEP;
private static final String GEN_SRC_DIRECTORY =
- SdkConstants.FD_GEN_SOURCES + AndroidConstants.WS_SEP;
+ SdkConstants.FD_GEN_SOURCES + AdtConstants.WS_SEP;
private static final String TEMPLATES_DIRECTORY = "templates/"; //$NON-NLS-1$
private static final String TEMPLATE_MANIFEST = TEMPLATES_DIRECTORY
AndroidNature.setupProjectNatures(project, monitor);
// Create folders in the project if they don't already exist
- addDefaultDirectories(project, AndroidConstants.WS_ROOT, DEFAULT_DIRECTORIES, monitor);
+ addDefaultDirectories(project, AdtConstants.WS_ROOT, DEFAULT_DIRECTORIES, monitor);
String[] sourceFolders = new String[] {
(String) parameters.get(PARAM_SRC_FOLDER),
GEN_SRC_DIRECTORY
};
- addDefaultDirectories(project, AndroidConstants.WS_ROOT, sourceFolders, monitor);
+ addDefaultDirectories(project, AdtConstants.WS_ROOT, sourceFolders, monitor);
// Create the resource folders in the project if they don't already exist.
if (legacy) {
throws CoreException, IOException {
// create the IFile object and check if the file doesn't already exist.
- IFile file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
- + VALUES_DIRECTORY + AndroidConstants.WS_SEP + STRINGS_FILE);
+ IFile file = project.getFile(RES_DIRECTORY + AdtConstants.WS_SEP
+ + VALUES_DIRECTORY + AdtConstants.WS_SEP + STRINGS_FILE);
if (!file.exists()) {
// get the Strings.xml template
String stringDefinitionTemplate = AdtPlugin.readEmbeddedTextFile(TEMPLATE_STRINGS);
throws CoreException {
if (legacy) { // density support
// do medium density icon only, in the default drawable folder.
- IFile file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
- + DRAWABLE_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+ IFile file = project.getFile(RES_DIRECTORY + AdtConstants.WS_SEP
+ + DRAWABLE_DIRECTORY + AdtConstants.WS_SEP + PROJECT_ICON);
if (!file.exists()) {
addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_MDPI), monitor);
}
IFile file;
// high density
- file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
- + DRAWABLE_HDPI_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+ file = project.getFile(RES_DIRECTORY + AdtConstants.WS_SEP
+ + DRAWABLE_HDPI_DIRECTORY + AdtConstants.WS_SEP + PROJECT_ICON);
if (!file.exists()) {
addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_HDPI), monitor);
}
// medium density
- file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
- + DRAWABLE_MDPI_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+ file = project.getFile(RES_DIRECTORY + AdtConstants.WS_SEP
+ + DRAWABLE_MDPI_DIRECTORY + AdtConstants.WS_SEP + PROJECT_ICON);
if (!file.exists()) {
addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_MDPI), monitor);
}
// low density
- file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
- + DRAWABLE_LDPI_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+ file = project.getFile(RES_DIRECTORY + AdtConstants.WS_SEP
+ + DRAWABLE_LDPI_DIRECTORY + AdtConstants.WS_SEP + PROJECT_ICON);
if (!file.exists()) {
addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_LDPI), monitor);
}
// Resource class
if (lastDotIndex > 0) {
- resourcePackageClass = packageName + "." + AndroidConstants.FN_RESOURCE_BASE; //$NON-NLS-1$
+ resourcePackageClass = packageName + "." + AdtConstants.FN_RESOURCE_BASE; //$NON-NLS-1$
}
// Package name
}
}
- String[] components = packageName.split(AndroidConstants.RE_DOT);
+ String[] components = packageName.split(AdtConstants.RE_DOT);
for (String component : components) {
pkgFolder = pkgFolder.getFolder(component);
if (!pkgFolder.exists()) {
if (activityName != null) {
// create the main activity Java file
- String activityJava = activityName + AndroidConstants.DOT_JAVA;
+ String activityJava = activityName + AdtConstants.DOT_JAVA;
IFile file = pkgFolder.getFile(activityJava);
if (!file.exists()) {
copyFile(JAVA_ACTIVITY_TEMPLATE, file, java_activity_parameters, monitor);
package com.android.ide.eclipse.adt.internal.wizards.newxmlfile;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DocumentDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.IDescriptorProvider;
final static int NUM_COL = 4;
/** Absolute destination folder root, e.g. "/res/" */
- private static final String RES_FOLDER_ABS = AndroidConstants.WS_RESOURCES + AndroidConstants.WS_SEP;
+ private static final String RES_FOLDER_ABS = AdtConstants.WS_RESOURCES + AdtConstants.WS_SEP;
/** Relative destination folder root, e.g. "res/" */
- private static final String RES_FOLDER_REL = SdkConstants.FD_RESOURCES + AndroidConstants.WS_SEP;
+ private static final String RES_FOLDER_REL = SdkConstants.FD_RESOURCES + AdtConstants.WS_SEP;
private IProject mProject;
private Text mProjectTextField;
} else {
fileName = mFileNameTextField.getText().trim();
if (fileName.length() > 0 && fileName.indexOf('.') == -1) {
- fileName = fileName + AndroidConstants.DOT_XML;
+ fileName = fileName + AdtConstants.DOT_XML;
}
}
// Is this an Android project?
try {
- if (project == null || !project.hasNature(AndroidConstants.NATURE_DEFAULT)) {
+ if (project == null || !project.hasNature(AdtConstants.NATURE_DEFAULT)) {
continue;
}
} catch (CoreException e) {
if (wsFolderPath.startsWith(RES_FOLDER_ABS)) {
wsFolderPath = wsFolderPath.substring(RES_FOLDER_ABS.length());
- int pos = wsFolderPath.indexOf(AndroidConstants.WS_SEP_CHAR);
+ int pos = wsFolderPath.indexOf(AdtConstants.WS_SEP_CHAR);
if (pos >= 0) {
wsFolderPath = wsFolderPath.substring(0, pos);
}
*/
package com.android.ide.eclipse.tests;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
}
}
- if (mOsRootDataPath.equals(AndroidConstants.WS_SEP)) {
+ if (mOsRootDataPath.equals(AdtConstants.WS_SEP)) {
sLogger.warning("Resource data not found using class loader!, Defaulting to no path");
}