本文整理汇总了Java中com.intellij.lang.folding.FoldingDescriptor.getPlaceholderText方法的典型用法代码示例。如果您正苦于以下问题:Java FoldingDescriptor.getPlaceholderText方法的具体用法?Java FoldingDescriptor.getPlaceholderText怎么用?Java FoldingDescriptor.getPlaceholderText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.lang.folding.FoldingDescriptor
的用法示例。
在下文中一共展示了FoldingDescriptor.getPlaceholderText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNewRegions
import com.intellij.lang.folding.FoldingDescriptor; //导入方法依赖的package包/类
private List<FoldRegion> addNewRegions(@NotNull EditorFoldingInfo info,
@NotNull FoldingModelEx foldingModel,
FoldingUpdate.FoldingMap elementsToFold, @NotNull Map<TextRange, Boolean> rangeToExpandStatusMap,
@NotNull Map<FoldRegion, Boolean> shouldExpand,
@NotNull Map<FoldingGroup, Boolean> groupExpand) {
List<FoldRegion> newRegions = newArrayList();
SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(myProject);
for (PsiElement element : elementsToFold.keySet()) {
ProgressManager.checkCanceled();
final Collection<FoldingDescriptor> descriptors = elementsToFold.get(element);
for (FoldingDescriptor descriptor : descriptors) {
FoldingGroup group = descriptor.getGroup();
TextRange range = descriptor.getRange();
String placeholder = descriptor.getPlaceholderText();
if (range.getEndOffset() > myEditor.getDocument().getTextLength()) {
LOG.error(String.format("Invalid folding descriptor detected (%s). It ends beyond the document range (%d)",
descriptor, myEditor.getDocument().getTextLength()));
continue;
}
FoldRegion region = foldingModel.createFoldRegion(range.getStartOffset(), range.getEndOffset(),
placeholder == null ? "..." : placeholder,
group,
descriptor.isNonExpandable());
if (region == null) continue;
PsiElement psi = descriptor.getElement().getPsi();
if (psi == null || !psi.isValid() || !foldingModel.addFoldRegion(region) || !myFile.isValid()) {
region.dispose();
continue;
}
info.addRegion(region, smartPointerManager.createSmartPsiElementPointer(psi));
newRegions.add(region);
boolean expandStatus = !descriptor.isNonExpandable() && shouldExpandNewRegion(element, range, rangeToExpandStatusMap);
if (group == null) {
shouldExpand.put(region, expandStatus);
}
else {
final Boolean alreadyExpanded = groupExpand.get(group);
groupExpand.put(group, alreadyExpanded == null ? expandStatus : alreadyExpanded.booleanValue() || expandStatus);
}
}
}
return newRegions;
}
示例2: addNewRegions
import com.intellij.lang.folding.FoldingDescriptor; //导入方法依赖的package包/类
private List<FoldRegion> addNewRegions(@NotNull EditorFoldingInfo info,
@NotNull FoldingModelEx foldingModel,
@NotNull Map<TextRange, Boolean> rangeToExpandStatusMap,
@NotNull Map<FoldRegion, Boolean> shouldExpand,
@NotNull Map<FoldingGroup, Boolean> groupExpand) {
List<FoldRegion> newRegions = newArrayList();
SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(myProject);
for (PsiElement element : myElementsToFoldMap.keySet()) {
ProgressManager.checkCanceled();
final Collection<FoldingDescriptor> descriptors = myElementsToFoldMap.get(element);
for (FoldingDescriptor descriptor : descriptors) {
FoldingGroup group = descriptor.getGroup();
TextRange range = descriptor.getRange();
String placeholder = descriptor.getPlaceholderText();
if (range.getEndOffset() > myEditor.getDocument().getTextLength()) {
LOG.error(String.format("Invalid folding descriptor detected (%s). It ends beyond the document range (%d)",
descriptor, myEditor.getDocument().getTextLength()));
continue;
}
FoldRegion region = foldingModel.createFoldRegion(range.getStartOffset(), range.getEndOffset(),
placeholder == null ? "..." : placeholder,
group,
descriptor.isNonExpandable());
if (region == null) continue;
PsiElement psi = descriptor.getElement().getPsi();
if (psi == null || !psi.isValid() || !foldingModel.addFoldRegion(region)) {
region.dispose();
continue;
}
info.addRegion(region, smartPointerManager.createSmartPsiElementPointer(psi, myFile));
newRegions.add(region);
boolean expandStatus = !descriptor.isNonExpandable() && shouldExpandNewRegion(element, range, rangeToExpandStatusMap);
if (group == null) {
shouldExpand.put(region, expandStatus);
}
else {
final Boolean alreadyExpanded = groupExpand.get(group);
groupExpand.put(group, alreadyExpanded == null ? expandStatus : alreadyExpanded.booleanValue() || expandStatus);
}
}
}
return newRegions;
}
示例3: addNewRegions
import com.intellij.lang.folding.FoldingDescriptor; //导入方法依赖的package包/类
private List<FoldRegion> addNewRegions(@Nonnull EditorFoldingInfo info,
@Nonnull FoldingModelEx foldingModel,
@Nonnull Map<TextRange, Boolean> rangeToExpandStatusMap,
@Nonnull Map<FoldRegion, Boolean> shouldExpand,
@Nonnull Map<FoldingGroup, Boolean> groupExpand) {
List<FoldRegion> newRegions = new ArrayList<>();
SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(myProject);
for (FoldingUpdate.RegionInfo regionInfo : myRegionInfos) {
ProgressManager.checkCanceled();
FoldingDescriptor descriptor = regionInfo.descriptor;
FoldingGroup group = descriptor.getGroup();
TextRange range = descriptor.getRange();
String placeholder = null;
try {
placeholder = descriptor.getPlaceholderText();
}
catch (IndexNotReadyException ignore) {
}
if (range.getEndOffset() > myEditor.getDocument().getTextLength()) {
LOG.error(String.format("Invalid folding descriptor detected (%s). It ends beyond the document range (%d)",
descriptor, myEditor.getDocument().getTextLength()));
continue;
}
FoldRegion region = foldingModel.createFoldRegion(range.getStartOffset(), range.getEndOffset(),
placeholder == null ? "..." : placeholder,
group,
descriptor.isNonExpandable());
if (region == null) continue;
if (descriptor.isNonExpandable()) region.putUserData(FoldingModelImpl.SELECT_REGION_ON_CARET_NEARBY, Boolean.TRUE);
PsiElement psi = descriptor.getElement().getPsi();
if (psi == null || !psi.isValid() || !myFile.isValid()) {
region.dispose();
continue;
}
if (descriptor.canBeRemovedWhenCollapsed()) region.putUserData(CAN_BE_REMOVED_WHEN_COLLAPSED, Boolean.TRUE);
region.putUserData(COLLAPSED_BY_DEFAULT, regionInfo.collapsedByDefault);
region.putUserData(SIGNATURE, regionInfo.signature);
info.addRegion(region, smartPointerManager.createSmartPsiElementPointer(psi));
newRegions.add(region);
boolean expandStatus = !descriptor.isNonExpandable() && shouldExpandNewRegion(range, rangeToExpandStatusMap,
regionInfo.collapsedByDefault);
if (group == null) {
shouldExpand.put(region, expandStatus);
}
else {
final Boolean alreadyExpanded = groupExpand.get(group);
groupExpand.put(group, alreadyExpanded == null ? expandStatus : alreadyExpanded.booleanValue() || expandStatus);
}
}
return newRegions;
}