當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。