本文整理汇总了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);
}
示例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);
}