本文整理汇总了Java中com.intellij.lang.properties.IProperty.getPropertiesFile方法的典型用法代码示例。如果您正苦于以下问题:Java IProperty.getPropertiesFile方法的具体用法?Java IProperty.getPropertiesFile怎么用?Java IProperty.getPropertiesFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.lang.properties.IProperty
的用法示例。
在下文中一共展示了IProperty.getPropertiesFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: safeGetLocale
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
private static Locale safeGetLocale(final @NotNull IProperty property) {
try {
PropertiesFile file = property.getPropertiesFile();
return file == null ? null : file.getLocale();
} catch (PsiInvalidElementAccessException e) {
return null;
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:9,代码来源:JspPropertyFoldingBuilder.java
示例3: renderElement
import com.intellij.lang.properties.IProperty; //导入方法依赖的package包/类
@Override
public void renderElement(LookupElement element, LookupElementPresentation presentation) {
IProperty property = (IProperty)element.getObject();
presentation.setIcon(PlatformIcons.PROPERTY_ICON);
String key = StringUtil.notNullize(property.getUnescapedKey());
presentation.setItemText(key);
PropertiesFile propertiesFile = property.getPropertiesFile();
ResourceBundle resourceBundle = propertiesFile.getResourceBundle();
String value = property.getValue();
boolean hasBundle = resourceBundle != EmptyResourceBundle.getInstance();
if (hasBundle) {
PropertiesFile defaultPropertiesFile = resourceBundle.getDefaultPropertiesFile();
IProperty defaultProperty = defaultPropertiesFile.findPropertyByKey(key);
if (defaultProperty != null) {
value = defaultProperty.getValue();
}
}
if (hasBundle) {
presentation.setTypeText(resourceBundle.getBaseName(), AllIcons.FileTypes.Properties);
}
if (presentation instanceof RealLookupElementPresentation && value != null) {
value = "=" + value;
int limit = 1000;
if (value.length() > limit || !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value, false)) {
if (value.length() > limit) {
value = value.substring(0, limit);
}
while (value.length() > 0 && !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value + "...", false)) {
value = value.substring(0, value.length() - 1);
}
value += "...";
}
}
TextAttributes attrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_VALUE);
presentation.setTailText(value, attrs.getForegroundColor());
}