當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertiesComponent.getValues方法代碼示例

本文整理匯總了Java中com.intellij.ide.util.PropertiesComponent.getValues方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertiesComponent.getValues方法的具體用法?Java PropertiesComponent.getValues怎麽用?Java PropertiesComponent.getValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.ide.util.PropertiesComponent的用法示例。


在下文中一共展示了PropertiesComponent.getValues方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: _init

import com.intellij.ide.util.PropertiesComponent; //導入方法依賴的package包/類
@Override
public void _init() {
  myIdeaAndroidProject = myWizard.getFacet().getIdeaAndroidProject();

  PropertiesComponent properties = PropertiesComponent.getInstance(myWizard.getProject());
  String lastSelectedBuildType = properties.getValue(PROPERTY_BUILD_TYPE);

  myBuildTypeComboModel.removeAllElements();
  Set<String> buildTypes = myIdeaAndroidProject == null ? Collections.<String>emptySet() : myIdeaAndroidProject.getBuildTypes();
  for (String buildType : buildTypes) {
    myBuildTypeComboModel.addElement(buildType);

    if ((lastSelectedBuildType == null && buildType.equals("release")) || buildType.equals(lastSelectedBuildType)) {
      myBuildTypeComboModel.setSelectedItem(buildType);
    }
  }

  myFlavorsListModel.clear();
  List<String> productFlavors;
  if (myIdeaAndroidProject == null || myIdeaAndroidProject.getProductFlavors().isEmpty()) {
    productFlavors = Collections.emptyList();
  } else {
    // if there are multiple flavors, we want the merged flavor list
    Set<String> mergedFlavors = Sets.newHashSet();
    for (Variant v : myIdeaAndroidProject.getDelegate().getVariants()) {
      mergedFlavors.add(ExportSignedPackageWizard.getMergedFlavorName(v));
    }
    productFlavors = Lists.newArrayList(mergedFlavors);
    Collections.sort(productFlavors);
  }

  TIntArrayList lastSelectedIndices = new TIntArrayList(productFlavors.size());
  String[] flavors = properties.getValues(PROPERTY_FLAVORS);
  Set<String> lastSelectedFlavors = flavors == null ? Collections.<String>emptySet() : Sets.newHashSet(flavors);

  for (int i = 0; i < productFlavors.size(); i++) {
    String flavor = productFlavors.get(i);
    myFlavorsListModel.addElement(flavor);

    if (lastSelectedFlavors.contains(flavor)) {
      lastSelectedIndices.add(i);
    }
  }

  myFlavorsList.setSelectedIndices(lastSelectedIndices.toNativeArray());

  String lastApkFolderPath = properties.getValue(PROPERTY_APK_PATH);
  File lastApkFolder;
  if (lastApkFolderPath != null) {
    lastApkFolder = new File(lastApkFolderPath);
  }
  else {
    if (myIdeaAndroidProject == null) {
      lastApkFolder = VfsUtilCore.virtualToIoFile(myWizard.getProject().getBaseDir());
    } else {
      lastApkFolder = myIdeaAndroidProject.getRootDirPath();
    }
  }
  myApkPathField.setText(lastApkFolder.getAbsolutePath());
  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  myApkPathField.addBrowseFolderListener("Select APK Destination Folder", null, myWizard.getProject(), descriptor);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:63,代碼來源:GradleSignStep.java


注:本文中的com.intellij.ide.util.PropertiesComponent.getValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。