本文整理汇总了Java中com.intellij.lang.properties.IProperty.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java IProperty.getKey方法的具体用法?Java IProperty.getKey怎么用?Java IProperty.getKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.lang.properties.IProperty
的用法示例。
在下文中一共展示了IProperty.getKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteElement
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
@Override
public void deleteElement(@NotNull final DataContext dataContext) {
final List<PropertiesFile> bundlePropertiesFiles = myResourceBundle.getPropertiesFiles();
final List<PsiElement> toDelete = new ArrayList<PsiElement>();
for (IProperty property : myProperties) {
final String key = property.getKey();
if (key == null) {
LOG.error("key must be not null " + property);
} else {
for (PropertiesFile propertiesFile : bundlePropertiesFiles) {
for (final IProperty iProperty : propertiesFile.findPropertiesByKey(key)) {
toDelete.add(iProperty.getPsiElement());
}
}
}
}
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
LOG.assertTrue(project != null);
new SafeDeleteHandler().invoke(project, PsiUtilCore.toPsiElementArray(toDelete), dataContext);
myInsertDeleteManager.reload();
}
示例2: getAdditionalElementsToDelete
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
@Nullable
@Override
public Collection<PsiElement> getAdditionalElementsToDelete(@NotNull PsiElement element,
@NotNull Collection<PsiElement> allElementsToDelete,
boolean askUser) {
final IProperty property = (IProperty)element;
final String key = property.getKey();
if (key == null) {
return null;
}
final PropertiesFile file = property.getPropertiesFile();
if (file == null) {
return null;
}
final List<PsiElement> result = new ArrayList<PsiElement>();
for (PropertiesFile propertiesFile : file.getResourceBundle().getPropertiesFiles()) {
for (IProperty p : propertiesFile.findPropertiesByKey(key)) {
result.add(p.getPsiElement());
}
}
return result;
}
示例3: getPropertiesMap
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
public static MultiMap<String, IProperty> getPropertiesMap(ResourceBundle resourceBundle, boolean onlyIncomplete) {
List<PropertiesFile> propertiesFiles = resourceBundle.getPropertiesFiles();
final MultiMap<String, IProperty> propertyNames;
if (onlyIncomplete) {
propertyNames = getChildrenIdShowOnlyIncomplete(resourceBundle);
} else {
propertyNames = MultiMap.createLinked();
for (PropertiesFile propertiesFile : propertiesFiles) {
List<IProperty> properties = propertiesFile.getProperties();
for (IProperty property : properties) {
String name = property.getKey();
propertyNames.putValue(name, property);
}
}
}
return propertyNames;
}
示例4: collectPropertiesFileVariants
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
protected static void collectPropertiesFileVariants(@Nullable PropertiesFile file, @Nullable String prefix, List<Object> result, Set<String> variants) {
if (file == null) return;
for (IProperty each : file.getProperties()) {
String name = each.getKey();
if (name != null) {
if (prefix != null) name = prefix + name;
if (variants.add(name)) {
result.add(createLookupElement(each, name, PlatformIcons.PROPERTY_ICON));
}
}
}
}
示例5: selectNextIncompleteProperty
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
public void selectNextIncompleteProperty() {
if (getSelectedNodes().size() != 1) {
return;
}
final IProperty selectedProperty = getSelectedProperty();
if (selectedProperty == null) {
return;
}
final ResourceBundleFileStructureViewElement root =
(ResourceBundleFileStructureViewElement)myStructureViewComponent.getTreeModel().getRoot();
final Set<String> propertyKeys = ResourceBundleFileStructureViewElement.getPropertiesMap(myResourceBundle, root.isShowOnlyIncomplete()).keySet();
final boolean isAlphaSorted = myStructureViewComponent.isActionActive(Sorter.ALPHA_SORTER_ID);
final List<String> keysOrder = new ArrayList<String>(propertyKeys);
if (isAlphaSorted) {
Collections.sort(keysOrder);
}
final String currentKey = selectedProperty.getKey();
final int idx = keysOrder.indexOf(currentKey);
LOG.assertTrue(idx != -1);
final IgnoredPropertiesFilesSuffixesManager
ignoredPropertiesFilesSuffixesManager = IgnoredPropertiesFilesSuffixesManager.getInstance(myProject);
for (int i = 1; i < keysOrder.size(); i++) {
int trimmedIndex = (i + idx) % keysOrder.size();
final String key = keysOrder.get(trimmedIndex);
if (!ignoredPropertiesFilesSuffixesManager.isPropertyComplete(myResourceBundle, key)) {
selectProperty(key);
return;
}
}
}
示例6: createVariant
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
@Nullable
public static LookupElement createVariant(IProperty property) {
String key = property.getKey();
return key == null ? null : LookupElementBuilder.create(property, key).withRenderer(LOOKUP_ELEMENT_RENDERER);
}