use of com.android.annotations.Nullable in project android by JetBrains.
the class StudioEmbeddedRenderTarget method getEmbeddedLayoutLibPath.
/**
* Returns the URL for the embedded layoutlib distribution.
*/
@Nullable
private static String getEmbeddedLayoutLibPath() {
String homePath = FileUtil.toSystemIndependentName(PathManager.getHomePath());
StringBuilder notFoundPaths = new StringBuilder();
for (String path : EMBEDDED_PATHS) {
String jarPath = homePath + path;
VirtualFile root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(jarPath));
if (root != null) {
File rootFile = VfsUtilCore.virtualToIoFile(root);
if (rootFile.exists() && rootFile.isDirectory()) {
LOG.debug("Embedded layoutlib found at " + jarPath);
return rootFile.getAbsolutePath() + File.separator;
}
} else {
notFoundPaths.append(jarPath).append('\n');
}
}
LOG.error("Unable to find embedded layoutlib in paths:\n" + notFoundPaths.toString());
return null;
}
use of com.android.annotations.Nullable in project android by JetBrains.
the class AndroidPluginGeneration method find.
@Nullable
public static AndroidPluginGeneration find(@NotNull Module module) {
AndroidModuleModel gradleModel = AndroidModuleModel.get(module);
if (gradleModel != null) {
try {
// only true for experimental plugin 0.6.0-betaX (or whenever the getPluginGeneration() was added) or later.
return gradleModel.getAndroidProject().getPluginGeneration() == GENERATION_COMPONENT ? COMPONENT : ORIGINAL;
} catch (UnsupportedMethodException t) {
// happens for 2.0.0-alphaX or earlier stable version plugins and 0.6.0-alphax or earlier experimental plugin versions.
}
}
// Now look at the applied plugins in the build.gradle file.
GradleBuildModel buildModel = GradleBuildModel.get(module);
if (buildModel != null) {
List<String> appliedPlugins = getValues(buildModel.appliedPlugins());
for (AndroidPluginGeneration generation : ourValues) {
if (appliedPlugins.contains(generation.getApplicationPluginId()) || appliedPlugins.contains(generation.getLibraryPluginId())) {
return generation;
}
}
}
return null;
}
use of com.android.annotations.Nullable in project android by JetBrains.
the class NlPropertyInspectorFixture method findProperty.
@Nullable
public NlPropertyFixture findProperty(final String name) {
JBLabel label = waitUntilFound(robot(), myPanel, new GenericTypeMatcher<JBLabel>(JBLabel.class) {
@Override
protected boolean isMatching(@NotNull JBLabel label) {
return name.equals(label.getText()) && label.getIcon() == null;
}
});
Container parent = label.getParent();
Component[] components = parent.getComponents();
for (int i = 0; i < components.length; i++) {
if (label == components[i]) {
return new NlPropertyFixture(robot(), (JPanel) components[i + 1]);
}
}
return null;
}
use of com.android.annotations.Nullable in project android by JetBrains.
the class GradleImport method resolvePathVariable.
@Nullable
File resolvePathVariable(@Nullable EclipseProject fromProject, @NonNull String name, boolean record) throws IOException {
File file = myPathMap.get(name);
if (file != null) {
return file;
}
if (fromProject != null && myWorkspaceLocation == null) {
guessWorkspace(fromProject.getDir());
}
String value = null;
Properties properties = getJdtSettingsProperties(false);
if (properties != null) {
value = properties.getProperty("org.eclipse.jdt.core.classpathVariable." + name);
}
if (value == null) {
properties = getPathSettingsProperties(false);
if (properties != null) {
value = properties.getProperty("pathvariable." + name);
}
}
if (value == null) {
if (record) {
myPathMap.put(name, null);
}
return null;
}
file = new File(value.replace('/', separatorChar));
return file;
}
use of com.android.annotations.Nullable in project android by JetBrains.
the class ImportModule method getLatestVersion.
@Nullable
public GradleCoordinate getLatestVersion(String artifact) {
int compileVersion = GradleImport.CURRENT_COMPILE_VERSION;
AndroidVersion version = getCompileSdkVersion();
if (version != AndroidVersion.DEFAULT) {
compileVersion = version.getFeatureLevel();
}
// from version 18 (earliest version where we have all the libs in the m2 repository)
if (compileVersion < 18) {
compileVersion = 18;
}
String compileVersionString = Integer.toString(compileVersion);
if (myImporter.getSdkLocation() != null) {
@SuppressWarnings("UnnecessaryLocalVariable") String filter = compileVersionString;
GradleCoordinate max = SdkMavenRepository.ANDROID.getHighestInstalledVersion(myImporter.getSdkLocation(), SUPPORT_GROUP_ID, artifact, filter, true);
if (max != null) {
return max;
}
}
String coordinate = SUPPORT_GROUP_ID + ':' + artifact + ':' + compileVersionString + ".+";
return GradleCoordinate.parseCoordinateString(coordinate);
}
Aggregations