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


Java IProperty.getKey方法代码示例

本文整理汇总了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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ResourceBundleStructureViewComponent.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PropertyKeysSafeDeleteProcessor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ResourceBundleFileStructureViewElement.java

示例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));
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MavenPropertyPsiReference.java

示例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;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ResourceBundleEditor.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:PropertiesCompletionContributor.java


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