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


Java PropertiesComponent.setValues方法代码示例

本文整理汇总了Java中com.intellij.ide.util.PropertiesComponent.setValues方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesComponent.setValues方法的具体用法?Java PropertiesComponent.setValues怎么用?Java PropertiesComponent.setValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ide.util.PropertiesComponent的用法示例。


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

示例1: commitForNext

import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected void commitForNext() throws CommitStepException {
  if (myIdeaAndroidProject == null) {
    throw new CommitStepException(AndroidBundle.message("android.apk.sign.gradle.no.model"));
  }

  final String apkFolder = myApkPathField.getText().trim();
  if (apkFolder.isEmpty()) {
    throw new CommitStepException(AndroidBundle.message("android.apk.sign.gradle.missing.destination"));
  }

  File f = new File(apkFolder);
  if (!f.isDirectory() || !f.canWrite()) {
    throw new CommitStepException(AndroidBundle.message("android.apk.sign.gradle.invalid.destination"));
  }

  int[] selectedFlavorIndices = myFlavorsList.getSelectedIndices();
  if (!myFlavorsListModel.isEmpty() && selectedFlavorIndices.length == 0) {
    throw new CommitStepException(AndroidBundle.message("android.apk.sign.gradle.missing.flavors"));
  }

  Object[] selectedFlavors = myFlavorsList.getSelectedValues();
  List<String> flavors = new ArrayList<String>(selectedFlavors.length);
  for (int i = 0; i < selectedFlavors.length; i++) {
    flavors.add((String)selectedFlavors[i]);
  }

  myWizard.setApkPath(apkFolder);
  myWizard.setGradleOptions((String)myBuildTypeCombo.getSelectedItem(), flavors);

  PropertiesComponent properties = PropertiesComponent.getInstance(myWizard.getProject());
  properties.setValue(PROPERTY_APK_PATH, apkFolder);
  properties.setValues(PROPERTY_FLAVORS, ArrayUtil.toStringArray(flavors));
  properties.setValue(PROPERTY_BUILD_TYPE, (String)myBuildTypeCombo.getSelectedItem());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:GradleSignStep.java

示例2: saveHistory

import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
private static void saveHistory(Project project, String text, Object value) {
  if (project == null || project.isDisposed() || !project.isInitialized()) {
    return;
  }
  HistoryType type = null;
  String fqn = null;
  if (isActionValue(value)) {
    type = HistoryType.ACTION;
    AnAction action = (AnAction)(value instanceof GotoActionModel.ActionWrapper ? ((GotoActionModel.ActionWrapper)value).getAction() : value);
    fqn = ActionManager.getInstance().getId(action);
  } else if (value instanceof VirtualFile) {
    type = HistoryType.FILE;
    fqn = ((VirtualFile)value).getUrl();
  } else if (value instanceof ChooseRunConfigurationPopup.ItemWrapper) {
    type = HistoryType.RUN_CONFIGURATION;
    fqn = ((ChooseRunConfigurationPopup.ItemWrapper)value).getText();
  } else if (value instanceof PsiElement) {
    final PsiElement psiElement = (PsiElement)value;
    final Language language = psiElement.getLanguage();
    final String name = LanguagePsiElementExternalizer.INSTANCE.forLanguage(language).getQualifiedName(psiElement);
    if (name != null) {
      type = HistoryType.PSI;
      fqn = language.getID() + "://" + name;
    }
  }

  final PropertiesComponent storage = PropertiesComponent.getInstance(project);
  final String[] values = storage.getValues(SE_HISTORY_KEY);
  List<HistoryItem> history = new ArrayList<HistoryItem>();
  if (values != null) {
    for (String s : values) {
      final String[] split = s.split("\t");
      if (split.length != 3 || text.equals(split[0])) {
        continue;
      }
      if (!StringUtil.isEmpty(split[0])) {
        history.add(new HistoryItem(split[0], split[1], split[2]));
      }
    }
  }
  history.add(0, new HistoryItem(text, type == null ? null : type.name(), fqn));

  if (history.size() > MAX_SEARCH_EVERYWHERE_HISTORY) {
    history = history.subList(0, MAX_SEARCH_EVERYWHERE_HISTORY);
  }
  final String[] newValues = new String[history.size()];
  for (int i = 0; i < newValues.length; i++) {
    newValues[i] = history.get(i).toString();
  }
  storage.setValues(SE_HISTORY_KEY, newValues);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:SearchEverywhereAction.java


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