当前位置: 首页>>代码示例>>Java>>正文


Java AndroidBundle类代码示例

本文整理汇总了Java中org.jetbrains.android.util.AndroidBundle的典型用法代码示例。如果您正苦于以下问题:Java AndroidBundle类的具体用法?Java AndroidBundle怎么用?Java AndroidBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AndroidBundle类属于org.jetbrains.android.util包,在下文中一共展示了AndroidBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getApk

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@Nullable
private static File getApk(@NotNull Variant variant, @NotNull IDevice device) {
  AndroidArtifact mainArtifact = variant.getMainArtifact();
  List<AndroidArtifactOutput> outputs = Lists.newArrayList(mainArtifact.getOutputs());
  if (outputs.isEmpty()) {
    LOG.info("No outputs for the main artifact of variant: " + variant.getDisplayName());
    return null;
  }

  List<String> abis = device.getAbis();
  int density = device.getDensity();
  Set<String> variantAbiFilters = mainArtifact.getAbiFilters();
  List<OutputFile> apkFiles = SplitOutputMatcher.computeBestOutput(outputs, variantAbiFilters, density, abis);
  if (apkFiles.isEmpty()) {
    String message = AndroidBundle.message("deployment.failed.splitapk.nomatch", outputs.size(), density, Joiner.on(", ").join(abis));
    LOG.error(message);
    return null;
  }
  return apkFiles.get(0).getOutputFile();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidRunningState.java

示例2: generate

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
private static void generate(Project project, final Module... modules) {
  CompilerManager.getInstance(project).executeTask(new CompileTask() {
    @Override
    public boolean execute(CompileContext context) {
      // todo: compatibility with background autogenerating

      for (Module module : modules) {
        final AndroidFacet facet = AndroidFacet.getInstance(module);

        if (facet != null) {
          for (AndroidAutogeneratorMode mode : AndroidAutogeneratorMode.values()) {
            AndroidCompileUtil.generate(facet, mode, context, true);
          }
        }
      }
      return true;
    }
  }, new ModuleCompileScope(project, modules, false), AndroidBundle.message("android.compile.messages.generating.r.java.content.name"),
                                                   null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidRegenerateSourcesAction.java

示例3: getText

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@NotNull
@Override
public String getText() {
  String id = getLintId(myId);
  final PsiFile file = PsiTreeUtil.getParentOfType(myElement, PsiFile.class);
  if (file == null) {
    return "";
  } else if (file instanceof XmlFile) {
    return AndroidBundle.message("android.lint.fix.suppress.lint.api.attr", id);
  } else if (file instanceof PsiJavaFile) {
    return AndroidBundle.message("android.lint.fix.suppress.lint.api.annotation", id);
  } else if (file instanceof GroovyFile) {
    return "Suppress: Add //noinspection " + id;
  } else {
    return "";
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SuppressLintIntentionAction.java

示例4: MyDialog

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
protected MyDialog(@NotNull AndroidFacet facet, @Nullable InputValidator validator) {
  super(facet.getModule().getProject());
  myValidator = validator;
  setTitle(AndroidBundle.message("new.typed.resource.dialog.title", myResourcePresentableName));
  final List<String> tagNames = getSortedAllowedTagNames(facet);
  myRootElementField = new TextFieldWithAutoCompletion<String>(
    facet.getModule().getProject(), new TextFieldWithAutoCompletion.StringsCompletionProvider(tagNames, null), true, null);
  myRootElementField.setText(myDefaultRootTag);
  myRootElementFieldWrapper.add(myRootElementField, BorderLayout.CENTER);
  myRootElementLabel.setLabelFor(myRootElementField);
  init();

  myFileNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      final String text = myFileNameField.getText().trim();
      if (myValidator instanceof InputValidatorEx) {
        setErrorText(((InputValidatorEx) myValidator).getErrorText(text));
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CreateMultiRootResourceFileAction.java

示例5: reportMissingOnClickProblem

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
private void reportMissingOnClickProblem(OnClickConverter.MyReference reference,
                                         PsiClass activity,
                                         String methodName,
                                         boolean incorrectSignature) {
  String activityName = activity.getName();

  if (activityName == null) {
    activityName = "";
  }
  final String message =
    incorrectSignature
    ? AndroidBundle.message("android.inspections.on.click.missing.incorrect.signature", methodName, activityName)
    : AndroidBundle.message("android.inspections.on.click.missing.problem", methodName, activityName);

  final LocalQuickFix[] fixes =
    StringUtil.isJavaIdentifier(methodName)
    ? new LocalQuickFix[]{new MyQuickFix(methodName, reference.getConverter(), activity)}
    : LocalQuickFix.EMPTY_ARRAY;

  myResult.add(myInspectionManager.createProblemDescriptor(
    reference.getElement(), reference.getRangeInElement(), message,
    ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myOnTheFly, fixes));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidMissingOnClickHandlerInspection.java

示例6: getResourceName

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@Nullable
private static String getResourceName(Project project, String newFieldName, String oldResourceName) {
  if (newFieldName.indexOf('_') < 0) return newFieldName;
  if (oldResourceName.indexOf('_') < 0 && oldResourceName.indexOf('.') >= 0) {
    String suggestion = newFieldName.replace('_', '.');
    newFieldName = Messages.showInputDialog(project, AndroidBundle.message("rename.resource.dialog.text", oldResourceName),
                                            RefactoringBundle.message("rename.title"), Messages.getQuestionIcon(), suggestion, null);
  }
  return newFieldName;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AndroidResourceRenameResourceProcessor.java

示例7: doOKAction

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@Override
protected void doOKAction() {
  FileSaverDescriptor descriptor =
    new FileSaverDescriptor(AndroidBundle.message("android.ddms.screenshot.save.title"), "", SdkConstants.EXT_PNG);
  FileSaverDialog saveFileDialog = FileChooserFactory.getInstance().createSaveFileDialog(descriptor, myProject);
  VirtualFile baseDir = ourLastSavedFolder != null ? ourLastSavedFolder : myProject.getBaseDir();
  VirtualFileWrapper fileWrapper = saveFileDialog.save(baseDir, getDefaultFileName());
  if (fileWrapper == null) {
    return;
  }

  myScreenshotFile = fileWrapper.getFile();
  try {
    ImageIO.write(myDisplayedImageRef.get(), SdkConstants.EXT_PNG, myScreenshotFile);
  }
  catch (IOException e) {
    Messages.showErrorDialog(myProject,
                             AndroidBundle.message("android.ddms.screenshot.save.error", e),
                             AndroidBundle.message("android.ddms.actions.screenshot"));
    return;
  }

  VirtualFile virtualFile = fileWrapper.getVirtualFile();
  if (virtualFile != null) {
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    ourLastSavedFolder = virtualFile.getParent();
  }

  super.doOKAction();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ScreenshotViewer.java

示例8: createCenterPanel

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  final JPanel panel = new JPanel(new BorderLayout());
  panel.setPreferredSize(new Dimension(350, 200));
  final JBLabel label = new JBLabel(AndroidBundle.message("android.import.dependencies.source.roots.dialog.label"));
  label.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
  panel.add(label, BorderLayout.NORTH);
  panel.add(mySourcePathsChooser, BorderLayout.CENTER);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ImportSourceRootsDialog.java

示例9: doValidatePackageName

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@NotNull
static String doValidatePackageName(boolean library, @NotNull String candidate, @Nullable ModulesProvider modulesProvider) {
  if (candidate.length() == 0) {
    return AndroidBundle.message("specify.package.name.error");
  }
  if (!AndroidUtils.isValidAndroidPackageName(candidate)) {
    return candidate;
  }
  if (!AndroidCommonUtils.contains2Identifiers(candidate)) {
    return AndroidBundle.message("package.name.must.contain.2.ids.error");
  }

  if (!library) {
    for (Module module : modulesProvider.getModules()) {
      final AndroidFacet facet = AndroidFacet.getInstance(module);
      if (facet != null && !facet.isLibraryProject()) {
        final Manifest manifest = facet.getManifest();
        if (manifest != null) {
          final String packageName = manifest.getPackage().getValue();
          if (candidate.equals(packageName)) {
            return "Package name '" + packageName + "' is already used by module '" + module.getName() + "'";
          }
        }
      }
    }
  }
  return "";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidAppPropertiesEditor.java

示例10: validateActivityName

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
private String validateActivityName() {
  String candidate = myActivityNameField.getText().trim();
  if (!AndroidUtils.isIdentifier(candidate)) {
    return AndroidBundle.message("not.valid.acvitiy.name.error", candidate);
  }
  return "";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AndroidAppPropertiesEditor.java

示例11: getActiveText

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@Override
@NotNull
protected String getActiveText(@NotNull Client c) {
  return c.getClientData().getAllocationStatus() == ClientData.AllocationTrackingStatus.ON ?
                AndroidBundle.message("android.ddms.actions.allocationtracker.stop") :
                AndroidBundle.message("android.ddms.actions.allocationtracker.start");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ToggleAllocationTrackingAction.java

示例12: getErrorMessage

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@Override
public String getErrorMessage(@Nullable String s, ConvertContext context) {
  if (s != null) {
    String message = ResourceNameValidator.create(false, ResourceFolderType.VALUES).getErrorText(s);
    if (message != null) {
      return message;
    }
  }

  return AndroidBundle.message("invalid.resource.name.error", s);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ResourceNameConverter.java

示例13: getQuickFixes

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@NotNull
@Override
public AndroidLintQuickFix[] getQuickFixes(@NotNull String message) {
  return new AndroidLintQuickFix[]{
    new ParcelableQuickFix(AndroidBundle.message("implement.parcelable.intention.text"), ParcelableQuickFix.Operation.IMPLEMENT),
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AndroidLintInspectionToolProvider.java

示例14: createFindStyleApplicationsProcessor

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
public static AndroidFindStyleApplicationsProcessor createFindStyleApplicationsProcessor(XmlTag tag,
                                                                                          MyStyleData styleData,
                                                                                          PsiFile context) {
  final ErrorReporter errorReporter = new ProjectBasedErrorReporter(tag.getProject());
  final Style style = styleData.getStyle();
  final Map<AndroidAttributeInfo, String> attrMap =
    AndroidRefactoringUtil.computeAttributeMap(style, new ProjectBasedErrorReporter(tag.getProject()),
                                               AndroidBundle.message("android.find.style.applications.title"));

  if (attrMap == null || attrMap.size() == 0) {
    return null;
  }
  final AndroidFacet facet = styleData.getFacet();
  final StyleRefData parentStyleRef = AndroidRefactoringUtil.getParentStyle(style);
  PsiElement parentStyleAttrName = null;

  if (parentStyleRef != null) {
    parentStyleAttrName = resolveStyleRef(parentStyleRef, facet);

    if (parentStyleAttrName == null) {
      errorReporter.report("Cannot resolve parent style '" + parentStyleRef.getStyleName() + "'",
                           AndroidBundle.message("android.find.style.applications.title"));
      return null;
    }
  }
  return new AndroidFindStyleApplicationsProcessor(styleData.getFacet().getModule(), attrMap, styleData.getName(), tag,
                                                   styleData.getNameAttrValue(), parentStyleAttrName, context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidFindStyleApplicationsAction.java

示例15: checkConfiguration

import org.jetbrains.android.util.AndroidBundle; //导入依赖的package包/类
@Override
public void checkConfiguration(@NotNull AndroidFacet facet) throws RuntimeConfigurationException {
  if (getTargetSelectionMode() == TargetSelectionMode.CLOUD_MATRIX_TEST && !IS_VALID_CLOUD_MATRIX_SELECTION) {
    throw new RuntimeConfigurationError(INVALID_CLOUD_MATRIX_SELECTION_ERROR);
  }
  if (getTargetSelectionMode() == TargetSelectionMode.CLOUD_DEVICE_LAUNCH && !IS_VALID_CLOUD_DEVICE_SELECTION) {
    throw new RuntimeConfigurationError(INVALID_CLOUD_DEVICE_SELECTION_ERROR);
  }

  Module module = facet.getModule();
  JavaPsiFacade facade = JavaPsiFacade.getInstance(module.getProject());
  switch (TESTING_TYPE) {
    case TEST_ALL_IN_PACKAGE:
      final PsiPackage testPackage = facade.findPackage(PACKAGE_NAME);
      if (testPackage == null) {
        throw new RuntimeConfigurationWarning(ExecutionBundle.message("package.does.not.exist.error.message", PACKAGE_NAME));
      }
      break;
    case TEST_CLASS:
      final PsiClass testClass =
        getConfigurationModule().checkModuleAndClassName(CLASS_NAME, ExecutionBundle.message("no.test.class.specified.error.text"));
      if (!JUnitUtil.isTestClass(testClass)) {
        throw new RuntimeConfigurationWarning(ExecutionBundle.message("class.isnt.test.class.error.message", CLASS_NAME));
      }
      break;
    case TEST_METHOD:
      checkTestMethod();
      break;
  }
  if (INSTRUMENTATION_RUNNER_CLASS.length() > 0) {
    if (facade.findClass(INSTRUMENTATION_RUNNER_CLASS, module.getModuleWithDependenciesAndLibrariesScope(true)) == null) {
      throw new RuntimeConfigurationError(AndroidBundle.message("instrumentation.runner.class.not.specified.error"));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:AndroidTestRunConfiguration.java


注:本文中的org.jetbrains.android.util.AndroidBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。